Browse Source

定时执行阀控规则:增加检测内容

oppadmin 4 năm trước cách đây
mục cha
commit
136c2ca078

+ 20 - 14
smart-city-platform/src/main/java/com/bz/smart_city/quartz/service/impl/ControlDayServiceImpl.java

@@ -144,8 +144,11 @@ public class ControlDayServiceImpl implements ControlDayService, InitializingBea
             Customer customerNo = customerMapper.findById(customer.getCustomerId().intValue());
             Customer customerNo = customerMapper.findById(customer.getCustomerId().intValue());
             List<Integer> filterId = new ArrayList<>();
             List<Integer> filterId = new ArrayList<>();
             filterId.add(1); //欠费天数
             filterId.add(1); //欠费天数
-            //filterId.add(3); //预存金额
-            //filterId.add(7); //预存与欠费差额
+            filterId.add(2); //欠费金额
+            filterId.add(3); //预存金额
+            //filterId.add(4); //用水余额
+            //filterId.add(5); //开户状态
+            filterId.add(7); //预存与欠费差额
             for (PayBaseCustomerandmeterrela one: payBaseCustomerandmeterrelaList){
             for (PayBaseCustomerandmeterrela one: payBaseCustomerandmeterrelaList){
                 sendValve(customerNo.getCustomerNo(),flag,filterId,one);
                 sendValve(customerNo.getCustomerNo(),flag,filterId,one);
             }
             }
@@ -172,11 +175,6 @@ public class ControlDayServiceImpl implements ControlDayService, InitializingBea
                 Integer result = payControlRuleService.GetConditionReusl(new Integer(deviceType[i]),one.getAccountId().toString(),flag,ConditionIds);
                 Integer result = payControlRuleService.GetConditionReusl(new Integer(deviceType[i]),one.getAccountId().toString(),flag,ConditionIds);
                 if(result != null){
                 if(result != null){
                     try {
                     try {
-                        //后面规则执行动作与前面一样不操作
-                        if(ControlResult == result.intValue())
-                            continue;
-                        ControlResult = result;
-
                         //最近一次阀控动作如果与当前一致则不操作
                         //最近一次阀控动作如果与当前一致则不操作
 /*                        PayControlRecord payControlRecordTemp = new PayControlRecord();
 /*                        PayControlRecord payControlRecordTemp = new PayControlRecord();
                         payControlRecordTemp.setAccountId(one.getAccountId());
                         payControlRecordTemp.setAccountId(one.getAccountId());
@@ -194,13 +192,21 @@ public class ControlDayServiceImpl implements ControlDayService, InitializingBea
                                 continue;
                                 continue;
                         }*/
                         }*/
 
 
-                        //调用阀门接口
-                        String url=SyncUrl + "/api/platform/sendCommond";
-                        String params = String.format("?customerNo=%s&meterNo=%s&type=%s",customerNo,one.getMetercode(),result.toString());
-                        url += params;
-                        String postResult = HttpRequest.doPost(url ,"");
-                        SyncValveResult syncValveResult = JacksonUtil.string2Obj(postResult, SyncValveResult.class);
-                        Integer getResult = Integer.parseInt(syncValveResult.getStatus());
+                        //后面规则执行动作与前面一样不发送指令,但保存记录
+                        Integer getResult =0;
+                        if(ControlResult != result.intValue()){
+                            getResult = -1;
+                            //调用阀门接口
+                            String url=SyncUrl + "/api/platform/sendCommond";
+                            String params = String.format("?customerNo=%s&meterNo=%s&type=%s",customerNo,one.getMetercode(),result.toString());
+                            url += params;
+                            String postResult = HttpRequest.doPost(url ,"");
+                            SyncValveResult syncValveResult = JacksonUtil.string2Obj(postResult, SyncValveResult.class);
+                            if(syncValveResult != null)
+                                getResult = Integer.parseInt(syncValveResult.getStatus());
+                        }
+                        ControlResult = result;
+
                         if(getResult != null && getResult == 0){
                         if(getResult != null && getResult == 0){
                             //插入数据库
                             //插入数据库
                             PayControlRecord payControlRecord = new PayControlRecord();
                             PayControlRecord payControlRecord = new PayControlRecord();