Przeglądaj źródła

Merge branch '20200908' into 20201014

lin 4 lat temu
rodzic
commit
b10ac9b6b5

+ 40 - 19
smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/PayInvoiceController.java

@@ -63,16 +63,27 @@ public class PayInvoiceController {
     @GetMapping("/getPrintData")
     @ApiOperation("获取打印数据")
     public AjaxMessage< PrintInvoiceData> getPrintData(
-            @ApiParam(value = "缴费批次号", required = true) @RequestParam(required = true) String payseriesno,
-            @ApiParam(value = "交易类型,实收打印时为空", required = false) @RequestParam(required = false) Integer transType,
-            @ApiParam(value = "支付方式,查询返回信息的payway", required = true) @RequestParam(required = true) Integer payway ) {
-        if(transType !=null && transType==1 && payway == 4){	//单纯充值
-            return  new AjaxMessage<>(ResultStatus.OK,payinvoiceService.getPrintDataOfTrans(payseriesno));
+            @ApiParam(value = "缴费批次号", required = true) @RequestParam(required = true) String payseriesno) {
+
+        PrintInvoiceData printInvoiceData = null ;
+        PrintInvoiceData type = payinvoiceService.getPayInvoiceType(payseriesno);
+        if(type != null && type.getPayInvoiceType() == 0){  //默认
+            if(type.getPrintType() != null && type.getPrintType() == 1){	//单纯充值
+                printInvoiceData = payinvoiceService.getPrintDataOfTrans(payseriesno);
 
+            }else{	//缴费
+                printInvoiceData = payinvoiceService.getPrintDataOfReceived(payseriesno);
+            }
+        }else if(type != null && type.getPayInvoiceType() == 1){  //开鲁
+            printInvoiceData = payinvoiceService.getPrintDataOfTransKailu(payseriesno);
+        }else if(type != null && type.getPayInvoiceType() == 2){  //盖州
+            printInvoiceData = payinvoiceService.getPrintDataOfTransGaizhou(payseriesno);
 
-        }else{	//缴费
-            return  new AjaxMessage<>(ResultStatus.OK,payinvoiceService.getPrintDataOfReceived(payseriesno));
         }
+        if(printInvoiceData != null){
+            printInvoiceData.setPayInvoiceType(type.getPayInvoiceType());
+        }
+        return  new AjaxMessage<>(ResultStatus.OK,printInvoiceData);
     }
 
     @GetMapping("/getPrintDataAgain")
@@ -81,23 +92,33 @@ public class PayInvoiceController {
             @ApiParam(value = "票据id", required = true) @RequestParam(required = true) BigInteger id
            ){
 
+        PrintInvoiceData printInvoiceData = null ;
         PayInvoiceDto payInvoiceDto = payinvoiceService.get(id);
-        String payseriesno = payinvoiceService.findPayseriesnoByPrint(id, 1);
-        if (StringUtils.isNotBlank(payseriesno)) {
-            PrintInvoiceData printInvoiceData= payinvoiceService.getPrintDataOfReceived(payseriesno);
-            printInvoiceData.setInvoiceNo(payInvoiceDto.getInvoiceno());
-            return new AjaxMessage<>(ResultStatus.OK,printInvoiceData);
 
-        } else {
+        String payseriesno = payinvoiceService.findPayseriesnoByPrint(id, 1);
+        if (StringUtils.isBlank(payseriesno)) {
             payseriesno = payinvoiceService.findPayseriesnoByPrint(id, 2);
-            if (StringUtils.isNotBlank(payseriesno)) {
-                PrintInvoiceData printInvoiceData= payinvoiceService.getPrintDataOfTrans(payseriesno);
-                printInvoiceData.setInvoiceNo(payInvoiceDto.getInvoiceno());
-                return new AjaxMessage<>(ResultStatus.OK,printInvoiceData);
-            } else {
-                return new AjaxMessage<>(ResultStatus.OPERATE_RECORD_NOT_EXIT);
+        }
+        PrintInvoiceData type = payinvoiceService.getPayInvoiceType(payseriesno);
+        if(type != null && type.getPayInvoiceType() == 0){  //默认
+            if(type.getPrintType() != null && type.getPrintType() == 1){	//单纯充值
+                printInvoiceData = payinvoiceService.getPrintDataOfTrans(payseriesno);
+
+            }else{	//缴费
+                printInvoiceData = payinvoiceService.getPrintDataOfReceived(payseriesno);
             }
+        }else if(type != null && type.getPayInvoiceType() == 1){  //开鲁
+            printInvoiceData = payinvoiceService.getPrintDataOfTransKailu(payseriesno);
+        }else if(type != null && type.getPayInvoiceType() == 2){  //盖州
+            printInvoiceData = payinvoiceService.getPrintDataOfTransGaizhou(payseriesno);
+
+        }
+
+        if(printInvoiceData != null){
+            printInvoiceData.setInvoiceNo(payInvoiceDto.getInvoiceno());
+            printInvoiceData.setPayInvoiceType(type.getPayInvoiceType());
         }
+        return  new AjaxMessage<>(ResultStatus.OK,printInvoiceData);
     }
 
     @PostMapping("/cancelPrintinfo")

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

@@ -17,6 +17,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.time.LocalDateTime;
@@ -30,7 +32,7 @@ import java.time.format.DateTimeFormatter;
 @RequestMapping("/payreport")
 @Api(tags = "计费系统-报表")
 public class PayReportController {
-    @Autowired
+    @Resource
     PayReportService payReportService;
 
     @ApiOperation(value="收费明细报表")
@@ -119,4 +121,80 @@ public class PayReportController {
         return  new AjaxMessage<>(ResultStatus.OK,pagination);
     }
 
+
+    @ApiOperation(value = "欠费用户明细报表导出")
+    @GetMapping("/exportDebt")
+    public void exportDebt(
+            @ApiParam(value = "机构ID", required = false) @RequestParam(required = false) Integer officeId,
+            @ApiParam(value = "小区code", required = false) @RequestParam(required = false) String communityId,
+            @ApiParam(value = "用户编码(模糊查询)", required = false) @RequestParam(required = false) String accountNumber,
+            HttpServletResponse httpServletResponse
+    ){
+        PayArrearagedetailsReportDto  inParams = new PayArrearagedetailsReportDto();
+        inParams.setOfficeId(officeId);
+        inParams.setCommunity(communityId);
+        inParams.setAccountNumber(accountNumber);
+        payReportService.getDebtListExcel(inParams,httpServletResponse);
+    }
+
+    @ApiOperation(value = "收费员明细报表导出")
+    @GetMapping("/exportOperatorde")
+    public void exportOperatorde(
+            @ApiParam(value = "小区code", required = false) @RequestParam(required = false) String communityId,
+            @ApiParam(value = "收费员ID",required = false)@RequestParam(required = false) Integer operateId,
+            @ApiParam(value = "小计值(与小计状态一起使用,如查询小计值大于100的)",required = false) @RequestParam(required = false) BigDecimal subtotal,
+            @ApiParam(value = "小计状态,0等于,1小于,2大于",required = false) @RequestParam(required = false) Integer subtotalSt,
+            @ApiParam(value = "开始时间yyyyMMdd", required = false) @RequestParam(required = false) String beginTime,
+            @ApiParam(value = "结束时间yyyyMMdd", required = false) @RequestParam(required = false) String endTime,
+            HttpServletResponse httpServletResponse
+    ){
+        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
+        PayOperatordetailsReportDto inParams = new PayOperatordetailsReportDto();
+        inParams.setCommunity(communityId);
+        if(operateId != null)
+            inParams.setCreateBy(new BigInteger(String.valueOf(operateId)));
+        if(StringUtils.isNotBlank(beginTime)){
+            beginTime = beginTime +"000000";
+            inParams.setBeginTime( LocalDateTime.parse(beginTime,df));
+        }
+        if(StringUtils.isNotBlank(endTime)){
+            endTime = endTime + "235959";
+            inParams.setEndTime(LocalDateTime.parse(endTime, df));
+        }
+        if(subtotal != null)
+            inParams.setSubtotal(subtotal);
+        if(subtotalSt != null)
+            inParams.setDataType(subtotalSt);
+        payReportService.getOperatordetListExcel(inParams,httpServletResponse);
+    }
+
+    @ApiOperation(value = "收费明细报表导出")
+    @GetMapping("/exportTran")
+    public void exportTran(
+            @ApiParam(value = "机构ID", required = false) @RequestParam(required = false) Integer officeId,
+            @ApiParam(value = "支付方式ID,字典类:type=支付方式", required = false) @RequestParam(required = false) Integer payway,
+            @ApiParam(value = "收费员ID",required = false)@RequestParam(required = false) Integer operateId,
+            @ApiParam(value = "开始时间yyyyMMdd", required = false) @RequestParam(required = false) String beginTime,
+            @ApiParam(value = "结束时间yyyyMMdd", required = false) @RequestParam(required = false) String endTime,
+            HttpServletResponse httpServletResponse
+    ){
+        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
+        PayTransactiondetailsReportDto inParams = new PayTransactiondetailsReportDto();
+
+        inParams.setOfficeId(officeId);
+        inParams.setPayWay(payway);
+        if(operateId != null)
+            inParams.setCreateBy(new BigInteger(String.valueOf(operateId)));
+
+        if(StringUtils.isNotBlank(beginTime)){
+            beginTime = beginTime +"000000";
+            inParams.setBeginTime( LocalDateTime.parse(beginTime,df));
+        }
+        if(StringUtils.isNotBlank(endTime)){
+            endTime = endTime + "235959";
+            inParams.setEndTime(LocalDateTime.parse(endTime, df));
+        }
+        payReportService.getTranExcel(inParams,httpServletResponse);
+    }
+
 }

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

@@ -27,12 +27,15 @@ public interface PayInvoiceMapper {
     List<PayTransactiondetails> findTransByPayseriesno(@Param("payseriesno") String payseriesno, @Param("siteId") Integer siteId, @Param("customerId") Integer customerId);
     List<PayPayReceived> findReceivedByPayseriesno(@Param("payseriesno") String payseriesno , @Param("siteId") Integer siteId, @Param("customerId") Integer customerId);
     void updatePrintInvoiceRecord(@Param("type") Integer type, @Param("payseriesno") String payseriesno, @Param("invoiceId") BigInteger invoiceId,@Param("siteId") Integer siteId, @Param("customerId") Integer customerId);
+
     PrintInvoiceData getPrintDataOfTran(@Param("payseriesno")String payseriesno,@Param("siteId")Integer siteId,@Param("customerId")Integer customerId);
+
     PrintInvoiceData getLastWaterUsedRecord(@Param("accountId")BigInteger accountId,@Param("date") LocalDateTime date, @Param("siteId")Integer siteId, @Param("customerId")Integer customerId);
 
     PrintInvoiceData getPrintDataKailu(@Param("accountId")BigInteger accountId);
 
-    PrintInvoiceData getDateRangeInfoPrint(@Param("payseriesno")String payseriesno,@Param("siteId")Integer siteId,@Param("customerId")Integer customerId);
+    PrintInvoiceData getDateRangeInfoPrint(@Param("payseriesno")String payseriesno);
+
     PrintInvoiceData getAccountInfoPrint(@Param("accountId") BigInteger accountId);
     List<PrintReceivedInfo>  getPayfeeInfoPrint(@Param("minPeriod")Integer minPeriod,@Param("maxPeriod")Integer maxPeriod,@Param("accountId")BigInteger accountId);
     PrintInvoiceData getPayfeeRemainingPrint(@Param("accountId")BigInteger accountId,@Param("maxPeriod")Integer maxPeriod,@Param("payseriesno")String payseriesno);
@@ -40,6 +43,20 @@ public interface PayInvoiceMapper {
     String findPayseriesnoByPrint(@Param("id")BigInteger id, @Param("type")Integer type);
 
     void deleteTransPrint(@Param("id")BigInteger id);
+
     void deleteReceivedPrint(@Param("id")BigInteger id);
+
     void cancelPayInvoice(@Param("id")BigInteger id,@Param("canceltime")LocalDateTime canceltime,@Param("cancelperson")BigInteger cancelperson);
+
+    PrintInvoiceData countTransactiondetails( @Param("payseriesno")String payseriesno);
+
+    PrintInvoiceData getAmountPeriod(@Param("payseriesno")String payseriesno);
+
+    PrintInvoiceData getAmountInfoAndReceivablefee(@Param("accountId")BigInteger accountId ,@Param("maxPeriod")Integer maxPeriod, @Param("minPeriod")Integer minPeriod);
+
+    PrintInvoiceData getAccountBaseInfo(@Param("accountId")BigInteger accountId );
+
+    PrintInvoiceData getPayInvoiceType(@Param("payseriesno")String payseriesno );
+
+
 }

+ 3 - 1
smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/PayInvoiceDto.java

@@ -25,7 +25,9 @@ public class PayInvoiceDto {
     private BigInteger id;
     @ApiModelProperty(value = "收据号码")
     private String invoiceno;
-    @ApiModelProperty(value = "客户编号")
+    @ApiModelProperty(value = "用户id")
+    private String accountId;
+    @ApiModelProperty(value = "客户名称")
     private String accountnumber;
     @ApiModelProperty(value = "客户名称")
     private String accountname;

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

@@ -20,6 +20,9 @@ import java.util.List;
 @ApiModel("打印信息")
 public class PrintInvoiceData {
 
+    @ApiModelProperty(value="收据模板类型:0:默认 1:开鲁 2:盖州")
+    private Integer payInvoiceType;
+
     @ApiModelProperty(value = "收据类型:1充值 2缴费")
     private Integer printType ;
     @ApiModelProperty(value = "客户名称(水司名称)")
@@ -66,11 +69,17 @@ public class PrintInvoiceData {
     @ApiModelProperty(value = "实收信息")
     private List<PrintReceivedInfo> printReceivedInfo;
 
+    @ApiModelProperty(value = "账期年" ,hidden = true)
+    private Integer year;
+    @ApiModelProperty(value = "账期月" ,hidden = true)
+    private Integer month;
+
     @ApiModelProperty(value = "最大账期(year*12+month)" ,hidden = true)
     private Integer maxPeriod;
     @ApiModelProperty(value = "最小账期(year*12+month)" ,hidden = true)
     private Integer minPeriod;
 
+
     @ApiModelProperty("水表表号")
     private String eleno;
     @ApiModelProperty("水表档案号")
@@ -84,4 +93,12 @@ public class PrintInvoiceData {
     @ApiModelProperty(value = "用水性质名称" )
     private String waterPropertyName;
 
+    @ApiModelProperty("一阶水价")
+    private String totalPrice;
+    @ApiModelProperty("一阶水价")
+    private String livingareaName;
+
+    @ApiModelProperty("结算水量")
+    private String payamount;
+
 }

+ 3 - 0
smart-city-platform/src/main/java/com/bz/smart_city/entity/Customer.java

@@ -62,4 +62,7 @@ public class Customer implements Serializable {
 
     @ApiModelProperty(value="子客户数量")
     private Integer childrenNum;
+
+    @ApiModelProperty(value="收据类型:0:默认 1:开鲁 2:盖州")
+    private Integer payInvoiceType;
 }

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

@@ -74,7 +74,7 @@ public class AmountSynByDayServiceImpl implements AmountSynByDayService, Initial
 
         boolean exists = jobAndTriggerService.isExists(entity);
         if(!exists){
-            String cron = "0 */1 * * * ?";
+            String cron = "0 * */1 * * ?";
             log.info("水量每天同步:" + cron);
             entity.setCronExpression(cron);
             entity.setJobClassName(AmountSyncByDayJob.class.getName());

+ 80 - 19
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayInvoiceServiceImpl.java

@@ -167,7 +167,7 @@ public class PayInvoiceServiceImpl implements PayinvoiceService {
      * @param payseriesno
      * @return
      */
-    public PrintInvoiceData getPrintDataOfTrans2(String payseriesno){
+    public PrintInvoiceData getPrintDataOfTrans(String payseriesno){
         LoginUser loginUser=UserUtil.getCurrentUser();
         PrintInvoiceData printInvoiceData=payInvoiceMapper.getPrintDataOfTran(payseriesno,loginUser.getSiteId(),loginUser.getCustomerId());
         if(printInvoiceData!=null){
@@ -192,33 +192,89 @@ public class PayInvoiceServiceImpl implements PayinvoiceService {
         return printInvoiceData;
     }
 
-    public PrintInvoiceData getPrintDataOfTrans(String payseriesno){
-        LoginUser loginUser=UserUtil.getCurrentUser();
-        PrintInvoiceData printInvoiceData=payInvoiceMapper.getPrintDataOfTran(payseriesno,loginUser.getSiteId(),loginUser.getCustomerId());
+    public PrintInvoiceData getPrintDataOfTransKailu(String payseriesno){
+        PrintInvoiceData printInvoiceData=payInvoiceMapper.countTransactiondetails(payseriesno);
+        PrintInvoiceData printDataKailu;
         if(printInvoiceData!=null){
-            PrintInvoiceData printDataKailu = payInvoiceMapper.getPrintDataKailu(printInvoiceData.getAccountId());
-
-            printInvoiceData.setWaterPropertyName(printDataKailu.getWaterPropertyName());
-            printInvoiceData.setMetercode(printDataKailu.getMetercode());
-            printInvoiceData.setEleno(printDataKailu.getEleno());
-            printInvoiceData.setPrice1(printDataKailu.getPrice1());
-            printInvoiceData.setPrice4(printDataKailu.getPrice4());
-
+            printDataKailu = payInvoiceMapper.getPrintDataKailu(printInvoiceData.getAccountId());
+            printDataKailu.setTransamount(printInvoiceData.getTransamount());
+            printDataKailu.setCreateBy(printInvoiceData.getCreateBy());
+            printDataKailu.setRemaining(printInvoiceData.getRemaining());
+            printDataKailu.setLastRemaining(printInvoiceData.getLastRemaining());
             DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
             if(printInvoiceData.getCreateDate()!=null){
-                printInvoiceData.setPaydate(df.format(printInvoiceData.getCreateDate()));
+                printDataKailu.setPaydate(df.format(printInvoiceData.getCreateDate()));
             }else{
-                printInvoiceData.setPaydate(df.format(LocalDateTime.now()));
+                printDataKailu.setPaydate(df.format(LocalDateTime.now()));
             }
         }else{
             throw new ServiceException(ResultStatus.OPERATE_RECORD_NOT_EXIT);
         }
-        printInvoiceData.setPrintType(1);
-        printInvoiceData.setPayseriesno(payseriesno);
-        printInvoiceData.setInvoiceNo(
+        printDataKailu.setPrintType(1);
+        printDataKailu.setPayseriesno(payseriesno);
+        printDataKailu.setInvoiceNo(
                 DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS").format(LocalDateTime.now())+""+(int)(Math.random()*1000));
-        return printInvoiceData;
+        return printDataKailu;
+    }
+
+    public PrintInvoiceData getPrintDataOfTransGaizhou(String payseriesno){
+
+        //查询交易
+        PrintInvoiceData printInvoiceData=payInvoiceMapper.countTransactiondetails(payseriesno);
+        if(printInvoiceData == null){
+            //没有查询到交易信息
+            throw new ServiceException(ResultStatus.OPERATE_RECORD_NOT_EXIT);
+        }
+        BigInteger accountId=printInvoiceData.getAccountId();
+        //查询账期信息
+        PrintInvoiceData printInvoiceDataPeriod=payInvoiceMapper.getAmountPeriod(payseriesno);
+        Integer maxPeriod;
+        Integer minPeriod;
+        if(printInvoiceDataPeriod != null){
+            maxPeriod=printInvoiceDataPeriod.getMaxPeriod();
+            minPeriod=printInvoiceDataPeriod.getMinPeriod();
+        }else{
+            maxPeriod=printInvoiceData.getMinPeriod();
+            minPeriod=printInvoiceData.getMinPeriod();
+        }
+        //查询水量应收信息
+        PrintInvoiceData printInvoiceDataReceivablefee=payInvoiceMapper.getAmountInfoAndReceivablefee(accountId,maxPeriod,minPeriod);
+        //查询客户基础信息
+        PrintInvoiceData printInvoiceDataAccountBaseInfo=payInvoiceMapper.getAccountBaseInfo(accountId);
+
+        //拼装数据
+        printInvoiceDataAccountBaseInfo.setReading(printInvoiceDataReceivablefee.getReading());
+        printInvoiceDataAccountBaseInfo.setRecorddate(printInvoiceDataReceivablefee.getRecorddate());
+        printInvoiceDataAccountBaseInfo.setLastreading(printInvoiceDataReceivablefee.getLastreading());
+        printInvoiceDataAccountBaseInfo.setLastrecorddate(printInvoiceDataReceivablefee.getLastrecorddate());
+        printInvoiceDataAccountBaseInfo.setPayamount(printInvoiceDataReceivablefee.getPayamount());
+        printInvoiceDataAccountBaseInfo.setReceivablefee(printInvoiceDataReceivablefee.getReceivablefee());
+        if(printInvoiceData.getRemaining().compareTo(BigDecimal.ZERO) == 1 ){
+            printInvoiceDataAccountBaseInfo.setRemaining(printInvoiceData.getRemaining());
+        }
+        printInvoiceDataAccountBaseInfo.setCreateBy(printInvoiceData.getCreateBy());
+        printInvoiceDataAccountBaseInfo.setCreateDate(printInvoiceData.getCreateDate());
+        printInvoiceDataAccountBaseInfo.setTransamount(printInvoiceData.getTransamount());
+
+        BigDecimal lastRemaining = printInvoiceDataAccountBaseInfo.getRemaining()
+                                    .add(printInvoiceDataAccountBaseInfo.getReceivablefee())
+                                    .subtract(printInvoiceDataAccountBaseInfo.getTransamount());
+        printInvoiceDataAccountBaseInfo.setLastRemaining(lastRemaining);
+
+        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        if(printInvoiceData.getCreateDate()!=null){
+            printInvoiceDataAccountBaseInfo.setPaydate(df.format(printInvoiceData.getCreateDate()));
+        }else{
+            printInvoiceDataAccountBaseInfo.setPaydate(df.format(LocalDateTime.now()));
+        }
+
+        printInvoiceDataAccountBaseInfo.setPrintType(1);
+        printInvoiceDataAccountBaseInfo.setPayseriesno(payseriesno);
+        printInvoiceDataAccountBaseInfo.setInvoiceNo(
+                DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS").format(LocalDateTime.now())+""+(int)(Math.random()*1000));
+        return printInvoiceDataAccountBaseInfo;
     }
+
     /**
      * 打印收据——缴纳欠费(transtype == null || (transtype ==2 ||transtype ==4))
      * @param payseriesno
@@ -228,7 +284,7 @@ public class PayInvoiceServiceImpl implements PayinvoiceService {
     public PrintInvoiceData getPrintDataOfReceived(String payseriesno){
         LoginUser loginUser=UserUtil.getCurrentUser();
         //收费区间信息和抄表信息
-        PrintInvoiceData printInvoiceData=payInvoiceMapper.getDateRangeInfoPrint(payseriesno,loginUser.getSiteId(),loginUser.getCustomerId());
+        PrintInvoiceData printInvoiceData=payInvoiceMapper.getDateRangeInfoPrint(payseriesno);
         DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
         if(printInvoiceData.getCreateDate()!=null){
             printInvoiceData.setPaydate(df.format(printInvoiceData.getCreateDate()));
@@ -297,4 +353,9 @@ public class PayInvoiceServiceImpl implements PayinvoiceService {
         payInvoiceMapper.deleteReceivedPrint(id);
         payInvoiceMapper.cancelPayInvoice(id,LocalDateTime.now(),BigInteger.valueOf(loginUser.getId()));
     }
+
+    public PrintInvoiceData getPayInvoiceType(String payseriesno){
+        return payInvoiceMapper.getPayInvoiceType(payseriesno);
+    }
+
 }

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

@@ -1,6 +1,8 @@
 package com.bz.smart_city.service.impl.pay;
 
+import com.bz.smart_city.commom.exception.ServiceException;
 import com.bz.smart_city.commom.model.Pagination;
+import com.bz.smart_city.commom.util.ExcelUtil;
 import com.bz.smart_city.commom.util.UserUtil;
 import com.bz.smart_city.dao.pay.PayReportMapper;
 import com.bz.smart_city.dto.LoginUser;
@@ -8,14 +10,19 @@ import com.bz.smart_city.dto.pay.*;
 import com.bz.smart_city.service.pay.PayAgenttransactionService;
 import com.bz.smart_city.service.pay.PayReportService;
 import com.github.pagehelper.PageHelper;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
 import java.math.BigDecimal;
 import java.math.BigInteger;
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.List;
 
+import static com.google.common.collect.Lists.newArrayList;
+
 /**
  * @Author: ZJY
  * @DATE: 2020-07-28 11:18
@@ -175,4 +182,198 @@ public class PayReportServiceImpl implements PayReportService {
         //return new Pagination<>(reList);
     }
 
+    /**
+     * 导出用户欠费明细表
+     * @param payArrearagedetailsReportDto
+     * @param httpServletResponse
+     */
+    public void getDebtListExcel(PayArrearagedetailsReportDto payArrearagedetailsReportDto, HttpServletResponse httpServletResponse){
+
+        LoginUser loginUser = UserUtil.getCurrentUser();
+        BigInteger customerId = new BigInteger(String.valueOf(loginUser.getCustomerId()));
+        payArrearagedetailsReportDto.setCustomerId(customerId);
+        BigInteger siteId = new BigInteger(String.valueOf(loginUser.getSiteId()));
+        payArrearagedetailsReportDto.setSiteId(siteId);
+
+        String title = "欠费用户明细表";//表头名称
+        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        //列名
+        String[] rowsName = new String[]{"序号","客户编码","客户名称","地址","水量","水费","污水费","不征税自来水","违约金","超计划水费","合计金额","联系方式"};
+        List<PayArrearagedetailsReportDto> reSubList = new ArrayList<>();
+        List<PayArrearagedetailsReportDto> reList = payReportMapper.getPayArrearagedetailsReportList(payArrearagedetailsReportDto);
+        if(reList != null && reList.size() > 0){
+            PayArrearagedetailsReportDto totalDto = new PayArrearagedetailsReportDto();
+            Integer payamount = 0;
+            BigDecimal payamountFee = BigDecimal.ZERO;
+            BigDecimal polluteFee= BigDecimal.ZERO;
+            BigDecimal taxExemptFee= BigDecimal.ZERO;
+            BigDecimal penltyFee= BigDecimal.ZERO;
+            BigDecimal outLevelFee= BigDecimal.ZERO;
+            BigDecimal subtotal= BigDecimal.ZERO;
+            for(int i=0;i<reList.size();i++){
+                payamount = payamount + reList.get(i).getPayamount();//水量
+                payamountFee = payamountFee.add(reList.get(i).getPayamountFee());//水费
+                polluteFee = polluteFee.add(reList.get(i).getPolluteFee());//污水费
+                taxExemptFee = taxExemptFee.add(reList.get(i).getTaxExemptFee());//不征税
+                penltyFee = penltyFee.add(reList.get(i).getPenltyFee());//违约金
+                outLevelFee = outLevelFee.add(reList.get(i).getOutLevelFee());//超计划水费
+                subtotal = subtotal.add(reList.get(i).getSubtotal());//合计
+            }
+            totalDto.setPayamount(payamount);
+            totalDto.setPayamountFee(payamountFee);;
+            totalDto.setPolluteFee(polluteFee);
+            totalDto.setTaxExemptFee(taxExemptFee);
+            totalDto.setPenltyFee(penltyFee);
+            totalDto.setOutLevelFee(outLevelFee);
+            totalDto.setSubtotal(subtotal);
+            totalDto.setAccountNumber("合计");
+            reSubList.add(totalDto);
+            reSubList.addAll(reList);
+        }
+
+        List<Object[]> dataList = newArrayList();
+        Object[] objs = null;
+        BigDecimal db =  new BigDecimal("0.0");
+        for(int i=0; i<reSubList.size() ; i++){
+            PayArrearagedetailsReportDto dto = reSubList.get(i);
+            objs = new Object[rowsName.length];
+            objs[0] = i;
+            objs[1] = dto != null && StringUtils.isNotBlank(dto.getAccountNumber()) ? dto.getAccountNumber() : "";
+            objs[2] = dto != null && StringUtils.isNotBlank(dto.getAccountName()) ? dto.getAccountName() : "";
+            objs[3] = dto != null && StringUtils.isNotBlank(dto.getAccountAddr()) ? dto.getAccountAddr() : "" ;
+            objs[4] = dto != null && dto.getPayamount() != null ? dto.getPayamount() : db;
+            objs[5] = dto != null && dto.getPayamountFee() != null ? dto.getPayamountFee() : db;
+            objs[6] = dto != null && dto.getPolluteFee() != null ? dto.getPolluteFee() : db;
+            objs[7] = dto != null && dto.getTaxExemptFee() != null ? dto.getTaxExemptFee() : db;
+            objs[8] = dto != null && dto.getPenltyFee() != null ? dto.getPenltyFee() : db;
+            objs[9] = dto != null && dto.getOutLevelFee() != null ? dto.getOutLevelFee() : db;
+            objs[10] = dto != null && dto.getSubtotal() != null ? dto.getSubtotal() : db;
+            objs[11] = dto != null && StringUtils.isNotBlank(dto.getMobilePhone()) ? dto.getMobilePhone() : "";
+            dataList.add(objs);
+        }
+        ExcelUtil excelUtil = new ExcelUtil(title, rowsName, dataList);
+        try {
+            excelUtil.export(httpServletResponse);
+        } catch (Exception e) {
+            throw new ServiceException(-900, "导出异常");
+        }
+    }
+
+    /**
+     * 导出操作员明细表
+     * @param payOperatordetailsReportDto
+     * @param httpServletResponse
+     */
+    public void getOperatordetListExcel(PayOperatordetailsReportDto payOperatordetailsReportDto, HttpServletResponse httpServletResponse){
+
+        LoginUser loginUser = UserUtil.getCurrentUser();
+        BigInteger customerId = new BigInteger(String.valueOf(loginUser.getCustomerId()));
+        payOperatordetailsReportDto.setCustomerId(customerId);
+        BigInteger siteId = new BigInteger(String.valueOf(loginUser.getSiteId()));
+        payOperatordetailsReportDto.setSiteId(siteId);
+
+        String title = "收费员明细表";//表头名称
+        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        //列名
+        String[] rowsName = new String[]{"序号","客户名称","小区","客户编码","地址","预存款","实收款","小计","收费时间","收费员"};
+        List<PayOperatordetailsReportDto> reSubList = new ArrayList<>();
+        List<PayOperatordetailsReportDto> reList = payReportMapper.getPayOperatordetailsReportList(payOperatordetailsReportDto);
+        if(reList != null && reList.size() > 0){
+            PayOperatordetailsReportDto totalDto = new PayOperatordetailsReportDto();
+            BigDecimal receivedCount = BigDecimal.ZERO;
+            BigDecimal transamount = BigDecimal.ZERO;
+            BigDecimal subtotal = BigDecimal.ZERO;
+            for(int i=0;i<reList.size();i++){
+                receivedCount = receivedCount.add(reList.get(i).getReceivedCount());
+                transamount = transamount.add(reList.get(i).getTransamount());
+                subtotal = subtotal.add(reList.get(i).getSubtotal());
+            }
+            totalDto.setSubtotal(subtotal);
+            totalDto.setTransamount(transamount);
+            totalDto.setReceivedCount(receivedCount);
+            totalDto.setAccountName("合计");
+            reSubList.add(totalDto);
+            reSubList.addAll(reList);
+        }
+
+        List<Object[]> dataList = newArrayList();
+        Object[] objs = null;
+        BigDecimal db =  new BigDecimal("0.0");
+        for(int i=0; i<reSubList.size() ; i++){
+            PayOperatordetailsReportDto dto = reSubList.get(i);
+            objs = new Object[rowsName.length];
+            objs[0] = i;
+            objs[1] = dto != null && StringUtils.isNotBlank(dto.getAccountName()) ? dto.getAccountName() : "";
+            objs[2] = dto != null && StringUtils.isNotBlank(dto.getCommunityName()) ? dto.getCommunityName() : "";
+            objs[3] = dto != null && StringUtils.isNotBlank(dto.getAccountNumber()) ? dto.getAccountNumber() : "";
+            objs[4] = dto != null && StringUtils.isNotBlank(dto.getAccountAddr()) ? dto.getAccountAddr() : "";
+            objs[5] = dto != null && dto.getTransamount() != null ? dto.getTransamount() : db;
+            objs[6] = dto != null && dto.getReceivedCount() != null ? dto.getReceivedCount() : db;
+            objs[7] = dto != null && dto.getSubtotal() != null ? dto.getSubtotal() : db;
+            objs[8] = dto != null && dto.getTransTime() != null ? dto.getTransTime() : null;
+            objs[9] = dto != null && dto.getCreateByName() != null ? dto.getCreateByName() : "";
+            dataList.add(objs);
+        }
+        ExcelUtil excelUtil = new ExcelUtil(title, rowsName, dataList);
+        try {
+            excelUtil.export(httpServletResponse);
+        } catch (Exception e) {
+            throw new ServiceException(-900, "导出异常");
+        }
+    }
+
+    /**
+     * 导出收费明细表
+     * @param payTransactiondetailsReportDto
+     * @param httpServletResponse
+     */
+    public void getTranExcel(PayTransactiondetailsReportDto payTransactiondetailsReportDto,HttpServletResponse httpServletResponse){
+
+        LoginUser loginUser = UserUtil.getCurrentUser();
+        BigInteger customerId = new BigInteger(String.valueOf(loginUser.getCustomerId()));
+        payTransactiondetailsReportDto.setCustomerId(customerId);
+        BigInteger siteId = new BigInteger(String.valueOf(loginUser.getSiteId()));
+        payTransactiondetailsReportDto.setSiteId(siteId);
+
+        String title = "收费明细表";//表头名称
+        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        //列名
+        String[] rowsName = new String[]{"序号","客户编码","客户名称","地址","收费金额","支付方式","收费时间","收费员"};
+        List<PayTransactiondetailsReportDto> reSubList = new ArrayList<>();
+        List<PayTransactiondetailsReportDto> reList = payReportMapper.getPayTransactiondetailsReportList(payTransactiondetailsReportDto);
+        if(reList != null && reList.size() > 0){
+            PayTransactiondetailsReportDto totalDto = new PayTransactiondetailsReportDto();
+            BigDecimal transAmount = BigDecimal.ZERO;
+            for(int i=0;i<reList.size();i++){
+                transAmount = transAmount.add(reList.get(i).getTransAmount());
+            }
+            totalDto.setTransAmount(transAmount);
+            totalDto.setAccountNumber("合计");
+            reSubList.add(totalDto);
+            reSubList.addAll(reList);
+        }
+
+        List<Object[]> dataList = newArrayList();
+        Object[] objs = null;
+        BigDecimal db =  new BigDecimal("0.0");
+        for(int i=0; i<reSubList.size() ; i++){
+            PayTransactiondetailsReportDto dto = reSubList.get(i);
+            objs = new Object[rowsName.length];
+            objs[0] = i;
+            objs[1] = dto != null && StringUtils.isNotBlank(dto.getAccountNumber()) ? dto.getAccountNumber() : "";
+            objs[2] = dto != null && StringUtils.isNotBlank(dto.getAccountName()) ? dto.getAccountName() : "";
+            objs[3] = dto != null && StringUtils.isNotBlank(dto.getAccountAddr()) ? dto.getAccountAddr() : "";
+            objs[4] = dto != null && dto.getTransAmount() != null ? dto.getTransAmount() : db;
+            objs[5] = dto != null && StringUtils.isNotBlank(dto.getPaywayLabel()) ? dto.getPaywayLabel() : "";
+            objs[6] = dto != null && dto.getTransTime() != null ? dto.getTransTime() : null;
+            objs[7] = dto != null && dto.getCreateByName() != null ? dto.getCreateByName() : "";
+            dataList.add(objs);
+        }
+        ExcelUtil excelUtil = new ExcelUtil(title, rowsName, dataList);
+        try {
+            excelUtil.export(httpServletResponse);
+        } catch (Exception e) {
+            throw new ServiceException(-900, "导出异常");
+        }
+    }
 }

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

@@ -5,6 +5,8 @@ import com.bz.smart_city.dto.pay.PayArrearagedetailsReportDto;
 import com.bz.smart_city.dto.pay.PayOperatordetailsReportDto;
 import com.bz.smart_city.dto.pay.PayTransactiondetailsReportDto;
 
+import javax.servlet.http.HttpServletResponse;
+
 /**
  * @Author: ZJY
  * @DATE: 2020-07-28 11:17
@@ -16,4 +18,10 @@ public interface PayReportService {
     Pagination<PayOperatordetailsReportDto> getPayOperatordetailsReport(PayOperatordetailsReportDto payOperatordetailsReportDto,int pageNum,int pageSize);
 
     Pagination<PayArrearagedetailsReportDto> getPayArrearagedetailsReport(PayArrearagedetailsReportDto payArrearagedetailsReportDto, int pageNum, int pageSize);
+
+    void getDebtListExcel(PayArrearagedetailsReportDto payArrearagedetailsReportDto, HttpServletResponse httpServletResponse);
+
+    void getOperatordetListExcel(PayOperatordetailsReportDto payOperatordetailsReportDto, HttpServletResponse httpServletResponse);
+
+    void getTranExcel(PayTransactiondetailsReportDto payTransactiondetailsReportDto,HttpServletResponse httpServletResponse);
 }

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

@@ -52,13 +52,15 @@ public interface PayinvoiceService {
     void savePrintInfo(String payseriesno,String invoiceno);
 
     /**
-     * 打印收据——仅充值(payway==4 && transtype ==1)
+     * 打印收据——仅充值
      * @param payseriesno
      * @return
      */
-    PrintInvoiceData getPrintDataOfTrans2(String payseriesno);
     PrintInvoiceData getPrintDataOfTrans(String payseriesno);
 
+    PrintInvoiceData getPrintDataOfTransKailu(String payseriesno);
+
+    PrintInvoiceData getPrintDataOfTransGaizhou(String payseriesno);
     /**
      * 打印收据——缴纳欠费(transtype == null || (transtype ==2 ||transtype ==4))
      * @param payseriesno
@@ -78,4 +80,11 @@ public interface PayinvoiceService {
      * @param id
      */
     void cancelPrintInfo(BigInteger id);
+
+    /**
+     * 获取票据打印类型
+     * @param payseriesno
+     * @return
+     */
+    PrintInvoiceData getPayInvoiceType(String payseriesno  );
 }

+ 18 - 6
smart-city-platform/src/main/resources/mapper/CustomerMapper.xml

@@ -20,6 +20,7 @@
         <result column="update_by" property="updateBy" jdbcType="VARCHAR"/>
         <result column="parent_id" property="parentId" jdbcType="INTEGER"/>
         <result column="children_num" property="childrenNum" jdbcType="INTEGER"/>
+        <result column="pay_invoice_type" property="payInvoiceType" jdbcType="INTEGER"/>
     </resultMap>
 
     <!--auto generated Code-->
@@ -40,7 +41,8 @@
         create_by,
         update_by,
         parent_id,
-        children_num
+        children_num,
+        pay_invoice_type
     </sql>
 
     <!--auto generated Code-->
@@ -62,7 +64,8 @@
             create_by,
             update_by,
             parent_id,
-            children_num
+            children_num,
+            pay_invoice_type
         ) VALUES (
             #{customer.id,jdbcType=INTEGER},
             #{customer.siteId,jdbcType=INTEGER},
@@ -80,7 +83,8 @@
             #{customer.createBy,jdbcType=VARCHAR},
             #{customer.updateBy,jdbcType=VARCHAR},
             #{customer.parentId,jdbcType=INTEGER},
-            #{customer.childrenNum,jdbcType=INTEGER}
+            #{customer.childrenNum,jdbcType=INTEGER},
+            #{customer.payInvoiceType,jdbcType=INTEGER}
         )
     </insert>
 
@@ -105,6 +109,9 @@
             <if test="customer.updateBy!=null"> update_by,</if>
             <if test="customer.parentId!=null"> parent_id,</if>
             <if test="customer.childrenNum!=null"> children_num,</if>
+            <if test="customer.childrenNum!=null"> children_num,</if>
+            <if test="customer.childrenNum!=null"> children_num,</if>
+            <if test="customer.payInvoiceType!=null"> pay_invoice_type,</if>
         </trim>
         VALUES
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -142,6 +149,8 @@
             </if>
             <if test="customer.childrenNum!=null">#{customer.childrenNum,jdbcType=INTEGER},
             </if>
+            <if test="customer.payInvoiceType!=null">#{customer.pay_invoice_type,jdbcType=INTEGER},
+            </if>
         </trim>
     </insert>
 
@@ -164,7 +173,8 @@
             create_by,
             update_by,
             parent_id,
-            children_num
+            children_num,
+            pay_invoice_type
         )VALUES
         <foreach collection="customers" item="customer" index="index" separator=",">
             (
@@ -184,7 +194,8 @@
             #{customer.createBy,jdbcType=VARCHAR},
             #{customer.updateBy,jdbcType=VARCHAR},
             #{customer.parentId,jdbcType=INTEGER},
-            #{customer.childrenNum,jdbcType=INTEGER}
+            #{customer.childrenNum,jdbcType=INTEGER},
+            #{customer.payInvoiceType,jdbcType=INTEGER}
             )
         </foreach>
     </insert>
@@ -208,7 +219,8 @@
             <if test="customer.createBy != null"> create_by= #{customer.createBy,jdbcType=VARCHAR},</if>
             <if test="customer.updateBy != null"> update_by= #{customer.updateBy,jdbcType=VARCHAR},</if>
             <if test="customer.parentId != null"> parent_id= #{customer.parentId,jdbcType=INTEGER},</if>
-            <if test="customer.childrenNum != null"> children_num= #{customer.childrenNum,jdbcType=INTEGER}</if>
+            <if test="customer.childrenNum != null"> children_num= #{customer.childrenNum,jdbcType=INTEGER},</if>
+            <if test="customer.payInvoiceType != null"> pay_invoice_type= #{customer.payInvoiceType,jdbcType=INTEGER}</if>
         </set>
         WHERE id = #{customer.id,jdbcType=INTEGER}
     </update>

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

@@ -55,6 +55,7 @@
         select
         a.id,
         a.invoiceno as "invoiceno",
+        a.account_id as "accountId",
         a.accountnumber as "accountnumber",
         a.accountname as "accountname",
         a.invoiceamount as "invoiceamount",
@@ -72,6 +73,7 @@
         select
         a.id,
         a.invoiceno as "invoiceno",
+        a.account_id as "accountId",
         a.accountnumber as "accountnumber",
         a.accountname as "accountname",
         a.invoiceamount as "invoiceamount",
@@ -178,22 +180,29 @@
             ,account.accountnumber
             ,account.address
             ,u.name AS "createBy"
+            ,a.year
+            ,a.month
             ,(select  customer_name from sc_customer where id=#{customerId}) as "customerName"
         from pay_pay_transactiondetails a
         left join pay_base_account account on account.id=a.account_id
         left join sc_user u on u.id=a.create_by
         where a.payseriesno =#{payseriesno} and a.site_id=#{siteId} and a.customer_id=#{customerId}
-            and a.canceledrecord_id is null and a.iscanceled=0
+            and a.canceledrecord_id is null and a.iscanceled=0 and payway != 5
     </select>
 
     <select id="getPrintDataKailu" resultType="com.bz.smart_city.dto.pay.payfee.PrintInvoiceData">
      select
             d.water_meter_no as eleno
+            ,account.id AS "accountId"
+            ,account.name AS "accountname"
+            ,account.accountnumber
+            ,account.address
             ,c.metercode
             ,p.name as waterPropertyName
             ,p.price1 as price1
             ,p.price4 as price4
         from pay_base_customerandmeterrela c
+        left join pay_base_account account on account.id=c.account_id
         left join sc_device d on c.watermeter_id=d.id
         left join (
                 select
@@ -229,12 +238,13 @@
             max(amount.reading) as "reading",
             min(amount.lastreading) as "lastreading",
             max(reced.create_date) as "createDate",
+            sum(amount.payamount) as "payamount",
             (select name from sc_user where id=max(reced.create_by)) as "createBy",
-            (select  customer_name from sc_customer where id=#{customerId}) as "customerName"
+            (select  customer_name from sc_customer where id=max(reced.customer_id)) as "customerName"
         from pay_pay_received reced
         left join pay_pay_receivable rece on reced.receivable_id=rece.id
         left join pay_amount_waterusedamount amount on amount.id=rece.usedamount_id
-        where reced.payseriesno=#{payseriesno} and reced.site_id=#{siteId} and reced.customer_id=#{customerId}
+        where reced.payseriesno=#{payseriesno}
         group by amount.account_id
 
     </select>
@@ -344,4 +354,101 @@
         where id=#{id}
 
     </update>
+
+
+    <select id="countTransactiondetails" resultType="com.bz.smart_city.dto.pay.payfee.PrintInvoiceData">
+         select
+            account_id as "accountId"
+            ,max(minPeriod) minPeriod
+            ,max(remaining)  remaining
+            ,max(lastRemaining)	 lastRemaining
+            ,max(createBy) createBy
+            ,max(createDate)  createDate
+            ,sum(transamount) transamount
+        from (
+            select
+                account_id
+                ,max(year*12 + month ) minPeriod
+                ,max(lastrecreamaing)  remaining
+                ,max(remaining)	 lastRemaining
+                ,(select u.name from sc_user u where id = max(t.create_by)) createBy
+                ,max(create_date)  createDate
+                ,sum(case when payway != 5 then transamount else 0 end ) transamount
+            from pay_pay_transactiondetails t
+            where payseriesno=#{payseriesno}
+            group by account_id
+            union all
+            select
+                account_id
+                ,0 minPeriod
+                ,0  remaining
+                ,0	lastRemaining
+                ,(select u.name from sc_user u where id = max(r.create_by)) createBy
+                ,max(create_date)  createDate
+                ,sum(case when payway != 5 then r.receivedamount else 0 end ) transamount
+            from pay_pay_received r
+            where payseriesno=#{payseriesno}
+            group by account_id
+        ) t
+        group by account_id
+
+    </select>
+
+    <select id="getAmountPeriod" resultType="com.bz.smart_city.dto.pay.payfee.PrintInvoiceData">
+        select
+            max(amount.year*12+amount.`month`) as  "maxPeriod",
+            min(amount.year*12+amount.`month`) as  "minPeriod"
+        from pay_pay_received reced
+        left join pay_pay_receivable rece on reced.receivable_id=rece.id
+        left join pay_amount_waterusedamount amount on amount.id=rece.usedamount_id
+        where reced.payseriesno=#{payseriesno}
+    </select>
+    <select id="getAmountInfoAndReceivablefee" resultType="com.bz.smart_city.dto.pay.payfee.PrintInvoiceData">
+        select
+        amount.account_id
+        ,ifnull(sum(rece.receivablefee),0) receivablefee
+        ,ifnull(sum(amount.payamount),0) payamount
+        ,ifnull(min(amount.lastreading),0) lastreading
+        ,ifnull(min(amount.lastrecorddate),0) lastrecorddate
+        ,ifnull(max(amount.reading),0) reading
+        ,ifnull(max(amount.recorddate),0) recorddate
+        from pay_amount_waterusedamount amount
+        left join pay_pay_receivable rece on rece.usedamount_id =amount.id
+        where amount.account_id =#{accountId}
+        and  amount.year*12 + amount.month &lt;= #{maxPeriod}
+        and  amount.year*12 + amount.month >= #{minPeriod}
+        group by amount.account_id
+    </select>
+    <select id="getAccountBaseInfo" resultType="com.bz.smart_city.dto.pay.payfee.PrintInvoiceData">
+        select
+            a.accountnumber
+            ,a.name as accountname
+            ,a.address as address
+            ,p.totalprice_l1 as totalPrice
+            ,d.water_meter_no as eleno
+            ,l.`name` as livingareaName
+            ,re.remaining
+        from pay_base_account a
+        left join pay_base_customerandmeterrela c on c.account_id=a.id
+        left join pay_pay_rechargeaccount re on re.account_id =a.id
+        left join pay_base_waterproperty p on p.id=c.waterproperty_id
+        left join sc_device d on d.id=c.watermeter_id
+        left join sc_building bd on bd.id=d.building_id
+        left join sc_community l on l.id=bd.community
+        where a.id= #{accountId}
+    </select>
+
+
+    <select id="getPayInvoiceType" resultType="com.bz.smart_city.dto.pay.payfee.PrintInvoiceData">
+        select
+            max(printType) printType
+            ,max(c.pay_invoice_type) payInvoiceType
+        from (
+        select account_id , 1 printType ,customer_id from pay_pay_transactiondetails   where payseriesno = #{payseriesno}
+        union all
+        select account_id , 2 printType ,customer_id from pay_pay_received   where payseriesno = #{payseriesno}
+        ) t
+        left join sc_customer c on c.id =t.customer_id
+
+    </select>
 </mapper>

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

@@ -105,7 +105,7 @@
         ppr.payseriesno
         FROM pay_pay_received ppr
         LEFT JOIN pay_base_account pba on ppr.account_id = pba.id
-        LEFT JOIN sc_community scc on scc.`code` = substring(pba.accountnumber,1,3)
+        LEFT JOIN sc_community scc on scc.`code` = substring(pba.accountnumber,1,3) and scc.`status`=1 and scc.customer_id =#{customerId}
         LEFT JOIN sc_user scu on scu.id = ppr.create_by
         LEFT JOIN pay_pay_transactiondetails ppt on ppt.payseriesno = ppr.payseriesno and ppt.transtype = 4
         <where>
@@ -134,7 +134,7 @@
             ppt.payseriesno
         FROM pay_pay_transactiondetails ppt
         LEFT JOIN pay_base_account pba on ppt.account_id = pba.id
-        LEFT JOIN sc_community scc on scc.`code` = substring(ppt.accountnumber,1,3)
+        LEFT JOIN sc_community scc on scc.`code` = substring(ppt.accountnumber,1,3) and scc.`status`=1 and scc.customer_id =#{customerId}
         LEFT JOIN sc_user scu on scu.id = ppt.create_by
         WHERE ppt.canceledrecord_id is null and ppt.iscanceled =0 and ppt.transtype != 4 AND ppt.transtype != 2 and ppt.transamount>0
         <if test="customerId != null"> and ppt.customer_id = #{customerId}</if>

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

@@ -290,6 +290,7 @@
         select
         a.id,
         a.invoiceno as "invoiceno",
+        a.account_id as "accountId",
         a.accountnumber as "accountnumber",
         a.accountname as "accountname",
         a.invoiceamount as "invoiceamount",