feat:刷新全文检索数据
This commit is contained in:
@@ -115,6 +115,9 @@ public class ShiroFilterConfiguration {
|
|||||||
/* 用户信息不用认证 */
|
/* 用户信息不用认证 */
|
||||||
filterChainDefinitionMap.put(restPath + "/userInfo", ANON);
|
filterChainDefinitionMap.put(restPath + "/userInfo", ANON);
|
||||||
|
|
||||||
|
/* 用户信息不用认证 */
|
||||||
|
filterChainDefinitionMap.put(restPath + "/report/refreshReportContent", ANON);
|
||||||
|
|
||||||
/* 在线用户列表不用验证 */
|
/* 在线用户列表不用验证 */
|
||||||
filterChainDefinitionMap.put(restPath + "/onlineUser", ANON);
|
filterChainDefinitionMap.put(restPath + "/onlineUser", ANON);
|
||||||
|
|
||||||
|
|||||||
@@ -809,4 +809,15 @@ public class ReportManageConroller {
|
|||||||
return Result.success(reportFileIPage);
|
return Result.success(reportFileIPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新报告内容表,对比报告内容和报告表的差异,找到没有抽取过内容的报告,生成其内容放入报告内容表中
|
||||||
|
* @return
|
||||||
|
* @throws ParseException
|
||||||
|
*/
|
||||||
|
@ApiOperation("刷新报告内容表")
|
||||||
|
@GetMapping("/refreshReportContent")
|
||||||
|
public ResponseMessage refreshReportContent() {
|
||||||
|
return reportService.refreshReportContent();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,4 +19,10 @@ public interface IReportContentService extends IService<ReportContentEntity> {
|
|||||||
* @param reportId 报告id
|
* @param reportId 报告id
|
||||||
*/
|
*/
|
||||||
void insertReportContent(String reportId) throws IOException;
|
void insertReportContent(String reportId) throws IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据报告id删除记录
|
||||||
|
* @param reportId
|
||||||
|
*/
|
||||||
|
void removeByReportId(String reportId);
|
||||||
}
|
}
|
||||||
|
|||||||
+7
@@ -103,6 +103,13 @@ public class IReportContentServiceImpl extends ServiceImpl<ReportContentDao, Rep
|
|||||||
saveOrUpdate(reportContent);
|
saveOrUpdate(reportContent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeByReportId(String reportId) {
|
||||||
|
LambdaQueryWrapper<ReportContentEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(ReportContentEntity::getReportId, reportId);
|
||||||
|
remove(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -175,7 +175,8 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
|||||||
}
|
}
|
||||||
iReportLabelService.saveBatch(labelList);
|
iReportLabelService.saveBatch(labelList);
|
||||||
}
|
}
|
||||||
//插入报表内容表
|
//修改报表内容表(先删后增)
|
||||||
|
iReportContentService.removeByReportId(reportId);
|
||||||
try {
|
try {
|
||||||
iReportContentService.insertReportContent(reportId);
|
iReportContentService.insertReportContent(reportId);
|
||||||
log.info("抽取报告内容");
|
log.info("抽取报告内容");
|
||||||
@@ -213,6 +214,46 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
|||||||
return reportFileDao.filePage(page,reportFilePageVO);
|
return reportFileDao.filePage(page,reportFilePageVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseMessage refreshReportContent() {
|
||||||
|
//找出所有能生成内容的报告id
|
||||||
|
LambdaQueryWrapper<ReportFile> reportFileLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
//只找不在流程中的报告
|
||||||
|
reportFileLambdaQueryWrapper.ne(ReportFile::getState, 1);
|
||||||
|
List<ReportFile> reportFileList = iReportFileService.list(reportFileLambdaQueryWrapper);
|
||||||
|
Set<String> allReportIdSet = reportFileList.stream().map(ReportFile::getReportId).collect(Collectors.toSet());
|
||||||
|
//找出已经生成过的报告id
|
||||||
|
List<ReportContentEntity> reportContentList = iReportContentService.list();
|
||||||
|
Set<String> generatedReportIdSet = reportContentList.stream().map(ReportContentEntity::getReportId).collect(Collectors.toSet());
|
||||||
|
//获取缺失的报告id
|
||||||
|
allReportIdSet.removeAll(generatedReportIdSet);
|
||||||
|
//需要生成的数量
|
||||||
|
int needGenerateCount = allReportIdSet.size();
|
||||||
|
log.info("发现缺少" + needGenerateCount + "条报告的内容");
|
||||||
|
//实际生成的数量
|
||||||
|
int count = 0;
|
||||||
|
//生成报告内容
|
||||||
|
for (String reportId : allReportIdSet) {
|
||||||
|
//修改报表内容表(先删后增)
|
||||||
|
iReportContentService.removeByReportId(reportId);
|
||||||
|
try {
|
||||||
|
iReportContentService.insertReportContent(reportId);
|
||||||
|
log.info("抽取reportId为{}报告内容", reportId);
|
||||||
|
count++;
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("获取reportId为{}的报告内容失败", reportId);
|
||||||
|
log.error(String.valueOf(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.info("实际生成" + count + "条报告的内容");
|
||||||
|
if (needGenerateCount == count) {
|
||||||
|
return Result.success("成功,全部生成完毕,共" + count + "条");
|
||||||
|
} else {
|
||||||
|
int missing = needGenerateCount - count;
|
||||||
|
return Result.success("失败," + missing + "条报告的内容生成失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增或编辑报告
|
* 新增或编辑报告
|
||||||
*
|
*
|
||||||
|
|||||||
+2
@@ -165,6 +165,8 @@ public class ITtReportManageActServiceImpl extends ServiceImpl<TtReportManageAct
|
|||||||
//标签
|
//标签
|
||||||
reportLabelDao.actEndDelReport(ttReportManageAct.getDataId());
|
reportLabelDao.actEndDelReport(ttReportManageAct.getDataId());
|
||||||
reportLabelDao.updateState(ttReportManageAct.getDataId());
|
reportLabelDao.updateState(ttReportManageAct.getDataId());
|
||||||
|
//修改报表内容表(先删后增)
|
||||||
|
iReportContentService.removeByReportId(ttReportManageAct.getDataId());
|
||||||
try {
|
try {
|
||||||
iReportContentService.insertReportContent(ttReportManageAct.getDataId());
|
iReportContentService.insertReportContent(ttReportManageAct.getDataId());
|
||||||
log.info("抽取报告内容");
|
log.info("抽取报告内容");
|
||||||
|
|||||||
Reference in New Issue
Block a user