Explorar o código

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

oppadmin %!s(int64=4) %!d(string=hai) anos
pai
achega
06c8fef346

+ 1 - 0
smart-city-platform/src/main/java/com/bz/smart_city/commom/security/WebSecurityConfig.java

@@ -96,6 +96,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
                 .antMatchers("/printinvoice/InvoicePrintRequest")
                 .antMatchers("/printinvoice/InvoicePrintRequest")
                 .antMatchers("/waterMeter/getMeterByDeviceNo")
                 .antMatchers("/waterMeter/getMeterByDeviceNo")
                 .antMatchers("/device/synArchies")
                 .antMatchers("/device/synArchies")
+                .antMatchers("/customer/synCustomer")
                 .antMatchers("/druid/**");
                 .antMatchers("/druid/**");
 
 
     }
     }

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

@@ -15,6 +15,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import io.swagger.annotations.ApiParam;
 
 
+import org.json.JSONObject;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
@@ -105,4 +106,19 @@ public class PaySyncDataController {
 
 
         return new AjaxMessage<>(ResultStatus.OK);
         return new AjaxMessage<>(ResultStatus.OK);
     }
     }
+
+
+    @ResponseBody
+    @PostMapping("/customer/synCustomer")
+    @ApiOperation(value = "客户编码同步接口")
+    public AjaxMessage synCustomer(@RequestBody(required = true) String json){
+        try {
+            JSONObject jsonObject = new JSONObject(json);
+            String oldNo = jsonObject.getString("oldNo");
+            String newNo = jsonObject.getString("newNo");
+            return paySyncDataService.synCustomer(oldNo,newNo);
+        }catch (Exception ex){
+            return new AjaxMessage<>(ResultStatus.ERROR);
+        }
+    }
 }
 }

+ 2 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dao/CustomerMapper.java

@@ -39,4 +39,6 @@ public interface CustomerMapper {
     CustomerDto getCustomerByCustomerno(@Param("customerNo") String customerNo);
     CustomerDto getCustomerByCustomerno(@Param("customerNo") String customerNo);
 
 
     Customer findByName(@Param("siteId") Integer siteId, @Param("name") String name);
     Customer findByName(@Param("siteId") Integer siteId, @Param("name") String name);
+
+    void updateCustomer(@Param("oldNo")String oldNo,@Param("newNo")String newNo);
 }
 }

+ 2 - 2
smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/payfee/BankCancelPayFeeParm.java

