Quellcode durchsuchen

增加收费员明细报表、欠费用户明细报表

zhoujiangyuan vor 4 Jahren
Ursprung
Commit
f3e7b09558

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

@@ -3,6 +3,7 @@ package com.bz.smart_city.controller.pay;
 import com.bz.smart_city.commom.model.AjaxMessage;
 import com.bz.smart_city.commom.model.Pagination;
 import com.bz.smart_city.commom.model.ResultStatus;
+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 com.bz.smart_city.service.pay.PayReportService;
@@ -16,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
@@ -31,17 +33,16 @@ public class PayReportController {
     @Autowired
     PayReportService payReportService;
 
-    @ApiOperation(value="交易明细报表")
+    @ApiOperation(value="收费明细报表")
     @GetMapping("/getPayTransactiondetailsReport")
     public AjaxMessage<Pagination<PayTransactiondetailsReportDto>> getPayTransactiondetailsReport(
-            @ApiParam(value = "部门ID", required = false) @RequestParam(required = false) Integer officeId,
+            @ApiParam(value = "机构ID", required = false) @RequestParam(required = false) Integer officeId,
             @ApiParam(value = "支付方式,字典类:type=支付方式", required = false) @RequestParam(required = false) Integer payway,
             @ApiParam(value = "收费员ID",required = false)@RequestParam(required = false) Integer operateId,
             @ApiParam(value = "开始时间yyyyMMddhhmmss", required = false) @RequestParam(required = false) String beginTime,
             @ApiParam(value = "结束时间yyyyMMddhhmmss", required = false) @RequestParam(required = false) String endTime,
             @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
-
     ){
         DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
         PayTransactiondetailsReportDto inParams = new PayTransactiondetailsReportDto();
@@ -62,12 +63,12 @@ public class PayReportController {
         return new AjaxMessage<>(ResultStatus.OK,pagination);
     }
 
-    @ApiOperation(value="操作员明细报表")
+    @ApiOperation(value="收费员明细报表")
     @GetMapping("/getPayOperatordetailsReport")
     public AjaxMessage<Pagination<PayOperatordetailsReportDto>> getPayOperatordetailsReport(
-            @ApiParam(value = "小区ID", required = false) @RequestParam(required = false) Integer communityId,
+            @ApiParam(value = "小区ID", required = false) @RequestParam(required = false) String communityId,
             @ApiParam(value = "收费员ID",required = false)@RequestParam(required = false) Integer operateId,
-            @ApiParam(value = "小计",required = false) @RequestParam(required = false) Integer subtotal,
+            @ApiParam(value = "小计值(与小计状态一起使用,如查询小计值大于100的)",required = false) @RequestParam(required = false) BigDecimal subtotal,
             @ApiParam(value = "小计状态,0等于,1小于,2大于",required = false) @RequestParam(required = false) Integer subtotalSt,
             @ApiParam(value = "开始时间yyyyMMddhhmmss", required = false) @RequestParam(required = false) String beginTime,
             @ApiParam(value = "结束时间yyyyMMddhhmmss", required = false) @RequestParam(required = false) String endTime,
@@ -75,7 +76,43 @@ public class PayReportController {
             @ApiParam(value = "条数,非必传,默认10条", required = false, defaultValue = "10") @RequestParam(required = false, defaultValue = "10") int pageSize
 
     ){
-        return null;
+        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)){
+            inParams.setBeginTime( LocalDateTime.parse(beginTime,df));
+        }
+        if(StringUtils.isNotBlank(endTime)){
+            inParams.setEndTime(LocalDateTime.parse(endTime, df));
+        }
+        if(subtotal != null)
+            inParams.setSubtotal(subtotal);
+        if(subtotalSt != null)
+            inParams.setDataType(subtotalSt);
+
+        Pagination<PayOperatordetailsReportDto> pagination = payReportService.getPayOperatordetailsReport(inParams,pageNum,pageSize);
+
+        return new AjaxMessage<>(ResultStatus.OK,pagination);
+    }
+
+    @ApiOperation(value = "欠费用户明细报表")
+    @GetMapping("/getPayArrearagedetailsReport")
+    public AjaxMessage<Pagination<PayArrearagedetailsReportDto>> getPayArrearagedetailsReport(
+            @ApiParam(value = "机构ID", required = false) @RequestParam(required = false) Integer officeId,
+            @ApiParam(value = "小区ID", required = false) @RequestParam(required = false) String communityId,
+            @ApiParam(value = "用户编码(模糊查询)", required = false) @RequestParam(required = false) String accountNumber,
+            @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
+    ){
+        PayArrearagedetailsReportDto  inParams = new PayArrearagedetailsReportDto();
+        inParams.setOfficeId(officeId);
+        inParams.setCommunity(communityId);
+        inParams.setAccountNumber(accountNumber);
+
+        Pagination<PayArrearagedetailsReportDto> pagination = payReportService.getPayArrearagedetailsReport(inParams,pageNum,pageSize);
+        return  new AjaxMessage<>(ResultStatus.OK,pagination);
     }
 
 }

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

