|
|
|
@ -856,14 +856,14 @@ public class AnalyseResponseServiceImpl implements IAnalyseResponseService { |
|
|
|
patrolTaskStatus.setTaskEstimatedTime(algorithmProgress); |
|
|
|
if ("100.0".equals(algorithmProgress)) { |
|
|
|
patrolTaskStatus.setEndTime(DateUtil.formatDateTime(new Date())); |
|
|
|
log.info(Color.GREEN + "DONE calcRemoteAlgorithmProgress: curNumber: {}, totalNumer: {}, algorithmProgress: {}, taskPatrolledId: {}, db-taskProgress: {}" + Color.END, |
|
|
|
resultAnalysisList.size(), totalNumber, algorithmProgress, taskPatrolledId, patrolTaskStatus.getTaskProgress()); |
|
|
|
log.info(Color.GREEN + "DONE CALC_REMOTE_ALGORITHM_PROGRESS: taskPatrolledId: {}, curNumber: {}, totalNumer: {}, algorithmProgress: {}, db-taskProgress: {}" + Color.END, |
|
|
|
taskPatrolledId, resultAnalysisList.size(), totalNumber, algorithmProgress, patrolTaskStatus.getTaskProgress()); |
|
|
|
patrolTaskStatus.setTaskProgress("100.0"); |
|
|
|
patrolTaskStatus.setTaskState(TaskStatus.DONE.getCode()); |
|
|
|
patrolTaskStatusService.updatePatrolTaskStatus(patrolTaskStatus); |
|
|
|
} else { |
|
|
|
log.info(Color.GREEN + "RUNNING calcRemoteAlgorithmProgress: curNumber: {}, totalNumer: {}, algorithmProgress: {}, taskPatrolledId: {}, status: {}" + Color.END, |
|
|
|
resultAnalysisList.size(), totalNumber, algorithmProgress, taskPatrolledId, patrolTaskStatus.getTaskState()); |
|
|
|
log.info(Color.GREEN + "RUNNING CALC_REMOTE_ALGORITHM_PROGRESS taskPatrolledId: {}, curNumber: {}, totalNumer: {}, algorithmProgress: {}, status: {}" + Color.END, |
|
|
|
taskPatrolledId, resultAnalysisList.size(), totalNumber, algorithmProgress, patrolTaskStatus.getTaskState()); |
|
|
|
|
|
|
|
if (TaskStatus.RUNNING.getCode().equals(patrolTaskStatus.getTaskState())) { |
|
|
|
patrolTaskStatus.setTaskState(TaskStatus.RUNNING.getCode()); |
|
|
|
@ -888,27 +888,34 @@ public class AnalyseResponseServiceImpl implements IAnalyseResponseService { |
|
|
|
} |
|
|
|
|
|
|
|
private AlgValue selectAlgMap(String devId, String type) { |
|
|
|
log.info("selectAlgMap patrolPointId: {}, type: {}", devId, type); |
|
|
|
AlgValue algValue = null; |
|
|
|
|
|
|
|
Map<String, String> map = this.resultAnalysisService.selectPointInfoById(devId); |
|
|
|
String alarmThreshold = map.get(AnalyseConstants.ANALYSE_ALARM_THRESHOLD); |
|
|
|
log.info("selectAlgMap patrolPointId: {}, type: {}, alarmThreshold: {}", devId, type, alarmThreshold); |
|
|
|
if (StringUtils.isNotBlank(alarmThreshold)) { |
|
|
|
JSONArray thresholdList = JSONArray.parseArray(alarmThreshold); |
|
|
|
for (int i = 0; i < thresholdList.size(); ++i) { |
|
|
|
JSONObject threshold = thresholdList.getJSONObject(i); |
|
|
|
if (StringUtils.isNotEmpty(type) && type.equals(threshold.getString(AnalyseConstants.ANALYSE_CODE))) { |
|
|
|
log.info("selectAlgMap patrolpoint threshold: {}", JSONObject.toJSONString(threshold)); |
|
|
|
algValue = new AlgValue(threshold.getString(AnalyseConstants.ANALYSE_UPPER_VALUE), threshold.getString(AnalyseConstants.ANALYSE_LOWER_VALUE)); |
|
|
|
try { |
|
|
|
JSONArray thresholdList = JSONArray.parseArray(alarmThreshold); |
|
|
|
for (int i = 0; i < thresholdList.size(); ++i) { |
|
|
|
JSONObject threshold = thresholdList.getJSONObject(i); |
|
|
|
if (StringUtils.isNotEmpty(type) && type.equals(threshold.getString(AnalyseConstants.ANALYSE_CODE))) { |
|
|
|
log.info("selectAlgMap patrolpoint threshold: {}", JSONObject.toJSONString(threshold)); |
|
|
|
algValue = new AlgValue(threshold.getString(AnalyseConstants.ANALYSE_UPPER_VALUE), threshold.getString(AnalyseConstants.ANALYSE_LOWER_VALUE)); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("selectAlgMap Exception alarmThreshold: {}, Msg: {}", alarmThreshold, e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (algValue == null) { |
|
|
|
Map<String, String> threshold = patrolResultService.selectPatrolPresetParam(devId); |
|
|
|
if (threshold != null) { |
|
|
|
log.info("selectAlgMap patrolpreset threshold: {}", JSONObject.toJSONString(threshold)); |
|
|
|
algValue = new AlgValue(threshold.get(AnalyseConstants.ANALYSE_MAX_TEMP), threshold.get(AnalyseConstants.ANALYSE_MIN_TEMP)); |
|
|
|
log.info("selectAlgMap patrolPreset threshold: {}", JSONObject.toJSONString(threshold)); |
|
|
|
try { |
|
|
|
algValue = new AlgValue(threshold.get(AnalyseConstants.ANALYSE_MAX_TEMP), threshold.get(AnalyseConstants.ANALYSE_MIN_TEMP)); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("selectAlgMap Exception-2 Msg: {}", e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|