@@ -27,7 +27,7 @@ public class BankCancelPayFeeParm implements Serializable {
     @ApiModelProperty("用户编号")
     @ApiModelProperty("用户编号")
     private String accountNumber;
     private String accountNumber;
     @ApiModelProperty("缴费总金额(包含预存)需要缴费的金额一致")
     @ApiModelProperty("缴费总金额(包含预存)需要缴费的金额一致")
-    private String money;
+    private Float money;
     @ApiModelProperty("取消缴费时间,格式为yyyyMMddhhmmss")
     @ApiModelProperty("取消缴费时间,格式为yyyyMMddhhmmss")
     private String cancelPayTime;
     private String cancelPayTime;
 
 
@@ -44,7 +44,7 @@ public class BankCancelPayFeeParm implements Serializable {
         if(StringUtils.isBlank(this.accountNumber)){
         if(StringUtils.isBlank(this.accountNumber)){
             return "用户编号为空";
             return "用户编号为空";
         }
         }
-        if(StringUtils.isBlank(this.money)){
+        if(this.money == null){
             return "缴费总金额为空";
             return "缴费总金额为空";
         }
         }
         if(StringUtils.isBlank(this.cancelPayTime)){
         if(StringUtils.isBlank(this.cancelPayTime)){

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

@@ -2,6 +2,7 @@ package com.bz.smart_city.service.impl.pay;
 
 
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.TypeReference;
 import com.alibaba.fastjson.TypeReference;
+import com.bz.smart_city.commom.exception.ServiceException;
 import com.bz.smart_city.commom.model.AjaxMessage;
 import com.bz.smart_city.commom.model.AjaxMessage;
 import com.bz.smart_city.commom.model.ResultStatus;
 import com.bz.smart_city.commom.model.ResultStatus;
 import com.bz.smart_city.commom.util.HttpRequest;
 import com.bz.smart_city.commom.util.HttpRequest;
@@ -11,10 +12,7 @@ import com.bz.smart_city.commom.util.UserUtil;
 import com.bz.smart_city.dao.CustomerMapper;
 import com.bz.smart_city.dao.CustomerMapper;
 import com.bz.smart_city.dao.DeviceMapper;
 import com.bz.smart_city.dao.DeviceMapper;
 import com.bz.smart_city.dao.WaterMeterReplaceLogMapper;
 import com.bz.smart_city.dao.WaterMeterReplaceLogMapper;
-import com.bz.smart_city.dto.AreaDto;
-import com.bz.smart_city.dto.CommunityDto;
-import com.bz.smart_city.dto.DeviceTypeDto;
-import com.bz.smart_city.dto.LoginUser;
+import com.bz.smart_city.dto.*;
 import com.bz.smart_city.dto.pay.InstallPlanDataDTO;
 import com.bz.smart_city.dto.pay.InstallPlanDataDTO;
 import com.bz.smart_city.dto.pay.InstallPlanInputDTO;
 import com.bz.smart_city.dto.pay.InstallPlanInputDTO;
 import com.bz.smart_city.dto.pay.PayBaseAccountDto;
 import com.bz.smart_city.dto.pay.PayBaseAccountDto;
@@ -326,4 +324,31 @@ public class PaySyncDataServiceImpl implements PaySyncDataService {
         }
         }
         return  new AjaxMessage(ResultStatus.ERROR);
         return  new AjaxMessage(ResultStatus.ERROR);
     }
     }
+
+    @Transactional
+    public AjaxMessage synCustomer(String oldNo,String newNo){
+        try {
+            if(StringUtils.isBlank(oldNo)){
+                return new AjaxMessage(ResultStatus.ERROR,"旧客户编号不能为空");
+            }
+            if (StringUtils.isBlank(newNo)){
+                return new AjaxMessage(ResultStatus.ERROR,"新客户编号不能为空");
+            }
+            //校验旧客户编号是否存在
+            CustomerDto oldCustomer = customerMapper.getCustomerByCustomerno(oldNo);
+            if(oldCustomer == null){
+                return new AjaxMessage(ResultStatus.ERROR,"旧客户编号不存在");
+            }
+            //校验新客户编号是否已经存在
+            CustomerDto newCustomer = customerMapper.getCustomerByCustomerno(newNo);
+            if(newCustomer != null && newCustomer.getId() != null){
+                return new AjaxMessage(ResultStatus.ERROR,"新客户编号已存在,不能重复修改");
+            }
+            customerMapper.updateCustomer(oldNo,newNo);
+        }catch (Exception ex){
+            ex.printStackTrace();
+            return new AjaxMessage(ResultStatus.ERROR);
+        }
+        return new AjaxMessage(ResultStatus.OK);
+    }
 }
 }

+ 2 - 0
smart-city-platform/src/main/java/com/bz/smart_city/service/pay/PaySyncDataService.java

@@ -25,4 +25,6 @@ public interface PaySyncDataService {
     int addReplaceRecord(WaterMeterReplaceLog waterMeterReplaceLog);
     int addReplaceRecord(WaterMeterReplaceLog waterMeterReplaceLog);
 
 
     AjaxMessage addJF(InstallPlanInputDTO installPlanInput, LoginUser excelloginUser);
     AjaxMessage addJF(InstallPlanInputDTO installPlanInput, LoginUser excelloginUser);
+
+    AjaxMessage synCustomer(String oldNo,String newNo);
 }
 }

+ 2 - 2
smart-city-platform/src/main/resources/application-prd.properties

@@ -53,13 +53,13 @@ spring.redis.jedis.pool.min-idle=2
 
 
 #============== kafka ===================
 #============== kafka ===================
 # 指定kafka 代理地址,可以多个
 # 指定kafka 代理地址,可以多个
-spring.kafka.bootstrap-servers=47.112.15.78:9092
+spring.kafka.bootstrap-servers=47.112.217.10:9092
 
 
 # 指定消费者group id
 # 指定消费者group id
 spring.kafka.consumer.group-id = water_api_jf_valveStatus_received
 spring.kafka.consumer.group-id = water_api_jf_valveStatus_received
 spring.kafka.consumer.auto-offset-reset=latest
 spring.kafka.consumer.auto-offset-reset=latest
 spring.kafka.consumer.enable-auto-commit=true
 spring.kafka.consumer.enable-auto-commit=true
-#spring.kafka.consumer.auto-commit-interval=100
+spring.kafka.consumer.auto-commit-interval=100
 
 
 # 指定消息key和消息体的编解码方式
 # 指定消息key和消息体的编解码方式
 spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer
 spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer

+ 5 - 0
smart-city-platform/src/main/resources/mapper/CustomerMapper.xml

@@ -279,5 +279,10 @@
         select id,customer_name from sc_customer where status = 1 and site_id = #{siteId} and customer_name = #{name} limit 1
         select id,customer_name from sc_customer where status = 1 and site_id = #{siteId} and customer_name = #{name} limit 1
     </select>
     </select>
 
 
+    <update id="updateCustomer">
+        update sc_customer set customer_no =#{newNo}
+        where customer_no =#{oldNo}
+    </update>
+
 </mapper>
 </mapper>
 
 

+ 2 - 2
smart-city-platform/src/main/resources/mapper/pay/PayBaseAccountMapper.xml

@@ -266,7 +266,7 @@
         IFNULL(paw.sum_payamount,0) sumPayamount,
         IFNULL(paw.sum_payamount,0) sumPayamount,
         pba.state as state,
         pba.state as state,
         (select label from pay_sys_dict where value = pba.state and type='客户状态' and site_id = #{siteId} and customer_id = #{customerId}) stateName,
         (select label from pay_sys_dict where value = pba.state and type='客户状态' and site_id = #{siteId} and customer_id = #{customerId}) stateName,
-        rech.balance as remaining,
+        IFNULL(rech.balance,0) as remaining,
         <!-- dt.remaining ,-->
         <!-- dt.remaining ,-->
         (select label from pay_sys_dict where value = pba.idtype and type='证件类型' and site_id = #{siteId} and customer_id = #{customerId}) idTypeName,
         (select label from pay_sys_dict where value = pba.idtype and type='证件类型' and site_id = #{siteId} and customer_id = #{customerId}) idTypeName,
         pba.accountnumber,
         pba.accountnumber,
@@ -560,7 +560,7 @@
         where b.reading > 0 and b.customer_id=#{customerId} and b.site_id=#{siteId}
         where b.reading > 0 and b.customer_id=#{customerId} and b.site_id=#{siteId}
         GROUP BY b.watermeter_id)
         GROUP BY b.watermeter_id)
         AS c WHERE a.watermeter_id=c.watermeter_id AND a.read_date = c.read_date)  rd on rd.watermeter_id = scd.id
         AS c WHERE a.watermeter_id=c.watermeter_id AND a.read_date = c.read_date)  rd on rd.watermeter_id = scd.id