@@ -1,5 +1,6 @@
 package com.bz.smart_city.dao.pay;
 
+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 org.apache.ibatis.annotations.Mapper;
@@ -14,8 +15,11 @@ import java.util.List;
 public interface PayReportMapper {
 
     List<PayTransactiondetailsReportDto>getPayTransactiondetailsReportList(PayTransactiondetailsReportDto inParams);
-
     PayTransactiondetailsReportDto getPayTransactiondetailsReportCount(PayTransactiondetailsReportDto inParams);
 
     List<PayOperatordetailsReportDto>getPayOperatordetailsReportList(PayOperatordetailsReportDto inParams);
+    PayOperatordetailsReportDto getPayOperatordetailsReportCount(PayOperatordetailsReportDto inParams);
+
+    List<PayArrearagedetailsReportDto>getPayArrearagedetailsReportList(PayArrearagedetailsReportDto inParams);
+    PayArrearagedetailsReportDto getPayArrearagedetailsReportCount(PayArrearagedetailsReportDto inParams);
 }

+ 36 - 6
smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/PayArrearagedetailsReportDto.java

@@ -1,18 +1,23 @@
 package com.bz.smart_city.dto.pay;
 
+import com.bz.smart_city.entity.ProgramItem;
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import javafx.scene.control.cell.PropertyValueFactory;
 import lombok.Data;
 
 import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.time.LocalDateTime;
+import java.util.List;
 
 /**
  * @Author: ZJY
  * @DATE: 2020-07-28 10:39
  */
 @Data
