فهرست منبع

1.添加水表电子号
2.按量购水

Xiaojh 4 سال پیش
والد
کامیت
3120754fcd
29فایلهای تغییر یافته به همراه445 افزوده شده و 152 حذف شده
  1. 4 0
      smart-city-platform/src/main/java/com/bz/smart_city/commom/model/ResultStatus.java
  2. 1 1
      smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/AmountWaterUsedAmountController.java
  3. 3 2
      smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/PayBaseAccountController.java
  4. 99 69
      smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/PayFeeController.java
  5. 12 3
      smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/archives/PayBaseCustomerandmeterrelaController.java
  6. 2 0
      smart-city-platform/src/main/java/com/bz/smart_city/dao/pay/AmountWaterUsedAmountMapper.java
  7. 1 1
      smart-city-platform/src/main/java/com/bz/smart_city/dao/pay/PayBaseAccountMapper.java
  8. 2 0
      smart-city-platform/src/main/java/com/bz/smart_city/dao/pay/PayFeeMapper.java
  9. 2 0
      smart-city-platform/src/main/java/com/bz/smart_city/dao/pay/archives/PayBaseCustomerandmeterrelaMapper.java
  10. 9 2
      smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/BaseWaterPropertyFormDto.java
  11. 2 0
      smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/PayBaseAccountMeterDto.java
  12. 2 0
      smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/PayCustomerDto.java
  13. 2 0
      smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/payfee/PayfeeAccountInfoDto.java
  14. 21 0
      smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/payfee/PayfeeDetaileBill.java
  15. 2 0
      smart-city-platform/src/main/java/com/bz/smart_city/entity/pay/AmountWaterUsedAmount.java
  16. 3 1
      smart-city-platform/src/main/java/com/bz/smart_city/entity/pay/archives/CustomerListInfo.java
  17. 2 0
      smart-city-platform/src/main/java/com/bz/smart_city/entity/pay/archives/PayAccountInfo.java
  18. 2 0
      smart-city-platform/src/main/java/com/bz/smart_city/entity/pay/archives/PayBaseCustomerandmeterrela.java
  19. 5 0
      smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/BaseWaterPropertyServiceImpl.java
  20. 2 2
      smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayBaseAccountServiceImpl.java
  21. 82 13
      smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayFeeServiceImp.java
  22. 1 1
      smart-city-platform/src/main/java/com/bz/smart_city/service/pay/PayBaseAccountService.java
  23. 4 1
      smart-city-platform/src/main/java/com/bz/smart_city/service/pay/PayFeeService.java
  24. 3 1
      smart-city-platform/src/main/java/com/bz/smart_city/service/pay/archives/PayBaseCustomerandmeterrelaService.java
  25. 63 18
      smart-city-platform/src/main/java/com/bz/smart_city/service/pay/archives/impl/PayBaseCustomerandmeterrelaServiceImpl.java
  26. 73 17
      smart-city-platform/src/main/resources/mapper/PayBaseCustomerandmeterrelaMapper.xml
  27. 18 11
      smart-city-platform/src/main/resources/mapper/pay/AmountWaterUsedAmountMapper.xml
  28. 7 2
      smart-city-platform/src/main/resources/mapper/pay/PayBaseAccountMapper.xml
  29. 16 7
      smart-city-platform/src/main/resources/mapper/pay/payFeeMapper.xml

+ 4 - 0
smart-city-platform/src/main/java/com/bz/smart_city/commom/model/ResultStatus.java

