Browse Source

缴费开阀

wangli 4 years ago
parent
commit
f054fe3b65

+ 24 - 31
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayFeeServiceImp.java

@@ -338,39 +338,32 @@ public class PayFeeServiceImp implements PayFeeService {
             if(payValveStateInfo != null
                     && ((payValveStateInfo.getValveState()!= null && payValveStateInfo.getValveState() == 0)
                             || payValveStateInfo.getValveState() == null)){
+                payValveStateInfo.setOperation(1);
+                payValveStateInfo.setSiteId(BigInteger.valueOf(siteId));
+                payValveStateInfo.setCustomerId(BigInteger.valueOf(customerId));
 
                 for(PayControlRule payControlRule : payControlRules){
-                    if(payControlRule.getConditionId() == 2 && payValveStateInfo.getDebt() != null && payControlRule.checkCondition(payValveStateInfo.getDebt())){
-                        payValveStateInfo.setControlRuleId(payControlRule.getId().intValue());
-                        payValveStateInfo.setOperation(1);
-                        payValveStateInfo.setSiteId(BigInteger.valueOf(siteId));
-                        payValveStateInfo.setCustomerId(BigInteger.valueOf(customerId));
-                        Boolean sendValveCommondResult = this.sendValveCommond(payValveStateInfo);
-                        break;
-                    }
-                    if(payControlRule.getConditionId() == 3 && payValveStateInfo.getRemaining() != null && payControlRule.checkCondition(payValveStateInfo.getRemaining())){
-                        payValveStateInfo.setControlRuleId(payControlRule.getId().intValue());
-                        payValveStateInfo.setOperation(1);
-                        payValveStateInfo.setSiteId(BigInteger.valueOf(siteId));
-                        payValveStateInfo.setCustomerId(BigInteger.valueOf(customerId));
-                        Boolean sendValveCommondResult = this.sendValveCommond(payValveStateInfo);
-                        break;
-                    }
-                    if(payControlRule.getConditionId() == 4 && payValveStateInfo.getBalance() != null && payControlRule.checkCondition(payValveStateInfo.getBalance())){
-                        payValveStateInfo.setControlRuleId(payControlRule.getId().intValue());
-                        payValveStateInfo.setOperation(1);
-                        payValveStateInfo.setSiteId(BigInteger.valueOf(siteId));
-                        payValveStateInfo.setCustomerId(BigInteger.valueOf(customerId));
-                        Boolean sendValveCommondResult = this.sendValveCommond(payValveStateInfo);
-                        break;
-                    }
-                    if(payControlRule.getConditionId() == 7 && payValveStateInfo.getRemaining() != null && payValveStateInfo.getDebt() != null && payControlRule.checkCondition(payValveStateInfo.getRemaining().subtract(payValveStateInfo.getDebt()))){
-                        payValveStateInfo.setControlRuleId(payControlRule.getId().intValue());
-                        payValveStateInfo.setOperation(1);
-                        payValveStateInfo.setSiteId(BigInteger.valueOf(siteId));
-                        payValveStateInfo.setCustomerId(BigInteger.valueOf(customerId));
-                        Boolean sendValveCommondResult = this.sendValveCommond(payValveStateInfo);
-                        break;
+                    if((","+payValveStateInfo.getValveRuleIds()+",").indexOf(","+payControlRule.getId()+",") != -1){
+                        if(payControlRule.getConditionId() == 2 && payValveStateInfo.getDebt() != null && payControlRule.checkCondition(payValveStateInfo.getDebt())){
+                            payValveStateInfo.setControlRuleId(payControlRule.getId().intValue());
+                            Boolean sendValveCommondResult = this.sendValveCommond(payValveStateInfo);
+                            break;
+                        }
+                        if(payControlRule.getConditionId() == 3 && payValveStateInfo.getRemaining() != null && payControlRule.checkCondition(payValveStateInfo.getRemaining())){
+                            payValveStateInfo.setControlRuleId(payControlRule.getId().intValue());
+                            Boolean sendValveCommondResult = this.sendValveCommond(payValveStateInfo);
+                            break;
+                        }
+                        if(payControlRule.getConditionId() == 4 && payValveStateInfo.getBalance() != null && payControlRule.checkCondition(payValveStateInfo.getBalance())){
+                            payValveStateInfo.setControlRuleId(payControlRule.getId().intValue());
+                            Boolean sendValveCommondResult = this.sendValveCommond(payValveStateInfo);
+                            break;
+                        }
+                        if(payControlRule.getConditionId() == 7 && payValveStateInfo.getRemaining() != null && payValveStateInfo.getDebt() != null && payControlRule.checkCondition(payValveStateInfo.getRemaining().subtract(payValveStateInfo.getDebt()))){
+                            payValveStateInfo.setControlRuleId(payControlRule.getId().intValue());
+                            Boolean sendValveCommondResult = this.sendValveCommond(payValveStateInfo);
+                            break;
+                        }
                     }
                 }
             }

+ 30 - 28
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayMessagesendrecordServiceImp.java

@@ -400,6 +400,36 @@ public class PayMessagesendrecordServiceImp implements PayMessagesendrecordServi
 
     @Override
     public void afterPropertiesSet()  {
+        QuartzEntity entity3 = new QuartzEntity();
+        entity3.setJobGroup("巡检开户开阀操作");
+        entity3.setJobName("OpenAccountValveInspectionSyncByJob" );
+        entity3.setDescription("OpenAccountValveInspectionSyncByJob" );
+        // modify by pengdi ,判断定时任务是否存在,不存在才进行新增
+        log.info("巡检开户开阀操作:" + "0 0/2 * * * ?");
+        entity3.setCronExpression("0 0/2 * * * ?");
+        entity3.setJobClassName(OpenAccountValveInspection.class.getName());
+        boolean exists3 = jobAndTriggerService.isExists(entity3);
+        if(!exists3) {
+            jobAndTriggerService.save(entity3);
+        }
+
+
+
+        QuartzEntity entity4 = new QuartzEntity();
+        entity4.setJobGroup("巡检阀门操作有效期");
+        entity4.setJobName("DeviceValveSyncByJob" );
+        entity4.setDescription("DeviceValveSyncByJob" );
+        // modify by pengdi ,判断定时任务是否存在,不存在才进行新增
+        boolean exists4 = jobAndTriggerService.isExists(entity4);
+        if(!exists4) {
+            log.info("巡检阀门操作有效期:" + "0 */30 * * * ?");
+            entity4.setCronExpression("0 */30 * * * ?");
+            entity4.setJobClassName(DeviceValveCommondSync.class.getName());
+            jobAndTriggerService.save(entity4);
+        }
+
+
+
         //获取需要自动推送的模板
         PayMessageTemplateDto payMessageTemplateDto =new PayMessageTemplateDto();
         payMessageTemplateDto.setOperationType(1);
@@ -474,34 +504,6 @@ public class PayMessagesendrecordServiceImp implements PayMessagesendrecordServi
         }
         jobAndTriggerService.save(entity2);
 
-        QuartzEntity entity3 = new QuartzEntity();
-        entity3.setJobGroup("巡检开户开阀操作");
-        entity3.setJobName("OpenAccountValveInspectionSyncByJob" );
-        entity3.setDescription("OpenAccountValveInspectionSyncByJob" );
-        // modify by pengdi ,判断定时任务是否存在,不存在才进行新增
-        log.info("巡检开户开阀操作:" + "0 0/2 * * * ?");
-        entity3.setCronExpression("0 0/2 * * * ?");
-        entity3.setJobClassName(OpenAccountValveInspection.class.getName());
-        boolean exists3 = jobAndTriggerService.isExists(entity3);
-        if(!exists3) {
-         jobAndTriggerService.save(entity3);
-        }
-
-
-
-        QuartzEntity entity4 = new QuartzEntity();
-        entity4.setJobGroup("巡检阀门操作有效期");
-        entity4.setJobName("DeviceValveSyncByJob" );
-        entity4.setDescription("DeviceValveSyncByJob" );
-        // modify by pengdi ,判断定时任务是否存在,不存在才进行新增
-        boolean exists4 = jobAndTriggerService.isExists(entity4);
-        if(!exists4) {
-            log.info("巡检阀门操作有效期:" + "0 */30 * * * ?");
-            entity4.setCronExpression("0 */30 * * * ?");
-            entity4.setJobClassName(DeviceValveCommondSync.class.getName());
-            jobAndTriggerService.save(entity4);
-        }
-
 
     }
 

+ 6 - 4
smart-city-platform/src/main/resources/mapper/pay/payFeeMapper.xml

@@ -405,6 +405,7 @@
         select
             d.account_id as "accountId"
             ,d.id as "meterId"
+            ,c.valve_rule_id as "valveRuleIds"
             ,d.water_meter_no as "eleno"
             ,ifnull(d.metercode,d.water_meter_file_no )as "metercode"
             ,d.control_status as "valveState"
@@ -439,6 +440,7 @@
     <select id="getDeviceValveStateByAmount" resultType="com.bz.smart_city.dto.pay.payfee.PayValveStateInfoDto">
         select
         r.account_id as "accountId"
+        ,c.valve_rule_id as "valveRuleIds"
         ,d.id as "meterId"
         ,d.water_meter_no as "eleno"
         ,ifnull(d.metercode,d.water_meter_file_no )as "metercode"
@@ -589,10 +591,10 @@
             <if test="searchType != null and searchType == 4">and rh.balance >= #{beginDebtFee}</if>
         </if>
         <if test="endDebtFee != null">
-            <if test="searchType != null and searchType == 1">and TIMESTAMPDIFF(day,ifnull(r.create_date,NOW()),NOW()) &lt;= #{beginDebtFee}</if>
-            <if test="searchType != null and searchType == 2">and r.debt &lt;= #{beginDebtFee}</if>
-            <if test="searchType != null and searchType == 3">and rh.remaining &lt;= #{beginDebtFee}</if>
-            <if test="searchType != null and searchType == 4">and rh.balance &lt;= #{beginDebtFee}</if>
+            <if test="searchType != null and searchType == 1">and TIMESTAMPDIFF(day,ifnull(r.create_date,NOW()),NOW()) &lt;= #{endDebtFee}</if>
+            <if test="searchType != null and searchType == 2">and r.debt &lt;= #{endDebtFee}</if>
+            <if test="searchType != null and searchType == 3">and rh.remaining &lt;= #{endDebtFee}</if>
+            <if test="searchType != null and searchType == 4">and rh.balance &lt;= #{endDebtFee}</if>
         </if>
 
         and (r.debt > 0 or rh.balance &lt; 0