浏览代码

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

oppadmin 4 年之前
父节点
当前提交
bc91c0f9a9

+ 3 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dao/pay/archives/PayBaseCustomerandmeterrelaMapper.java

@@ -4,6 +4,7 @@ import com.bz.smart_city.dto.pay.PayBaseCustomerandmeterrelaDto;
 import com.bz.smart_city.dto.pay.PayCustomerDto;
 import com.bz.smart_city.entity.Organization;
 import com.bz.smart_city.entity.pay.PayBaseAccount;
+import com.bz.smart_city.entity.pay.PayControlRule;
 import com.bz.smart_city.entity.pay.PayPayRechargeaccount;
 import com.bz.smart_city.entity.pay.archives.*;
 import org.apache.ibatis.annotations.Mapper;
@@ -98,4 +99,6 @@ public interface PayBaseCustomerandmeterrelaMapper {
     public PayBaseCustomerandmeterrela findAccountByAccountNumber(@Param("siteId") Integer siteId, @Param("customerId")Integer customerId,@Param("accountnumber")String accountnumber);
 
     void updateMeterInstallOpen(@Param("isAccepted")Integer isAccepted, @Param("updateBy")String updateBy,@Param("date") LocalDateTime date, @Param("id") BigInteger id);
+
+    public List<PayControlRule> getRuleNames(@Param("siteId")Integer siteId,@Param("customerId")Integer customerId,@Param("list")List<String> list);
 }

+ 4 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/PaySaveCustomerDto.java

@@ -47,4 +47,8 @@ public class PaySaveCustomerDto extends PayBaseCustomerandmeterrela {
     private String vatno;
     @ApiModelProperty(value = "设备安装地址", position = 14)
     private String installAddress;
+    @ApiModelProperty(value = "阀控规则ID数组", position = 15)
+    private String[] valveRuleIds;
+    @ApiModelProperty(value = "阀控规则名称数组", position = 15)
+    private String[] valveRuleNames;
 }

+ 2 - 2
smart-city-platform/src/main/java/com/bz/smart_city/quartz/service/impl/EstimateMsgSendServiceImpl.java

@@ -77,8 +77,8 @@ public class EstimateMsgSendServiceImpl implements EstimateMsgSendService, Initi
                 minute = sp[1];
                 //String cron = "0 */3 * * * ?";
                 //String cron ="0 40 14 * * ?";
-                //String cron = "0 "+Integer.valueOf(minute)+" "+Integer.valueOf(time)+" * * ? ";
-                String cron = "0 0 19 * * ? ";
+                String cron = "0 "+Integer.valueOf(minute)+" "+Integer.valueOf(time)+" * * ?";
+                //String cron = "0 20 11 * * ?";
                 log.info("预计费每天推送:" + cron);
                 log.info("预计费每天推送:" + "站点ID:"+siteId+"水司ID:"+customerId);
                 entity.setCronExpression(cron);

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