-@ApiModel("欠费明细报表")
+@ApiModel("欠费用户明细报表")
 public class PayArrearagedetailsReportDto {
     @ApiModelProperty(value = "客户编码")
     private String accountNumber;
@@ -24,7 +29,7 @@ public class PayArrearagedetailsReportDto {
     private String accountAddr;
 
     @ApiModelProperty(example = "13800000001",notes = "手机号码")
-    private String	telephone	;
+    private String	mobilePhone;
 
     @ApiModelProperty(value = "水量")
     private Integer payamount;
@@ -36,14 +41,39 @@ public class PayArrearagedetailsReportDto {
     private BigDecimal polluteFee;
 
     @ApiModelProperty(value = "不征税")
-    private BigDecimal taxExempt;
+    private BigDecimal taxExemptFee;
 
     @ApiModelProperty(value = "违约金")
-    private BigDecimal lateFee;
+    private BigDecimal penltyFee;
 
     @ApiModelProperty(value = "超计划水费")
-    private BigDecimal cjhFee;
+    private BigDecimal outLevelFee;
 
-    @ApiModelProperty("小计")
+    @ApiModelProperty(value = "欠费合计")
+    private BigDecimal debtFee;
+
+    @ApiModelProperty(value = "小计")
     private BigDecimal subtotal;
+
+    @ApiModelProperty(value = "小区ID",example = "027")
+    private String community;
+
+    @ApiModelProperty(value = "部门ID",  hidden = true)
+    @JsonIgnore
+    private Integer officeId;
+    @ApiModelProperty(value = "开始时间",  hidden = true)
+    @JsonIgnore
+    private LocalDateTime beginTime;
+    @ApiModelProperty(value = "结束时间",  hidden = true)
+    @JsonIgnore
+    private LocalDateTime endTime;
+    @ApiModelProperty(value ="站点id",  hidden = true)
+    @JsonIgnore
+    private BigInteger siteId;
+    @ApiModelProperty(value ="客户id",  hidden = true)
+    @JsonIgnore
+    private BigInteger customerId;
+    @ApiModelProperty(value = "权限项",  hidden = true)
+    @JsonIgnore
+    private List<ProgramItem> programItems;
 }

+ 28 - 6
smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/PayOperatordetailsReportDto.java

@@ -1,6 +1,8 @@
 package com.bz.smart_city.dto.pay;
 
+import com.bz.smart_city.entity.ProgramItem;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -8,6 +10,7 @@ import lombok.Data;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.time.LocalDateTime;
+import java.util.List;
 
 /**
  * @Author: ZJY
@@ -25,17 +28,17 @@ public class PayOperatordetailsReportDto {
     @ApiModelProperty(value = "客户地址")
     private String accountAddr;
 
-    @ApiModelProperty(value = "小区ID")
-    private Integer community;
+    @ApiModelProperty(value = "小区ID",example = "027")
+    private String community;
 
     @ApiModelProperty(value = "小区名称")
     private  String communityName;
 
-    @ApiModelProperty(value = "实收")
-    private BigDecimal received;
+    @ApiModelProperty(value = "实收")
+    private BigDecimal receivedCount;
 
-    @ApiModelProperty(value = "应收")
-    private BigDecimal receivable;
+    @ApiModelProperty(value = "预存款")
+    private BigDecimal transamount;
 
     @ApiModelProperty("小计")
     private BigDecimal subtotal;
@@ -50,8 +53,27 @@ public class PayOperatordetailsReportDto {
     @ApiModelProperty(value = "收费员姓名")
     private String createByName;
 
+    @ApiModelProperty(value = "交易流水号",  hidden = true)
+    @JsonIgnore
+    private String payseriesno;
+    @ApiModelProperty(value = "条件,0等于,1小于,2大于",  hidden = true)
+    @JsonIgnore
+    private Integer dataType;
+
     @ApiModelProperty(value = "开始时间",  hidden = true)
+    @JsonIgnore
     private LocalDateTime beginTime;
     @ApiModelProperty(value = "结束时间",  hidden = true)
+    @JsonIgnore
     private LocalDateTime endTime;
+    @ApiModelProperty(value ="站点id",  hidden = true)
+    @JsonIgnore
+    private BigInteger siteId;
+    @ApiModelProperty(value ="客户id",  hidden = true)
+    @JsonIgnore
+    private BigInteger customerId;
+
+    @ApiModelProperty(value = "权限项",  hidden = true)
+    @JsonIgnore
+    private List<ProgramItem> programItems;
 }

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

@@ -1,5 +1,6 @@
 package com.bz.smart_city.dto.pay;
 
+import com.bz.smart_city.entity.ProgramItem;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import io.swagger.annotations.ApiModel;
@@ -9,6 +10,7 @@ import lombok.Data;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.time.LocalDateTime;
+import java.util.List;
 
 /**
  * @Author: ZJY
@@ -69,4 +71,8 @@ public class PayTransactiondetailsReportDto {
     @ApiModelProperty(value ="客户id",  hidden = true)
     @JsonIgnore
     private BigInteger customerId;
+
+    @ApiModelProperty(value = "权限项",  hidden = true)
+    @JsonIgnore
+    private List<ProgramItem> programItems;
 }

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

@@ -4,6 +4,7 @@ import com.bz.smart_city.commom.model.Pagination;
 import com.bz.smart_city.commom.util.UserUtil;
 import com.bz.smart_city.dao.pay.PayReportMapper;
 import com.bz.smart_city.dto.LoginUser;
+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 com.bz.smart_city.service.pay.PayReportService;
@@ -26,7 +27,7 @@ public class PayReportServiceImpl implements PayReportService {
     PayReportMapper payReportMapper;
 
     /**
-     * 交易明细报表
+     * 收费明细报表
      * @param payTransactiondetailsReportDto
      * @param pageNum
      * @param pageSize
@@ -37,12 +38,16 @@ public class PayReportServiceImpl implements PayReportService {
     {
         LoginUser loginUser = UserUtil.getCurrentUser();
         BigInteger customerId = new BigInteger(String.valueOf(loginUser.getCustomerId()));
+        BigInteger siteId = new BigInteger(String.valueOf(loginUser.getSiteId()));
         payTransactiondetailsReportDto.setCustomerId(customerId);
+        payTransactiondetailsReportDto.setSiteId(siteId);
 
         PageHelper.startPage(pageNum, pageSize);
         List<PayTransactiondetailsReportDto> reList = payReportMapper.getPayTransactiondetailsReportList(payTransactiondetailsReportDto);
         PayTransactiondetailsReportDto subDto = payReportMapper.getPayTransactiondetailsReportCount(payTransactiondetailsReportDto);
-        reList.add(0,subDto);
+        if(reList != null && reList.size() > 0)
+            if(subDto != null)
+                reList.add(0,subDto);
 
         return new Pagination<>(reList);
     }
@@ -57,6 +62,46 @@ public class PayReportServiceImpl implements PayReportService {
     @Override
     public Pagination<PayOperatordetailsReportDto> getPayOperatordetailsReport(PayOperatordetailsReportDto payOperatordetailsReportDto, int pageNum, int pageSize)
     {
-        return  null;
+        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);
+
+        //数据权限
+
+        PageHelper.startPage(pageNum,pageSize);
+        List<PayOperatordetailsReportDto> reList = payReportMapper.getPayOperatordetailsReportList(payOperatordetailsReportDto);
+        PayOperatordetailsReportDto subDto = payReportMapper.getPayOperatordetailsReportCount(payOperatordetailsReportDto);
+        if(reList != null && reList.size() > 0)
+            if(subDto != null)
+                reList.add(0,subDto);
+        return new Pagination<>(reList);
     }
+
+    /**
+     * 欠费用户明细报表
+     * @param payArrearagedetailsReportDto
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @Override
+    public Pagination<PayArrearagedetailsReportDto> getPayArrearagedetailsReport(PayArrearagedetailsReportDto payArrearagedetailsReportDto, int pageNum, int pageSize)
+    {
+        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);
+
+        PageHelper.startPage(pageNum,pageSize);
+        List<PayArrearagedetailsReportDto> reList = payReportMapper.getPayArrearagedetailsReportList(payArrearagedetailsReportDto);
+        PayArrearagedetailsReportDto subDto = payReportMapper.getPayArrearagedetailsReportCount(payArrearagedetailsReportDto);
+        if(reList != null && reList.size() > 0)
+            if(subDto != null)
+                reList.add(0,subDto);
+        return new Pagination<>(reList);
+    }
+
 }

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

@@ -1,6 +1,7 @@
 package com.bz.smart_city.service.pay;
 
 import com.bz.smart_city.commom.model.Pagination;
+import com.bz.smart_city.dto.pay.PayArrearagedetailsReportDto;
 import com.bz.smart_city.dto.pay.PayOperatordetailsReportDto;
 import com.bz.smart_city.dto.pay.PayTransactiondetailsReportDto;
 
@@ -13,4 +14,6 @@ public interface PayReportService {
     Pagination<PayTransactiondetailsReportDto> getPayTransactiondetailsReport(PayTransactiondetailsReportDto payTransactiondetailsReportDto,int pageNum,int pageSize);
 
     Pagination<PayOperatordetailsReportDto> getPayOperatordetailsReport(PayOperatordetailsReportDto payOperatordetailsReportDto,int pageNum,int pageSize);
+
+    Pagination<PayArrearagedetailsReportDto> getPayArrearagedetailsReport(PayArrearagedetailsReportDto payArrearagedetailsReportDto, int pageNum, int pageSize);
 }

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

@@ -21,17 +21,21 @@
         LEFT JOIN sc_user scu ON ppt.create_by = scu.id
     WHERE
         ppt.transtype =1
+        <if test="customerId != null"> and ppt.customer_id = #{customerId}</if>
+        <if test="siteId != null"> and ppt.site_id = #{siteId}</if>
         <if test ="officeId != null"> and ppt.office_id = #{officeId}</if>
         <if test="createBy != null"> and ppt.create_by = #{createBy}</if>
-        <if test="beginTime != null"> and ppt.transtime >= #{beginTime}</if>
-        <if test="endTime != null"> and ppt.transtime &lt;= #{endTime}</if>
+        <if test="beginTime != null"> and ppt.transtime >= #{beginTime,jdbcType=TIMESTAMP}</if>
+        <if test="endTime != null"> and ppt.transtime &lt;= #{endTime,jdbcType=TIMESTAMP}</if>
         <if test="payWay != null"> and ppt.payway = #{payWay}</if>
 
+    order by ppt.transtime desc
+
     </select>
 
     <select id="getPayTransactiondetailsReportCount" resultType="com.bz.smart_city.dto.pay.PayTransactiondetailsReportDto">
         SELECT
-        '合计' as accountName,
+        '合计' as accountNumber,
         SUM(ppt.transamount) as transAmount
         FROM
         pay_pay_transactiondetails ppt
@@ -39,17 +43,191 @@
         LEFT JOIN sc_user scu ON ppt.create_by = scu.id
         WHERE
         ppt.transtype =1
+        <if test="customerId != null"> and ppt.customer_id = #{customerId}</if>
+        <if test="siteId != null"> and ppt.site_id = #{siteId}</if>
         <if test ="officeId != null"> and ppt.office_id = #{officeId}</if>
         <if test="createBy != null"> and ppt.create_by = #{createBy}</if>
-        <if test="beginTime != null"> and ppt.transtime >= #{beginTime}</if>
-        <if test="endTime != null"> and ppt.transtime &lt;= #{endTime}</if>
+        <if test="beginTime != null"> and ppt.transtime >= #{beginTime,jdbcType=TIMESTAMP}</if>
+        <if test="endTime != null"> and ppt.transtime &lt;= #{endTime,jdbcType=TIMESTAMP}</if>
         <if test="payWay != null"> and ppt.payway = #{payWay}</if>
 
+
     </select>
 
     <select id="getPayOperatordetailsReportList" resultType="com.bz.smart_city.dto.pay.PayOperatordetailsReportDto">
+    SELECT * from
+    (
+        SELECT
+        pba.`name` as accountName,
+        pba.accountnumber as accountNumber,
+        pba.address as accountAddr,
+        scc.`name` communityName,
+        SUM(ppr.receivedamount) receivedCount,
+        max(ifnull(ppt.transamount,0)) transamount,
+        sum(ppr.receivedamount)  + max(ifnull(ppt.transamount,0))  subtotal,
+        min(ppr.create_date) transTime,
+        min(scu.`name`) createByName
+        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_user scu on scu.id = ppr.create_by
+        LEFT JOIN pay_pay_transactiondetails ppt on ppt.payseriesno = ppr.payseriesno and ppt.transtype = 4
+        <where>
+            ppr.payway != 4 and ppr.canceledrecord_id is null and ppr.iscanceled =0
+            <if test="customerId != null"> and ppr.customer_id = #{customerId}</if>
+            <if test="siteId != null"> and ppr.site_id = #{siteId}</if>
+            <if test="community != null and community != ''"> and scc.code = #{community,jdbcType=VARCHAR} </if>
+            <if test="createBy != null"> and ppr.create_by = #{createBy} </if>
+            <if test="beginTime != null"> and ppr.create_date >= #{beginTime,jdbcType=TIMESTAMP}</if>
+            <if test="endTime != null"> and ppr.create_date &lt;= #{endTime,jdbcType=TIMESTAMP}</if>
+
+        </where>
+        GROUP BY pba.`name`,pba.accountnumber,pba.address,scc.`name`
+    ) tb
+    <where>
+        <if test="dataType != null and subtotal != null">
+            <if test="dataType == 0"> subtotal = #{subtotal}</if>
+            <if test="dataType == 1"> subtotal &lt; #{subtotal}</if>
+            <if test="dataType == 2"> subtotal > #{subtotal}</if>
+
+        </if>
+    </where>
+
+    </select>
+
+    <select id="getPayOperatordetailsReportCount" resultType="com.bz.smart_city.dto.pay.PayOperatordetailsReportDto">
+        SELECT
+            '合计' as accountName,
+            sum(receivedCount) receivedCount,
+            sum(transamount) transamount,
+            sum(subtotal) subtotal
+        from
+        (
+        SELECT
+        pba.`name` as accountName,
+        pba.accountnumber as accountNumber,
+        pba.address as accountAddr,
+        scc.`name` communityName,
+        SUM(ppr.receivedamount) receivedCount,
+        max(ifnull(ppt.transamount,0)) transamount,
+        sum(ppr.receivedamount)  + max(ifnull(ppt.transamount,0))  subtotal,
+        min(ppr.create_date) transTime,
+        min(scu.`name`) createByName
+        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) and scc.customer_id = 47
+        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>
+            ppr.payway != 4 and ppr.canceledrecord_id is null and ppr.iscanceled =0
+            <if test="customerId != null"> and ppr.customer_id = #{customerId}</if>
+            <if test="siteId != null"> and ppr.site_id = #{siteId}</if>
+            <if test="community != null and community != ''"> and scc.code = #{community,jdbcType=VARCHAR} </if>
+            <if test="createBy != null"> and ppr.create_by = #{createBy} </if>
+            <if test="beginTime != null"> and ppr.create_date >= #{beginTime,jdbcType=TIMESTAMP}</if>
+            <if test="endTime != null"> and ppr.create_date &lt;= #{endTime,jdbcType=TIMESTAMP}</if>
+
+        </where>
+        GROUP BY pba.`name`,pba.accountnumber,pba.address,scc.`name`
+        ) tb
+        <where>
+            <if test="dataType != null and subtotal != null">
+                <if test="dataType == 0"> subtotal = #{subtotal}</if>
+                <if test="dataType == 1"> subtotal &lt; #{subtotal}</if>
+                <if test="dataType == 2"> subtotal > #{subtotal}</if>
+
+            </if>
+        </where>
 
     </select>
 
+    <select id="getPayArrearagedetailsReportList" resultType="com.bz.smart_city.dto.pay.PayArrearagedetailsReportDto">
+
+        SELECT
+            pba.NAME as accountName,
+            pba.accountnumber as accountNumber,
+            pba.address as accountAddr,
+            pba.mobilephone as mobilePhone,
+            sum( CASE WHEN pprb.feetype = 1 THEN pprb.receivablefee ELSE 0 END ) as payamountFee,
+            sum( CASE WHEN pprb.feetype = 3 THEN pprb.receivablefee ELSE 0 END ) as taxExemptFee,
+            sum( CASE WHEN pprb.feetype = 4 THEN pprb.receivablefee ELSE 0 END ) as polluteFee,
+            sum( CASE WHEN pprb.feetype = 6 THEN pprb.receivablefee ELSE 0 END ) as penltyFee,
+            sum( CASE WHEN pprb.feetype = 1 THEN pprb.payamount ELSE 0 END ) payamount,
+            sum( CASE WHEN pprb.ladderlevel != 1 THEN pprb.receivablefee ELSE 0 END ) as outLevelFee,
+            sum( CASE WHEN pprb.receivablefee IS NULL THEN 0 ELSE pprb.receivablefee END ) as subtotal,
+            sum( CASE WHEN pprb.debt IS NULL THEN 0 ELSE pprb.debt END ) as debtFee
+        FROM
+            pay_pay_receivable pprb
+            LEFT JOIN pay_base_account pba ON pba.id = pprb.account_id
+        <where>
+            <if test="customerId != null"> and pprb.customer_id = #{customerId}</if>
+            <if test="siteId != null"> and pprb.site_id = #{siteId}</if>
+            <if test="officeId != null"> and pprb.office_id = #{officeId}</if>
+            <if test="community != null and community != ''"> and substring(pba.accountnumber,1,3) = #{community,jdbcType=VARCHAR}</if>
+            <if test="accountNumber != null and accountNumber != ''"> and pba.accountnumber like concat('%',#{accountNumber},'%')</if>
+
+        </where>
+
+        GROUP BY
+            pba.NAME,
+            pba.NAME,
+            pba.accountnumber,
+            pba.address,
+            pba.mobilephone
+        HAVING
+            sum( CASE WHEN pprb.debt IS NULL THEN 0 ELSE pprb.debt END )> 0
+
+    </select>
+
+    <select id="getPayArrearagedetailsReportCount" resultType="com.bz.smart_city.dto.pay.PayArrearagedetailsReportDto">
+
+        SELECT
+            '合计' as accountName,
+            sum(payamount) as payamount,
+            sum(payamountFee) as payamountFee,
+            sum(taxExemptFee) as taxExemptFee,
+            sum(polluteFee) as polluteFee,
+            sum(penltyFee) as penltyFee,
+            sum(outLevelFee) as outLevelFee,
+            sum(subtotal) as subtotal,
+            sum(debtFee) as debtFee
+        FROM
+        (
+            SELECT
+            pba.NAME as accountName,
+            pba.accountnumber as accountNumber,
+            pba.address as accountAddr,
+            pba.mobilephone as mobilePhone,
+            sum( CASE WHEN pprb.feetype = 1 THEN pprb.receivablefee ELSE 0 END ) as payamountFee,
+            sum( CASE WHEN pprb.feetype = 3 THEN pprb.receivablefee ELSE 0 END ) as taxExemptFee,
+            sum( CASE WHEN pprb.feetype = 4 THEN pprb.receivablefee ELSE 0 END ) as polluteFee,
+            sum( CASE WHEN pprb.feetype = 6 THEN pprb.receivablefee ELSE 0 END ) as penltyFee,
+            sum( CASE WHEN pprb.feetype = 1 THEN pprb.payamount ELSE 0 END ) payamount,
+            sum( CASE WHEN pprb.ladderlevel != 1 THEN pprb.receivablefee ELSE 0 END ) as outLevelFee,
+            sum( CASE WHEN pprb.receivablefee IS NULL THEN 0 ELSE pprb.receivablefee END ) as subtotal,
+            sum( CASE WHEN pprb.debt IS NULL THEN 0 ELSE pprb.debt END ) as debtFee
+            FROM
+            pay_pay_receivable pprb
+            LEFT JOIN pay_base_account pba ON pba.id = pprb.account_id
+            <where>
+                <if test="customerId != null"> and pprb.customer_id = #{customerId}</if>
+                <if test="siteId != null"> and pprb.site_id = #{siteId}</if>
+                <if test="officeId != null"> and pprb.office_id = #{officeId}</if>
+                <if test="community != null and community != ''"> and substring(pba.accountnumber,1,3) = #{community,jdbcType=VARCHAR}</if>
+                <if test="accountNumber != null and accountNumber != ''"> and pba.accountnumber like concat('%',#{accountNumber},'%')</if>
+
+            </where>
+
+            GROUP BY
+            pba.NAME,
+            pba.NAME,
+            pba.accountnumber,
+            pba.address,
+            pba.mobilephone
+            HAVING
+            sum( CASE WHEN pprb.debt IS NULL THEN 0 ELSE pprb.debt END )> 0
+        ) tb
+
+    </select>
 
 </mapper>