From b173d31976fc4731b7c247d4038de92134eba317 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期四, 29 六月 2023 11:42:17 +0800
Subject: [PATCH] Merge branch 'master' of http://git.homecommunity.cn/supervip/MicroCommunity

---
 service-report/src/main/java/com/java110/report/smo/impl/GeneratorFeeYearStatisticsInnerServiceSMOImpl.java |   76 ++++++++++++++++++++++++++-----------
 1 files changed, 53 insertions(+), 23 deletions(-)

diff --git a/service-report/src/main/java/com/java110/report/smo/impl/GeneratorFeeYearStatisticsInnerServiceSMOImpl.java b/service-report/src/main/java/com/java110/report/smo/impl/GeneratorFeeYearStatisticsInnerServiceSMOImpl.java
index 7b95171..d4bb8d7 100755
--- a/service-report/src/main/java/com/java110/report/smo/impl/GeneratorFeeYearStatisticsInnerServiceSMOImpl.java
+++ b/service-report/src/main/java/com/java110/report/smo/impl/GeneratorFeeYearStatisticsInnerServiceSMOImpl.java
@@ -3,19 +3,19 @@
 import com.alibaba.fastjson.JSONObject;
 import com.java110.core.factory.GenerateCodeFactory;
 import com.java110.core.smo.IComputeFeeSMO;
-import com.java110.dto.RoomDto;
+import com.java110.dto.room.RoomDto;
 import com.java110.dto.fee.FeeDto;
 import com.java110.dto.report.ReportCarDto;
 import com.java110.dto.report.ReportFeeDetailDto;
 import com.java110.dto.report.ReportFeeDto;
 import com.java110.dto.report.ReportRoomDto;
-import com.java110.dto.reportFeeYearCollection.ReportFeeYearCollectionDto;
-import com.java110.dto.reportFeeYearCollectionDetail.ReportFeeYearCollectionDetailDto;
+import com.java110.dto.reportFee.ReportFeeYearCollectionDto;
+import com.java110.dto.reportFee.ReportFeeYearCollectionDetailDto;
 import com.java110.intf.report.IGeneratorFeeYearStatisticsInnerServiceSMO;
 import com.java110.intf.user.IOwnerCarInnerServiceSMO;
-import com.java110.po.reportFeeMonthStatistics.ReportFeeMonthStatisticsPo;
-import com.java110.po.reportFeeYearCollection.ReportFeeYearCollectionPo;
-import com.java110.po.reportFeeYearCollectionDetail.ReportFeeYearCollectionDetailPo;
+import com.java110.po.reportFee.ReportFeeMonthStatisticsPo;
+import com.java110.po.reportFee.ReportFeeYearCollectionPo;
+import com.java110.po.reportFee.ReportFeeYearCollectionDetailPo;
 import com.java110.report.dao.IReportCommunityServiceDao;
 import com.java110.report.dao.IReportFeeServiceDao;
 import com.java110.report.dao.IReportFeeYearCollectionDetailServiceDao;
@@ -23,7 +23,7 @@
 import com.java110.utils.cache.CommonCache;
 import com.java110.utils.util.*;
 import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import com.java110.core.log.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -31,8 +31,7 @@
 
 import java.math.BigDecimal;
 import java.text.ParseException;