-        where  scd.customer_id = #{customerId}
+        where  scd.customer_id = #{customerId}  and scd.account_id is not null
         <if test="queryInfo != null and queryInfo != ''">
         <if test="queryInfo != null and queryInfo != ''">
             and (
             and (
             scd.metercode like concat('%',#{queryInfo,jdbcType=VARCHAR} ,'%')
             scd.metercode like concat('%',#{queryInfo,jdbcType=VARCHAR} ,'%')

+ 1 - 8
smart-city-platform/src/main/resources/mapper/pay/PayControlRuleMapper.xml

@@ -143,14 +143,7 @@
     </select>
     </select>
 
 
     <select id="findUseMoeny" resultType="decimal">
     <select id="findUseMoeny" resultType="decimal">
-        select
-            (
-            SELECT remaining remaining from pay_pay_rechargeaccount
-            where  account_id=#{accountId})
-         -
-            (select IFNULL(SUM(debt),0) debt  from pay_pay_receivable where
-            account_id=#{accountId} and debt > 0 )
-         as remaining
+         select balance as remaining from pay_pay_rechargeaccount where account_id =#{accountId}
     </select>
     </select>
 
 
     <select id="findOpenUse" resultType="integer">
     <select id="findOpenUse" resultType="integer">

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

@@ -238,7 +238,7 @@
             max(amount.reading) as "reading",
             max(amount.reading) as "reading",
             min(amount.lastreading) as "lastreading",
             min(amount.lastreading) as "lastreading",
             max(reced.create_date) as "createDate",
             max(reced.create_date) as "createDate",
-            sum(amount.payamount) as "payamount",
+            sum(case when rece.feetype = 1 then rece.payamount else 0 end )as "payamount",
             (select name from sc_user where id=max(reced.create_by)) as "createBy",
             (select name from sc_user where id=max(reced.create_by)) as "createBy",
             (select  customer_name from sc_customer where id=max(reced.customer_id)) as "customerName"
             (select  customer_name from sc_customer where id=max(reced.customer_id)) as "customerName"
         from pay_pay_received reced
         from pay_pay_received reced
@@ -250,7 +250,7 @@
     </select>
     </select>
 
 
     <select id="getAccountInfoPrint"  resultType="com.bz.smart_city.dto.pay.payfee.PrintInvoiceData">
     <select id="getAccountInfoPrint"  resultType="com.bz.smart_city.dto.pay.payfee.PrintInvoiceData">
-                select
+        select
             a.id as "accountId",
             a.id as "accountId",
             a.accountnumber,
             a.accountnumber,
             a.name as "accountname",
             a.name as "accountname",
@@ -410,7 +410,7 @@
         select
         select
         amount.account_id
         amount.account_id
         ,ifnull(sum(rece.receivablefee),0) receivablefee
         ,ifnull(sum(rece.receivablefee),0) receivablefee
-        ,ifnull(sum(amount.payamount),0) payamount
+        ,ifnull(sum(case when rece.feetype = 1 then rece.payamount else 0 end ),0) payamount
         ,ifnull(min(amount.lastreading),0) lastreading
         ,ifnull(min(amount.lastreading),0) lastreading
         ,ifnull(min(amount.lastrecorddate),0) lastrecorddate
         ,ifnull(min(amount.lastrecorddate),0) lastrecorddate
         ,ifnull(max(amount.reading),0) reading
         ,ifnull(max(amount.reading),0) reading
@@ -457,7 +457,7 @@
     <select id="getPayInvoiceReceivable" resultType="com.bz.smart_city.dto.pay.payfee.PrintInvoiceData">
     <select id="getPayInvoiceReceivable" resultType="com.bz.smart_city.dto.pay.payfee.PrintInvoiceData">
         select
         select
             rec.account_id
             rec.account_id
-            ,sum(case when rec.feetype = 1 then rec.receivablefee else 0 end ) payamount
+            ,sum(case when rec.feetype = 1 then rec.payamount else 0 end ) payamount
             ,max(case when rec.feetype = 1 and rec.ladderlevel =1 then rec.waterbasicprice else 0 end ) price1
             ,max(case when rec.feetype = 1 and rec.ladderlevel =1 then rec.waterbasicprice else 0 end ) price1
             ,sum(case when rec.feetype = 1 then rec.receivablefee else 0 end ) receivablefee1
             ,sum(case when rec.feetype = 1 then rec.receivablefee else 0 end ) receivablefee1
             ,max(case when rec.feetype = 3 and rec.ladderlevel =1 then rec.waterbasicprice else 0 end ) price3
             ,max(case when rec.feetype = 3 and rec.ladderlevel =1 then rec.waterbasicprice else 0 end ) price3

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

@@ -110,10 +110,10 @@
             c.opendate,
             c.opendate,
             c.metercode,
             c.metercode,
             c.watermeter_id as "watermeterId",
             c.watermeter_id as "watermeterId",
-            (select label from pay_sys_dict where type='住房类型' and `value`=c.housetype and site_id=#{siteId}
+            (select label from pay_sys_dict where type='住房类型' and `value`=c.housetype and customer_id=#{customerId} and site_id=#{siteId}
             and customer_id=#{customerId}) as "housetype",
             and customer_id=#{customerId}) as "housetype",
-            (select label from pay_sys_dict where type='结算方式' and `value`=c.calculateway and  site_id=#{siteId}
-            and customer_id=#{customerId}) as "calculateway",
+            (select label from pay_sys_dict where type='结算方式' and `value`=c.calculateway and customer_id=#{customerId} and  site_id=#{siteId}
+            ) as "calculateway",
 
 
             p.id as "waterPropertyId",
             p.id as "waterPropertyId",
             p.name as "waterPropertyName",
             p.name as "waterPropertyName",
@@ -124,7 +124,7 @@
         left join pay_base_waterproperty p on c.waterProperty_id=p.id
         left join pay_base_waterproperty p on c.waterProperty_id=p.id
         inner join sc_device device on c.watermeter_id=device.id  and device.customer_id =#{customerId}
         inner join sc_device device on c.watermeter_id=device.id  and device.customer_id =#{customerId}
         <where>
         <where>
-            c.businessstate=1 and c.site_id=#{siteId}
+            c.businessstate=1 and c.customer_id=#{customerId} and c.site_id=#{siteId}
             <if test="id != null and id != ''">
             <if test="id != null and id != ''">
                and  c.id= #{id}
                and  c.id= #{id}
             </if>
             </if>