提交 284c7260 作者: 925993793@qq.com

bug修改

上级 4dc0a14d
...@@ -21,9 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -21,9 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import javax.servlet.http.HttpServletRequest;
import java.util.*; import java.util.*;
/** /**
...@@ -102,9 +100,7 @@ public class EventManageController { ...@@ -102,9 +100,7 @@ public class EventManageController {
*/ */
@PostMapping(value = "/upload") @PostMapping(value = "/upload")
@ResponseBody @ResponseBody
public Result<?> uploadKnowledge(HttpServletRequest request) { public Result<?> uploadKnowledge(MultipartFile file) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
MultipartFile file = multipartRequest.getFile("file");// 获取上传文件对象
String url = eventService.upload(file); String url = eventService.upload(file);
return Result.OK(url); return Result.OK(url);
} }
......
...@@ -186,11 +186,10 @@ public class EsStatisticsServiceImpl implements EsStatisticsService { ...@@ -186,11 +186,10 @@ public class EsStatisticsServiceImpl implements EsStatisticsService {
try { try {
SearchResponse response = client.search(searchRequest, RequestOptions.DEFAULT); SearchResponse response = client.search(searchRequest, RequestOptions.DEFAULT);
SearchHit[] hits = response.getHits().getHits(); SearchHit[] hits = response.getHits().getHits();
if (hits.length == 0) { if (hits.length > 0) {
return " There is nothing about this event in repeathold "; SearchHit hit = hits[0];
title = hit.getSourceAsMap().get("title").toString();
} }
SearchHit hit = hits[0];
title = hit.getSourceAsMap().get("title").toString();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -230,7 +230,10 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements ...@@ -230,7 +230,10 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
public void updateMain(AddEventParam addEventParam) { public void updateMain(AddEventParam addEventParam) {
Event subject = new Event(); Event subject = new Event();
BeanUtils.copyProperties(addEventParam, subject); BeanUtils.copyProperties(addEventParam, subject);
subject.setEventIcon(subject.getEventIcon().replace(imgPreview,"")); String eventIcon = subject.getEventIcon();
if (StringUtils.isNotEmpty(eventIcon)) {
subject.setEventIcon(eventIcon.replace(imgPreview,""));
}
String eventId = subject.getId(); String eventId = subject.getId();
baseMapper.updateById(subject); baseMapper.updateById(subject);
...@@ -271,7 +274,6 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements ...@@ -271,7 +274,6 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
log.info("文件上传成功:" + fileName + "---" + filePath); log.info("文件上传成功:" + fileName + "---" + filePath);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.error(e.getMessage());
} }
return filePath; return filePath;
} }
...@@ -336,7 +338,6 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements ...@@ -336,7 +338,6 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
Files.createDirectories(directory); Files.createDirectories(directory);
log.info("文件夹创建成功:" + filePath); log.info("文件夹创建成功:" + filePath);
} catch (IOException e) { } catch (IOException e) {
log.error("文件夹创建失败:" + filePath);
e.printStackTrace(); e.printStackTrace();
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论