提交 7775a8ba 作者: 刘凯歌

合并分支 'event_fusion_dev' 到 'event_fusion'

事件分析优化以及bug修改

查看合并请求 !15
...@@ -7,10 +7,10 @@ import cn.hutool.core.date.DateUtil; ...@@ -7,10 +7,10 @@ import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.aspose.words.SaveFormat;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.obs.services.model.PutObjectResult;
import com.zzsn.event.constant.Constants; import com.zzsn.event.constant.Constants;
import com.zzsn.event.constant.Result; import com.zzsn.event.constant.Result;
import com.zzsn.event.entity.*; import com.zzsn.event.entity.*;
...@@ -19,30 +19,28 @@ import com.zzsn.event.es.EsService; ...@@ -19,30 +19,28 @@ import com.zzsn.event.es.EsService;
import com.zzsn.event.service.*; import com.zzsn.event.service.*;
import com.zzsn.event.util.CalculateUtil; import com.zzsn.event.util.CalculateUtil;
import com.zzsn.event.util.DocUtil; import com.zzsn.event.util.DocUtil;
import com.zzsn.event.util.ObsUtil;
import com.zzsn.event.util.RedisUtil; import com.zzsn.event.util.RedisUtil;
import com.zzsn.event.util.user.UserUtil; import com.zzsn.event.util.user.UserUtil;
import com.zzsn.event.util.user.UserVo; import com.zzsn.event.util.user.UserVo;
import com.zzsn.event.vo.CoOccurrenceVO; import com.zzsn.event.vo.CoOccurrenceVO;
import com.zzsn.event.vo.CountVO; import com.zzsn.event.vo.CountVO;
import com.zzsn.event.vo.EventViewVO; import com.zzsn.event.vo.EventViewVO;
import com.zzsn.event.vo.es.Doc;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
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 javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.*; import java.io.*;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.*; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -82,8 +80,6 @@ public class EventAnalysisController { ...@@ -82,8 +80,6 @@ public class EventAnalysisController {
private CommonService commonService; private CommonService commonService;
@Autowired @Autowired
private IEventService eventService; private IEventService eventService;
@Autowired
private ObsUtil obsUtil;
/** /**
...@@ -706,6 +702,7 @@ public class EventAnalysisController { ...@@ -706,6 +702,7 @@ public class EventAnalysisController {
* @author lkg * @author lkg
* @date 2024/4/12 * @date 2024/4/12
*/ */
@Deprecated
@GetMapping("/domesticSimilarEvent") @GetMapping("/domesticSimilarEvent")
public Result<?> domesticSimilarEvent(@RequestParam String eventId, public Result<?> domesticSimilarEvent(@RequestParam String eventId,
@RequestParam(required = false) String startTime, @RequestParam(required = false) String startTime,
...@@ -737,6 +734,7 @@ public class EventAnalysisController { ...@@ -737,6 +734,7 @@ public class EventAnalysisController {
* @author lkg * @author lkg
* @date 2024/4/12 * @date 2024/4/12
*/ */
@Deprecated
@GetMapping("/foreignSimilarEvent") @GetMapping("/foreignSimilarEvent")
public Result<?> foreignSimilarEvent(@RequestParam String eventId, public Result<?> foreignSimilarEvent(@RequestParam String eventId,
@RequestParam(required = false) String startTime, @RequestParam(required = false) String startTime,
...@@ -792,67 +790,21 @@ public class EventAnalysisController { ...@@ -792,67 +790,21 @@ public class EventAnalysisController {
/** /**
* 导出PDF * 导出pdf
* *
* @param request * @param file 文件
* @param response
* @author lkg * @author lkg
* @date 2025/8/19 * @date 2025/8/15
*/ */
@PostMapping(value = "/exportPDF", consumes = MediaType.APPLICATION_OCTET_STREAM_VALUE) @PostMapping(value = "/exportPDF")
public void exportPdf(HttpServletRequest request,HttpServletResponse response) {
try {
InputStream inputStream = request.getInputStream();
String content = DocUtil.convertDocStream2Html(inputStream);
byte[] pdfBytes = DocUtil.convertDocHtml2Pdf(content);
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
ByteArrayInputStream byteInputStream = new ByteArrayInputStream(pdfBytes);
try {
OutputStream outs = response.getOutputStream();
bos = new BufferedOutputStream(outs);
bis = new BufferedInputStream(byteInputStream);
int i;
while ((i = bis.read(pdfBytes)) != -1) {
bos.write(pdfBytes, 0, i);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (bos != null) {
bos.flush();
bos.close();
}
if (bis != null) {
bis.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
@PostMapping(value = "/new_exportPDF")
public void new_exportPdf(MultipartFile file, HttpServletResponse response) { public void new_exportPdf(MultipartFile file, HttpServletResponse response) {
try { try {
InputStream inputStream = file.getInputStream(); InputStream inputStream = file.getInputStream();
String content = DocUtil.convertDocStream2Html(inputStream);
byte[] pdfBytes = DocUtil.convertDocHtml2Pdf(content);
BufferedInputStream bis = null;
BufferedOutputStream bos = null; BufferedOutputStream bos = null;
ByteArrayInputStream byteInputStream = new ByteArrayInputStream(pdfBytes);
try { try {
OutputStream outs = response.getOutputStream(); OutputStream outs = response.getOutputStream();
bos = new BufferedOutputStream(outs); bos = new BufferedOutputStream(outs);
bis = new BufferedInputStream(byteInputStream); DocUtil.convertWordTo(inputStream, bos, SaveFormat.PDF);
int i;
while ((i = bis.read(pdfBytes)) != -1) {
bos.write(pdfBytes, 0, i);
}
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
...@@ -861,9 +813,6 @@ public class EventAnalysisController { ...@@ -861,9 +813,6 @@ public class EventAnalysisController {
bos.flush(); bos.flush();
bos.close(); bos.close();
} }
if (bis != null) {
bis.close();
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -887,6 +836,16 @@ public class EventAnalysisController { ...@@ -887,6 +836,16 @@ public class EventAnalysisController {
if (StringUtils.isEmpty(versionId)) { if (StringUtils.isEmpty(versionId)) {
return Result.FAIL("请选择要导出的版本"); return Result.FAIL("请选择要导出的版本");
} }
EventAnalysisVersion eventAnalysisVersion = eventAnalysisVersionService.getById(versionId);
String pptPath = eventAnalysisVersion.getPptPath();
if (StringUtils.isNotEmpty(pptPath)) {
JSONObject jsonObject = JSON.parseObject(pptPath);
Integer code = jsonObject.getInteger("code");
if (code == 500) {
eventAnalysisVersionService.update(Wrappers.<EventAnalysisVersion>lambdaUpdate().set(EventAnalysisVersion::getPptPath, null)
.eq(EventAnalysisVersion::getId, versionId));
}
}
CompletableFuture.runAsync(() -> { CompletableFuture.runAsync(() -> {
String eventId = params.getString("eventId"); String eventId = params.getString("eventId");
JSONArray content = params.getJSONArray("content"); JSONArray content = params.getJSONArray("content");
......
...@@ -145,7 +145,7 @@ public class EventManageController { ...@@ -145,7 +145,7 @@ public class EventManageController {
public Result<?> queryById(@RequestParam String eventId, public Result<?> queryById(@RequestParam String eventId,
@RequestParam(required = false) String versionId) { @RequestParam(required = false) String versionId) {
EventVO eventVO = eventService.queryInfo(eventId); EventVO eventVO = eventService.queryInfo(eventId);
if (StringUtils.isNotEmpty(versionId)) { if (StringUtils.isNotEmpty(versionId) && eventVO.getYnManualEdit() == 0) {
String versionData = eventAnalysisVersionRecordService.getVersionData(versionId, AnalysisColumnEnum.CORE_SUMMARY.getCode()); String versionData = eventAnalysisVersionRecordService.getVersionData(versionId, AnalysisColumnEnum.CORE_SUMMARY.getCode());
eventVO.setEventDescribe(versionData); eventVO.setEventDescribe(versionData);
} }
......
...@@ -37,8 +37,6 @@ public class NetWorkEventTask { ...@@ -37,8 +37,6 @@ public class NetWorkEventTask {
@Autowired @Autowired
private LlmService llmService; private LlmService llmService;
@Value("${scheduling.yjzxEnable:false}")
Boolean yjzxEnable;
@Value("${python.hot-crawler:}") @Value("${python.hot-crawler:}")
private String hotCrawlerPath; private String hotCrawlerPath;
...@@ -48,7 +46,8 @@ public class NetWorkEventTask { ...@@ -48,7 +46,8 @@ public class NetWorkEventTask {
"2. 按照指定格式返回符合经济领域条件的网络事件集合,且无需额外解释。\n" + "2. 按照指定格式返回符合经济领域条件的网络事件集合,且无需额外解释。\n" +
"3. 必须严格依据事件标题-【title】字段进行判断。\n" + "3. 必须严格依据事件标题-【title】字段进行判断。\n" +
"4. 禁止返回不符合经济领域条件的事件。\n" + "4. 禁止返回不符合经济领域条件的事件。\n" +
"5. 严格按照以下json格式返回数据:\n" + "5. 最少返回10条。\n" +
"6. 严格按照以下json格式返回数据:\n" +
"[\n" + "[\n" +
" {\n" + " {\n" +
" \"title\": \"经济\"\n" + " \"title\": \"经济\"\n" +
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论