|
|
@ -265,28 +265,29 @@ public class PatrolTaskResultMainController extends BaseController { |
|
|
public AjaxResult updateInfo_shaoxing( |
|
|
public AjaxResult updateInfo_shaoxing( |
|
|
@RequestBody PatrolTaskResultMain resultMain) { |
|
|
@RequestBody PatrolTaskResultMain resultMain) { |
|
|
long startTime = System.currentTimeMillis(); |
|
|
long startTime = System.currentTimeMillis(); |
|
|
List<String> taskPatrolledIds = resultMain.getTaskPatrolledIds(); |
|
|
|
|
|
logger.info("-----------patrolTaskResultMains taskPatrolledIds: {}", taskPatrolledIds); |
|
|
|
|
|
List<PatrolTaskResultMain> patrolTaskResultMains = patrolTaskResultMainService.selectPatrolTaskResultMainByTaskPatrolledIds(taskPatrolledIds); |
|
|
|
|
|
logger.info("-----------patrolTaskResultMains: {}", patrolTaskResultMains); |
|
|
|
|
|
if (patrolTaskResultMains.size() == 0) { |
|
|
|
|
|
logger.error("[归档]失败, 数据采集中..."); |
|
|
|
|
|
return AjaxResult.error("数据采集中请稍后...."); |
|
|
|
|
|
} |
|
|
|
|
|
List<Long> lineIds = patrolTaskResultMains.stream().map(PatrolTaskResultMain::getLineId).collect(Collectors.toList()); |
|
|
|
|
|
List<Long> longs = patrolTaskResultMainService.selectLineIdsByList(lineIds); |
|
|
|
|
|
if (longs != null && longs.size() > 0) { |
|
|
|
|
|
lineIds.addAll(longs); |
|
|
|
|
|
} |
|
|
|
|
|
lineIds = lineIds.stream().distinct().collect(Collectors.toList()); |
|
|
|
|
|
List<PatrolResult> resultList = patrolResultService.selectPatrolResultListByMainIds(lineIds); |
|
|
|
|
|
if (resultList.isEmpty()) { |
|
|
|
|
|
logger.error("[归档]失败, 数据采集中..."); |
|
|
|
|
|
return AjaxResult.error("数据采集中请稍后...."); |
|
|
|
|
|
} |
|
|
|
|
|
List<Long> finalLineIds = lineIds; |
|
|
|
|
|
startTime = PrintUtil.useTime("查询统计数据", startTime); |
|
|
|
|
|
|
|
|
long finalStartTime = startTime; |
|
|
CompletableFuture<List<Long>> saveReportFuture = CompletableFuture.supplyAsync(() -> { |
|
|
CompletableFuture<List<Long>> saveReportFuture = CompletableFuture.supplyAsync(() -> { |
|
|
|
|
|
List<String> taskPatrolledIds = resultMain.getTaskPatrolledIds(); |
|
|
|
|
|
logger.info("-----------patrolTaskResultMains taskPatrolledIds: {}", taskPatrolledIds); |
|
|
|
|
|
List<PatrolTaskResultMain> patrolTaskResultMains = patrolTaskResultMainService.selectPatrolTaskResultMainByTaskPatrolledIds(taskPatrolledIds); |
|
|
|
|
|
logger.info("-----------patrolTaskResultMains: {}", patrolTaskResultMains); |
|
|
|
|
|
if (patrolTaskResultMains.size() == 0) { |
|
|
|
|
|
logger.error("[归档]失败, 数据采集中..."); |
|
|
|
|
|
// return AjaxResult.error("数据采集中请稍后...."); |
|
|
|
|
|
} |
|
|
|
|
|
List<Long> lineIds = patrolTaskResultMains.stream().map(PatrolTaskResultMain::getLineId).collect(Collectors.toList()); |
|
|
|
|
|
List<Long> longs = patrolTaskResultMainService.selectLineIdsByList(lineIds); |
|
|
|
|
|
if (longs != null && longs.size() > 0) { |
|
|
|
|
|
lineIds.addAll(longs); |
|
|
|
|
|
} |
|
|
|
|
|
lineIds = lineIds.stream().distinct().collect(Collectors.toList()); |
|
|
|
|
|
List<PatrolResult> resultList = patrolResultService.selectPatrolResultListByMainIds(lineIds); |
|
|
|
|
|
if (resultList.isEmpty()) { |
|
|
|
|
|
logger.error("[归档]失败, 数据采集中..."); |
|
|
|
|
|
// return AjaxResult.error("数据采集中请稍后...."); |
|
|
|
|
|
} |
|
|
|
|
|
List<Long> finalLineIds = lineIds; |
|
|
|
|
|
PrintUtil.useTime("查询统计数据", finalStartTime); |
|
|
logger.info("[ARCHIVE] Start saving reports"); |
|
|
logger.info("[ARCHIVE] Start saving reports"); |
|
|
return patrolResultService.saveReportShaoxing(resultMain, finalLineIds, resultList); |
|
|
return patrolResultService.saveReportShaoxing(resultMain, finalLineIds, resultList); |
|
|
}, executor).exceptionally(ex -> { |
|
|
}, executor).exceptionally(ex -> { |
|
|
|