|
|
|
@ -737,14 +737,35 @@ public class AnalysisServiceImpl implements IAnalysisService { |
|
|
|
} |
|
|
|
|
|
|
|
private AlgValue selectAlgMap(String devId, String type) { |
|
|
|
log.info("selectAlgMap patrolPointId: {}", devId); |
|
|
|
Map<String, String> thresholdMap = patrolResultService.selectPatrolPresetParam(devId); |
|
|
|
if(thresholdMap != null) { |
|
|
|
log.info("selectAlgMap thresholdMap: {}", JSONObject.toJSONString(thresholdMap)); |
|
|
|
return new AlgValue(thresholdMap.get("alarm_max_temp"), thresholdMap.get("alarm_min_temp")); |
|
|
|
} else { |
|
|
|
log.info("selectAlgMap thresholdMap is null"); |
|
|
|
return new AlgValue(); |
|
|
|
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); |
|
|
|
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)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
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)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if(algValue == null) { |
|
|
|
log.info("selectAlgMap threshold is not set"); |
|
|
|
algValue = new AlgValue(); |
|
|
|
} |
|
|
|
|
|
|
|
return algValue; |
|
|
|
} |
|
|
|
} |