From 3721d9e4c1f79b7b38d89db3a73c62135640be64 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期二, 24 五月 2022 15:52:04 +0800
Subject: [PATCH] 优化代码

---
 service-report/src/main/java/com/java110/report/bmo/reportFeeMonthStatistics/impl/GetReportFeeMonthStatisticsBMOImpl.java |   50 +++++++++++++++++---------------------------------
 1 files changed, 17 insertions(+), 33 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 4b4a65c..dd15cac 100755
--- 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
@@ -24,7 +24,7 @@
 import com.java110.utils.util.StringUtil;
 import com.java110.vo.ResultVo;
 import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import com.java110.core.log.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
@@ -86,6 +86,7 @@
 
     @Override
     public ResponseEntity<String> queryReportFeeSummary(ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto) {
+
         int count = reportFeeMonthStatisticsInnerServiceSMOImpl.queryReportFeeSummaryCount(reportFeeMonthStatisticsDto);
 
         List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos = new ArrayList<>();
@@ -231,6 +232,8 @@
 
     @Override
     public ResponseEntity<String> queryReportFloorUnitFeeSummary(ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto) {
+        reportFeeMonthStatisticsDto.setFeeYear(DateUtil.getYear()+"");
+        reportFeeMonthStatisticsDto.setFeeMonth(DateUtil.getMonth()+"");
         int count = reportFeeMonthStatisticsInnerServiceSMOImpl.queryReportFloorUnitFeeSummaryCount(reportFeeMonthStatisticsDto);
 
         List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos = null;
@@ -287,6 +290,11 @@
 
     @Override
     public ResponseEntity<String> queryFeeDetail(ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto) {
+
+
+        reportFeeMonthStatisticsDto.setFeeYear(DateUtil.getYear()+"");
+        reportFeeMonthStatisticsDto.setFeeMonth(DateUtil.getMonth()+"");
+
         int count = reportFeeMonthStatisticsInnerServiceSMOImpl.queryFeeDetailCount(reportFeeMonthStatisticsDto);
 
         List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos = null;
@@ -297,41 +305,17 @@
         if (count > 0) {
             reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryFeeDetail(reportFeeMonthStatisticsDto);
             List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsList = reportFeeMonthStatisticsInnerServiceSMOImpl.queryAllFeeDetail(reportFeeMonthStatisticsDto);
-            allReceivableAmount = Double.valueOf(reportFeeMonthStatisticsList.get(0).getAllReceivableAmount());
-            allReceivedAmount = Double.valueOf(reportFeeMonthStatisticsList.get(0).getAllReceivedAmount());
+            if (reportFeeMonthStatisticsDtos != null && reportFeeMonthStatisticsDtos.size() > 0) {
+                for (ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto1 : reportFeeMonthStatisticsDtos) {
+                    reportFeeMonthStatisticsDto1.setAllReceivableAmount(reportFeeMonthStatisticsList.get(0).getAllReceivableAmount());
+                    reportFeeMonthStatisticsDto1.setAllReceivedAmount(reportFeeMonthStatisticsList.get(0).getAllReceivedAmount());
+                    reportFeeMonthStatisticsDto1.setAllOweAmount(reportFeeMonthStatisticsList.get(0).getAllOweAmount());
+                }
+            }
         } else {
             reportFeeMonthStatisticsDtos = new ArrayList<>();
         }
-
-        //搴旀敹鎬婚噾棰�(灏忚)
-        Double totalReceivableAmount = 0.0;
-        //瀹炴敹鎬婚噾棰�(灏忚)
-        Double totalReceivedAmount = 0.0;
-        List<ReportFeeMonthStatisticsDto> reportList = new ArrayList<>();
-        for (ReportFeeMonthStatisticsDto reportFeeMonthStatistics : reportFeeMonthStatisticsDtos) {
-            //搴旀敹閲戦
-            Double receivableAmount = Double.valueOf(reportFeeMonthStatistics.getReceivableAmount());
-            //瀹炴敹閲戦
-            Double receivedAmount = Double.valueOf(reportFeeMonthStatistics.getReceivedAmount());
-            totalReceivableAmount = totalReceivableAmount + receivableAmount;
-            totalReceivedAmount = totalReceivedAmount + receivedAmount;
-        }
-
-        //鏌ヨ璇ュ皬鍖轰笅鐨勮垂鐢ㄩ」鐩�
-        FeeConfigDto feeConfigDto = new FeeConfigDto();
-        feeConfigDto.setCommunityId(reportFeeMonthStatisticsDto.getCommunityId());
-        List<FeeConfigDto> feeConfigDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryFeeConfigs(feeConfigDto);
-
-        for (ReportFeeMonthStatisticsDto reportFeeMonthStatistics : reportFeeMonthStatisticsDtos) {
-            reportFeeMonthStatistics.setTotalReceivableAmount(String.format("%.2f", totalReceivableAmount));
-            reportFeeMonthStatistics.setTotalReceivedAmount(String.format("%.2f", totalReceivedAmount));
-            reportFeeMonthStatistics.setAllReceivableAmount(String.format("%.2f", allReceivableAmount));
-            reportFeeMonthStatistics.setAllReceivedAmount(String.format("%.2f", allReceivedAmount));
-            reportFeeMonthStatistics.setFeeConfigDtos(feeConfigDtos);
-            reportList.add(reportFeeMonthStatistics);
-        }
-
-        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, reportFeeMonthStatisticsDtos);
 
         ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
 

--
Gitblit v1.8.0