-import java.util.Calendar;
-import java.util.List;
+import java.util.*;
 
 /**
  * @ClassName GeneratorFeeMonthStatisticsInnerServiceSMOImpl
@@ -84,12 +83,40 @@
 
         Assert.hasLength(communityId, "鏈寘鍚皬鍖轰俊鎭�");
 
+        //杩欓噷澶勭悊 鎶ヨ〃涓殑璐圭敤鏄惁琚汉涓� 鍙栨秷 鎴栬�呰垂鐢ㄩ」鏄惁琚垹闄わ紝杩欑鏁版嵁 鎶ヨ〃涓仛娓呯悊锛屼互闃插奖鍝� 鎶ヨ〃鐨勫噯纭害
+        feeDataFiltering(communityId);
+
         //澶勭悊鎴垮眿璐圭敤
         dealRoomFee(reportFeeMonthStatisticsPo);
 
         //澶勭悊杞︿綅璐圭敤
         dealCarFee(reportFeeMonthStatisticsPo);
 
+    }
+
+    private void feeDataFiltering(String communityId) {
+        Map reportFeeDto = new HashMap();
+        reportFeeDto.put("communityId", communityId);
+        List<Map> feeDtos = reportCommunityServiceDaoImpl.queryInvalidFeeMonthStatistics(reportFeeDto);
+
+        List<String> feeIds = new ArrayList<>();
+        for (Map feeDto : feeDtos) {
+            if (!feeDto.containsKey("feeId") || StringUtil.isNullOrNone(feeDto.get("feeId"))) {
+                continue;
+            }
+
+            feeIds.add(feeDto.get("feeId").toString());
+
+            if (feeIds.size() >= 50) {
+                reportFeeDto.put("feeIds", feeIds);
+                reportCommunityServiceDaoImpl.deleteInvalidFee(reportFeeDto);
+                feeIds = new ArrayList<>();
+            }
+        }
+        reportFeeDto.put("feeIds", feeIds);
+        if (feeIds.size() > 0) {
+            reportCommunityServiceDaoImpl.deleteInvalidFee(reportFeeDto);
+        }
     }
 
 
@@ -231,15 +258,17 @@
         configStartTime.setTime(tmpReportFeeDto.getConfigEndTime());
         int endYear = configEndTime.get(Calendar.YEAR);
         int curYear = Calendar.getInstance().get(Calendar.YEAR) + 1;
-        double feePrice = computeFeeSMOImpl.getReportFeePrice(tmpReportFeeDto, null, tmpReportCarDto);
-        tmpReportFeeDto.setFeePrice(feePrice);
+
+        FeeDto feeDto = BeanConvertUtil.covertBean(tmpReportFeeDto, FeeDto.class);
+        //鍒峰叆娆犺垂閲戦
+        computeFeeSMOImpl.computeEveryOweFee(feeDto);
 
         if (endYear > curYear) {
             endYear = curYear;
         }
 
         for (int year = startYear; year <= endYear; year++) {
-            computeYearFee(year, tmpReportFeeDto, reportFeeYearCollectionPo);
+            computeYearFee(year, feeDto, reportFeeYearCollectionPo);
         }
 
     }
@@ -324,15 +353,16 @@
         //褰撳墠骞�
         int curYear = Calendar.getInstance().get(Calendar.YEAR) + 1;
 
-        double feePrice = computeFeeSMOImpl.getReportFeePrice(tmpReportFeeDto, reportRoomDto, null);
-        tmpReportFeeDto.setFeePrice(feePrice);
+        FeeDto feeDto = BeanConvertUtil.covertBean(tmpReportFeeDto, FeeDto.class);
+        //鍒峰叆娆犺垂閲戦
+        computeFeeSMOImpl.computeEveryOweFee(feeDto);
 
         if (endYear > curYear) {
             endYear = curYear;
         }
 
         for (int year = startYear; year <= endYear; year++) {
-            computeYearFee(year, tmpReportFeeDto, reportFeeYearCollectionPo);
+            computeYearFee(year, feeDto, reportFeeYearCollectionPo);
         }
     }
 
@@ -340,10 +370,10 @@
      * 璁$畻鎸囧畾骞寸殑鏁版嵁
      *
      * @param year
-     * @param tmpReportFeeDto
+     * @param feeDto
      * @param reportFeeYearCollectionPo
      */
-    private void computeYearFee(int year, ReportFeeDto tmpReportFeeDto, ReportFeeYearCollectionPo reportFeeYearCollectionPo) {
+    private void computeYearFee(int year, FeeDto feeDto, ReportFeeYearCollectionPo reportFeeYearCollectionPo) {
         int curYear = Calendar.getInstance().get(Calendar.YEAR);
 
         ReportFeeYearCollectionDetailDto reportFeeYearCollectionDetailDto = new ReportFeeYearCollectionDetailDto();
@@ -355,13 +385,13 @@
                 = BeanConvertUtil.covertBeanList(reportFeeYearCollectionDetailServiceDaoImpl.getReportFeeYearCollectionDetailInfo(BeanConvertUtil.beanCovertMap(reportFeeYearCollectionDetailDto)),
                 ReportFeeYearCollectionDetailDto.class);
 
-        if (!ListUtil.isNull(reportFeeYearCollectionDetailDtos) && year != curYear) { // 璇存槑宸茬粡澶勭悊杩囦簡 涓嶅啀澶勭悊
-            return;
-        }
+//        if (!ListUtil.isNull(reportFeeYearCollectionDetailDtos) && year != curYear) { // 璇存槑宸茬粡澶勭悊杩囦簡 涓嶅啀澶勭悊
+//            return;
+//        }
 
-        double receivableAmount = getReceivableAmount(tmpReportFeeDto);
+        double receivableAmount = feeDto.getFeePrice();
 
-        double receivedAmount = getReceivedAmount(tmpReportFeeDto, year);
+        double receivedAmount = getReceivedAmount(feeDto, year);
 
         ReportFeeYearCollectionDetailPo reportFeeYearCollectionDetailPo = null;
 
@@ -426,7 +456,7 @@
      * @param tmpReportFeeDto
      * @return
      */
-    private double getReceivedAmount(ReportFeeDto tmpReportFeeDto, int year) {
+    private double getReceivedAmount(FeeDto tmpReportFeeDto, int year) {
         ReportFeeDetailDto feeDetailDto = new ReportFeeDetailDto();
         feeDetailDto.setConfigId(tmpReportFeeDto.getConfigId());
         feeDetailDto.setPayerObjId(tmpReportFeeDto.getPayerObjId());

--
Gitblit v1.8.0