Browse Source

报表修改

zhoujiangyuan 4 years ago
parent
commit
0835bd1162

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

@@ -4,9 +4,8 @@ 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.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.springframework.stereotype.Service;
@@ -14,6 +13,7 @@ import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.BigInteger;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -42,22 +42,30 @@ public class PayReportServiceImpl implements PayReportService {
         payTransactiondetailsReportDto.setCustomerId(customerId);
         payTransactiondetailsReportDto.setSiteId(siteId);
 
-        PageHelper.startPage(pageNum, pageSize);
+        //PageHelper.startPage(pageNum, pageSize);
+        Pagination<PayTransactiondetailsReportDto> pg = new Pagination<>();
         List<PayTransactiondetailsReportDto> reList = payReportMapper.getPayTransactiondetailsReportList(payTransactiondetailsReportDto);
-
         if(reList != null && reList.size() > 0){
-            PayTransactiondetailsReportDto subDto = new PayTransactiondetailsReportDto();
+
+            PayTransactiondetailsReportDto totalDto = new PayTransactiondetailsReportDto();
+            List<PayTransactiondetailsReportDto> reSubList = new ArrayList<>();
             BigDecimal transAmount = BigDecimal.ZERO;
             for(int i=0;i<reList.size();i++){
                 transAmount = transAmount.add(reList.get(i).getTransAmount());
+                if(i >= (pageNum-1)*pageSize && i < pageNum*pageSize){
+                    reSubList.add(reList.get(i));
+                }
             }
-            subDto.setTransAmount(transAmount);
-            subDto.setAccountNumber("合计");
-            reList.add(0,subDto);
-        }
+            totalDto.setTransAmount(transAmount);
+            totalDto.setAccountNumber("合计");
+            reSubList.add(0,totalDto);
 
+            pg.setTotal(reList.size());
+            pg.setList(reSubList);
+        }
 
