Browse Source

阈值从preset_param取不到就从patrol_point取

master
lijiuwei 8 months ago
parent
commit
61ab520bd2
2 changed files with 31 additions and 8 deletions
  1. +2
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/constant/AnalyseConstants.java
  2. +29
    -8
      inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/service/impl/AnalysisServiceImpl.java

+ 2
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/constant/AnalyseConstants.java View File

@ -15,6 +15,8 @@ public class AnalyseConstants {
public static final String ANALYSE_RET_URI = "/picAnalyseRetNotify";
public static final String ANALYSE_UPPER_VALUE = "upperValue";
public static final String ANALYSE_LOWER_VALUE = "lowerValue";
public static final String ANALYSE_MAX_TEMP = "alarm_max_temp";
public static final String ANALYSE_MIN_TEMP = "alarm_min_temp";
public static final String ANALYSE_ALARM_THRESHOLD = "alarm_threshold";
public static final String ANALYSE_VALUE_ERROR = "1";
public static final String ANALYSE_SPLIT = "$analyse$";


+ 29
- 8
inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/service/impl/AnalysisServiceImpl.java View File

@ -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;
}
}

Loading…
Cancel
Save