feat:编辑报告的同时修改报告内容表中的记录

This commit is contained in:
2023-05-15 10:11:22 +08:00
parent 57c92cbdb0
commit 03ba9069e6
3 changed files with 14 additions and 14 deletions
@@ -70,8 +70,14 @@ public class IReportContentServiceImpl extends ServiceImpl<ReportContentDao, Rep
//解析出内容
String content = FileContentUtil.readFileContent(file);
//将内容存入
ReportContentEntity reportContentEntity = new ReportContentEntity(UUID.randomUUID10(), reportId, content);
save(reportContentEntity);
ReportContentEntity reportContent = query().eq("report_id", reportId).one();
if (reportContent == null) {
ReportContentEntity reportContentEntity = new ReportContentEntity(UUID.randomUUID10(), reportId, content);
save(reportContentEntity);
} else {
reportContent.setReportContent(content);
saveOrUpdate(reportContent);
}
//将文件删除
outputStream.close();
FileUtil.deleteFile(path);
@@ -213,9 +213,6 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
});
}
//插入报表内容表
iReportContentService.insertReportContent(entity.getId(), entity.getFileId());
CommonUtils.threadPoolExecutor().execute(() -> {
//生成html
try {
@@ -128,14 +128,6 @@ public class ITtReportManageActServiceImpl extends ServiceImpl<TtReportManageAct
@Override
public void saveOrUpdataReport(TtReportManageAct ttReportManageAct) {
//插入报表内容表
try {
iReportContentService.insertReportContent(ttReportManageAct.getDataId(), ttReportManageAct.getFileId());
log.info("抽取报告内容");
} catch (IOException e) {
log.error("获取报告内容失败", e);
}
ReportEntity reportEntity = reportDao.selectById(ttReportManageAct.getDataId());
if (reportEntity == null){
//保存报告
@@ -147,6 +139,11 @@ public class ITtReportManageActServiceImpl extends ServiceImpl<TtReportManageAct
reportEntity1.setId(ttReportManageAct.getDataId());
reportDao.updateById(reportEntity);
}
try {
iReportContentService.insertReportContent(ttReportManageAct.getDataId(), ttReportManageAct.getFileId());
log.info("抽取报告内容");
} catch (IOException e) {
log.error("获取报告内容失败", e);
}
}
}