wangli 4 vuotta sitten
vanhempi
commit
d76dc3fdb7

+ 1 - 1
smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/PayControlRuleController.java

@@ -40,7 +40,7 @@ public class PayControlRuleController {
                     throw new Exception("阀控规则判断条件不能为空");
                 if(payControlRule.getOperator() == null)
                     throw new Exception("阀控规则运算符不能为空");
-                if(payControlRule.getValue() != null)
+                if(StringUtils.isNotBlank(payControlRule.getValue()))
                     throw new Exception("阀控规则条件值不能为空");
                 if(payControlRule.getAction() == null)
                     throw new Exception("阀控规则执行操作不能为空");

+ 8 - 9
smart-city-platform/src/main/java/com/bz/smart_city/entity/pay/PayControlRule.java

@@ -41,8 +41,7 @@ public class PayControlRule implements Serializable {
     private String operatorString;
 
     @ApiModelProperty(example="1",notes = "条件值",position = 20)
-    @JsonSerialize(using = BigDecimalJsonSerializer.class)
-    private BigDecimal value;
+    private String value;
 
     @ApiModelProperty(example="0",notes = "执行动作,0关阀 1开阀",position = 30)
     private Integer action;
@@ -77,31 +76,31 @@ public class PayControlRule implements Serializable {
 
 
     public Boolean checkCondition(BigDecimal data){
-        if(this.operator != null && this.value != null && data != null){
+        if(this.operator != null && StringUtils.isNotBlank(this.value) && data != null){
             switch (this.operator) {
                 case 1: {
                     condition = "=";
-                    return value.compareTo(data) == 0;
+                    return new BigDecimal(value).compareTo(data) == 0;
                 }
                 case 2: {
                     condition = "<>";
-                    return value.compareTo(data) != 0;
+                    return new BigDecimal(value).compareTo(data) != 0;
                 }
                 case 3: {
                     condition = ">";
-                    return value.compareTo(data) == -1;
+                    return new BigDecimal(value).compareTo(data) == -1;
                 }
                 case 4: {
                     condition = "<";
-                    return value.compareTo(data) == 1;
+                    return new BigDecimal(value).compareTo(data) == 1;
                 }
                 case 5: {
                     condition = ">=";
-                    return value.compareTo(data) != 1;
+                    return new BigDecimal(value).compareTo(data) != 1;
                 }
                 case 6: {
                     condition = "<=";
-                    return value.compareTo(data) != -1;
+                    return new BigDecimal(value).compareTo(data) != -1;
                 }
             }
         }

+ 1 - 1
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayControlRuleServiceImpl.java

@@ -524,7 +524,7 @@ public class PayControlRuleServiceImpl implements PayControlRuleService {
                 }
             }
 
-            String value = payControlRules.get(0).getValue().toString();
+            String value = payControlRules.get(0).getValue();
             boolean bl = false;
             switch (payControlRules.get(0).getConditionId()){
                 case 1:{  //欠费天数

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

@@ -757,7 +757,7 @@ public class PayMessagesendrecordServiceImp implements PayMessagesendrecordServi
         types.add(1);   //欠费天数
         types.add(2);   //欠费金额
         types.add(3);   //预存金额
-//        types.add(4);   //用水余额
+        types.add(4);   //用水余额
         types.add(7);   //预存与欠费差额
         List<PayControlRule> payControlRules = payFeeMapper.getValveRulesByType(0,types,siteId,customerId);
 

+ 1 - 3
smart-city-platform/src/main/resources/mapper/pay/payFeeMapper.xml

@@ -575,8 +575,6 @@
                #{item}
             </foreach>
         </if>
-
-
         <if test="condition != null and condition != ''">
             and (
                 a.name like concat('%',#{condition},'%')
@@ -597,7 +595,7 @@
             <if test="searchType != null and searchType == 4">and rh.balance &lt;= #{beginDebtFee}</if>
         </if>
 
-        and (r.debt > 0
+        and (r.debt > 0 and rh.balance &lt; 0
             <if test="payControlRules != null and payControlRules.size() != 0">
                 <foreach collection="payControlRules" item="rule" open=" or " separator=" or ">
                     ( concat(',',c.valve_rule_id,',') like concat('%,',${rule.id},',%')