Преглед на файлове

定时执行——规则引擎2.0

zhaoxian преди 3 години
родител
ревизия
8c0a48ac96
променени са 1 файла, в които са добавени 20 реда и са изтрити 0 реда
  1. 20 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/alarm/modules/service/impl/RuleTemplateServiceImpl.java

+ 20 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/alarm/modules/service/impl/RuleTemplateServiceImpl.java

@@ -305,6 +305,16 @@ public class RuleTemplateServiceImpl extends ServiceImpl<RuleTemplateMapper, Rul
             groupJson.put("operation", group.getOperation());
             groupJson.put("operationType", group.getOperationType());
             groupJson.put("operationValue", group.getOperationValue());
+            QueryWrapper<RuleAccountThreshold> wrapper = new QueryWrapper<>();
+            wrapper.eq("account_id", accountId);
+            wrapper.eq("group_id", groupId);
+            wrapper.orderByDesc("operation_threshold").last("limit 1");
+            RuleAccountThreshold thresholds = accountThresholdService.getOne(wrapper); // 查询基础规则绑定的阈值
+            if (!Check.isNull(thresholds)) {
+                groupJson.put("operationThreshold", thresholds.getOperationThreshold());
+                groupJson.put("maxValue", thresholds.getMaxValue());
+                groupJson.put("minValue", thresholds.getMinValue());
+            }
             JSONArray ruleDetail = new JSONArray();
 
             if (group.getIsCopy() == 0) { // 规则不可复制
@@ -476,6 +486,16 @@ public class RuleTemplateServiceImpl extends ServiceImpl<RuleTemplateMapper, Rul
             groupJson.put("operation", group.getOperation());
             groupJson.put("operationType", group.getOperationType());
             groupJson.put("operationValue", group.getOperationValue());
+            QueryWrapper<RuleAccountThreshold> wrapper = new QueryWrapper<>();
+//            wrapper.eq("account_id", accountId);
+            wrapper.eq("group_id", groupId);
+            wrapper.orderByDesc("operation_threshold").last("limit 1");
+            RuleAccountThreshold thresholds = accountThresholdService.getOne(wrapper); // 查询基础规则绑定的阈值
+            if (!Check.isNull(thresholds)) {
+                groupJson.put("operationThreshold", thresholds.getOperationThreshold());
+                groupJson.put("maxValue", thresholds.getMaxValue());
+                groupJson.put("minValue", thresholds.getMinValue());
+            }
             JSONArray ruleIds = JSONArray.parseArray(group.getRuleIds());
             if (Check.isNull(ruleIds)) {
                 continue;