Quellcode durchsuchen

修改规则判断代码

hujing vor 5 Jahren
Ursprung
Commit
9b524c14e1

+ 0 - 1
common-push/src/main/java/org/diagbot/common/push/cache/ApplicationCacheUtil.java

@@ -144,7 +144,6 @@ public class ApplicationCacheUtil {
         Configuration configuration = new DefaultConfig();
         List<String> fileContents = configuration.readFileContents("bigdata_rule_app_filter.dict");
 
-        RuleApp rules = new RuleApp();
         for (String line : fileContents) {
             String[] content = line.split("\\|");
             RuleApp ruleApp = new RuleApp();

+ 5 - 5
common-push/src/main/java/org/diagbot/common/push/filter/rule/PretreatmentRule.java

@@ -64,7 +64,7 @@ public class PretreatmentRule {
                         continue;
                     }
                     for (Rule rule : rules) {
-                        if (!Constants.COMMON_STRING_1.equals(rule.getSet_name_check())) {
+                        if (Constants.COMMON_STRING_1.equals(rule.getSet_name_check())) {
                             if (StringUtils.isEmpty(rule.getSet_name()) || !result.getName().equals(rule.getSet_name())) {
                                 continue;
                             }
@@ -102,15 +102,15 @@ public class PretreatmentRule {
         //标准值最优先匹配
         if (compareEqual(result.getValue(), rule.getEq_value())) {
             content = content + rule.getRemind() == null ? "" : rule.getRemind();
-        } else if (compareMin(result.getValue(), rule.getMin_value(), rule.getMin_operator())
-                && compareMax(result.getValue(), rule.getMax_value(), rule.getMax_operator())
+        } else if (compareMin(result.getValue(), rule.getMax_operator(), rule.getMax_operator())
+                && compareMax(result.getValue(), rule.getMin_operator(), rule.getMin_operator())
                 && result.getUnits().equals(rule.getMin_operator())
                 && result.getUnits().equals(rule.getMax_operator())) {
             content = content + rule.getRemind() == null ? "" : rule.getRemind();
-        } else if (compareMin(result.getValue(), rule.getMin_value(), rule.getMin_operator())
+        } else if (compareMin(result.getValue(), rule.getMax_value(), rule.getMax_operator())   //比最大值小
                 && result.getUnits().equals(rule.getMin_operator())) {
             content = content + rule.getRemind() == null ? "" : rule.getRemind();
-        } else if (compareMax(result.getValue(), rule.getMax_value(), rule.getMax_operator())
+        } else if (compareMax(result.getValue(), rule.getMin_value(), rule.getMin_operator())   //比最小值大
                 && result.getUnits().equals(rule.getMin_operator())) {
             content = content + rule.getRemind() == null ? "" : rule.getRemind();
         }