-        return new Pagination<>(reList);
+        return pg;
+        //return new Pagination<>(reList);
     }
 
     /**
@@ -78,10 +86,12 @@ public class PayReportServiceImpl implements PayReportService {
 
         //数据权限
 
-        PageHelper.startPage(pageNum,pageSize);
+        //PageHelper.startPage(pageNum,pageSize);
+        Pagination<PayOperatordetailsReportDto> pg = new Pagination<>();
         List<PayOperatordetailsReportDto> reList = payReportMapper.getPayOperatordetailsReportList(payOperatordetailsReportDto);
+        List<PayOperatordetailsReportDto> reSubList = new ArrayList<>();
         if(reList != null && reList.size() > 0){
-            PayOperatordetailsReportDto subDto = new PayOperatordetailsReportDto();
+            PayOperatordetailsReportDto totalDto = new PayOperatordetailsReportDto();
             BigDecimal receivedCount = BigDecimal.ZERO;
             BigDecimal transamount = BigDecimal.ZERO;
             BigDecimal subtotal = BigDecimal.ZERO;
@@ -89,15 +99,21 @@ public class PayReportServiceImpl implements PayReportService {
                 receivedCount = receivedCount.add(reList.get(i).getReceivedCount());
                 transamount = transamount.add(reList.get(i).getTransamount());
                 subtotal = subtotal.add(reList.get(i).getSubtotal());
+                if(i >= (pageNum-1)*pageSize && i<pageNum*pageSize){
+                    reSubList.add(reList.get(i));
+                }
             }
-            subDto.setSubtotal(subtotal);
-            subDto.setTransamount(transamount);
-            subDto.setReceivedCount(receivedCount);
-            subDto.setAccountName("合计");
-            reList.add(0,subDto);
+            totalDto.setSubtotal(subtotal);
+            totalDto.setTransamount(transamount);
+            totalDto.setReceivedCount(receivedCount);
+            totalDto.setAccountName("合计");
+            reSubList.add(0,totalDto);
+
+            pg.setList(reSubList);
+            pg.setTotal(reList.size());
         }
-
-        return new Pagination<>(reList);
+        return pg;
+        //return new Pagination<>(reList);
     }
 
     /**
@@ -116,10 +132,12 @@ public class PayReportServiceImpl implements PayReportService {
         BigInteger siteId = new BigInteger(String.valueOf(loginUser.getSiteId()));
         payArrearagedetailsReportDto.setSiteId(siteId);
 
-        PageHelper.startPage(pageNum,pageSize);
+        //PageHelper.startPage(pageNum,pageSize);
+        Pagination<PayArrearagedetailsReportDto> pg = new Pagination<>();
+        List<PayArrearagedetailsReportDto> reSubList = new ArrayList<>();
         List<PayArrearagedetailsReportDto> reList = payReportMapper.getPayArrearagedetailsReportList(payArrearagedetailsReportDto);
         if(reList != null && reList.size() > 0){
-            PayArrearagedetailsReportDto subDto = new PayArrearagedetailsReportDto();
+            PayArrearagedetailsReportDto totalDto = new PayArrearagedetailsReportDto();
             Integer payamount = 0;
             BigDecimal payamountFee = BigDecimal.ZERO;
             BigDecimal polluteFee= BigDecimal.ZERO;
@@ -135,19 +153,26 @@ public class PayReportServiceImpl implements PayReportService {
                 penltyFee = penltyFee.add(reList.get(i).getPenltyFee());
                 outLevelFee = outLevelFee.add(reList.get(i).getOutLevelFee());
                 subtotal = subtotal.add(reList.get(i).getSubtotal());
+
+                if(i>= (pageNum-1)*pageSize && i< pageNum*pageSize){
+                    reSubList.add(reList.get(i));
+                }
             }
-            subDto.setPayamount(payamount);
-            subDto.setPayamountFee(payamountFee);;
-            subDto.setPolluteFee(polluteFee);
-            subDto.setTaxExemptFee(taxExemptFee);
-            subDto.setPenltyFee(penltyFee);
-            subDto.setOutLevelFee(outLevelFee);
-            subDto.setSubtotal(subtotal);
-            subDto.setAccountNumber("合计");
-            reList.add(0,subDto);
+            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(0,totalDto);
+
+            pg.setTotal(reList.size());
+            pg.setList(reSubList);
         }
-
-        return new Pagination<>(reList);
+        return pg;
+        //return new Pagination<>(reList);
     }
 
 }

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

@@ -101,7 +101,8 @@
         max(ifnull(ppt.transamount,0)) transamount,
         sum(ppr.receivedamount)  + max(ifnull(ppt.transamount,0))  subtotal,
         min(ppr.create_date) transTime,
-        min(scu.`name`) createByName
+        min(scu.`name`) createByName,
+        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)
@@ -117,7 +118,7 @@
             <if test="endTime != null"> and ppr.create_date &lt;= #{endTime,jdbcType=TIMESTAMP}</if>
 
         </where>
-        GROUP BY pba.`name`,pba.accountnumber,pba.address,scc.`name`
+        GROUP BY pba.`name`,pba.accountnumber,pba.address,scc.`name`,ppr.payseriesno
         union all
 
         SELECT
@@ -129,7 +130,8 @@
             sum(ppt.transamount) transamount,
             sum(ppt.transamount) subtotal,
             min(ppt.create_date) transTime,
-            min(scu.`name`) createByName
+            min(scu.`name`) createByName,
+            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)
@@ -141,9 +143,9 @@
         <if test="createBy != null"> and ppt.create_by = #{createBy} </if>
         <if test="beginTime != null"> and ppt.create_date >= #{beginTime,jdbcType=TIMESTAMP}</if>
         <if test="endTime != null"> and ppt.create_date &lt;= #{endTime,jdbcType=TIMESTAMP}</if>
-        GROUP BY pba.`name`,pba.accountnumber,pba.address,scc.`name`
+        GROUP BY pba.`name`,pba.accountnumber,pba.address,scc.`name`,ppt.payseriesno
 
-    ) tb
+        ) tb
     <where>
         <if test="dataType != null and subtotal != null">
             <if test="dataType == 0"> subtotal = #{subtotal}</if>
@@ -193,7 +195,7 @@
             pba.mobilephone
         HAVING
             sum( CASE WHEN pprb.debt IS NULL THEN 0 ELSE pprb.debt END )> 0
-
+        ORDER BY accountnumber asc
     </select>