From 086af9a242c7c14e9214ed5fabc4d5dfed1fa577 Mon Sep 17 00:00:00 2001
From: xiaogang <905166056@qq.com>
Date: 星期二, 05 一月 2021 08:13:07 +0800
Subject: [PATCH] 1.新增查询优惠、减免、滞纳金、空置房打折、空置房减免总金额sql语句2、新添加优惠、减免、滞纳金、空置房打折、空置房减免金额以及对应的大计、小计

---
 service-report/src/main/java/com/java110/report/bmo/reportFeeMonthStatistics/impl/GetReportFeeMonthStatisticsBMOImpl.java |  154 ++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 132 insertions(+), 22 deletions(-)

diff --git a/service-report/src/main/java/com/java110/report/bmo/reportFeeMonthStatistics/impl/GetReportFeeMonthStatisticsBMOImpl.java b/service-report/src/main/java/com/java110/report/bmo/reportFeeMonthStatistics/impl/GetReportFeeMonthStatisticsBMOImpl.java
index 6b121ea..161ee12 100644
--- a/service-report/src/main/java/com/java110/report/bmo/reportFeeMonthStatistics/impl/GetReportFeeMonthStatisticsBMOImpl.java
+++ b/service-report/src/main/java/com/java110/report/bmo/reportFeeMonthStatistics/impl/GetReportFeeMonthStatisticsBMOImpl.java
@@ -4,11 +4,11 @@
 import com.java110.dto.fee.FeeConfigDto;
 import com.java110.dto.fee.FeeDto;
 import com.java110.dto.reportFeeMonthStatistics.ReportFeeMonthStatisticsDto;
+import com.java110.dto.reportFeeMonthStatistics.ReportFeeMonthStatisticsTotalDto;
 import com.java110.intf.report.IReportFeeMonthStatisticsInnerServiceSMO;
 import com.java110.report.bmo.reportFeeMonthStatistics.IGetReportFeeMonthStatisticsBMO;
 import com.java110.utils.util.DateUtil;
 import com.java110.utils.util.StringUtil;
-import com.java110.vo.FeeDetailResultVo;
 import com.java110.vo.ResultVo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -198,6 +198,7 @@
         int count = Integer.parseInt(countInfo.get("count").toString());
 
         List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos = null;
+        ReportFeeMonthStatisticsTotalDto reportFeeMonthStatisticsTotalDto = new ReportFeeMonthStatisticsTotalDto();
         List<ReportFeeMonthStatisticsDto> reportList = new ArrayList<>();
         //鏌ヨ璇ュ皬鍖轰笅鐨勮垂鐢ㄩ」鐩�
         FeeConfigDto feeConfigDto = new FeeConfigDto();
@@ -207,15 +208,63 @@
         Double allReceivableAmount = 0.0;
         //瀹炴敹閲戦(澶ц)
         Double allReceivedAmount = 0.0;
