This commit is contained in:
2026-07-29 13:08:49 +08:00
parent 29ecbf321f
commit 6be6d5d333
59 changed files with 1396 additions and 304 deletions

View File

@@ -31,38 +31,38 @@ public class CompareUtils {
return !compareValue.equals(targetValue);
case GT:
return isNumeric(compareValue) && isNumeric(targetValue) &&
Double.parseDouble(compareValue) > Double.parseDouble(targetValue);
Double.parseDouble(targetValue) > Double.parseDouble(compareValue);
case LT:
return isNumeric(compareValue) && isNumeric(targetValue) &&
Double.parseDouble(compareValue) < Double.parseDouble(targetValue);
Double.parseDouble(targetValue) < Double.parseDouble(compareValue);
case GTE:
return isNumeric(compareValue) && isNumeric(targetValue) &&
Double.parseDouble(compareValue) >= Double.parseDouble(targetValue);
Double.parseDouble(targetValue) >= Double.parseDouble(compareValue);
case LTE:
return isNumeric(compareValue) && isNumeric(targetValue) &&
Double.parseDouble(compareValue) <= Double.parseDouble(targetValue);
Double.parseDouble(targetValue) <= Double.parseDouble(compareValue);
case BETWEEN:
// 范围值用英文中划线分割
String[] rangeValues = targetValue.split("-");
String[] rangeValues = compareValue.split("-");
if (rangeValues.length != 2) {
return false;
}
return isNumeric(compareValue) && isNumeric(rangeValues[0]) && isNumeric(rangeValues[1]) &&
Double.parseDouble(compareValue) >= Double.parseDouble(rangeValues[0]) &&
Double.parseDouble(compareValue) <= Double.parseDouble(rangeValues[1]);
Double.parseDouble(targetValue) >= Double.parseDouble(rangeValues[0]) &&
Double.parseDouble(targetValue) <= Double.parseDouble(rangeValues[1]);
case NOT_BETWEEN:
// 范围值用英文中划线分割
String[] notRangeValues = targetValue.split("-");
String[] notRangeValues = compareValue.split("-");
if (notRangeValues.length != 2) {
return false;
}
return isNumeric(compareValue) && isNumeric(notRangeValues[0]) && isNumeric(notRangeValues[1]) &&
(Double.parseDouble(compareValue) < Double.parseDouble(notRangeValues[0]) ||
Double.parseDouble(compareValue) > Double.parseDouble(notRangeValues[1]));
(Double.parseDouble(targetValue) < Double.parseDouble(notRangeValues[0]) ||
Double.parseDouble(targetValue) > Double.parseDouble(notRangeValues[1]));
case CONTAIN:
return compareValue.contains(targetValue);
return targetValue.contains(compareValue);
case NOT_CONTAIN:
return !compareValue.contains(targetValue);
return !targetValue.contains(compareValue);
default:
return false;
}

View File

@@ -12,6 +12,7 @@ public class DingTalkTemplate {
"告警时间:%s\n\n" +
"设备名称:%s\n\n" +
"设备编号:%s\n\n" +
"当前值:%s\n\n" +
"告警内容:\n%s\n\n" +
"发生位置:\n%s\n\n" +
"处理建议:\n%s\n\n" +
@@ -21,6 +22,7 @@ public class DingTalkTemplate {
alarm.getTime(),
alarm.getDeviceName(),
alarm.getDeviceSn(),
alarm.getTimeValues(),
alarm.getContent(),
alarm.getLocation(),
alarm.getSuggestion(),