@@ -59,7 +59,7 @@ public class EstimatedDayServiceImpl implements EstimatedDayService, Initializin
         boolean exists = jobAndTriggerService.isExists(entity);
         if(!exists) {
             //String cron = "0 */2 * * * ?";
-            String cron = "0 0 19 * * ? ";
+            String cron = "0 0 0 * * ?";
             log.info("预计费每天统计:" + cron);
             log.info("预计费每天统计:" + "站点ID:"+siteId+"水司ID:"+customerId);
             entity.setCronExpression(cron);

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

@@ -313,7 +313,9 @@ public class PayFeeServiceImp implements PayFeeService {
         //查询阀门状态,判断是否需要开阀
         List<PayValveStateInfo> payValveStateInfos = payFeeMapper.getDeviceValveState(new BigInteger(id));
         for(PayValveStateInfo payValveStateInfo : payValveStateInfos){
-            if(payValveStateInfo.getDebt().compareTo(BigDecimal.ZERO) ==1 && payValveStateInfo.getValveState().equals("0")){
+            if(payValveStateInfo != null
+                    && payValveStateInfo.getDebt()!= null && payValveStateInfo.getDebt().compareTo(BigDecimal.ZERO) ==1
+                    && payValveStateInfo.getValveState()!= null && payValveStateInfo.getValveState().equals("0")){
                 Boolean sendValveCommondResult = this.sendValveCommond(payValveStateInfo);
                 if(!sendValveCommondResult){
 //                    result+="; 开阀异常:"+String.format("%.2f", transAmount)+"元";
@@ -574,7 +576,9 @@ public class PayFeeServiceImp implements PayFeeService {
        //查询阀门状态,判断是否需要开阀
        List<PayValveStateInfo> payValveStateInfos = payFeeMapper.getDeviceValveState(payCustomRechargeDto.getAccountId());
        for(PayValveStateInfo payValveStateInfo : payValveStateInfos){
-           if(payValveStateInfo.getDebt().compareTo(BigDecimal.ZERO) ==1 && payValveStateInfo.getValveState().equals("0")){
+           if(payValveStateInfo != null
+                   && payValveStateInfo.getDebt()!= null && payValveStateInfo.getDebt().compareTo(BigDecimal.ZERO) ==1
+                   && payValveStateInfo.getValveState()!= null && payValveStateInfo.getValveState().equals("0")){
                Boolean sendValveCommondResult = this.sendValveCommond(payValveStateInfo);
                if(!sendValveCommondResult){
 //                    result+="; 开阀异常:"+String.format("%.2f", transAmount)+"元";
@@ -1240,7 +1244,9 @@ public class PayFeeServiceImp implements PayFeeService {
         //查询阀门状态,判断是否需要开阀
         List<PayValveStateInfo> payValveStateInfos = payFeeMapper.getDeviceValveState(payCustomRechargeDto.getAccountId());
         for(PayValveStateInfo payValveStateInfo : payValveStateInfos){
-            if(payValveStateInfo.getDebt().compareTo(BigDecimal.ZERO) ==1 && payValveStateInfo.getValveState().equals("0")){
+            if(payValveStateInfo != null
+                    && payValveStateInfo.getDebt()!= null && payValveStateInfo.getDebt().compareTo(BigDecimal.ZERO) ==1
+                    && payValveStateInfo.getValveState()!= null && payValveStateInfo.getValveState().equals("0")){
                 Boolean sendValveCommondResult = this.sendValveCommond(payValveStateInfo);
                 if(!sendValveCommondResult){    //关阀失败
 //                    result+="; 开阀异常:"+String.format("%.2f", transAmount)+"元";

+ 43 - 4
smart-city-platform/src/main/java/com/bz/smart_city/service/pay/archives/impl/PayBaseCustomerandmeterrelaServiceImpl.java

@@ -16,10 +16,7 @@ import com.bz.smart_city.dto.OrganizationDto;
 import com.bz.smart_city.dto.pay.*;
 import com.bz.smart_city.entity.Organization;
 import com.bz.smart_city.entity.ProgramItem;
-import com.bz.smart_city.entity.pay.PayBaseAccount;
-import com.bz.smart_city.entity.pay.PayBaseWaterprice;
-import com.bz.smart_city.entity.pay.PayMeter;
-import com.bz.smart_city.entity.pay.PayPayRechargeaccount;
+import com.bz.smart_city.entity.pay.*;
 import com.bz.smart_city.entity.pay.archives.*;
 import com.bz.smart_city.service.pay.PayBaseAccountService;
 import com.bz.smart_city.service.pay.PaySysDictService;
@@ -393,6 +390,20 @@ public class PayBaseCustomerandmeterrelaServiceImpl implements PayBaseCustomeran
             customer.setOpendate(LocalDateTime.now());
             customer.setWaterPropertyId(paySaveCustomerDto.waterPropertyId);
             customer.setVatno(paySaveCustomerDto.getVatno()); //公司税号
+            customer.setValveRuleId(paySaveCustomerDto != null && paySaveCustomerDto.getValveRuleIds() != null ? StringUtils.join(paySaveCustomerDto.getValveRuleIds(),",") : "");
+            String[] valveIds = paySaveCustomerDto.getValveRuleIds();
+            String RName = "";
+            if(valveIds != null && valveIds.length >0){
+                List<String> list = Arrays.asList(valveIds);
+                List<PayControlRule> RList = payBaseCustomerandmeterrelaMapper.getRuleNames(loginUser.getSiteId(),loginUser.getCustomerId(),list);
+                if (RList != null && RList.size() >0){
+                    for(PayControlRule dao:RList){
+                        String name = dao.getName();
+                        RName = RName + name +",";
+                    }
+                }
+            }
+            customer.setValveRuleName(RName);
             payBaseCustomerandmeterrelaMapper.update(customer);
 
             //重修开户修改其它地方客户名称
@@ -421,6 +432,20 @@ public class PayBaseCustomerandmeterrelaServiceImpl implements PayBaseCustomeran
             customer.setOpendate(LocalDateTime.now());
             customer.setWaterPropertyId(paySaveCustomerDto.waterPropertyId);
             customer.setVatno(paySaveCustomerDto.getVatno()); //公司税号
+            customer.setValveRuleId(paySaveCustomerDto != null && paySaveCustomerDto.getValveRuleIds() != null ? StringUtils.join(paySaveCustomerDto.getValveRuleIds(),",") : "");
+            String[] valveIds = paySaveCustomerDto.getValveRuleIds();
+            String RName = "";
+            if(valveIds != null && valveIds.length >0){
+                List<String> list = Arrays.asList(valveIds);
+                List<PayControlRule> RList = payBaseCustomerandmeterrelaMapper.getRuleNames(loginUser.getSiteId(),loginUser.getCustomerId(),list);
+                if (RList != null && RList.size() >0){
+                    for(PayControlRule dao:RList){
+                        String name = dao.getName();
+                        RName = RName + name +",";
+                    }
+                }
+            }
+            customer.setValveRuleName(RName);
             customerList.add(customer);
         }
 
@@ -759,6 +784,20 @@ public class PayBaseCustomerandmeterrelaServiceImpl implements PayBaseCustomeran
             customer.setId(payBaseCustomerandmeterrela.getId());
             customer.setVatno(payBaseCustomerandmeterrela.getVatno());
             customer.setWaterPropertyId(newWaterPropertyId);
+            customer.setValveRuleId(payBaseCustomerandmeterrela != null && payBaseCustomerandmeterrela.getValveRuleIds() != null ? StringUtils.join(payBaseCustomerandmeterrela.getValveRuleIds(),",") : "");
+            String[] valveIds = payBaseCustomerandmeterrela.getValveRuleIds();
+            String RName = "";
+            if(valveIds != null && valveIds.length >0){
+                List<String> list = Arrays.asList(valveIds);
+                List<PayControlRule> RList = payBaseCustomerandmeterrelaMapper.getRuleNames(loginUser.getSiteId(),loginUser.getCustomerId(),list);
+                if (RList != null && RList.size() >0){
+                    for(PayControlRule dao:RList){
+                        String name = dao.getName();
+                        RName = RName + name +",";
+                    }
+                }
+            }
+            customer.setValveRuleName(RName);
             payBaseCustomerandmeterrelaMapper.update(customer);
 
             //编辑开户修改其它地方客户名称

+ 104 - 81
smart-city-platform/src/main/resources/mapper/PayBaseCustomerandmeterrelaMapper.xml

@@ -115,68 +115,72 @@
     <insert id="insertList">
         INSERT INTO pay_base_customerandmeterrela
         (
-        id,
-        account_id,
-        watermeter_id,
-        accountname,
-        accountnumber,
-        metercode,
-        businessstate,
-        office_id,
-        housetype,
-        calculateway,
-        customercategory,
-        customergroup,
-        fixedamount,
-        vatno,
-        bankaccount,
-        invoicetitle,
-        address,
-        opendate,
-        waterproperty_id,
-        watertype,
-        canceldate,
-        create_by,
-        create_date,
-        update_by,
-        update_date,
-        remarks,
-        del_flag,
-        site_id,
-        customer_id
+            id,
+            account_id,
+            watermeter_id,
+            accountname,
+            accountnumber,
+            metercode,
+            businessstate,
+            office_id,
+            housetype,
+            calculateway,
+            customercategory,
+            customergroup,
+            fixedamount,
+            vatno,
+            bankaccount,
+            invoicetitle,
+            address,
+            opendate,
+            waterproperty_id,
+            watertype,
+            canceldate,
+            create_by,
+            create_date,
+            update_by,
+            update_date,
+            remarks,
+            del_flag,
+            site_id,
+            customer_id,
+            valve_rule_id,
+            valve_rule_name
         )
         values
         <foreach collection="customers" item="customer" index="index" separator=",">
             (
-            #{customer.id,jdbcType=BIGINT},
-            #{customer.accountId,jdbcType=BIGINT},
-            #{customer.watermeterId,jdbcType=BIGINT},
-            #{customer.accountname,jdbcType=VARCHAR},
-            #{customer.accountnumber,jdbcType=VARCHAR},
-            #{customer.metercode,jdbcType=VARCHAR},
-            #{customer.businessstate,jdbcType=INTEGER},
-            #{customer.officeId,jdbcType=BIGINT},
-            #{customer.housetype,jdbcType=INTEGER},
-            #{customer.calculateway,jdbcType=INTEGER},
-            #{customer.customercategory,jdbcType=INTEGER},
-            #{customer.customergroup,jdbcType=INTEGER},
-            #{customer.fixedamount,jdbcType=VARCHAR},
-            #{customer.vatno,jdbcType=VARCHAR},
-            #{customer.bankaccount,jdbcType=VARCHAR},
-            #{customer.invoicetitle,jdbcType=VARCHAR},
-            #{customer.address,jdbcType=VARCHAR},
-            #{customer.opendate,jdbcType=TIMESTAMP},
-            #{customer.waterPropertyId,jdbcType=BIGINT},
-            #{customer.watertype,jdbcType=INTEGER},
-            #{customer.canceldate,jdbcType=TIMESTAMP},
-            #{customer.createBy,jdbcType=VARCHAR},
-            #{customer.createDate,jdbcType=TIMESTAMP},
-            #{customer.updateBy,jdbcType=VARCHAR},
-            #{customer.updateDate,jdbcType=TIMESTAMP},
-            #{customer.remarks,jdbcType=VARCHAR},
-            #{customer.delFlag,jdbcType=VARCHAR},
-            #{customer.siteId,jdbcType=BIGINT},
-            #{customer.customerId,jdbcType=BIGINT}
+                #{customer.id,jdbcType=BIGINT},
+                #{customer.accountId,jdbcType=BIGINT},
+                #{customer.watermeterId,jdbcType=BIGINT},
+                #{customer.accountname,jdbcType=VARCHAR},
+                #{customer.accountnumber,jdbcType=VARCHAR},
+                #{customer.metercode,jdbcType=VARCHAR},
+                #{customer.businessstate,jdbcType=INTEGER},
+                #{customer.officeId,jdbcType=BIGINT},
+                #{customer.housetype,jdbcType=INTEGER},
+                #{customer.calculateway,jdbcType=INTEGER},
+                #{customer.customercategory,jdbcType=INTEGER},
+                #{customer.customergroup,jdbcType=INTEGER},
+                #{customer.fixedamount,jdbcType=VARCHAR},
+                #{customer.vatno,jdbcType=VARCHAR},
+                #{customer.bankaccount,jdbcType=VARCHAR},
+                #{customer.invoicetitle,jdbcType=VARCHAR},
+                #{customer.address,jdbcType=VARCHAR},
+                #{customer.opendate,jdbcType=TIMESTAMP},
+                #{customer.waterPropertyId,jdbcType=BIGINT},
+                #{customer.watertype,jdbcType=INTEGER},
+                #{customer.canceldate,jdbcType=TIMESTAMP},
+                #{customer.createBy,jdbcType=VARCHAR},
+                #{customer.createDate,jdbcType=TIMESTAMP},
+                #{customer.updateBy,jdbcType=VARCHAR},
+                #{customer.updateDate,jdbcType=TIMESTAMP},
+                #{customer.remarks,jdbcType=VARCHAR},
+                #{customer.delFlag,jdbcType=VARCHAR},
+                #{customer.siteId,jdbcType=BIGINT},
+                #{customer.customerId,jdbcType=BIGINT},
+                #{customer.valveRuleId,jdbcType=VARCHAR},
+                #{customer.valveRuleName,jdbcType=VARCHAR}
             )
         </foreach>
     </insert>
@@ -205,6 +209,8 @@
             <if test="canceldate != null">canceldate =#{canceldate},</if>
             <if test="updateBy != null">update_by =#{updateBy},</if>
             <if test="updateDate != null">update_date =#{updateDate},</if>
+            <if test="valveRuleId != null">valve_rule_id =#{valveRuleId},</if>
+            <if test="valveRuleName != null">valve_rule_name =#{valveRuleName},</if>
         </set>
         <where>
             <if test="id != null">id =#{id}</if>
@@ -254,6 +260,8 @@
         customer.office_id as "officeId",
         account.email,
         customer.vatno,
+        customer.valve_rule_id as "valveRuleId",
+        customer.valve_rule_name as "valveRuleName",
         customer.businessstate as "businessstate",
         (select label from pay_sys_dict where type = '开户状态' and value = customer.businessstate and site_id = #{siteId} and customer_id =#{customerId}) as "businessName",
         customer.calculateway as "calculateway",
@@ -372,10 +380,10 @@
 
     <select id="selectAccountInfo" resultType="com.bz.smart_city.entity.pay.archives.MeterListInfo">
         select
-            device.metercode as "metercode",
-            sil.user_name as accountname,
-            sil.user_phone as telephone,
-            sil.id_card as idcardno
+        device.metercode as "metercode",
+        account.name as accountname,
+        account.telephone as telephone,
+        account.idcardno as idcardno
         from pay_base_account account
         inner join sc_device device on account.id = device.account_id
         <where>
@@ -395,15 +403,14 @@
 
     <select id="selectAccountMeterInfo" resultType="com.bz.smart_city.entity.pay.archives.PayAccountInfo">
         select
-            account.accountnumber as "accountnumber",
-            account.calculateway as "calculateway",
-            account.waterproperty_id as "waterPropertyId",
-            account.address as installAddress,
-            device.metercode as "metercode",
-            sil.user_name as accountname,
-            sil.user_phone as telephone,
-            sil.id_card as idcardno,
-            device.water_meter_no as "metereleno"
+        account.accountnumber as "accountnumber",
+        account.calculateway as "calculateway",
+        account.waterproperty_id as "waterPropertyId",
+        device.metercode as "metercode",
+        account.name as accountname,
+        account.telephone as telephone,
+        account.idcardno as idcardno,
+        device.water_meter_no as "metereleno"
         from pay_base_account account
         inner join sc_device device on account.id = device.account_id
         <where>
@@ -423,18 +430,16 @@
 
     <select id="selectMeterElenoMeterInfo" resultType="com.bz.smart_city.entity.pay.archives.PayAccountInfo">
         select
-            account.accountnumber as "accountnumber",
-            account.calculateway as "calculateway",
-            account.waterproperty_id as "waterPropertyId",
-            account.address as installAddress,
-            device.metercode as "metercode",
-            sil.user_name as accountname,
-            sil.user_phone as telephone,
-            sil.id_card as idcardno,
-            device.water_meter_no as "metereleno"
+        account.accountnumber as "accountnumber",
+        account.calculateway as "calculateway",
+        account.waterproperty_id as "waterPropertyId",
+        device.metercode as "metercode",
+        account.name as accountname,
+        account.telephone as telephone,
+        account.idcardno as idcardno,
+        device.water_meter_no as "metereleno"
         from pay_base_account account
         inner join sc_device device on account.id = device.account_id
-        inner join sc_install_list sil on sil.device_id = device.id
         <where>
             device.id not in(select watermeter_id from pay_base_customerandmeterrela where businessstate = '1')
             <if test="metereleno != null">
@@ -669,4 +674,22 @@
         </where>
         limit 1
     </select>
+
+    <select id="getRuleNames" resultType="com.bz.smart_city.entity.pay.PayControlRule">
+        select c.name from pay_control_rule c
+        <where>
+            <if test="siteId != null">
+                and c.site_id =#{siteId}
+            </if>
+            <if test="customerId != null">
+                and c.customer_id =#{customerId}
+            </if>
+            <if test="list != null">
+                and c.id in
+                <foreach collection="list" item="item" separator="," open="(" close=")" index="index" >
+                    #{item}
+                </foreach>
+            </if>
+        </where>
+    </select>
 </mapper>