+        //浼樻儬閲戦(澶ц)
+        Double allPreferentialAmount = 0.0;
+        //鍑忓厤閲戦(澶ц)
+        Double allDeductionAmount = 0.0;
+        //婊炵撼閲�(澶ц)
+        Double allLateFee = 0.0;
+        //绌虹疆鎴挎墦鎶�(澶ц)
+        Double allVacantHousingDiscount = 0.0;
+        //绌虹疆鎴垮噺鍏�(澶ц)
+        Double allVacantHousingReduction = 0.0;
         if (count > 0) {
+            //鏌ヨ缂磋垂鏄庣粏
             reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryPayFeeDetail(reportFeeMonthStatisticsDto);
+            //鏌ヨ搴旀敹銆佸疄鏀舵�婚噾棰�(澶ц)
             List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsList = reportFeeMonthStatisticsInnerServiceSMOImpl.queryAllPayFeeDetail(reportFeeMonthStatisticsDto);
+            //鏌ヨ(浼樻儬銆佸噺鍏嶃�佹粸绾抽噾銆佺┖缃埧鎵撴姌銆佺┖缃埧鍑忓厤閲戦绛�)澶ц鎬婚噾棰�
+            List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsSum = reportFeeMonthStatisticsInnerServiceSMOImpl.queryPayFeeDetailSum(reportFeeMonthStatisticsDto);
             allReceivableAmount = Double.valueOf(reportFeeMonthStatisticsList.get(0).getAllReceivableAmount());
             allReceivedAmount = Double.valueOf(reportFeeMonthStatisticsList.get(0).getAllReceivedAmount());
+            for (ReportFeeMonthStatisticsDto reportFeeMonthStatistics : reportFeeMonthStatisticsSum) {
+                //杩欓噷鏄煡璇㈠嚭鐨勯噾棰濇�诲拰
+                String discountPrice = reportFeeMonthStatistics.getDiscountPrice();
+                //浼樻儬閲戦(澶ц)
+                if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallType()) && reportFeeMonthStatistics.getDiscountSmallType().equals("1")) {
+                    allPreferentialAmount = Double.valueOf(discountPrice);
+                }
+                //鍑忓厤閲戦(澶ц)
+                if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallType()) && reportFeeMonthStatistics.getDiscountSmallType().equals("2")) {
+                    allDeductionAmount = Double.valueOf(discountPrice);
+                }
+                //婊炵撼閲�(澶ц)
+                if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallType()) && reportFeeMonthStatistics.getDiscountSmallType().equals("3")) {
+                    allLateFee = Double.valueOf(discountPrice);
+                }
+                //绌虹疆鎴挎墦鎶橀噾棰�(澶ц)
+                if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallType()) && reportFeeMonthStatistics.getDiscountSmallType().equals("4")) {
+                    allVacantHousingDiscount = Double.valueOf(discountPrice);
+                }
+                //绌虹疆鎴垮噺鍏嶉噾棰�(澶ц)
+                if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallType()) && reportFeeMonthStatistics.getDiscountSmallType().equals("5")) {
+                    allVacantHousingReduction = Double.valueOf(discountPrice);
+                }
+            }
             //搴旀敹鎬婚噾棰�(灏忚)
             Double totalReceivableAmount = 0.0;
             //瀹炴敹鎬婚噾棰�(灏忚)
             Double totalReceivedAmount = 0.0;
