提交 260fe6ce 作者: 925993793@qq.com

事件分析优化以及bug修改

上级 d4880dc4
......@@ -7,10 +7,10 @@ import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.aspose.words.SaveFormat;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
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.Result;
import com.zzsn.event.entity.*;
......@@ -19,30 +19,28 @@ import com.zzsn.event.es.EsService;
import com.zzsn.event.service.*;
import com.zzsn.event.util.CalculateUtil;
import com.zzsn.event.util.DocUtil;
import com.zzsn.event.util.ObsUtil;
import com.zzsn.event.util.RedisUtil;
import com.zzsn.event.util.user.UserUtil;
import com.zzsn.event.util.user.UserVo;
import com.zzsn.event.vo.CoOccurrenceVO;
import com.zzsn.event.vo.CountVO;
import com.zzsn.event.vo.EventViewVO;
import com.zzsn.event.vo.es.Doc;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
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.atomic.AtomicLong;
import java.util.stream.Collectors;
......@@ -82,8 +80,6 @@ public class EventAnalysisController {
private CommonService commonService;
@Autowired
private IEventService eventService;
@Autowired
private ObsUtil obsUtil;
/**
......@@ -706,6 +702,7 @@ public class EventAnalysisController {
* @author lkg
* @date 2024/4/12
*/
@Deprecated
@GetMapping("/domesticSimilarEvent")
public Result<?> domesticSimilarEvent(@RequestParam String eventId,
@RequestParam(required = false) String startTime,
......@@ -737,6 +734,7 @@ public class EventAnalysisController {
* @author lkg
* @date 2024/4/12
*/
@Deprecated
@GetMapping("/foreignSimilarEvent")
public Result<?> foreignSimilarEvent(@RequestParam String eventId,
@RequestParam(required = false) String startTime,
......@@ -792,67 +790,21 @@ public class EventAnalysisController {
/**
* 导出PDF
* 导出pdf
*
* @param request
* @param response
* @param file 文件
* @author lkg
* @date 2025/8/19
* @date 2025/8/15
*/
@PostMapping(value = "/exportPDF", consumes = MediaType.APPLICATION_OCTET_STREAM_VALUE)
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")
@PostMapping(value = "/exportPDF")
public void new_exportPdf(MultipartFile file, HttpServletResponse response) {
try {
InputStream inputStream = file.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);
}
DocUtil.convertWordTo(inputStream, bos, SaveFormat.PDF);
} catch (IOException e) {
e.printStackTrace();
} finally {
......@@ -861,9 +813,6 @@ public class EventAnalysisController {
bos.flush();
bos.close();
}
if (bis != null) {
bis.close();
}
} catch (Exception e) {
e.printStackTrace();
}
......@@ -887,6 +836,16 @@ public class EventAnalysisController {
if (StringUtils.isEmpty(versionId)) {
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(() -> {
String eventId = params.getString("eventId");
JSONArray content = params.getJSONArray("content");
......
......@@ -145,7 +145,7 @@ public class EventManageController {
public Result<?> queryById(@RequestParam String eventId,
@RequestParam(required = false) String versionId) {
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());
eventVO.setEventDescribe(versionData);
}
......
......@@ -37,8 +37,6 @@ public class NetWorkEventTask {
@Autowired
private LlmService llmService;
@Value("${scheduling.yjzxEnable:false}")
Boolean yjzxEnable;
@Value("${python.hot-crawler:}")
private String hotCrawlerPath;
......@@ -48,7 +46,8 @@ public class NetWorkEventTask {
"2. 按照指定格式返回符合经济领域条件的网络事件集合,且无需额外解释。\n" +
"3. 必须严格依据事件标题-【title】字段进行判断。\n" +
"4. 禁止返回不符合经济领域条件的事件。\n" +
"5. 严格按照以下json格式返回数据:\n" +
"5. 最少返回10条。\n" +
"6. 严格按照以下json格式返回数据:\n" +
"[\n" +
" {\n" +
" \"title\": \"经济\"\n" +
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论