Browse Source

Merge branch '20200918' of http://114.135.61.188:53000/ZONIOT/water-iot into 20200918

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

+ 7 - 0
smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/PayMessagesendrecordController.java

@@ -188,4 +188,11 @@ public class PayMessagesendrecordController {
         return payMessagesendrecordService.sendPayDebtPushMessagesByUser( condition, searchType, beginDebtFee,  endDebtFee,  arrayList);
     }
 
+    @PostMapping("/sendValveCommond")
+    @ApiOperation("测试阀门任务")
+    public AjaxMessage<String> sendValveCommond(){
+                payMessagesendrecordService.sendValveCommond( 25,33);
+        return new AjaxMessage<>(ResultStatus.OK,"OK");
+    }
+
 }

+ 2 - 1
smart-city-platform/src/main/java/com/bz/smart_city/dao/pay/PayFeeMapper.java

@@ -82,5 +82,6 @@ public interface PayFeeMapper {
             @Param("accountIds")List<BigInteger> accountIds,
             @Param("programItems") List<ProgramItem> programItems );
 
-    List<PayValveStateInfoDto> findValveInfoByMessages( @Param("siteId")Integer siteId, @Param("customerId")Integer customerId);
+    List<PayValveStateInfoDto> findValveInfoByMessages( @Param("siteId")Integer siteId, @Param("customerId")Integer customerId,
+                                            @Param("payControlRules") List<PayControlRule> payControlRules);
 }

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

@@ -767,7 +767,7 @@ public class PayFeeServiceImp implements PayFeeService {
             throw new ServiceException(ResultStatus.PAYFEE_QUERY_NO_CUSTOMER);
         }
         String payseriesno = recharge(transAmount, payway, siteId, customerId, userId, paywayName, localDateTime, payCustomRechargeDto);
-        openValveByPayFee(payCustomRechargeDto.getAccountId(), loginUser.getSiteId(),loginUser.getCustomerId());
+        openValveByPayFee(payCustomRechargeDto.getAccountId(), siteId, customerId);
         return payseriesno;
     }
 

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

@@ -882,8 +882,7 @@ public class PayMessagesendrecordServiceImp implements PayMessagesendrecordServi
 
 
     public void sendValveCommond(Integer siteId, Integer customerId){
-        //查询短信记录对应的信息
-        List<PayValveStateInfoDto>  payValveStateInfoDtos = payFeeMapper.findValveInfoByMessages(siteId,customerId);
+
         //获取需要处理的阀控信息
         List<Integer> types =new ArrayList<>();
         types.add(1);   //欠费天数
@@ -892,6 +891,9 @@ public class PayMessagesendrecordServiceImp implements PayMessagesendrecordServi
 //        types.add(4);   //用水余额
         types.add(7);   //预存与欠费差额
         List<PayControlRule> payControlRules = payFeeMapper.getValveRulesByType(0,types,siteId,customerId);
+
+        List<PayValveStateInfoDto>  payValveStateInfoDtos = payFeeMapper.findValveInfoByMessages(siteId,customerId,payControlRules);
+
         //匹配规则并发送指令
         payValveStateInfoDtos.stream().forEach(v ->{
                 for(PayControlRule r:payControlRules ){

+ 18 - 43
smart-city-platform/src/main/resources/mapper/pay/payFeeMapper.xml

@@ -652,50 +652,25 @@
         ) r on c.account_id =r.account_id
         left join pay_pay_rechargeaccount rh on rh.account_id =c.account_id
         where c.businessstate =1   and  d.control_status = 1  and c.site_id= #{siteId} and c.customer_id = #{customerId}
-                <if test="condition != null and condition != ''">
-            and (
-                a.name like concat('%',#{condition},'%')
-                or a.accountnumber like concat('%',#{condition},'%')
-                or a.mobilephone like concat('%',#{condition},'%')
-            )
-        </if>
-        <if test="beginDebtFee != null ">
-            <if test="searchType != null and searchType == 1">and TIMESTAMPDIFF(day,ifnull(r.create_date,NOW()),NOW()) >= #{beginDebtFee}</if>
-            <if test="searchType != null and searchType == 2">and r.debt >= #{beginDebtFee}</if>
-            <if test="searchType != null and searchType == 3">and rh.remaining >= #{beginDebtFee}</if>
-            <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>
-            <if test="payControlRules != null and payControlRules.size() != 0">
-                <foreach collection="payControlRules" item="rule" open="  and ( " separator=" or " close=" )  ">
-                     ( concat(',',c.valve_rule_id,',') like concat('%,',${rule.id},',%')
-                    <if test="rule.conditionId != null and rule.conditionId == 1">
-                       and  TIMESTAMPDIFF(day,ifnull(r.create_date,NOW()),NOW()) ${rule.operatorString} #{rule.value}
-                    </if>
-                    <if test="rule.conditionId != null and rule.conditionId == 2">
-                       and  r.debt ${rule.operatorString} #{rule.value}
-                    </if>
-                    <if test="rule.conditionId != null and rule.conditionId == 3">
-                        and  rh.remaining ${rule.operatorString} #{rule.value}
-                    </if>
-                    <if test="rule.conditionId != null and rule.conditionId == 4">
-                       and   rh.balance ${rule.operatorString} #{rule.value}
-                    </if>
-                    )
-                </foreach>
-            </if>
-        <if test="programItems != null and programItems.size() != 0">
-            and   <foreach collection="programItems" item="item" open="(" separator=" or " close=")">
-            <if test="item.dimensionId == 10">
-                c.${item.dimensionCode} = #{item.dimensionValue}
-            </if>
-        </foreach>
+        <if test="payControlRules != null and payControlRules.size() != 0">
+            <foreach collection="payControlRules" item="rule" open="  and ( " separator=" or " close=" )  ">
+                 ( concat(',',c.valve_rule_id,',') like concat('%,',${rule.id},',%')
+                <if test="rule.conditionId != null and rule.conditionId == 1">
+                   and  TIMESTAMPDIFF(day,ifnull(r.create_date,NOW()),NOW()) ${rule.operatorString} #{rule.value}
+                </if>
+                <if test="rule.conditionId != null and rule.conditionId == 2">
+                   and  r.debt ${rule.operatorString} #{rule.value}
+                </if>
+                <if test="rule.conditionId != null and rule.conditionId == 3">
+                    and  rh.remaining ${rule.operatorString} #{rule.value}
+                </if>
+                <if test="rule.conditionId != null and rule.conditionId == 4">
+                   and   rh.balance ${rule.operatorString} #{rule.value}
+                </if>
+                )
+            </foreach>
         </if>
+
     </select>
 
 </mapper>