+            //浼樻儬閲戦(灏忚)
+            Double totalPreferentialAmount = 0.0;
+            //鍑忓厤閲戦(灏忚)
+            Double totalDeductionAmount = 0.0;
+            //绌虹疆鎴挎墦鎶橀噾棰�(灏忚)
+            Double totalVacantHousingDiscount = 0.0;
+            //绌虹疆鎴垮噺鍏嶉噾棰�(灏忚)
+            Double totalVacantHousingReduction = 0.0;
+            //婊炵撼閲�(灏忚)
+            Double totalLateFee = 0.0;
             for (ReportFeeMonthStatisticsDto reportFeeMonthStatistics : reportFeeMonthStatisticsDtos) {
                 //搴旀敹閲戦
                 Double receivableAmount = Double.valueOf(reportFeeMonthStatistics.getReceivableAmount());
@@ -223,40 +272,101 @@
                 Double receivedAmount = Double.valueOf(reportFeeMonthStatistics.getReceivedAmount());
                 totalReceivableAmount = totalReceivableAmount + receivableAmount;
                 totalReceivedAmount = totalReceivedAmount + receivedAmount;
-            }
-            for (ReportFeeMonthStatisticsDto tmpReportFeeMonthStatisticsDto : reportFeeMonthStatisticsDtos) {
-                if (FeeDto.PAYER_OBJ_TYPE_ROOM.equals(tmpReportFeeMonthStatisticsDto.getPayerObjType())) {
-                    tmpReportFeeMonthStatisticsDto.setObjName(tmpReportFeeMonthStatisticsDto.getFloorNum()
-                            + "鏍�" + tmpReportFeeMonthStatisticsDto.getUnitNum()
-                            + "鍗曞厓" + tmpReportFeeMonthStatisticsDto.getRoomNum() + "瀹�");
-                } else {
-                    tmpReportFeeMonthStatisticsDto.setObjName(tmpReportFeeMonthStatisticsDto.getCarNum());
+                //浼樻儬閲戦
+                if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallType()) && reportFeeMonthStatistics.getDiscountSmallType().equals("1")) {
+                    //鑾峰彇浼樻儬閲戦
+                    Double discountPrice = Double.valueOf(reportFeeMonthStatistics.getDiscountPrice());
+                    totalPreferentialAmount = totalPreferentialAmount + discountPrice;
+                    //浼樻儬閲戦
+                    reportFeeMonthStatistics.setPreferentialAmount(reportFeeMonthStatistics.getDiscountPrice());
+                }
+                //鍑忓厤閲戦
+                if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallType()) && reportFeeMonthStatistics.getDiscountSmallType().equals("2")) {
+                    //鑾峰彇鍑忓厤閲戦
+                    Double discountPrice = Double.valueOf(reportFeeMonthStatistics.getDiscountPrice());
+                    totalDeductionAmount = totalDeductionAmount + discountPrice;
+                    //鍑忓厤閲戦
+                    reportFeeMonthStatistics.setDeductionAmount(reportFeeMonthStatistics.getDiscountPrice());
+                }
+                //婊炵撼閲�
+                if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallType()) && reportFeeMonthStatistics.getDiscountSmallType().equals("3")) {
+                    //鑾峰彇婊炵撼閲戦噾棰�
+                    Double discountPrice = Double.valueOf(reportFeeMonthStatistics.getDiscountPrice());
+                    totalLateFee = totalLateFee + discountPrice;
+                    //婊炵撼閲�
+                    reportFeeMonthStatistics.setLateFee(reportFeeMonthStatistics.getDiscountPrice());
+                }
+                //绌虹疆鎴挎墦鎶�
+                if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallType()) && reportFeeMonthStatistics.getDiscountSmallType().equals("4")) {
+                    //绌虹疆鎴挎墦鎶橀噾棰�
+                    Double discountPrice = Double.valueOf(reportFeeMonthStatistics.getDiscountPrice());
+                    totalVacantHousingDiscount = totalVacantHousingDiscount + discountPrice;
+                    //绌虹疆鎴挎墦鎶�
+                    reportFeeMonthStatistics.setVacantHousingDiscount(reportFeeMonthStatistics.getDiscountPrice());
+                }
+                //绌虹疆鎴垮噺鍏�
+                if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallType()) && reportFeeMonthStatistics.getDiscountSmallType().equals("5")) {
+                    //绌虹疆鎴垮噺鍏嶉噾棰�
+                    Double discountPrice = Double.valueOf(reportFeeMonthStatistics.getDiscountPrice());
+                    totalVacantHousingReduction = totalVacantHousingReduction + discountPrice;
+                    //绌虹疆鎴垮噺鍏�
+                    reportFeeMonthStatistics.setVacantHousingReduction(reportFeeMonthStatistics.getDiscountPrice());
                 }
 
-                if (!StringUtil.isEmpty(tmpReportFeeMonthStatisticsDto.getImportFeeName())) {
-                    tmpReportFeeMonthStatisticsDto.setFeeName(tmpReportFeeMonthStatisticsDto.getImportFeeName());
+                if (FeeDto.PAYER_OBJ_TYPE_ROOM.equals(reportFeeMonthStatistics.getPayerObjType())) {
+                    reportFeeMonthStatistics.setObjName(reportFeeMonthStatistics.getFloorNum()
+                            + "鏍�" + reportFeeMonthStatistics.getUnitNum()
+                            + "鍗曞厓" + reportFeeMonthStatistics.getRoomNum() + "瀹�");
+                } else {
+                    reportFeeMonthStatistics.setObjName(reportFeeMonthStatistics.getCarNum());
                 }
-                //搴旀敹閲戦(灏忚)
-                tmpReportFeeMonthStatisticsDto.setTotalReceivableAmount(String.format("%.2f", totalReceivableAmount));
-                //瀹炴敹閲戦(灏忚)
-                tmpReportFeeMonthStatisticsDto.setTotalReceivedAmount(String.format("%.2f", totalReceivedAmount));
-                //搴旀敹閲戦(澶ц)
-                tmpReportFeeMonthStatisticsDto.setAllReceivableAmount(String.format("%.2f", allReceivableAmount));
-                //瀹炴敹閲戦(澶ц)
-                tmpReportFeeMonthStatisticsDto.setAllReceivedAmount(String.format("%.2f", allReceivedAmount));
+
+                if (!StringUtil.isEmpty(reportFeeMonthStatistics.getImportFeeName())) {
+                    reportFeeMonthStatistics.setFeeName(reportFeeMonthStatistics.getImportFeeName());
+                }
+
                 //璐圭敤椤圭洰
-                tmpReportFeeMonthStatisticsDto.setFeeConfigDtos(feeConfigDtos);
-                reportList.add(tmpReportFeeMonthStatisticsDto);
+                reportFeeMonthStatistics.setFeeConfigDtos(feeConfigDtos);
+                reportList.add(reportFeeMonthStatistics);
             }
