|
|
|
@ -648,7 +648,7 @@ public class JobMainTask { |
|
|
|
String patrolId = taskExecRecord.getTaskPatrolId(); |
|
|
|
String[] ids = patrolId.split(StringUtils.UNDERLINE); |
|
|
|
String taskPatrolIdRemote = ids[1] + "_" + ids[2]; |
|
|
|
callRemoteSendMsgCtrlMode(taskPatrolIdRemote, taskExecRecord.getTotalNumber(), pointExecRecord);/*上报巡视结果*/ |
|
|
|
callRemoteSendMsgCtrlMode(taskPatrolIdRemote, taskExecRecord.getTotalAlgorithmNumber(), pointExecRecord);/*上报巡视结果*/ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -795,13 +795,13 @@ public class JobMainTask { |
|
|
|
List<PatrolTaskPointExecRecord> finishedInfos = taskExecClient.selectPatrolTaskPointExecRecordList(PatrolTaskPointExecRecord.builder().oldTaskPatrolledId(execRecord.getOldTaskPatrolId()).build()); |
|
|
|
String totalProgress = decimalFormatNum(finishedInfos.size(), infoListSize); |
|
|
|
log.info("totalProgress: {}, finish: {}, total: {}", totalProgress, finishedInfos.size(), infoListSize); |
|
|
|
callRemoteSendMsgRunMode( |
|
|
|
execRecord.getTaskCode(), |
|
|
|
execRecord.getTaskName(), |
|
|
|
execRecord.getTaskPatrolId(), |
|
|
|
totalProgress, |
|
|
|
TaskStatus.DONE.getCode()/*点位全部执行成功,上报进度100%*/ |
|
|
|
); |
|
|
|
// callRemoteSendMsgRunMode( |
|
|
|
// execRecord.getTaskCode(), |
|
|
|
// execRecord.getTaskName(), |
|
|
|
// execRecord.getTaskPatrolId(), |
|
|
|
// totalProgress, |
|
|
|
// TaskStatus.DONE.getCode()/*点位全部执行成功,上报进度100%*/ |
|
|
|
// ); |
|
|
|
final Integer redisRecCnt = redisService.getCacheObjectOfTask(RedisConst.TASK_RECORD_CNT, execRecord.getTaskCode()); |
|
|
|
log.info("execRecordCounter: {}, redisRecCnt: {}", execRecordCounter, redisRecCnt); |
|
|
|
if (execRecordCounter == redisRecCnt) { // 最后一个record |
|
|
|
@ -815,7 +815,7 @@ public class JobMainTask { |
|
|
|
// List<PatrolTaskInfo> totalInfos = getInfosByRecord(execRecord); |
|
|
|
List<PatrolTaskPointExecRecord> finishedInfos = taskExecClient.selectPatrolTaskPointExecRecordList(PatrolTaskPointExecRecord.builder().oldTaskPatrolledId(execRecord.getOldTaskPatrolId()).build()); |
|
|
|
String totalProgress = decimalFormatNum(finishedInfos.size(), infoListSize); |
|
|
|
log.info("totalProgress: {}, finish: {}, total: {}", totalProgress, finishedInfos.size(), infoListSize); |
|
|
|
log.info("finish not equal total totalProgress: {}, finish: {}, total: {}", totalProgress, finishedInfos.size(), infoListSize); |
|
|
|
callRemoteSendMsgRunMode( |
|
|
|
execRecord.getTaskCode(), |
|
|
|
execRecord.getTaskName(), |
|
|
|
@ -824,7 +824,7 @@ public class JobMainTask { |
|
|
|
TaskStatus.DONE.getCode()/*点位全部执行成功,上报进度100%*/ |
|
|
|
); |
|
|
|
final int redisRecCnt = redisService.getCacheObjectOfTask(RedisConst.TASK_RECORD_CNT, execRecord.getTaskCode()); |
|
|
|
log.info("execRecordCounter: {}, redisRecCnt: {}", execRecordCounter, redisRecCnt); |
|
|
|
log.info("finish not equal total execRecordCounter: {}, redisRecCnt: {}", execRecordCounter, redisRecCnt); |
|
|
|
if (execRecordCounter == redisRecCnt) { |
|
|
|
resetRecordCounter(execRecord.getTaskCode()); |
|
|
|
resetRedisCurrentCode(execRecord.getTaskCode()); |
|
|
|
@ -1160,16 +1160,31 @@ public class JobMainTask { |
|
|
|
// } |
|
|
|
// } |
|
|
|
|
|
|
|
private int calcTaskAlgorithmTotalNumber(List<PatrolTaskInfo> patrolTaskInfoList) { |
|
|
|
int totalAlgorithmNumber = 0; |
|
|
|
for(PatrolTaskInfo patrolTaskInfo : patrolTaskInfoList) { |
|
|
|
String result = taskExecClient.getAlgSubtypeIdsByPatrolPointId(patrolTaskInfo.getDeviceId()); |
|
|
|
if(StringUtils.isNotEmpty(result)) { |
|
|
|
String[] algSubtypeIds = result.split(StringUtils.COMMA); |
|
|
|
totalAlgorithmNumber += algSubtypeIds.length; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return totalAlgorithmNumber; |
|
|
|
} |
|
|
|
private void prePointExecImmediate(final PatrolTaskExecRecord patrolTaskExecRecord, List<PatrolTaskInfo> patrolTaskInfoList) { |
|
|
|
Map<String, List<PatrolTaskInfo>> deviceMap = new HashMap<>(); |
|
|
|
for (PatrolTaskInfo patrolTaskInfo : patrolTaskInfoList) { |
|
|
|
deviceMap.computeIfAbsent(patrolTaskInfo.getDeviceCode(), k -> new ArrayList<>()).add(patrolTaskInfo); |
|
|
|
} |
|
|
|
|
|
|
|
int totalAlgorithmNumber = calcTaskAlgorithmTotalNumber(patrolTaskInfoList); |
|
|
|
patrolTaskExecRecord.setTotalAlgorithmNumber(totalAlgorithmNumber); |
|
|
|
|
|
|
|
asyncTaskPatrolPointCnt.set(0); |
|
|
|
int batchSize = taskBatchSize; |
|
|
|
int total = patrolTaskInfoList.size(); |
|
|
|
log.info(Color.CYAN + "threadId: {}, batchSize: {}, total: {}" + Color.END, Thread.currentThread().getId(), batchSize, total); |
|
|
|
log.info(Color.CYAN + "threadId: {}, batchSize: {}, total: {}, totalAlgorithmNumber: {}" + Color.END, Thread.currentThread().getId(), batchSize, total, totalAlgorithmNumber); |
|
|
|
List<PatrolTaskInfo> currentGroup = new ArrayList<>(); |
|
|
|
List<CompletableFuture<Void>> futures = new ArrayList<>(); |
|
|
|
int index = 1; |
|
|
|
@ -1337,7 +1352,11 @@ public class JobMainTask { |
|
|
|
} |
|
|
|
|
|
|
|
private String decimalFormatNum(int current, int all) { |
|
|
|
DecimalFormat nf = new DecimalFormat("#"); |
|
|
|
if (all == 0) { |
|
|
|
return "0.0"; // 防止除以0 |
|
|
|
} |
|
|
|
|
|
|
|
DecimalFormat nf = new DecimalFormat("0.0"); |
|
|
|
nf.setMaximumIntegerDigits(3); |
|
|
|
float decimalFormatNum = (float) (current) / (float) all; |
|
|
|
if (decimalFormatNum > 1) { |
|
|
|
|