Просмотр исходного кода

预警规则判断-空值不预警处理

zhaoxian 4 лет назад
Родитель
Сommit
2631ee1926

+ 3 - 2
module-alarm/src/main/java/cn/com/ctop/alarm/modules/constant/MatchLogic.java

@@ -38,8 +38,9 @@ public class MatchLogic {
                 return false;
                 return false;
             }
             }
             if (Check.isNull(value) || "[]".equals(value)) {
             if (Check.isNull(value) || "[]".equals(value)) {
-                obj.put("isNull", true);
-                return true;
+                //洗出的数据为空的时候不报警,若想报警则改成true
+                obj.put("isNull", false);
+                return false;
             }
             }
             obj.put("isNull", false);
             obj.put("isNull", false);
             if ("number".equals(type)) {
             if ("number".equals(type)) {

+ 3 - 3
module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/impl/RuleGroupServiceImpl.java

@@ -390,7 +390,7 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
         if (!Check.isNull(ruleDatas)) {
         if (!Check.isNull(ruleDatas)) {
             JSONArray okData = new JSONArray();
             JSONArray okData = new JSONArray();
             for (int i = 0; i < ruleDatas.size(); i++) {
             for (int i = 0; i < ruleDatas.size(); i++) {
-                JSONObject targetEntity = dimensionData.getJSONObject(i);
+                JSONObject targetEntity = ruleDatas.getJSONObject(i);
                 String value = targetEntity.getString(ruleBase.getIndicatorCode());
                 String value = targetEntity.getString(ruleBase.getIndicatorCode());
                 if (MatchLogic.matchCondition(indicator, ruleBase.getRuleCondition(), threshold, value, targetEntity)) {
                 if (MatchLogic.matchCondition(indicator, ruleBase.getRuleCondition(), threshold, value, targetEntity)) {
                     okData.add(targetEntity);
                     okData.add(targetEntity);
@@ -527,8 +527,8 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
             } else if ("TEL".equals(sendType)) {
             } else if ("TEL".equals(sendType)) {
 
 
             } else {
             } else {
-//                sendMessageService.sendMessage("1b3deb8258e84df994f1371a51cfc14a", msg);
-                sendMessageService.sendMessage(user.getString("id"), msg);
+                sendMessageService.sendMessage("1b3deb8258e84df994f1371a51cfc14a", msg);
+//                sendMessageService.sendMessage(user.getString("id"), msg);
                 Thread.sleep(200);
                 Thread.sleep(200);
             }
             }
             if (!Check.isNull(msg)) {
             if (!Check.isNull(msg)) {