提交 2c6740af 作者: 925993793@qq.com

事件分析bug修改

上级 6d6dff7d
......@@ -35,6 +35,7 @@ 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;
......@@ -833,9 +834,46 @@ public class EventAnalysisController {
} catch (Exception e) {
e.printStackTrace();
}
}
@PostMapping(value = "/new_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);
}
} 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();
}
}
/**
* 导出ppt
*
......
......@@ -336,13 +336,17 @@ public class AnalysisServiceImpl implements AnalysisService {
EventLlmConfig detailConfig = eventLlmConfigService.getConfig(event.getId(), AnalysisColumnEnum.IMPACT_ASSESSMENT_DETAIL.getCode());
List<JSONObject> impactList = JSON.parseArray(result, JSONObject.class);
for (JSONObject impact : impactList) {
JSONObject params = new JSONObject();
params.put("eventName", event.getEventName());
params.put("eventSummary", event.getEventDescribe());
params.put("impactOutline", impact);
String impactDetail = llmService.model(detailConfig.getLlmName(),null, detailConfig.getLlmPrompt(), params.toJSONString());
impact.put("impactDetail", impactDetail);
log.info("{}-事件分析【{}-{}详情】重新生成逻辑完成。", event.getEventName(), AnalysisColumnEnum.IMPACT_ASSESSMENT.getName(),impact.getString("theme"));
try {
JSONObject params = new JSONObject();
params.put("eventName", event.getEventName());
params.put("eventSummary", event.getEventDescribe());
params.put("impactOutline", impact);
String impactDetail = llmService.model(detailConfig.getLlmName(),null, detailConfig.getLlmPrompt(), params.toJSONString());
impact.put("impactDetail", impactDetail);
log.info("{}-事件分析【{}-{}详情】重新生成逻辑完成。", event.getEventName(), AnalysisColumnEnum.IMPACT_ASSESSMENT.getName(),impact.getString("theme"));
} catch (Exception e) {
e.printStackTrace();
}
}
result = JSON.toJSONString(impactList);
} else if (llmConfig.getColumnCode().equals(AnalysisColumnEnum.DRIVING_FACTORS.getCode())) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论