优化报警判断

This commit is contained in:
zhanghan11 2024-09-27 09:25:34 +08:00
parent 40e3a31414
commit c3d0d9948f

View File

@ -52,9 +52,9 @@ public class IpcUtil {
flag = realValue.compareTo(referenceValue1) <= 0; flag = realValue.compareTo(referenceValue1) <= 0;
} else if (IpcConstant.EQUAL.equals(referenceCon)) { } else if (IpcConstant.EQUAL.equals(referenceCon)) {
flag = realValue.compareTo(referenceValue1) == 0; flag = realValue.compareTo(referenceValue1) == 0;
} else if (IpcConstant.WIDTHIN_INTERVAL.equals(referenceCon)) {
flag = realValue.compareTo(referenceValue1) >= 0 && realValue.compareTo(referenceValue2) <= 0;
} else if (IpcConstant.OUTSIDE_INTERVAL.equals(referenceCon)) { } else if (IpcConstant.OUTSIDE_INTERVAL.equals(referenceCon)) {
flag = realValue.compareTo(referenceValue1) >= 0 && realValue.compareTo(referenceValue2) <= 0;
} else if (IpcConstant.WIDTHIN_INTERVAL.equals(referenceCon)) {
flag = realValue.compareTo(referenceValue1) <= 0 || realValue.compareTo(referenceValue2) >= 0; flag = realValue.compareTo(referenceValue1) <= 0 || realValue.compareTo(referenceValue2) >= 0;
} else { } else {
flag = true; flag = true;
@ -69,7 +69,7 @@ public class IpcUtil {
List<IpcAlarmRecord> returnList = new ArrayList<>(); List<IpcAlarmRecord> returnList = new ArrayList<>();
String isAlarm = "0"; String isAlarm = "0";
for (IpcAlarmRules rulesConfig : rulesConfigList) { for (IpcAlarmRules rulesConfig : rulesConfigList) {
if (judgeAlarm(map.get(rulesConfig.getAlarmNameKey()), rulesConfig.getAlertLowerBound(), rulesConfig.getAlertLowerBound(), rulesConfig.getReferenceCon())) { if (judgeAlarm(map.get(rulesConfig.getAlarmNameKey()), rulesConfig.getAlertUpperBound(), rulesConfig.getAlertLowerBound(), rulesConfig.getReferenceCon())) {
// 报警数据 // 报警数据
isAlarm = "1"; isAlarm = "1";
IpcAlarmRecord ipcAlarmRecord = new IpcAlarmRecord(IdUtils.fastSimpleUUID(), rulesConfig.getEquipId(), rulesConfig.getEquipName(), rulesConfig.getAlarmNameKey(), rulesConfig.getAlarmName(), String.valueOf(map.get(rulesConfig.getAlarmNameKey())), rulesConfig.getAlarmInfoUnit(), rulesConfig.getAlarmLevel(), rulesConfig.getReferenceName(), rulesConfig.getDescription(), rulesConfig.getId()); IpcAlarmRecord ipcAlarmRecord = new IpcAlarmRecord(IdUtils.fastSimpleUUID(), rulesConfig.getEquipId(), rulesConfig.getEquipName(), rulesConfig.getAlarmNameKey(), rulesConfig.getAlarmName(), String.valueOf(map.get(rulesConfig.getAlarmNameKey())), rulesConfig.getAlarmInfoUnit(), rulesConfig.getAlarmLevel(), rulesConfig.getReferenceName(), rulesConfig.getDescription(), rulesConfig.getId());