+            //搴旀敹鎬婚噾棰�(灏忚)
+            reportFeeMonthStatisticsTotalDto.setTotalReceivableAmount(String.format("%.2f", totalReceivableAmount));
+            //瀹炴敹閲戦(灏忚)
+            reportFeeMonthStatisticsTotalDto.setTotalReceivedAmount(String.format("%.2f", totalReceivedAmount));
+            //浼樻儬閲戦(灏忚)
+            reportFeeMonthStatisticsTotalDto.setTotalPreferentialAmount(String.valueOf(totalPreferentialAmount));
+            //鍑忓厤閲戦(灏忚)
+            reportFeeMonthStatisticsTotalDto.setTotalDeductionAmount(String.valueOf(totalDeductionAmount));
+            //婊炵撼閲�(灏忚)
+            reportFeeMonthStatisticsTotalDto.setTotalLateFee(String.valueOf(totalLateFee));
+            //绌虹疆鎴挎墦鎶�(灏忚)
+            reportFeeMonthStatisticsTotalDto.setTotalVacantHousingDiscount(String.valueOf(totalVacantHousingDiscount));
+            //绌虹疆鎴垮噺鍏�(灏忚)
+            reportFeeMonthStatisticsTotalDto.setTotalVacantHousingReduction(String.valueOf(totalVacantHousingReduction));
+            //搴旀敹閲戦(澶ц)
+            reportFeeMonthStatisticsTotalDto.setAllReceivableAmount(String.format("%.2f", allReceivableAmount));
+            //瀹炴敹閲戦(澶ц)
+            reportFeeMonthStatisticsTotalDto.setAllReceivedAmount(String.format("%.2f", allReceivedAmount));
+            //浼樻儬閲戦(澶ц)
+            reportFeeMonthStatisticsTotalDto.setAllPreferentialAmount(String.valueOf(allPreferentialAmount));
+            //鍑忓厤閲戦(澶ц)
+            reportFeeMonthStatisticsTotalDto.setAllDeductionAmount(String.valueOf(allDeductionAmount));
+            //婊炵撼閲�(澶ц)
+            reportFeeMonthStatisticsTotalDto.setAllLateFee(String.valueOf(allLateFee));
+            //绌虹疆鎴挎墦鎶橀噾棰�(澶ц)
+            reportFeeMonthStatisticsTotalDto.setAllVacantHousingDiscount(String.valueOf(allVacantHousingDiscount));
+            //绌虹疆鎴垮噺鍏嶉噾棰�(澶ц)
+            reportFeeMonthStatisticsTotalDto.setAllVacantHousingReduction(String.valueOf(allVacantHousingReduction));
         } else {
             reportFeeMonthStatisticsDtos = new ArrayList<>();
             reportList.addAll(reportFeeMonthStatisticsDtos);
+            reportFeeMonthStatisticsTotalDto = new ReportFeeMonthStatisticsTotalDto();
         }
 
         /*FeeDetailResultVo resultVo = new FeeDetailResultVo(countInfo.getDouble("totalReceivableAmount"), countInfo.getDouble("totalReceivedAmount"),
                 (int) Math.ceil((double) count / (double) reportFeeMonthStatisticsDto.getRow()), count, reportList);*/
 
-        ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reportFeeMonthStatisticsDto.getRow()), count, reportList);
+        ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reportFeeMonthStatisticsDto.getRow()), count, reportList, reportFeeMonthStatisticsTotalDto);
 
         ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
 

--
Gitblit v1.8.0