|
|
|
@ -67,9 +67,11 @@ import org.apache.poi.xwpf.usermodel.*; |
|
|
|
import org.openxmlformats.schemas.wordprocessingml.x2006.main.*; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.cloud.context.config.annotation.RefreshScope; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
@RestController |
|
|
|
@RefreshScope |
|
|
|
@RequestMapping({"/resultmain"}) |
|
|
|
public class PatrolTaskResultMainController extends BaseController { |
|
|
|
|
|
|
|
@ -271,30 +273,23 @@ public class PatrolTaskResultMainController extends BaseController { |
|
|
|
@PostMapping({"/updateInfo"}) |
|
|
|
public AjaxResult updateInfo_lingzhou( |
|
|
|
@RequestBody PatrolTaskResultMain resultMain) { |
|
|
|
long startTime = System.currentTimeMillis(); |
|
|
|
List<Long> lineIds = resultMain.getLineIds(); |
|
|
|
Long lineId = resultMain.getLineIds().get(0); |
|
|
|
resultMain.setLineId(lineId); |
|
|
|
// resultMain.setLineIds(lineIds); |
|
|
|
// resultMain.setCheckPerson(checkPerson); |
|
|
|
// resultMain.setTaskResult(taskResult); |
|
|
|
String mainId = String.valueOf(lineId); |
|
|
|
long startTime = System.currentTimeMillis(); |
|
|
|
// logger.info("[ARCHIVE] Starting, Id: {}", mainId); |
|
|
|
List<Long> longs = patrolTaskResultMainService.selectLineIdsByList(lineIds); |
|
|
|
if (longs != null && longs.size() > 0) { |
|
|
|
lineIds.addAll(longs); |
|
|
|
} |
|
|
|
lineIds = lineIds.stream().distinct().collect(Collectors.toList()); |
|
|
|
|
|
|
|
PrintUtil.useTime("收集需归档的lineIds", startTime); |
|
|
|
logger.info("---归档--lineIds size: {},lineIds:{}", lineIds.size(), lineIds); |
|
|
|
// int analyseNum, collectNum; |
|
|
|
// AtomicInteger modifyNum = new AtomicInteger(0); |
|
|
|
// List<PatrolResult> resultList = patrolResultService.selectPatrolResultList(new PatrolResult(mainId)); |
|
|
|
List<PatrolResult> resultList = patrolResultService.selectPatrolResultListByMainIds(lineIds); |
|
|
|
if (resultList.isEmpty()) { |
|
|
|
logger.error("[归档]失败, 数据采集中..."); |
|
|
|
return AjaxResult.error("数据采集中请稍后...."); |
|
|
|
} |
|
|
|
startTime = System.currentTimeMillis(); |
|
|
|
ResultAnalysis resultAnalysis = new ResultAnalysis(); |
|
|
|
int csQxNum = 0, aiQxNum = 0; |
|
|
|
List<String> taskPatrolledIds = resultList.stream().map(PatrolResult::getTaskPatrolledId).distinct().collect(Collectors.toList()); |
|
|
|
@ -305,30 +300,13 @@ public class PatrolTaskResultMainController extends BaseController { |
|
|
|
aiQxNum += ras.getAiQxNum(); |
|
|
|
} |
|
|
|
|
|
|
|
if("0".equals(exportReportFlag) && 0 == aiQxNum) { |
|
|
|
if("0".equals(exportReportFlag) && 0 == aiQxNum && 0 == csQxNum) { |
|
|
|
logger.error("[归档]没有缺陷数据, 无需归档!"); |
|
|
|
return AjaxResult.error("没有缺陷数据, 无需归档!"); |
|
|
|
} |
|
|
|
// List<PatrolResultAux> patrolResultAuxList = iPatrolResultAuxService.selectPatrolResultAuxListByMainId(new PatrolResultAux(mainId)); |
|
|
|
// List<PatrolResultAux> patrolResultAuxList = iPatrolResultAuxService.selectPatrolResultAuxListByMainIds(lineIds); |
|
|
|
// for (PatrolResultAux aux : patrolResultAuxList) { |
|
|
|
// resultList.forEach((item) -> { |
|
|
|
// if (aux.getResultId().equals(String.valueOf(item.getLineId()))) { |
|
|
|
// item.setValue(aux.getValue()); |
|
|
|
// if (!"1".equals(item.getDataType())) { |
|
|
|
// modifyNum.addAndGet(1); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// }); |
|
|
|
// } |
|
|
|
|
|
|
|
// startTime = PrintUtil.useTime("INQUIRY MEND DATA", startTime); |
|
|
|
// collectNum = resultList.size(); |
|
|
|
// analyseNum = resultAnalysisService.selectResultAnalysisByMainId(lineId); |
|
|
|
// analyseNum = resultAnalysisService.selectResultAnalysisByMainIds(lineIds); |
|
|
|
// startTime = PrintUtil.useTime("INQUIRY ANALYZE DATA", startTime); |
|
|
|
// logger.info("[ARCHIVE] Id: {}, collectNum: {}, analyseNum: {}, modifyNum:{}", mainId, collectNum, analyseNum, modifyNum.get()); |
|
|
|
|
|
|
|
PrintUtil.useTime("查询统计缺陷数据", startTime); |
|
|
|
startTime = System.currentTimeMillis(); |
|
|
|
// 使用CompletableFuture异步执行saveReport |
|
|
|
int finalAiQxNum = aiQxNum; |
|
|
|
int finalCsQxNum = csQxNum; |
|
|
|
@ -340,7 +318,8 @@ public class PatrolTaskResultMainController extends BaseController { |
|
|
|
logger.error("Report saving failed", ex); |
|
|
|
return Collections.emptyList(); |
|
|
|
}); |
|
|
|
|
|
|
|
PrintUtil.useTime("保存报告数据", startTime); |
|
|
|
startTime = System.currentTimeMillis(); |
|
|
|
// 当saveReport完成后,再异步处理所有导出任务 |
|
|
|
saveReportFuture.thenAcceptAsync(reportIds -> { |
|
|
|
logger.info("-----------[ARCHIVE] Saved export reportIds: {}", reportIds); |
|
|
|
@ -360,7 +339,7 @@ public class PatrolTaskResultMainController extends BaseController { |
|
|
|
logger.error("Error occurred during saveReport: ", ex); |
|
|
|
return null; |
|
|
|
}); |
|
|
|
// logger.info("-----------[ARCHIVE] EndTime: {}, reportIds: {}", DateUtil.now(), reportIds); |
|
|
|
PrintUtil.useTime("导出报告数据", startTime); |
|
|
|
return toAjax(1); |
|
|
|
|
|
|
|
} |
|
|
|
|