Browse Source

优化 获取预警配置时候不在过滤关闭的配置

zhaiyifei 9 tháng trước cách đây
mục cha
commit
00b07a6766

+ 2 - 0
src/main/java/com/yunfeiyun/agmp/iots/warn/model/WarnConfigInfo.java

@@ -9,6 +9,7 @@ public class WarnConfigInfo {
     private String wcLevel;
     private String wcTouchtype;
     private String wcCondition;
+    private String wcStatus;
     private int wcRepeatnum;
     private String wiBid;
     private String wiAddress;
@@ -20,5 +21,6 @@ public class WarnConfigInfo {
     private String devtypeBid;
     private String devBid;
     private String tid;
+    private String wiStatus;
 
 }

+ 8 - 1
src/main/java/com/yunfeiyun/agmp/iots/warn/service/WarnService.java

@@ -195,6 +195,8 @@ public class WarnService {
         String targetValue = config.getWiValue();
         String wiAddress = config.getWiAddress();
         String wiCode = config.getWiCode();
+        String wcStatus = config.getWcStatus();
+        String wiStatus = config.getWiStatus();
         String key = wiAddress + wiCode;
 
         if (!currentValueMap.containsKey(key)) {
@@ -216,7 +218,12 @@ public class WarnService {
         EnumWarnRuleOp warnRuleOp = EnumWarnRuleOp.findEnumByCode(expression);
         String ruleName = warnRuleOp.getName();
 
-        boolean tempSuccess = CompareUtil.comp(currentValue, expression, targetValue);
+        boolean status = "0".equals(wcStatus) && "0".equals(wiStatus);
+        boolean tempSuccess = false;
+        if(status){
+            tempSuccess = CompareUtil.comp(currentValue, expression, targetValue);
+        }
+
         String warnMessage = WarnMessageBuilderUtil.buildQxzWarningMessage(
                 "气象站设备", devCode, wiName, currentValue, wiUnit, ruleName, targetValue);
 

+ 2 - 3
src/main/resources/mapper/IotWarnBusinessMapper.xml

@@ -79,15 +79,14 @@
 
     <select id="selectIotWarnConfigInfoList" parameterType="com.yunfeiyun.agmp.iots.warn.model.WarnConfigInfo" resultType="com.yunfeiyun.agmp.iots.warn.model.WarnConfigInfo">
         SELECT wc.*, wi.wiBid, wi.wiAddress,
-            wi.wiCode, wi.wiName, wi.wiUnit, wi.wiExpression, wi.wiValue
+            wi.wiCode, wi.wiName, wi.wiUnit, wi.wiExpression, wi.wiValue, wi.wiStatus
         FROM IotWarnconfig AS wc
             LEFT JOIN IotWarnindicator AS wi ON wi.wcBid = wc.wcBid
             <if test="devBid != null">
                 LEFT JOIN IotWarnobject AS wo ON wo.wcBid = wc.wcBid
             </if>
 
-        WHERE wc.wcStatus = '0' AND wc.tid = #{tid} AND wi.wiStatus = '0'
-            AND wi.wiBid IS NOT NULL
+        WHERE wc.tid = #{tid} AND wi.wiBid IS NOT NULL
             <if test="devBid != null">
                 AND wo.devBid = #{devBid} AND wo.woBid IS NOT NULL
             </if>