From 65763d38cf9b6b8067a293d9c99297efea0de3e3 Mon Sep 17 00:00:00 2001
From: 928255095 <928255095@qq.com>
Date: 星期二, 07 九月 2021 22:04:15 +0800
Subject: [PATCH] Merge branch 'xinghong-dev' into 'master'

---
 service-report/src/main/java/com/java110/report/bmo/reportFeeMonthStatistics/impl/GetReportFeeMonthStatisticsBMOImpl.java |   72 ++++++++++++++++++++++++++----------
 1 files changed, 52 insertions(+), 20 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 aeeb100..470c651 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
@@ -33,12 +33,7 @@
 
 import java.math.BigDecimal;
 import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 @Service("getReportFeeMonthStatisticsBMOImpl")
 public class GetReportFeeMonthStatisticsBMOImpl implements IGetReportFeeMonthStatisticsBMO {
@@ -60,6 +55,7 @@
     @Autowired
     private IOwnerInnerServiceSMO ownerInnerServiceSMOImpl;
 
+    @Autowired
     private IComputeFeeSMO computeFeeSMOImpl;
 
     /**
@@ -246,8 +242,8 @@
             ReportFeeMonthStatisticsDto tmpReportFeeMonthStatisticsDto = reportFeeMonthStatisticsInnerServiceSMOImpl.queryOweFeeDetailMajor(reportFeeMonthStatisticsDto);
             if (reportFeeMonthStatisticsDtos != null && reportFeeMonthStatisticsDtos.size() > 0) {
                 for (ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto1 : reportFeeMonthStatisticsDtos) {
-                    reportFeeMonthStatisticsDto1.setAllReceivableAmount(tmpReportFeeMonthStatisticsDto.getAllReceivableAmount());
-                    reportFeeMonthStatisticsDto1.setAllReceivedAmount(tmpReportFeeMonthStatisticsDto.getAllReceivedAmount());
+//                    reportFeeMonthStatisticsDto1.setAllReceivableAmount(tmpReportFeeMonthStatisticsDto.getAllReceivableAmount());
+//                    reportFeeMonthStatisticsDto1.setAllReceivedAmount(tmpReportFeeMonthStatisticsDto.getAllReceivedAmount());
                     reportFeeMonthStatisticsDto1.setAllOweAmount(tmpReportFeeMonthStatisticsDto.getAllOweAmount());
                 }
             }
@@ -428,13 +424,52 @@
                         OwnerRoomRelDto ownerRoomRelDto = new OwnerRoomRelDto();
                         ownerRoomRelDto.setRoomId(repairDtos.get(0).getRepairObjId());
                         List<OwnerRoomRelDto> ownerRoomRelDtos = ownerRoomRelInnerServiceSMOImpl.queryOwnerRoomRels(ownerRoomRelDto);
-                        Assert.listOnlyOne(ownerRoomRelDtos, "鏌ヨ涓氫富鎴垮眿鍏崇郴琛ㄩ敊璇紒");
-                        OwnerDto ownerDto = new OwnerDto();
-                        ownerDto.setOwnerId(ownerRoomRelDtos.get(0).getOwnerId());
-                        ownerDto.setOwnerTypeCd("1001"); //涓氫富鏈汉
-                        List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryOwners(ownerDto);
-                        Assert.listOnlyOne(ownerDtos, "鏌ヨ涓氫富淇℃伅閿欒锛�");
-                        reportFeeMonthStatistics.setOwnerName(ownerDtos.get(0).getName());
+                        if (ownerRoomRelDtos != null && ownerRoomRelDtos.size() == 0) { //鏌ヨ鏉℃暟涓�0鏉�
+                            OwnerRoomRelDto ownerRoomRel = new OwnerRoomRelDto();
+                            ownerRoomRel.setRoomId(repairDtos.get(0).getRepairObjId());
+                            ownerRoomRel.setStatusCd("1"); //鐪嬬湅涓氫富鎴垮眿鍏崇郴鏁版嵁鏄惁鍒犻櫎浜�
+                            List<OwnerRoomRelDto> ownerRoomRels = ownerRoomRelInnerServiceSMOImpl.queryOwnerRoomRels(ownerRoomRel);
+                            Assert.listOnlyOne(ownerRoomRels, "鏌ヨ涓氫富鎴垮眿鍏崇郴琛ㄩ敊璇紒");
+                            OwnerDto owner = new OwnerDto();
+                            owner.setOwnerId(ownerRoomRels.get(0).getOwnerId());
+                            owner.setOwnerTypeCd("1001"); //涓氫富鏈汉
+                            List<OwnerDto> owners = ownerInnerServiceSMOImpl.queryOwners(owner);
+                            if (owners != null && owners.size() == 0) { //鏌ュ嚭鏉℃暟涓�0鏉�
+                                //鍒ゆ柇涓氫富鏄惁鍒犻櫎浜�
+                                OwnerDto newOwner = new OwnerDto();
+                                newOwner.setOwnerId(ownerRoomRels.get(0).getOwnerId());
+                                newOwner.setOwnerTypeCd("1001"); //涓氫富鏈汉
+                                newOwner.setStatusCd("1");
+                                List<OwnerDto> newOwners = ownerInnerServiceSMOImpl.queryOwners(newOwner);
+                                Assert.listOnlyOne(newOwners, "鏌ヨ涓氫富淇℃伅閿欒锛�");
+                                reportFeeMonthStatistics.setOwnerName(newOwners.get(0).getName());
+                            } else if (owners != null && owners.size() == 1) { //鏌ュ嚭鏉℃暟涓�1鏉�
+                                reportFeeMonthStatistics.setOwnerName(owners.get(0).getName());
+                            } else {
+                                throw new IllegalArgumentException("鏌ヨ涓氫富淇℃伅閿欒锛�");
+                            }
+                        } else if (ownerRoomRelDtos != null && ownerRoomRelDtos.size() == 1) { //鏌ヨ鏉℃暟涓�1鏉�
+                            OwnerDto ownerDto = new OwnerDto();
+                            ownerDto.setOwnerId(ownerRoomRelDtos.get(0).getOwnerId());
+                            ownerDto.setOwnerTypeCd("1001"); //涓氫富鏈汉
+                            List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryOwners(ownerDto);
+                            if (ownerDtos != null && ownerDtos.size() == 0) { //涓氫富鏌ヨ鏉℃暟涓�0鏉�
+                                //鍒ゆ柇涓氫富鏄惁鍒犻櫎浜�
+                                OwnerDto newOwner = new OwnerDto();
+                                newOwner.setOwnerId(ownerRoomRelDtos.get(0).getOwnerId());
+                                newOwner.setOwnerTypeCd("1001"); //涓氫富鏈汉
+                                newOwner.setStatusCd("1");
+                                List<OwnerDto> newOwners = ownerInnerServiceSMOImpl.queryOwners(newOwner);
+                                Assert.listOnlyOne(newOwners, "鏌ヨ涓氫富淇℃伅閿欒锛�");
+                                reportFeeMonthStatistics.setOwnerName(newOwners.get(0).getName());
+                            } else if (ownerDtos != null || ownerDtos.size() == 1) {
+                                reportFeeMonthStatistics.setOwnerName(ownerDtos.get(0).getName());
+                            } else {
+                                throw new IllegalArgumentException("鏌ヨ涓氫富淇℃伅閿欒锛�");
+                            }
+                        } else {
+                            throw new IllegalArgumentException("鏌ヨ涓氫富鎴垮眿鍏崇郴琛ㄩ敊璇紒");
+                        }
                     }
                 }
                 reportList.add(reportFeeMonthStatistics);
@@ -933,7 +968,7 @@
         for (Map paramIn : reportFeeMonthStatisticsDtos) {
 
             startTime = (Date) paramIn.get("startTime");
-            endTime = (Date) paramIn.get("startTime");
+            endTime = (Date) paramIn.get("endTime");
             BigDecimal money = (BigDecimal) paramIn.get("oweAmount");
             double month = Math.ceil(computeFeeSMOImpl.dayCompare(startTime, endTime));
             if (month < 1) {
@@ -997,12 +1032,9 @@
     }
 
     private void freshReportOweDay(List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos) {
-
-        Date nowDate = DateUtil.getCurrentDate();
-
         for (ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto : reportFeeMonthStatisticsDtos) {
             try {
-                int day = DateUtil.daysBetween(nowDate, DateUtil.getDateFromString(reportFeeMonthStatisticsDto.getFeeCreateTime(),
+                int day = DateUtil.daysBetween(DateUtil.getDateFromString(reportFeeMonthStatisticsDto.getDeadlineTime(), DateUtil.DATE_FORMATE_STRING_A), DateUtil.getDateFromString(reportFeeMonthStatisticsDto.getFeeCreateTime(),
                         DateUtil.DATE_FORMATE_STRING_A));
                 reportFeeMonthStatisticsDto.setOweDay(day);
             } catch (Exception e) {

--
Gitblit v1.8.0