|
@@ -68,11 +68,14 @@ public class GisSurveySystemChecker {
|
|
|
/**
|
|
|
* 系统检查任务
|
|
|
*
|
|
|
- * @param params 系统检查参数
|
|
|
+ * @param params 系统检查参数
|
|
|
+ * @param onStartSubtask 启动子任务
|
|
|
+ * @param onDeprecatedSubtask 弃用子任务(完成数据收集/取消)
|
|
|
* @return 系统检查返回
|
|
|
*/
|
|
|
@Async
|
|
|
- public ListenableFuture<GisSurveySystemCheckResult> systemCheckTask(GisSurveyCheckParams params, Consumer<GisSurveySystemCheckSubtask> onStartSubtask) {
|
|
|
+ public ListenableFuture<GisSurveySystemCheckResult> systemCheckTask(GisSurveyCheckParams params
|
|
|
+ , Consumer<GisSurveySystemCheckSubtask> onStartSubtask, Consumer<GisSurveySystemCheckId> onDeprecatedSubtask) {
|
|
|
//系统检查id
|
|
|
GisSurveySystemCheckId systemCheckId = GisSurveySystemCheckId.generateId(params);
|
|
|
if (systemCheckId == null) return new AsyncResult<>(GisSurveySystemCheckResult.fail(params));
|
|
@@ -117,16 +120,20 @@ public class GisSurveySystemChecker {
|
|
|
|
|
|
//孤立点检查
|
|
|
if (points != null && lines != null) {
|
|
|
- isolatedPointsFuture = isolatedPointsFinder.findIsolatedPoints(points, lines, systemCheckId);
|
|
|
+ if (params.getIsolatedPointsStart())
|
|
|
+ isolatedPointsFuture = isolatedPointsFinder.findIsolatedPoints(points, lines, systemCheckId);
|
|
|
}
|
|
|
//重复点检查
|
|
|
if (points != null) {
|
|
|
- duplicatePointsFuture = duplicatePointsFinder.findDuplicatePoints(points, typeDefines, systemCheckId);
|
|
|
+ if (params.getDuplicatePointsStart())
|
|
|
+ duplicatePointsFuture = duplicatePointsFinder.findDuplicatePoints(points, typeDefines, systemCheckId);
|
|
|
}
|
|
|
//孤立线和重叠线检查
|
|
|
if (lines != null) {
|
|
|
- isolatedLinesFuture = isolatedLinesFinder.findIsolatedLines(lines, systemCheckId);
|
|
|
- overlapLinesFuture = overlapLinesFinder.findDuplicateLines(lines, systemCheckId);
|
|
|
+ if (params.getIsolatedLinesStart())
|
|
|
+ isolatedLinesFuture = isolatedLinesFinder.findIsolatedLines(lines, systemCheckId);
|
|
|
+ if (params.getOverlapLinesStart())
|
|
|
+ overlapLinesFuture = overlapLinesFinder.findOverlapLines(lines, systemCheckId);
|
|
|
}
|
|
|
|
|
|
//返回子任务
|
|
@@ -167,8 +174,11 @@ public class GisSurveySystemChecker {
|
|
|
//写入结果
|
|
|
systemCheckResultManager.writeResult(result, systemCheckId, GisSurveySystemCheckResultPath.RESULT);
|
|
|
//替换结果
|
|
|
- if (!systemCheckResultManager.replaceResult(systemCheckId))
|
|
|
+ if (!systemCheckResultManager.replaceResult(systemCheckId)) {
|
|
|
+ //弃用子任务
|
|
|
+ onDeprecatedSubtask.accept(systemCheckId);
|
|
|
return new AsyncResult<>(GisSurveySystemCheckResult.fail(params));
|
|
|
+ }
|
|
|
|
|
|
LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_INFO, mBizType, mStrClassName
|
|
|
, String.format(
|
|
@@ -178,6 +188,9 @@ public class GisSurveySystemChecker {
|
|
|
Duration.between(result.getRequestTime(), result.getCompleteTime()).toMillis()
|
|
|
)
|
|
|
);
|
|
|
+
|
|
|
+ //弃用子任务
|
|
|
+ onDeprecatedSubtask.accept(systemCheckId);
|
|
|
return new AsyncResult<>(result);
|
|
|
} catch (InterruptedException | ExecutionException e) {
|
|
|
LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_ERROR, mBizType, mStrClassName
|
|
@@ -187,14 +200,19 @@ public class GisSurveySystemChecker {
|
|
|
systemCheckId.getCode()
|
|
|
)
|
|
|
);
|
|
|
+
|
|
|
//清除子任务
|
|
|
if (isolatedPointsFuture != null) isolatedPointsFuture.cancel(true);
|
|
|
if (isolatedLinesFuture != null) isolatedLinesFuture.cancel(true);
|
|
|
if (duplicatePointsFuture != null) duplicatePointsFuture.cancel(true);
|
|
|
if (overlapLinesFuture != null) overlapLinesFuture.cancel(true);
|
|
|
+
|
|
|
//失败信息
|
|
|
result.setCheckStatus(GisSurveyCheckStatusEnum.FAIL.getCode());
|
|
|
result.setCompleteTime(LocalDateTime.now());
|
|
|
+
|
|
|
+ //弃用子任务
|
|
|
+ onDeprecatedSubtask.accept(systemCheckId);
|
|
|
return new AsyncResult<>(result);
|
|
|
}
|
|
|
}
|