@@ -98,6 +98,10 @@ public enum ResultStatus {
     PAYFEE_NOT_ENOUGH(-725,"缴费金额不足"),
     PAY_INVOICE_EXISTED(-726,"收据信息已存在"),
     PAY_CONDITION_ISNULL(-727,"查询条件为空"),
+    PAYFEE_DEBT_BELOW_ZERO(-728,"欠费金额必须不小于零"),
+    PAYFEE_REMAINING_BELOW_ZERO(-729,"预存金额必须不小于零"),
+    PAYFEE_WATERAMOUNT_BELOW_ZERO(-730,"购水金额必须不小于零"),
+    PAYFEE_TRANAMOUNT_BELOW_ZERO(-731,"实收金额不能小于购水金额"),
     CUSTOMER_IS_EXISTED(-3001,"客户名称已存在");
 
     private final int status;

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

@@ -37,7 +37,7 @@ public class AmountWaterUsedAmountController {
     @GetMapping("/pageList")
     @ApiOperation(value = "获取设备分页")
     public AjaxMessage<Pagination<AmountWaterUsedAmountDto>> propertyPageList(
-            @ApiParam(value = "查询条件:客户编号/客户名称/水表档案号/安装地址") @RequestParam(required = false) String condition,
+            @ApiParam(value = "查询条件:客户编号/水表档案号/水表电子号") @RequestParam(required = false) String condition,
             //@ApiParam(value = "客户编号") @RequestParam(required = false) String accountNumber,
             //@ApiParam(value = "客户名称") @RequestParam(required = false) String accountName,
             //@ApiParam(value = "水表档案号") @RequestParam(required = false) String meterCode,

+ 3 - 2
smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/PayBaseAccountController.java

@@ -56,13 +56,14 @@ public class PayBaseAccountController {
     @GetMapping("/findMeter")
     @ApiOperation(value = "开户管理-水表信息",notes = "开户管理-水表信息")
     public AjaxMessage<Pagination<PayMeter>>findMeter(
-            @ApiParam(value = "水表档案号、客户编号、安装地址",required = false) @RequestParam(required = false) String queryInfo,
+            @ApiParam(value = "水表档案号、水表电子号、安装地址",required = false) @RequestParam(required = false) String queryInfo,
+            @ApiParam(value = "安装地址",required = false) @RequestParam(required = false) String address,
             @ApiParam(value = "状态(0待验收,1待开户,2已开户)",required = false) @RequestParam(required = false) String state,
             @ApiParam(value = "页数,非必传,默认第一页", required = false, defaultValue = "1") @RequestParam(required = false, defaultValue = "1") Integer pageNum,
             @ApiParam(value = "条数,非必传,默认15条", required = false, defaultValue = "15") @RequestParam(required = false, defaultValue = "15") Integer pageSize
     )
     {
-        Pagination<PayMeter> meterInfoPagination = payBaseAccountService.findMeter(queryInfo,state,pageNum,pageSize);
+        Pagination<PayMeter> meterInfoPagination = payBaseAccountService.findMeter(queryInfo,address,state,pageNum,pageSize);
         return  new AjaxMessage<>(ResultStatus.OK,meterInfoPagination);
     }
 

+ 99 - 69
smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/PayFeeController.java

@@ -3,9 +3,11 @@ package com.bz.smart_city.controller.pay;
 import com.bz.smart_city.annotation.LogAnnotation;
 import com.bz.smart_city.commom.model.AjaxMessage;
 import com.bz.smart_city.commom.model.ResultStatus;
+import com.bz.smart_city.dto.pay.BaseWaterPropertyFormDto;
 import com.bz.smart_city.dto.pay.PayInvoiceDto;
 import com.bz.smart_city.dto.pay.PayTransactiondetailsDto;
 import com.bz.smart_city.dto.pay.payfee.*;
+import com.bz.smart_city.service.pay.BaseWaterPropertyService;
 import com.bz.smart_city.service.pay.PayFeeService;
 import com.bz.smart_city.service.pay.PayPayReceivedService;
 import com.bz.smart_city.service.pay.PayTransactiondetailsService;
@@ -13,7 +15,9 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import org.apache.commons.lang3.StringUtils;
+import org.aspectj.weaver.loadtime.Aj;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import java.math.BigDecimal;
@@ -40,10 +44,12 @@ public class PayFeeController {
     PayFeeService payFeeService;
     @Autowired
     PayTransactiondetailsService payTransactiondetailsService;
+    @Autowired
+    private BaseWaterPropertyService baseWaterPropertyService;
 
 
     @PostMapping("/payFee")
-    @ApiOperation(value="冲账接口,客户名称、客户编码、应收id不能同时为空")
+    @ApiOperation(value = "冲账接口,客户名称、客户编码、应收id不能同时为空")
     public AjaxMessage<String> payFee(
             @ApiParam(value = "客户编码", required = false) @RequestParam(required = false) String accountnumber,
             @ApiParam(value = "客户名称", required = false) @RequestParam(required = false) String metercode,
@@ -54,132 +60,156 @@ public class PayFeeController {
             @ApiParam(value = "站点ID", required = false) @RequestParam(required = false) String siteId,
             @ApiParam(value = "水司ID", required = false) @RequestParam(required = false) String customerId,
             @ApiParam(value = "用户ID", required = false) @RequestParam(required = false) String userId
-    ){
+    ) {
         DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
-        List<BigInteger> arrayList= null;
-        if(StringUtils.isNotBlank(receivableIds)){
-            arrayList=  Arrays.asList(receivableIds.split(",")).stream().map(BigInteger::new).collect(Collectors.toList());
+        List<BigInteger> arrayList = null;
+        if (StringUtils.isNotBlank(receivableIds)) {
+            arrayList = Arrays.asList(receivableIds.split(",")).stream().map(BigInteger::new).collect(Collectors.toList());
         }
 
-        return new AjaxMessage<>(ResultStatus.OK,payFeeService.payFee(accountnumber,
-                                                                            metercode,
-                                                                            BigDecimal.valueOf(Double.parseDouble(transAmount)),
-                                                                            Integer.valueOf(paytype),
-                                                                            transTime != null? LocalDateTime.parse(transTime,df): null,
-                                                                            arrayList,
-                                                                            siteId != null?Integer.parseInt(siteId):null,
-                                                                            customerId != null?Integer.parseInt(customerId):null,
-                                                                            userId != null?Integer.parseInt(userId):null)
-                );
+        return new AjaxMessage<>(ResultStatus.OK, payFeeService.payFee(accountnumber,
+                metercode,
+                BigDecimal.valueOf(Double.parseDouble(transAmount)),
+                Integer.valueOf(paytype),
+                transTime != null ? LocalDateTime.parse(transTime, df) : null,
+                arrayList,
+                siteId != null ? Integer.parseInt(siteId) : null,
+                customerId != null ? Integer.parseInt(customerId) : null,
+                userId != null ? Integer.parseInt(userId) : null)
+        );
     }
 
 
     @PostMapping("/payFeeCounter")
-    @ApiOperation(value="柜台缴费接口")
+    @ApiOperation(value = "柜台缴费接口")
     public AjaxMessage<PayfeeResult> payFeeCounter(
-            @ApiParam(value = "客户id", required = true) @RequestParam(required = true)String accountId,
-            @ApiParam(value = "支付方式", required = true) @RequestParam(required = true)Integer payway,
-            @ApiParam(value = "交易金额", required = true) @RequestParam(required = true)String transAmount,
-            @ApiParam(value = "是否转预存,0否 1是", required = true) @RequestParam(required = true)Integer balancetype
-
-    ){
+            @ApiParam(value = "客户id", required = true) @RequestParam(required = true) String accountId,
+            @ApiParam(value = "欠费金额", required = false) @RequestParam(required = false) String debt,
+            @ApiParam(value = "预存金额", required = false) @RequestParam(required = false) String remaining,
+            @ApiParam(value = "购水量", required = false) @RequestParam(required = false) String amount,
+            /*@ApiParam(value = "购水金额", required = false) @RequestParam(required = false)String waterAmount,*/
+            @ApiParam(value = "单价", required = false) @RequestParam(required = false) String price,
+            @ApiParam(value = "实收金额", required = true) @RequestParam(required = true) String transAmount,
+            @ApiParam(value = "支付方式", required = true) @RequestParam(required = true) Integer payway,
+            @ApiParam(value = "是否转预存,0否 1是", required = true) @RequestParam(required = true) Integer balancetype
+
+    ) {
         //暂时先默认柜台支付为现金支付,后期区分
-     return new AjaxMessage<>(ResultStatus.OK, payFeeService.payFeeCounter(accountId,4,new BigDecimal(transAmount),balancetype));
+        return new AjaxMessage<>(ResultStatus.OK, payFeeService.payFeeCounter(accountId, 4, new BigDecimal(transAmount), balancetype,
+                new BigDecimal(debt), new BigDecimal(remaining), Integer.valueOf(amount), new BigDecimal(price)));
     }
 
     @GetMapping("/findPayfeeAccountInfo")
-    @ApiOperation(value="收费界面查询客户信息,客户id是在查询出多用户时,选择某个用户")
+    @ApiOperation(value = "收费界面查询客户信息,客户id是在查询出多用户时,选择某个用户")
     public AjaxMessage<List<PayfeeAccountInfoDto>> findPayfeeAccountInfo(
-            @ApiParam(value = "开户id,查询多用户时,再次查询用id查询") @RequestParam(required = false)BigInteger id,
-            @ApiParam(value = "查询内容,户编、户名、手机、地址") @RequestParam(required = false)String condition ){
+            @ApiParam(value = "开户id,查询多用户时,再次查询用id查询") @RequestParam(required = false) BigInteger id,
+            @ApiParam(value = "查询内容,户编、户名、手机、地址") @RequestParam(required = false) String condition) {
 
-        return new AjaxMessage<>(ResultStatus.OK, payFeeService.findPayfeeAccountInfo(id , condition ));
+        return new AjaxMessage<>(ResultStatus.OK, payFeeService.findPayfeeAccountInfo(id, condition));
     }
 
     @GetMapping("/getPayfeeDetaileBill")
-    @ApiOperation(value="查询账单详情")
+    @ApiOperation(value = "查询账单详情")
     public AjaxMessage<PayfeeDetaileBill> getPayfeeDetaileBill(
-            @ApiParam(value = "客户id",required = true) @RequestParam(required = true)BigInteger accountId){
-        return new AjaxMessage<>(ResultStatus.OK,payFeeService.getPayfeeDetaileBill(accountId));
+            @ApiParam(value = "客户id", required = true) @RequestParam(required = true) BigInteger accountId) {
+        //根据客户id查找用水性质ID
+        BigInteger propertyId = payFeeService.getWaterPropertyId(accountId);
+        BaseWaterPropertyFormDto baseWaterPropertyFormDto = new BaseWaterPropertyFormDto();
+        if (propertyId != null) {
+            //根据用水性质ID去查找对应的用水性质
+            baseWaterPropertyFormDto = baseWaterPropertyService.getEditPage(propertyId);
+        } else {
+            baseWaterPropertyFormDto = new BaseWaterPropertyFormDto();
+        }
+        PayfeeDetaileBill bill = payFeeService.getPayfeeDetaileBill(accountId);
+        bill.setSumPrice1(baseWaterPropertyFormDto.getSumPrice1());//一阶单价合计
+        bill.setSumPrice2(baseWaterPropertyFormDto.getSumPrice2());//二阶单价合计
+        bill.setSumPrice3(baseWaterPropertyFormDto.getSumPrice3());//三阶单价合计
+        bill.setSumPrice4(baseWaterPropertyFormDto.getSumPrice4());//四阶单价合计
+        bill.setProp1(baseWaterPropertyFormDto.getProp1());//一阶用水性质
+        bill.setProp2(baseWaterPropertyFormDto.getProp2());//二阶用水性质
+        bill.setProp3(baseWaterPropertyFormDto.getProp3());//三阶用水性质
+        bill.setProp4(baseWaterPropertyFormDto.getProp4());//四阶用水性质
+        return new AjaxMessage<>(ResultStatus.OK, bill);
 
     }
 
     @GetMapping("/getPayfeeDetailed")
-    @ApiOperation(value="查询本账期欠费明细")
+    @ApiOperation(value = "查询本账期欠费明细")
     public AjaxMessage<PayfeeDetailed> getPayfeeDetailed(
-            @ApiParam(value = "客户id",required = true) @RequestParam(required = true)BigInteger accountId ){
-        return new AjaxMessage<>(ResultStatus.OK,payFeeService.getPayfeeDetailed(accountId));
+            @ApiParam(value = "客户id", required = true) @RequestParam(required = true) BigInteger accountId) {
+        return new AjaxMessage<>(ResultStatus.OK, payFeeService.getPayfeeDetailed(accountId));
     }
 
     @GetMapping("/getPayreceiveDebt")
-    @ApiOperation(value="收费页面————欠费信息")
+    @ApiOperation(value = "收费页面————欠费信息")
     public AjaxMessage<List<PayfeeReceivableInfo>> getPayreceiveDebt(
-            @ApiParam(value = "客户id",required = true) @RequestParam(required = true)BigInteger accountId ,
-            @ApiParam(value = "账期年",required = true) @RequestParam(required = true)Integer year
-    ){
-        return new AjaxMessage<>(ResultStatus.OK,payFeeService.getPayreceiveDebt(accountId,year));
+            @ApiParam(value = "客户id", required = true) @RequestParam(required = true) BigInteger accountId,
+            @ApiParam(value = "账期年", required = true) @RequestParam(required = true) Integer year
+    ) {
+        return new AjaxMessage<>(ResultStatus.OK, payFeeService.getPayreceiveDebt(accountId, year));
     }
 
     @GetMapping("/getPayreceiveDebtDetailed")
-    @ApiOperation(value="收费页面————欠费信息详情")
+    @ApiOperation(value = "收费页面————欠费信息详情")
     public AjaxMessage<List<PayfeeReceivableInfo>> getPayreceiveDebtDetailed(
-            @ApiParam(value = "客户id",required = true) @RequestParam(required = true)BigInteger accountId,
-            @ApiParam(value = "账期年",required = true) @RequestParam(required = true)Integer year,
-            @ApiParam(value = "账期月",required = true) @RequestParam(required = true)Integer month
-    ){
-        return new AjaxMessage<>(ResultStatus.OK,payFeeService.getPayreceiveDebtDetailed(accountId,year,month));
+            @ApiParam(value = "客户id", required = true) @RequestParam(required = true) BigInteger accountId,
+            @ApiParam(value = "账期年", required = true) @RequestParam(required = true) Integer year,
+            @ApiParam(value = "账期月", required = true) @RequestParam(required = true) Integer month
+    ) {
+        return new AjaxMessage<>(ResultStatus.OK, payFeeService.getPayreceiveDebtDetailed(accountId, year, month));
     }
 
     @GetMapping("/getPayreceived")
-    @ApiOperation(value="收费页面————实收信息")
+    @ApiOperation(value = "收费页面————实收信息")
     public AjaxMessage<List<PayfeeReceivedInfo>> getPayreceived(
-            @ApiParam(value = "客户id",required = true) @RequestParam(required = true)BigInteger accountId ,
-            @ApiParam(value = "账期年",required = true) @RequestParam(required = true)Integer year
-    ){
-        return new AjaxMessage<>(ResultStatus.OK,payFeeService.getPayreceived(accountId,year));
+            @ApiParam(value = "客户id", required = true) @RequestParam(required = true) BigInteger accountId,
+            @ApiParam(value = "账期年", required = true) @RequestParam(required = true) Integer year
+    ) {
+        return new AjaxMessage<>(ResultStatus.OK, payFeeService.getPayreceived(accountId, year));
     }
 
     @GetMapping("/getPayreceivedDetailed")
-    @ApiOperation(value="收费页面————实收信息详情")
+    @ApiOperation(value = "收费页面————实收信息详情")
     public AjaxMessage<List<PayfeeReceivedInfo>> getPayreceivedDetailed(
-            @ApiParam(value = "客户id" ,required = true) @RequestParam(required = true)BigInteger accountId,
-            @ApiParam(value = "交易流水号" ,required = true) @RequestParam(required = true)String payseriesno,
-            @ApiParam(value = "账期年",required = true) @RequestParam(required = true)Integer year,
-            @ApiParam(value = "账期月",required = true) @RequestParam(required = true)Integer month
-    ){
-        return new AjaxMessage<>(ResultStatus.OK,payFeeService.getPayreceivedDetailed(accountId,payseriesno,year,month));
+            @ApiParam(value = "客户id", required = true) @RequestParam(required = true) BigInteger accountId,
+            @ApiParam(value = "交易流水号", required = true) @RequestParam(required = true) String payseriesno,
+            @ApiParam(value = "账期年", required = true) @RequestParam(required = true) Integer year,
+            @ApiParam(value = "账期月", required = true) @RequestParam(required = true) Integer month
+    ) {
+        return new AjaxMessage<>(ResultStatus.OK, payFeeService.getPayreceivedDetailed(accountId, payseriesno, year, month));
     }
 
 
     @GetMapping("/getTransDetailed")
-    @ApiOperation(value="收费页面————交易明细详情")
+    @ApiOperation(value = "收费页面————交易明细详情")
     public AjaxMessage<List<PayTransactiondetailsDto>> getListByYear(
             @ApiParam(value = "客户id", required = true) @RequestParam(required = true) BigInteger accountId,
             @ApiParam(value = "账期年", required = true) @RequestParam(required = true) Integer year
-    ){
+    ) {
 
-        PayTransactiondetailsDto payTransactiondetailsDto =new PayTransactiondetailsDto();
+        PayTransactiondetailsDto payTransactiondetailsDto = new PayTransactiondetailsDto();
         payTransactiondetailsDto.setAccountId(accountId);
         payTransactiondetailsDto.setYear(year);
         return new AjaxMessage<>(ResultStatus.OK, payTransactiondetailsService.selectTransactionList(payTransactiondetailsDto));
     }
 
     @GetMapping("/getWaterusedamount")
-    @ApiOperation(value="收费页面————水量信息")
+    @ApiOperation(value = "收费页面————水量信息")
     public AjaxMessage<List<PayfeeWaterusedamount>> getWaterusedamount(
-            @ApiParam(value = "客户id" ,required = true) @RequestParam(required = true)BigInteger id,
-            @ApiParam(value = "账期年",required = true) @RequestParam(required = true)Integer year
-    ){
-        return new AjaxMessage<>(ResultStatus.OK,payFeeService.getWaterusedamount(id,year));
+            @ApiParam(value = "客户id", required = true) @RequestParam(required = true) BigInteger id,
+            @ApiParam(value = "账期年", required = true) @RequestParam(required = true) Integer year
+    ) {
+        return new AjaxMessage<>(ResultStatus.OK, payFeeService.getWaterusedamount(id, year));
     }
 
     @GetMapping("/getPayinvoiceInfo")
-    @ApiOperation(value="收费页面————收据信息")
+    @ApiOperation(value = "收费页面————收据信息")
     public AjaxMessage<List<PayInvoiceDto>> getPayinvoiceInfo(
-            @ApiParam(value = "客户id" ,required = true) @RequestParam(required = true)BigInteger id,
-            @ApiParam(value = "账期年",required = true) @RequestParam(required = true)Integer year
-    ){
-        return new AjaxMessage<>(ResultStatus.OK,payFeeService.getPayinvoiceInfo(id,year));
+            @ApiParam(value = "客户id", required = true) @RequestParam(required = true) BigInteger id,
+            @ApiParam(value = "账期年", required = true) @RequestParam(required = true) Integer year
+    ) {
+        return new AjaxMessage<>(ResultStatus.OK, payFeeService.getPayinvoiceInfo(id, year));
     }
 }
 

+ 12 - 3
smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/archives/PayBaseCustomerandmeterrelaController.java

@@ -93,6 +93,15 @@ public class PayBaseCustomerandmeterrelaController {
         return new AjaxMessage<>(ResultStatus.OK, info);
     }
 
+    @PostMapping("/selectMeterElenoMeterInfo")
+    @ApiOperation("计费系统-水表电子号点击事件")
+    public AjaxMessage<Pagination<PayAccountInfo>> selectMeterElenoMeterInfo(String metereleno,
+                                                                             @ApiParam(value = "页数,非必传,默认第一页", required = false, defaultValue = "1") @RequestParam(required = false, defaultValue = "1") int pageNum,
+                                                                             @ApiParam(value = "条数,非必传,默认10条", required = false, defaultValue = "10") @RequestParam(required = false, defaultValue = "10") int pageSize){
+        Pagination<PayAccountInfo> info  = payBaseCustomerandmeterrelaService.selectMeterElenoMeterInfo(metereleno,pageNum,pageSize);
+        return new AjaxMessage<>(ResultStatus.OK, info);
+    }
+
     @PostMapping("/saveCustomer")
     @ApiOperation(value = "计费系统-确认开户")
     public AjaxMessage saveCustomer(@ApiParam(value = "保存开户信息",required = true) @RequestBody(required = true) @Validated PaySaveCustomerDto paySaveCustomerDto){
@@ -115,12 +124,12 @@ public class PayBaseCustomerandmeterrelaController {
     @PostMapping("/edit")
     @ApiOperation(value = "计费系统-编辑开户信息")
     public AjaxMessage update(@ApiParam(value = "编辑开户信息",required = true) @RequestBody(required = true) @Validated PaySaveCustomerDto paySaveCustomerDto){
-        int result = 0;
+        String result = "";
         result = payBaseCustomerandmeterrelaService.edit(paySaveCustomerDto);
-        if(result == 1){
+        if(result.equals("修改成功")){
             return new AjaxMessage<>(ResultStatus.OK, result);
         }else{
-            return new AjaxMessage(ResultStatus.ERROR);
+            return new AjaxMessage(ResultStatus.ERROR,result);
         }
 
     }

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

@@ -88,4 +88,6 @@ public interface AmountWaterUsedAmountMapper {
     @MapKey("metercode")
     HashMap<String, DeviceReplaceRecord > getRepalceRecordCount(@Param("year")Integer year, @Param("month")Integer month,@Param("siteId")Integer siteId,@Param("customerId")Integer customerId);
 
+    Integer getwaterUserdAmount(@Param("year")Integer year,@Param("month")Integer month,@Param("siteId")Integer siteId,
+                                @Param("customerId")Integer customerId, @Param("id")BigInteger id);
 }

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

@@ -49,7 +49,7 @@ public interface PayBaseAccountMapper {
     List<PayBaseAccountMeterDto> findWaterMeter(@Param("accountnumber") String accountnumber,@Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId);
 
     //查询水表信息  涉及到查询云平台数据的如sc_device/抄表数据的,只按customer_id过滤
-    List<PayMeter>findMeterInfo(@Param("queryInfo") String queryInfo, @Param("state") String state, @Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId,@Param("year") Integer year,@Param("month") Integer month,@Param("programItemList") List<ProgramItem> programItemList);
+    List<PayMeter>findMeterInfo(@Param("queryInfo") String queryInfo, @Param("address") String address,@Param("state") String state,  @Param("sortColumn") String sortColumn,@Param("sortOrder") String sortOrder, @Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId,@Param("year") Integer year,@Param("month") Integer month,@Param("programItemList") List<ProgramItem> programItemList);
 
     void updateAccountName(@Param("type")Integer type,@Param("accountname")String accountname,@Param("accountId")BigInteger accountId);
 

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

@@ -51,4 +51,6 @@ public interface PayFeeMapper {
     List<PayfeeWaterusedamount> getWaterusedamount(@Param("accountId")BigInteger accountId , @Param("year")Integer year , @Param("siteId") Integer siteId, @Param("customerId") Integer customerId);
 
     List<PayInvoiceDto> getPayinvoiceInfo(@Param("accountId")BigInteger accountId , @Param("year")Integer year, @Param("siteId") Integer siteId, @Param("customerId") Integer customerId);
+
+    BigInteger getWaterPropertyId(@Param("id")BigInteger id);
 }

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

@@ -62,6 +62,8 @@ public interface PayBaseCustomerandmeterrelaMapper {
     public List<MeterListInfo> queryMetercode(@Param("siteId") Integer siteId, @Param("customerId")Integer customerId);
     public List<PayAccountInfo> selectAccountMeterInfo (@Param("siteId") Integer siteId, @Param("customerId")Integer customerId,@Param("metercode")String metercode);
 
+    public List<PayAccountInfo> selectMeterElenoMeterInfo (@Param("siteId") Integer siteId, @Param("customerId")Integer customerId,@Param("metereleno")String metereleno);
+
     public int updateAccountInfo(@Param("accountname")String accountname,@Param("accountnumber")String accountnumber,@Param("metercode")String metercode,@Param("idtype")Integer idtype,
                                  @Param("idcardno")String idcardno,@Param("telephone")String telephone,@Param("officeId")BigInteger officeId,
                                  @Param("housetype")Integer housetype,@Param("customergroup")Integer customergroup,@Param("updateBy")Integer updateBy,

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

@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Date;
@@ -32,12 +33,18 @@ public class BaseWaterPropertyFormDto  {
     private Integer laddertype;
     @ApiModelProperty(value = "用水价格数组1",example="[\"id1,price1,Ladderlimit1\",\"id2,price2,Ladderlimit2\"]" ,position = 1)
     private String[] prop1;
+    @ApiModelProperty(value = "一阶用水合计','", position = 1)
+    private BigDecimal sumPrice1;
     @ApiModelProperty(value = "用水价格数组2','",example="[1,1,100]", position = 1)
     private String[] prop2;
+    @ApiModelProperty(value = "二阶用水合计','", position = 1)
+    private BigDecimal sumPrice2;
     @ApiModelProperty(value = "用水价格数组3','", position = 1)
     private String[] prop3;
+    @ApiModelProperty(value = "三阶用水合计','", position = 1)
+    private BigDecimal sumPrice3;
     @ApiModelProperty(value = "用水价格数组4','", position = 1)
     private String[] prop4;
-
-
+    @ApiModelProperty(value = "四阶用水合计','", position = 1)
+    private BigDecimal sumPrice4;
 }

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

@@ -30,6 +30,8 @@ public class PayBaseAccountMeterDto {
     private String waterpropertyName;
     @ApiModelProperty(example = "001000000101",notes = "水表档案号")
     private String metercode;
+    @ApiModelProperty(example = "001000000101",notes = "水表电子号")
+    private String metereleno;
     @ApiModelProperty(example = "",notes = "帐期水量信息")
     private List<PayBaseAccountWaterusedamountDto> payBaseAccountWaterusedamountDtoList;
 

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

@@ -68,4 +68,6 @@ public class PayCustomerDto {
     public String vatno;
     @ApiModelProperty(value = "邮箱",position = 23)
     public String email;
+    @ApiModelProperty(value = "水表电子号",position = 24)
+    public String metereleno;
 }

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

@@ -52,6 +52,8 @@ public class PayfeeAccountInfoDto {
     private BigInteger waterPropertyId;
     @ApiModelProperty(value = "用水性质名称" )
     private String waterPropertyName;
+    @ApiModelProperty(value = "水表电子号" )
+    private String metereleno;
 
 
 }

+ 21 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/payfee/PayfeeDetaileBill.java

@@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.math.BigDecimal;
+
 /**
  * @description 缴费界面账单详情
  * @auto wangli
@@ -16,10 +18,29 @@ public class PayfeeDetaileBill {
 
     @ApiModelProperty(value = "欠费金额")
     private Double debt;
+    @ApiModelProperty(value = "实际欠费金额")
+    private Double actualDebt;
     @ApiModelProperty(value = "用水金额")
     private Double waterFee;
     @ApiModelProperty(value = "应缴金额")
     private Double receivableFee;
     @ApiModelProperty(value = "账户余额")
     private Double remaining;
+    @ApiModelProperty(value = "用水价格数组1",example="[\"id1,price1,Ladderlimit1\",\"id2,price2,Ladderlimit2\"]" ,position = 1)
+    private String[] prop1;
+    @ApiModelProperty(value = "用水价格数组2','",example="[1,1,100]", position = 1)
+    private String[] prop2;
+    @ApiModelProperty(value = "用水价格数组3','", position = 1)
+    private String[] prop3;
+    @ApiModelProperty(value = "用水价格数组4','", position = 1)
+    private String[] prop4;
+
+    @ApiModelProperty(value = "一阶单价合计','", position = 1)
+    private BigDecimal sumPrice1;
+    @ApiModelProperty(value = "二阶单价合计','", position = 1)
+    private BigDecimal sumPrice2;
+    @ApiModelProperty(value = "三阶单价合计','", position = 1)
+    private BigDecimal sumPrice3;
+    @ApiModelProperty(value = "四阶单价合计','", position = 1)
+    private BigDecimal sumPrice4;
 }

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

@@ -115,6 +115,8 @@ public class AmountWaterUsedAmount {
     private BigInteger siteId;
     @ApiModelProperty(value = "水司ID", hidden = true)
     private BigInteger customerId;
+    @ApiModelProperty(value = "水表电子号")
+    private String metereleno;
 
 
 

+ 3 - 1
smart-city-platform/src/main/java/com/bz/smart_city/entity/pay/archives/CustomerListInfo.java

@@ -26,6 +26,8 @@ public class CustomerListInfo {
     private String accountname;
     @ApiModelProperty(value = "用户手机号",position = 6)
     private String telephone;
-    @ApiModelProperty(value = "身份证号",position = 7)
+    @ApiModelProperty(value = "身份证号",position = 8)
     private String idcardno;
+    @ApiModelProperty(value = "水表电子号",position = 7)
+    private String metereleno;
 }

+ 2 - 0
smart-city-platform/src/main/java/com/bz/smart_city/entity/pay/archives/PayAccountInfo.java

@@ -27,5 +27,7 @@ public class PayAccountInfo {
     private String telephone;
     @ApiModelProperty(value = "身份证号",position = 7)
     private String idcardno;
+    @ApiModelProperty(value = "水表电子号", position =8 )
+    public String metereleno;
 
 }

+ 2 - 0
smart-city-platform/src/main/java/com/bz/smart_city/entity/pay/archives/PayBaseCustomerandmeterrela.java

@@ -99,5 +99,7 @@ public class PayBaseCustomerandmeterrela {
     public String condition;//组合查询
     @ApiModelProperty(value = "权限项",  hidden = true)
     private List<ProgramItem> programItems;
+    @ApiModelProperty(value = "水表电子号", position = 33)
+    public String metereleno;
 
 }

+ 5 - 0
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/BaseWaterPropertyServiceImpl.java

@@ -221,6 +221,11 @@ public class BaseWaterPropertyServiceImpl implements BaseWaterPropertyService {
         baseWaterPropertyFormDto.setCategoryId(baseWaterProperty.getCategoryId());
         baseWaterPropertyFormDto.setEffectivedate(baseWaterProperty.getEffectivedate());
 
+        baseWaterPropertyFormDto.setSumPrice1(baseWaterProperty.getTotalpriceL1());
+        baseWaterPropertyFormDto.setSumPrice2(baseWaterProperty.getTotalpriceL2());
+        baseWaterPropertyFormDto.setSumPrice3(baseWaterProperty.getTotalpriceL3());
+        baseWaterPropertyFormDto.setSumPrice4(baseWaterProperty.getTotalpriceL4());
+
         for (int i = 1; i <5; i++) {
             List<PayBaseWaterprice>  waterprices =   baseWaterPropertyMapper.getFeeInfo(id,i,loginUser.getCustomerId(),loginUser.getSiteId());
             if(waterprices!=null&&waterprices.size()>0){

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

@@ -253,7 +253,7 @@ public class PayBaseAccountServiceImpl implements PayBaseAccountService {
     }
 
     @Override
-    public Pagination<PayMeter>findMeter(String queryInfo, String state, Integer pageNum, Integer pageSize)
+    public Pagination<PayMeter>findMeter(String queryInfo,String address, String state, Integer pageNum, Integer pageSize)
     {
         LoginUser loginUser = UserUtil.getCurrentUser();
         BigInteger siteId = new BigInteger(String.valueOf(loginUser.getSiteId()));
@@ -274,7 +274,7 @@ public class PayBaseAccountServiceImpl implements PayBaseAccountService {
         List<ProgramItem> programItemList = loginUser.getDataPermissionMap().get(loginUser.getSiteId());
 
         PageHelper.startPage(pageNum,pageSize);
-        List<PayMeter> meterInfoList = payBaseAccountMapper.findMeterInfo(queryInfo,state,siteId,customerId,year,month,programItemList);
+        List<PayMeter> meterInfoList = payBaseAccountMapper.findMeterInfo(queryInfo,address,state,siteId,customerId,year,month,programItemList);
 
         return new Pagination<>(meterInfoList);
     }

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

@@ -52,12 +52,40 @@ public class PayFeeServiceImp implements PayFeeService {
     @Resource
     BaseClosingAccountInfoMapper baseClosingAccountInfoMapper;
 
-    public PayfeeResult payFeeCounter( String id,Integer payway,BigDecimal transAmount, Integer balancetype){
-        //交易金额不可为负数
-        if(transAmount.compareTo(BigDecimal.ZERO)!=1){
+    /**
+     *  柜台缴费
+     * @param id 客户id
+     * @param payway 支付方式
+     * @param transAmount 实收金额
+     * @param balancetype 余额处理 1转预存 2找零
+     * @param debt 欠费金额
+     * @param ycremaining 预存金额
+     * @param amount 购水量
+     * @pram waterAmount 购水金额
+     */
+    public PayfeeResult payFeeCounter( String id,Integer payway,BigDecimal transAmount, Integer balancetype,BigDecimal debt,
+                                       BigDecimal ycremaining,Integer amount,BigDecimal price){
+        //实收金额不可为负数
+        if(transAmount.compareTo(BigDecimal.ZERO) == -1){
             throw new ServiceException(ResultStatus.PAYFEE_TRANSAMOUNT_BELOW_ZERO);
         }
-//        String result="";   //执行结果描述
+        //欠费金额不能为负数
+        if(debt.compareTo(BigDecimal.ZERO) == -1){
+            throw new ServiceException(ResultStatus.PAYFEE_DEBT_BELOW_ZERO);
+        }
+        //预存金额不能为负数
+        if(ycremaining.compareTo(BigDecimal.ZERO) == -1){
+            throw new ServiceException(ResultStatus.PAYFEE_REMAINING_BELOW_ZERO);
+        }
+        //购水量不能为负数
+        if(amount < 0){
+            throw new ServiceException(ResultStatus.PAYFEE_REMAINING_BELOW_ZERO);
+        }
+        //购水金额不能为负数
+     /*   if(waterAmount.compareTo(BigDecimal.ZERO) != 1){
+            throw new ServiceException(ResultStatus.PAYFEE_WATERAMOUNT_BELOW_ZERO);
+        }*/
+        //String result="";   //执行结果描述
         String result="实收金额:"+String.format("%.2f",transAmount)+"元";
         BigDecimal fees=BigDecimal.ZERO;    //抵扣金额
         LoginUser loginUser = UserUtil.getCurrentUser();
@@ -73,11 +101,15 @@ public class PayFeeServiceImp implements PayFeeService {
         }
         //根据客编或者水编获取客户信息
         PayCustomRechargeDto payCustomRechargeDto = payFeeMapper.getCustomInfoByMeterOrAccount(id,null,null,BigInteger.valueOf(loginUser.getSiteId()),BigInteger.valueOf(loginUser.getCustomerId()));
-
+        //查询欠费信息
         List<PayReceivable> payReceivableList =payFeeMapper.getReceivable(loginUser.getSiteId(),loginUser.getCustomerId(),payCustomRechargeDto.getAccountId(),null);
 
-        if(payReceivableList.size() == 0){ //没有应收信息走仅充值
-            return rechargefeeCounter(id, transAmount, payway);
+
+        //购水金额 = 单价*水量
+        BigDecimal waterAmount = price.multiply(new BigDecimal(amount));
+
+        if(payReceivableList.size() == 0 && debt.compareTo(BigDecimal.ZERO) ==0){ //没有应收信息走仅充值
+            return rechargefeeCounter(id, transAmount, payway,balancetype,waterAmount);
         }else{
             BigDecimal debts=BigDecimal.ZERO;
             for(PayReceivable payReceivable: payReceivableList){
@@ -179,7 +211,9 @@ public class PayFeeServiceImp implements PayFeeService {
                 }
             }
         }
-    //    result+="<br>预存款抵扣:"+String.format("%.2f",fees)+"元";
+        //实收金额 = 实收金额 - 总的欠费金额
+        //transAmount = transAmount.subtract(fees);
+        //    result+="<br>预存款抵扣:"+String.format("%.2f",fees)+"元";
         fees=BigDecimal.ZERO;//
         //缴费抵扣
         Iterator<PayReceivable> iteratorTransAmount = payReceivableList.iterator();
@@ -220,7 +254,7 @@ public class PayFeeServiceImp implements PayFeeService {
                 }
             }
         }
-        result+="; 支付金额抵扣:"+String.format("%.2f",fees)+"元";
+        result+="; 支付金额抵扣:"+String.format("%.2f",fees)+"元;买水:"+amount+"吨;";
         //余额充值或划扣有余额
         if(balancetype == 1 && transAmount.compareTo(BigDecimal.ZERO) == 1){
             result+="; 余额转预存:"+String.format("%.2f",transAmount)+"元";
@@ -233,6 +267,18 @@ public class PayFeeServiceImp implements PayFeeService {
             payTransactiondetails.setTranstypeLabel("账户转预存");
             transactiondetailsDtoList.add(payTransactiondetails);
         }else{
+            //找零金额 = 实收金额-欠费-购水金额
+            //transAmount 已划扣掉欠费
+            transAmount = transAmount.subtract(waterAmount);
+            //购水金额转预存
+            remaining=remaining.add(waterAmount);
+            //生成交易明细
+            PayTransactiondetails payTransactiondetails = getPayTransactiondetails(payway, paywayName,localDateTime, payCustomRechargeDto, payseriesno, month, year, waterAmount, siteId, customerId, userId  );
+            payTransactiondetails.setName(payCustomRechargeDto.getAccountname() + payCustomRechargeDto.getAccountnumber() + "缴费");
+            payTransactiondetails.setTranstype(4);
+            payTransactiondetails.setTranstypeLabel("账户转预存");
+            transactiondetailsDtoList.add(payTransactiondetails);
+
             result+="; 余额找零:"+String.format("%.2f", transAmount)+"元";
         }
 
@@ -516,10 +562,10 @@ public class PayFeeServiceImp implements PayFeeService {
      *
      */
     @Transactional(rollbackFor = Exception.class)
-    public PayfeeResult rechargefeeCounter(String  accountId , BigDecimal transAmount, Integer payway ){
+    public PayfeeResult rechargefeeCounter(String  accountId , BigDecimal transAmount, Integer payway ,Integer balancetype,BigDecimal waterAmount){
 
         //交易金额不可为负数
-        if(transAmount.compareTo(BigDecimal.ZERO)!=1){
+        if(transAmount.compareTo(BigDecimal.ZERO) == -1){
             throw new ServiceException(ResultStatus.PAYFEE_TRANSAMOUNT_BELOW_ZERO);
         }
         LoginUser loginUser = UserUtil.getCurrentUser();
@@ -555,14 +601,33 @@ public class PayFeeServiceImp implements PayFeeService {
             //获取客户信息失败
             throw new ServiceException(ResultStatus.PAYFEE_QUERY_NO_CUSTOMER);
         }
+        //余额处理 1转预存 0找零
+        if(balancetype == 0){
+            //如果有找零的记录,则  充值金额=实收金额-购水金额
+            transAmount = transAmount.subtract(waterAmount);
+            if(transAmount.compareTo(BigDecimal.ZERO) == -1){
+                throw new ServiceException(ResultStatus.PAYFEE_TRANAMOUNT_BELOW_ZERO);
+            }
+        }
+
         //生成批次号
         // 微信:W  现金、预存账户:C 银行:B 支付宝:A
-        String payseriesno = recharge(transAmount, payway, siteId, customerId, userId, paywayName, localDateTime, payCustomRechargeDto);
+        String payseriesno = "";
+        if(balancetype == 0){
+            payseriesno = recharge(waterAmount, payway, siteId, customerId, userId, paywayName, localDateTime, payCustomRechargeDto);
+        }else if (balancetype == 1) {
+            payseriesno = recharge(transAmount, payway, siteId, customerId, userId, paywayName, localDateTime, payCustomRechargeDto);
+        }
         PayfeeResult payfeeResult =new PayfeeResult();
         payfeeResult.setPayseriesno(payseriesno);
         payfeeResult.setTransType(1);
         payfeeResult.setPayway(payway);
-        payfeeResult.setMsg("充值金额:"+String.format("%.2f", transAmount)+"元");
+        if(balancetype == 0){
+            payfeeResult.setMsg("充值金额:"+String.format("%.2f", waterAmount)+"元;找零:"+transAmount+"元");
+        }else if (balancetype == 1){
+            payfeeResult.setMsg("充值金额:"+String.format("%.2f", transAmount)+"元");
+        }
+
         return payfeeResult;
     }
 
@@ -853,4 +918,8 @@ public class PayFeeServiceImp implements PayFeeService {
         return payFeeMapper.getPayinvoiceInfo(accountId, year,  loginUser.getSiteId(), loginUser.getCustomerId());
     }
 
+    public BigInteger getWaterPropertyId(BigInteger id){
+        return payFeeMapper.getWaterPropertyId(id);
+    }
+
 }

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

@@ -34,7 +34,7 @@ public interface PayBaseAccountService {
 
     List<PaySysDictSelectDto> findState();
 
-    Pagination<PayMeter>findMeter(String queryInfo, String state, Integer pageNum, Integer pageSize);
+    Pagination<PayMeter>findMeter(String queryInfo,String address,String state, Integer pageNum, Integer pageSize);
 
 
     int getMaxAccountNumber(String CommunityCode);

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

@@ -37,7 +37,8 @@ public interface PayFeeService {
      * @param transAmount 交易金额
      * @param balancetype 余额处理 1转预存 2找零
      */
-    PayfeeResult payFeeCounter( String id,Integer payway,BigDecimal transAmount, Integer balancetype);
+    PayfeeResult payFeeCounter( String id,Integer payway,BigDecimal transAmount, Integer balancetype,BigDecimal debt,
+                                BigDecimal remaining,Integer amount,BigDecimal price);
 
     /**
      * 查询客户信息
@@ -111,6 +112,8 @@ public interface PayFeeService {
      */
     List<PayInvoiceDto> getPayinvoiceInfo(BigInteger accountId, Integer year);
 
+    BigInteger getWaterPropertyId(BigInteger id);
+
 
 
 }

+ 3 - 1
smart-city-platform/src/main/java/com/bz/smart_city/service/pay/archives/PayBaseCustomerandmeterrelaService.java

@@ -42,6 +42,8 @@ public interface PayBaseCustomerandmeterrelaService {
 
     public Pagination<PayAccountInfo> selectAccountMeterInfo(String metercode,int pageNum, int pageSize);
 
+    public Pagination<PayAccountInfo> selectMeterElenoMeterInfo(String metereleno,int pageNum, int pageSize);
+
     public int saveCustomer(String accountname,String accountnumber,String metercode,BigInteger waterPropertyId,Integer calculateway,Integer idtype,
                             String idcardno,String telephone,BigInteger officeId,Integer housetype,Integer customergroup,BigDecimal fixedamount);
 
@@ -50,7 +52,7 @@ public interface PayBaseCustomerandmeterrelaService {
     public  Pagination<PayCustomerDto>getAll (String condition, BigInteger waterPropertyId, Integer businessstate, Integer calculateway, String sortColumn, String sortOrder, int pageNum, int pageSize);
 
 
-    int edit (PaySaveCustomerDto paySaveCustomerDto);
+    String edit (PaySaveCustomerDto paySaveCustomerDto);
 
     //public List<CustomerListInfo> selectAccountnumberList(String accountnumber);
     public Pagination<CustomerListInfo> selectAccountnumberList(String accountnumber,int pageNum, int pageSize);

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

@@ -85,6 +85,11 @@ public class PayBaseCustomerandmeterrelaServiceImpl implements PayBaseCustomeran
     @Resource
     private OrganizationMapper organizationMapper;
 
+    @Resource
+    private AmountWaterUsedAmountMapper amountWaterUsedAmountMapper;
+    @Resource
+    private BaseClosingAccountInfoMapper baseClosingAccountInfoMapper;
+
     @Value("${files.path}")
     private String filesPath;
 
@@ -195,6 +200,19 @@ public class PayBaseCustomerandmeterrelaServiceImpl implements PayBaseCustomeran
         List<PayAccountInfo> list = payBaseCustomerandmeterrelaMapper.selectAccountMeterInfo(loginUser.getSiteId(),loginUser.getCustomerId(),metercode);
         return new Pagination<>(list);
     }
+
+    /**
+     * 根据水表电子号查询该水表所在的客户信息(模糊搜索)
+     * @param metereleno
+     * @return
+     */
+    public Pagination<PayAccountInfo> selectMeterElenoMeterInfo(String metereleno,int pageNum, int pageSize){
+        LoginUser loginUser = UserUtil.getCurrentUser();
+        PageHelper.startPage(pageNum, pageSize);
+        List<PayAccountInfo> list = payBaseCustomerandmeterrelaMapper.selectMeterElenoMeterInfo(loginUser.getSiteId(),loginUser.getCustomerId(),metereleno);
+        return new Pagination<>(list);
+    }
+
     /**
      * 确认开户
      * @param accountnumber
@@ -657,16 +675,39 @@ public class PayBaseCustomerandmeterrelaServiceImpl implements PayBaseCustomeran
     }
 
     @Transactional(rollbackFor = Exception.class)
-    public int edit (PaySaveCustomerDto payBaseCustomerandmeterrela){
+    public String edit (PaySaveCustomerDto payBaseCustomerandmeterrela){
         LoginUser loginUser = UserUtil.getCurrentUser();
 
         //根据客户编码寻找客户id
         PayBaseAccount accounts = payBaseCustomerandmeterrelaMapper.getAccountId(loginUser.getSiteId(),
-            loginUser.getCustomerId(),payBaseCustomerandmeterrela.getAccountnumber());
+                loginUser.getCustomerId(),payBaseCustomerandmeterrela.getAccountnumber());
 
         if(accounts != null){
             //修改客户信息
             PayBaseAccount saveAccount  = payBaseAccountMapper.get(accounts.getId());
+            PayBaseCustomerandmeterrela cus = new PayBaseCustomerandmeterrela();
+            cus.setId(payBaseCustomerandmeterrela.getId());
+            cus.setSiteId(BigInteger.valueOf(loginUser.getSiteId()));
+            cus.setCustomerId(BigInteger.valueOf(loginUser.getCustomerId()));
+            List<PayBaseCustomerandmeterrela> cusList = payBaseCustomerandmeterrelaMapper.findList(cus);
+            if(cusList == null && cusList.size() ==0){
+                return "修改失败,开户信息有误。";
+            }
+            BigInteger newWaterPropertyId = payBaseCustomerandmeterrela.getWaterPropertyId();
+            if(newWaterPropertyId == null){
+                return "修改失败,用水性质不能为空。";
+            }
+            BigInteger oldWaterPropertyId = cusList.get(0).getWaterPropertyId();
+
+            if(!oldWaterPropertyId.equals(newWaterPropertyId)){
+                //如果有更换用水性质则需要先判断本账期是否审核水量
+                //根据客户查找是否有本账期未审核的水量信息
+                BaseClosingAccountInfoDto baseClosingAccountInfoDto= baseClosingAccountInfoMapper.getLastClosingAccount(loginUser.getSiteId(),loginUser.getCustomerId());
+                Integer state = amountWaterUsedAmountMapper.getwaterUserdAmount(baseClosingAccountInfoDto.getYear(),baseClosingAccountInfoDto.getMonth(),loginUser.getSiteId(),loginUser.getCurrentSiteId(),saveAccount.getId());
+                if(state != null && state == 1){
+                    return "修改失败,本账期有未审核的水量。";
+                }
+            }
             saveAccount.setName(payBaseCustomerandmeterrela.getAccountname());
             saveAccount.setIdtype(payBaseCustomerandmeterrela.getIdtype());
             saveAccount.setIdcardno(payBaseCustomerandmeterrela.getIdcardno());
@@ -678,6 +719,7 @@ public class PayBaseCustomerandmeterrelaServiceImpl implements PayBaseCustomeran
             saveAccount.setUpdateBy(new BigInteger(String.valueOf(loginUser.getId())));
             saveAccount.setUpdateDate(LocalDateTime.now());
             saveAccount.setEmail(payBaseCustomerandmeterrela.getEmail()); //邮箱
+            saveAccount.setWaterpropertyId(newWaterPropertyId);
             payBaseAccountService.edit(saveAccount);
 
             //修改预存账户名称
@@ -708,12 +750,13 @@ public class PayBaseCustomerandmeterrelaServiceImpl implements PayBaseCustomeran
             customer.setUpdateDate(LocalDateTime.now());
             customer.setId(payBaseCustomerandmeterrela.getId());
             customer.setVatno(payBaseCustomerandmeterrela.getVatno());
+            customer.setWaterPropertyId(newWaterPropertyId);
             payBaseCustomerandmeterrelaMapper.update(customer);
 
             //编辑开户修改其它地方客户名称
             this.updateAccountnameInfo(payBaseCustomerandmeterrela.getAccountname(),accounts.getId());
 
-            return 1;
+            return "修改成功";
         }else{
             throw new ServiceException(-900, "客户信息有误");
         }
@@ -736,7 +779,7 @@ public class PayBaseCustomerandmeterrelaServiceImpl implements PayBaseCustomeran
             //1.查抄未开户水表信息集合
             List<ProgramItem> programItemList = loginUser.getDataPermissionMap().get(siteId);
             //查找待开户信息
-            List<PayMeter> meterInfoList = payBaseAccountMapper.findMeterInfo(null,"1",siteId,customerId,null,null,programItemList);
+            List<PayMeter> meterInfoList = payBaseAccountMapper.findMeterInfo(null,null,"1",null,null,siteId,customerId,null,null,programItemList);
             //2.查找用水性质集合
             List<BaseWaterPropertyDto> propertyList = baseWaterPropertyMapper.getList(null,customerId,siteId);
             //3.查找结算方式集合
@@ -1123,7 +1166,7 @@ public class PayBaseCustomerandmeterrelaServiceImpl implements PayBaseCustomeran
         LoginUser loginUser = UserUtil.getCurrentUser();
         String title = "开户信息列表";
         DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-        String[] rowsName = new String[]{"序号","客户编号","客户名称","手机号","水表档案号","用水性质","安装地址","开户时间","状态","结算方式"};
+        String[] rowsName = new String[]{"序号","客户编号","客户名称","手机号","水表电子号","水表档案号","用水性质","结算方式","安装地址","开户时间","状态"};
         List<PayBaseCustomerandmeterrela> customerList = payBaseCustomerandmeterrelaMapper.getList(condition,waterPropertyId,businessstate,calculateway,loginUser.getSiteId(),loginUser.getCustomerId());
         List<Object[]> dataList = newArrayList();
         Object[] objs = null;
@@ -1131,21 +1174,23 @@ public class PayBaseCustomerandmeterrelaServiceImpl implements PayBaseCustomeran
             PayBaseCustomerandmeterrela customer = customerList.get(i);
             objs = new Object[rowsName.length];
             objs[0] = i;
-            objs[1] = customer.getAccountnumber() != null ? customer.getAccountnumber() : "";
-            objs[2] = customer.getAccountname() != null ? customer.getAccountname() : "";
-            objs[3] = customer.getTelephone() != null ? customer.getTelephone() : "";
-            objs[4] = customer.getMetercode() != null ? customer.getMetercode() : "";
-            objs[5] = customer.getPropertyName() != null ? customer.getPropertyName() : "";
-            objs[6] = customer.getAddress() != null ? customer.getAddress() : "";
-            objs[7] = customer.getOpendate() != null ? df.format(customer.getOpendate()) : "";
-            Integer customerState = customer.getBusinessstate() != null ? customer.getBusinessstate() : 10;
-            String businessName = paySysDictService.getDiceLabel(customerState,"开户状态",new BigInteger(String.valueOf(loginUser.getSiteId())),
-                new BigInteger(String.valueOf(loginUser.getCustomerId())));
-            objs[8] = businessName;
+            objs[1] = customer.getAccountnumber() != null ? customer.getAccountnumber() : "";//客户编号
+            objs[2] = customer.getAccountname() != null ? customer.getAccountname() : "";//客户名称
+            objs[3] = customer.getTelephone() != null ? customer.getTelephone() : "";//手机号
+            objs[4] = customer.getMetereleno() != null ? customer.getMetereleno() :"";//水表电子号
+            objs[5] = customer.getMetercode() != null ? customer.getMetercode() : "";//水表档案号
+            objs[6] = customer.getPropertyName() != null ? customer.getPropertyName() : "";//用水性质
             Integer calcuState = customer.getCalculateway() != null ? customer.getCalculateway() : 10;
             String calcuName = paySysDictService.getDiceLabel(calcuState,"结算方式",new BigInteger(String.valueOf(loginUser.getSiteId())),
-                new BigInteger(String.valueOf(loginUser.getCustomerId())));
-            objs[9] = calcuName;
+                    new BigInteger(String.valueOf(loginUser.getCustomerId())));
+            objs[7] = calcuName;//结算方式
+            objs[8] = customer.getAddress() != null ? customer.getAddress() : "";//安装地址
+            objs[9] = customer.getOpendate() != null ? df.format(customer.getOpendate()) : "";//开户时间
+            Integer customerState = customer.getBusinessstate() != null ? customer.getBusinessstate() : 10;
+            String businessName = paySysDictService.getDiceLabel(customerState,"开户状态",new BigInteger(String.valueOf(loginUser.getSiteId())),
+                    new BigInteger(String.valueOf(loginUser.getCustomerId())));
+            objs[10] = businessName;//开户状态
+
             dataList.add(objs);
         }
         ExcelUtil excelUtil = new ExcelUtil(title, rowsName, dataList);

+ 73 - 17
smart-city-platform/src/main/resources/mapper/PayBaseCustomerandmeterrelaMapper.xml

@@ -35,7 +35,8 @@
         account.address as "address",
         customer.opendate as "opendate",
         customer.businessstate as "businessstate",
-        customer.calculateway as "calculateway"
+        customer.calculateway as "calculateway",
+        pro.id as "waterPropertyId"
         from pay_base_customerandmeterrela customer
         left join pay_base_account account on customer.account_id = account.id
         left join pay_base_waterproperty pro on pro.id = customer.waterproperty_id
@@ -74,6 +75,24 @@
         </where>
     </select>
 
+    <select id="getAccountId" resultType="com.bz.smart_city.entity.pay.PayBaseAccount">
+        select
+        id as "id"
+        from pay_base_account
+        <where>
+            <if test="siteId != null">
+                and site_id = #{siteId}
+            </if>
+            <if test="customerId != null">
+                and  customer_id = #{customerId}
+            </if>
+            <if test="accountnumber">
+                and  accountnumber =#{accountnumber}
+            </if>
+            order by create_date desc
+        </where>
+    </select>
+
     <select id="getDeviceId" resultType="com.bz.smart_city.entity.pay.archives.PayBaseCustomerandmeterrela" >
         select
         id as "id"
@@ -243,6 +262,7 @@
         account.name as "accountname",
         account.telephone as "telephone",
         customer.metercode as "metercode",
+        device.water_meter_no as "metereleno",
         property.id as "waterPropertyId",
         property.name as "waterPropertyName",
         account.address as "address",
@@ -262,6 +282,7 @@
         customer.customergroup as "customergroup",
         (select label from pay_sys_dict where type = '开户分组' and value = customer.customergroup and site_id = #{siteId} and customer_id =#{customerId}) as "customergroupName"
         from pay_base_customerandmeterrela customer
+        left join sc_device device on customer.watermeter_id = device.id
         left join pay_base_account account on account.id = customer.account_id
         left join pay_base_waterproperty property on property.id = customer.waterproperty_id
         <where>
@@ -279,6 +300,7 @@
                 or customer.metercode like  concat('%',#{condition},'%')
                 or account.address  like concat('%',#{condition},'%')
                 or account.telephone like concat('%',#{condition},'%')
+                or device.water_meter_no like concat('%',#{condition},'%')
                 )
             </if>
             <if test="waterPropertyId != null">
@@ -311,7 +333,8 @@
         device.loc_desc as "address",
         customer.opendate as "opendate",
         customer.businessstate as "businessstate",
-        customer.calculateway as "calculateway"
+        customer.calculateway as "calculateway",
+        device.water_meter_no as "metereleno"
         from pay_base_customerandmeterrela customer
         left join pay_base_account account on account.id = customer.account_id
         left join pay_base_waterproperty property on property.id = customer.waterproperty_id
@@ -331,6 +354,7 @@
                 or customer.metercode like  concat('%',#{condition},'%')
                 or account.address  like concat('%',#{condition},'%')
                 or account.telephone like concat('%',#{condition},'%')
+                or device.water_meter_no like concat('%',#{condition},'%')
                 )
             </if>
             <if test="waterPropertyId != null">
@@ -349,7 +373,7 @@
 
     <select id="queryNoOpenAccount" resultType="com.bz.smart_city.entity.pay.archives.DeviceListInfo">
         select
-        account.accountnumber as "accountnumber"
+            account.accountnumber as "accountnumber"
         from pay_base_account account
         <where>
             <if test="siteId != null">
@@ -364,12 +388,13 @@
 
     <select id="selectAccountInfo" resultType="com.bz.smart_city.entity.pay.archives.MeterListInfo">
         select
-        device.metercode as "metercode",
-        account.name as accountname,
-        account.mobilephone as telephone,
-        account.idcardno as idcardno
+            device.metercode as "metercode",
+            sil.user_name as accountname,
+            sil.user_phone as telephone,
+            sil.id_card as idcardno
         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.metercode not in(select metercode from pay_base_customerandmeterrela where businessstate = '1')
             <if test="accountnumber != null">
@@ -387,15 +412,17 @@
 
     <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",
-        device.metercode as "metercode",
-        account.name as accountname,
-        account.mobilephone as telephone,
-        account.idcardno as idcardno
+            account.accountnumber as "accountnumber",
+            account.calculateway as "calculateway",
+            account.waterproperty_id as "waterPropertyId",
+            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"
         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.metercode not in(select metercode from pay_base_customerandmeterrela where businessstate = '1')
             <if test="metercode != null">
@@ -411,11 +438,40 @@
         </where>
     </select>
 
+    <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",
+            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"
+        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">
+                and device.water_meter_no like concat('%',#{metereleno},'%')
+            </if>
+            <!--<if test="siteId != null">
+                and  account.site_id = #{siteId}
+            </if>-->
+            <if test="customerId != null">
+                and account.customer_id = #{customerId}
+            </if>
+            order by account.create_date desc
+        </where>
+    </select>
+
     <select id="selectAccountWater" resultType="com.bz.smart_city.entity.pay.archives.CustomerListInfo">
         select
-        accountnumber as "accountnumber",
-        calculateway as "calculateway" ,
-        waterproperty_id as "waterPropertyId"
+            accountnumber as "accountnumber",
+            calculateway as "calculateway" ,
+            waterproperty_id as "waterPropertyId",
+            device.water_meter_no as "metereleno"
         from pay_base_account account
         inner join sc_device device on account.id = device.account_id
         <where>

+ 18 - 11
smart-city-platform/src/main/resources/mapper/pay/AmountWaterUsedAmountMapper.xml

@@ -38,7 +38,8 @@
 		a.site_id as "siteId",
 		a.customer_id as "customerId",
 		c.label as stateName,
-		CONCAT(a.`year`,'年',LPAD(a.month, 2, 0),'月') as closingName
+		CONCAT(a.`year`,'年',LPAD(a.month, 2, 0),'月') as closingName,
+		d.water_meter_no as "metereleno"
 	</sql>
 
     <sql id="amountWaterusedamountJoins">
@@ -59,7 +60,7 @@
 	<select id="getList" resultType="com.bz.smart_city.dto.pay.AmountWaterUsedAmountDto">
 		SELECT
 		<include refid="amountWaterusedamountColumns"/>
-			FROM pay_amount_waterusedamount a
+		FROM pay_amount_waterusedamount a
 		<include refid="amountWaterusedamountJoins"/>
 		<where>
 			a.customer_id = #{customerId}
@@ -68,13 +69,16 @@
 
 			<choose>
 				<when test="condition != null and condition !=''">
-					and (a.accountname like concat('%',#{condition} ,'%') or a.accountnumber like concat('%',#{condition} ,'%') or a.metercode like concat('%',#{condition} ,'%') or a.address like concat('%',#{condition} ,'%'))
+					and
+					(
+					a.accountnumber like concat('%',#{condition} ,'%')
+					or a.metercode like concat('%',#{condition} ,'%')
+					or d.water_meter_no like concat('%',#{condition} ,'%')
+					)
 				</when>
 				<otherwise>
-					<if test="accountname!= null and accountname !=''" > and a.accountname = #{accountname} </if>
 					<if test="accountnumber!= null and accountnumber !=''" > and a.accountnumber = #{accountnumber} </if>
 					<if test="metercode!= null and metercode !=''" > and a.metercode = #{metercode} </if>
-					<if test="address!= null and address !=''" > and a.address = #{address} </if>
 
 				</otherwise>
 			</choose>
@@ -88,15 +92,14 @@
 			<if test="programItems != null and programItems.size() != 0">
 				and
 				<foreach collection="programItems" item="item" open="(" separator=" or " close=")">
-                    <if test="item.dimensionId == 10">
-                        a.${item.dimensionCode} = #{item.dimensionValue}
-                    </if>
-
+					<if test="item.dimensionId == 10">
+						a.${item.dimensionCode} = #{item.dimensionValue}
+					</if>
 				</foreach>
 			</if>
 		</where>
 
-        order by a.recorddate desc
+		order by a.recorddate desc
 
 	</select>
 
@@ -664,5 +667,9 @@
 		where site_id=#{siteId} and customer_id=#{customerId} and year=#{year} and month =#{month}
 	</select>
 
-
+	<select id="getwaterUserdAmount" resultType="java.lang.Integer">
+		select
+			amount.state from pay_amount_waterusedamount amount
+		where amount.account_id =#{id} and amount.year =#{year} and amount.month =#{month}
+	</select>
 </mapper>

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

@@ -416,11 +416,13 @@
             pbc.metercode,
             psd.label AS housetypeName,
             psd2.label AS calculateway,
-            pbw.name as waterpropertyName
+            pbw.name as waterpropertyName,
+            device.water_meter_no as "metereleno"
          from pay_base_customerandmeterrela pbc
         LEFT JOIN pay_sys_dict psd on pbc.housetype = psd.value and psd.type='住房类型' and psd.site_id=#{siteId} and psd.customer_id=#{customerId}
         left join pay_sys_dict psd2 on pbc.calculateway = psd2.value and psd2.type='结算方式' and psd2.site_id=#{siteId} and psd2.customer_id=#{customerId}
         left join pay_base_waterproperty pbw on pbc.waterproperty_id = pbw.id and pbw.site_id=#{siteId} and pbw.customer_id=#{customerId}
+        left join sc_device device on pbc.watermeter_id = device.id
         where pbc.accountnumber=#{accountnumber} and pbc.site_id=#{siteId} and pbc.customer_id=#{customerId}
     </select>
 
@@ -487,12 +489,15 @@
             and (
             scd.metercode like concat('%',#{queryInfo,jdbcType=VARCHAR} ,'%')
             or pba.accountnumber like concat('%',#{queryInfo,jdbcType=VARCHAR} ,'%')
-            or pba.address like concat('%',#{queryInfo,jdbcType=VARCHAR} ,'%')
+            or scd.water_meter_no like concat('%',#{queryInfo,jdbcType=VARCHAR} ,'%')
             )
         </if>
         <if test="state != null and state != '' ">
             and IFNULL(scd.curr_status,0) = #{state,jdbcType=INTEGER}
         </if>
+        <if test="address != null and address != ''">
+            and pba.address like concat('%',#{address,jdbcType=VARCHAR} ,'%')
+        </if>
         <if test="programItemList != null and programItemList.size() > 0">
             and ( ppr.office_id is null
             <foreach collection="programItemList" item="item" open="or" separator=" or " close=")">

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

@@ -110,23 +110,25 @@
             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",
-
             p.id as "waterPropertyId",
-            p.name as "waterPropertyName"
+            p.name as "waterPropertyName",
+            device.water_meter_no as "metereleno"
         from pay_base_customerandmeterrela c
         left join pay_base_account a on c.account_id=a.id
         left join pay_base_waterproperty p on c.waterProperty_id=p.id
+        inner join sc_device device on device.metercode = c.metercode
         <where>
             c.businessstate=1 and c.site_id=#{siteId} and c.customer_id=#{customerId}
             <if test="id != null and id != ''">
-               and  c.id= #{id}
+                and  c.id= #{id}
             </if>
             <if test="condition != null and condition != ''">
                 and( c.accountname like concat('%',#{condition},'%')
-                    or c.accountnumber like concat('%',#{condition},'%')
-                    or a.mobilephone like concat('%',#{condition},'%')
-                    or a.address like concat('%',#{condition},'%')
-                    )
+                or c.accountnumber like concat('%',#{condition},'%')
+                or a.mobilephone like concat('%',#{condition},'%')
+                or a.address like concat('%',#{condition},'%')
+                or device.water_meter_no like concat('%',#{condition},'%')
+                )
             </if>
             <if test="programItems != null and programItems.size() != 0">
                 and   <foreach collection="programItems" item="item" open="(" separator=" or " close=")">
@@ -311,4 +313,11 @@
         </where>
         order by a.create_date desc
     </select>
+
+    <select id="getWaterPropertyId" resultType="java.math.BigInteger">
+        select
+            waterproperty_id as "id"
+        from pay_base_customerandmeterrela
+        where account_id =#{id}
+    </select>
 </mapper>