From 35abc758bf497882462d50deda212af8a1666a9d Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期一, 25 十一月 2024 09:22:37 +0800
Subject: [PATCH] 优化出售车辆时间问题

---
 service-report/src/main/java/com/java110/report/bmo/reportFeeMonthStatistics/impl/GetReportFeeMonthStatisticsBMOImpl.java |   89 ++++++++------------------------------------
 1 files changed, 17 insertions(+), 72 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 efba38e..c2fba61 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
@@ -3,17 +3,13 @@
 import com.alibaba.fastjson.JSONObject;
 import com.java110.core.smo.IComputeFeeSMO;
 import com.java110.dto.PageDto;
-import com.java110.dto.RoomDto;
+import com.java110.dto.room.RoomDto;
 import com.java110.dto.fee.FeeConfigDto;
-import com.java110.dto.fee.FeeDetailDto;
 import com.java110.dto.fee.FeeDto;
 import com.java110.dto.owner.OwnerDto;
-import com.java110.dto.owner.OwnerRoomRelDto;
-import com.java110.dto.repair.RepairDto;
 import com.java110.dto.repair.RepairUserDto;
 import com.java110.dto.report.ReportDeposit;
-import com.java110.dto.reportFeeMonthStatistics.ReportFeeMonthStatisticsDto;
-import com.java110.dto.reportFeeMonthStatistics.ReportFeeMonthStatisticsTotalDto;
+import com.java110.dto.reportFee.ReportFeeMonthStatisticsDto;
 import com.java110.intf.community.IRepairInnerServiceSMO;
 import com.java110.intf.fee.IFeeConfigInnerServiceSMO;
 import com.java110.intf.fee.IFeeDetailInnerServiceSMO;
@@ -22,8 +18,9 @@
 import com.java110.intf.user.IOwnerInnerServiceSMO;
 import com.java110.intf.user.IOwnerRoomRelInnerServiceSMO;
 import com.java110.report.bmo.reportFeeMonthStatistics.IGetReportFeeMonthStatisticsBMO;
-import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
 import com.java110.utils.util.DateUtil;
+import com.java110.utils.util.ListUtil;
 import com.java110.utils.util.StringUtil;
 import com.java110.vo.ResultVo;
 import org.slf4j.Logger;
@@ -36,7 +33,6 @@
 import java.lang.reflect.Field;
 import java.math.BigDecimal;
 import java.text.ParseException;
-import java.text.SimpleDateFormat;
 import java.util.*;
 
 @Service("getReportFeeMonthStatisticsBMOImpl")
@@ -131,9 +127,7 @@
         }
 
         ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reportFeeMonthStatisticsDto.getRow()), count, reportFeeMonthStatisticsDtos);
-
         ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
-
         return responseEntity;
     }
 
@@ -179,7 +173,6 @@
                     .setScale(2, BigDecimal.ROUND_HALF_UP);
             tmpReportFeeMonthStatisticsDto.setHisOweAmount(hisOweAmountDec.doubleValue());
 
-
             //褰撴湀搴旀敹
             curReceivableAmountDec = new BigDecimal(tmpReportFeeMonthStatisticsDto.getCurReceivableAmount());
             curReceivableAmountDec = curReceivableAmountDec.add(new BigDecimal(reportFeeMonthStatisticsDto.getCurReceivableAmount()))
@@ -216,7 +209,6 @@
                     .setScale(2, BigDecimal.ROUND_HALF_UP);
             tmpReportFeeMonthStatisticsDto.setReceivedAmount(receivedAmountDec.doubleValue() + "");
         }
-
         return reportFeeMonthStatisticsDtos;
     }
 
@@ -234,7 +226,6 @@
                 return tmpReportFeeMonthStatisticsDto;
             }
         }
-
         return null;
     }
 
@@ -243,7 +234,6 @@
         reportFeeMonthStatisticsDto.setFeeYear(DateUtil.getYear() + "");
         reportFeeMonthStatisticsDto.setFeeMonth(DateUtil.getMonth() + "");
         int count = reportFeeMonthStatisticsInnerServiceSMOImpl.queryReportFloorUnitFeeSummaryCount(reportFeeMonthStatisticsDto);
-
         List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos = null;
         if (count > 0) {
             reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryReportFloorUnitFeeSummary(reportFeeMonthStatisticsDto);
@@ -272,7 +262,6 @@
 
     @Override
     public ResponseEntity<String> queryFeeBreakdown(ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto) {
-
         if (StringUtil.isEmpty(reportFeeMonthStatisticsDto.getYearMonth())) {
             reportFeeMonthStatisticsDto.setFeeYear(DateUtil.getYear() + "");
             reportFeeMonthStatisticsDto.setFeeMonth(DateUtil.getMonth() + "");
@@ -327,8 +316,6 @@
 
     @Override
     public ResponseEntity<String> queryFeeDetail(ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto) {
-
-
         reportFeeMonthStatisticsDto.setFeeYear(DateUtil.getYear() + "");
         reportFeeMonthStatisticsDto.setFeeMonth(DateUtil.getMonth() + "");
 
@@ -381,12 +368,11 @@
     @Override
     public ResponseEntity<String> queryOweFeeDetail(ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto) {
         int count = reportFeeMonthStatisticsInnerServiceSMOImpl.queryOweFeeDetailCount(reportFeeMonthStatisticsDto);
-
         List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos = null;
         if (count > 0) {
             reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryOweFeeDetail(reportFeeMonthStatisticsDto);
             ReportFeeMonthStatisticsDto tmpReportFeeMonthStatisticsDto = reportFeeMonthStatisticsInnerServiceSMOImpl.queryOweFeeDetailMajor(reportFeeMonthStatisticsDto);
-            if (reportFeeMonthStatisticsDtos != null && reportFeeMonthStatisticsDtos.size() > 0) {
+            if (!ListUtil.isNull(reportFeeMonthStatisticsDtos)) {
                 for (ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto1 : reportFeeMonthStatisticsDtos) {
 //                    reportFeeMonthStatisticsDto1.setAllReceivableAmount(tmpReportFeeMonthStatisticsDto.getAllReceivableAmount());
 //                    reportFeeMonthStatisticsDto1.setAllReceivedAmount(tmpReportFeeMonthStatisticsDto.getAllReceivedAmount());
@@ -405,25 +391,13 @@
         return responseEntity;
     }
 
-    /**
-     * 鍓嶅彴鏌ヨ鍒嗛〉鏌ヨ
-     * @param reportFeeMonthStatisticsDto
-     * @return
-     */
-    @Override
-    public ResponseEntity<String> queryPayFeeDetail(ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto) {
-        ResultVo resultVo = queryPayFeeDetailInnerServiceSMOImpl.query(reportFeeMonthStatisticsDto);
-        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
 
-        return responseEntity;
-    }
 
     /**
      * @param ownerIds
      * @param reportFeeMonthStatisticsDtos
      */
     private void refreshReportFeeMonthStatistics(List<String> ownerIds, List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos) {
-
         if (ownerIds == null || ownerIds.size() < 1) {
             return;
         }
@@ -500,7 +474,6 @@
 
     @Override
     public ResponseEntity<String> queryPrePaymentCount(ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto) {
-
         List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos = null;
 
         reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryPrePaymentCount(reportFeeMonthStatisticsDto);
@@ -514,7 +487,6 @@
 
     @Override
     public ResponseEntity<String> queryDeadlinePaymentCount(ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto) {
-
         List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos = null;
 
         reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryDeadlinePaymentCount(reportFeeMonthStatisticsDto);
@@ -528,7 +500,6 @@
 
     @Override
     public ResponseEntity<String> queryOwePaymentCount(ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto) {
-
         List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos = null;
         List<ReportFeeMonthStatisticsDto> reportAllFeeMonthStatisticsDtos = null;
 
@@ -546,7 +517,6 @@
                 }
             }
         }
-
 
         ResultVo resultVo = new ResultVo(reportAllFeeMonthStatisticsDtos);
 
@@ -713,7 +683,7 @@
         //鑾峰彇鎬绘潯鏁�
         int size = staffs.size();
 
-        ResultVo resultVo = new ResultVo((int) Math.ceil((double) size / (double) repairUserDto.getRow()), repairUserList.size(), repairUserList, staffs, repairUser);
+        ResultVo resultVo = new ResultVo((int) Math.ceil((double) size / (double) repairUserDto.getRow()), size, repairUserList, staffs, repairUser);
 
         ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
 
@@ -836,9 +806,8 @@
 
     @Override
     public ResponseEntity<String> queryHuaningOweFee(ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto) {
-        int count = reportFeeMonthStatisticsInnerServiceSMOImpl.queryHuaningOweFeeCount(reportFeeMonthStatisticsDto);
-
         List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos = null;
+        int count = reportFeeMonthStatisticsInnerServiceSMOImpl.queryHuaningOweFeeCounts(reportFeeMonthStatisticsDto);
         if (count > 0) {
             reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryHuaningOweFee(reportFeeMonthStatisticsDto);
         } else {
@@ -854,26 +823,16 @@
 
     @Override
     public ResponseEntity<String> queryHuaningPayFee(Map paramInfo) {
-        Calendar calendar = Calendar.getInstance();
-        calendar.set(Calendar.YEAR, (int) paramInfo.get("year"));
-        calendar.set(Calendar.MONTH, (int) paramInfo.get("month") - 1);
-        paramInfo.put("yearMonth", DateUtil.getFormatTimeString(calendar.getTime(), "YYYY-MM"));
-        calendar.add(Calendar.MONTH, 1);
-        paramInfo.put("nextYear", calendar.get(Calendar.YEAR));
-        paramInfo.put("nextMonth", calendar.get(Calendar.MONTH) + 1);
-        int count = reportFeeMonthStatisticsInnerServiceSMOImpl.queryHuaningPayFeeCount(paramInfo);
-
         List<Map> reportFeeMonthStatisticsDtos = null;
+        int count = reportFeeMonthStatisticsInnerServiceSMOImpl.queryHuaningPayFeeCounts(paramInfo);
         if (count > 0) {
             reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryHuaningPayFee(paramInfo);
         } else {
             reportFeeMonthStatisticsDtos = new ArrayList<>();
         }
-
-        ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (int) paramInfo.get("row")), count, reportFeeMonthStatisticsDtos);
-
+        ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto = BeanConvertUtil.covertBean(paramInfo, ReportFeeMonthStatisticsDto.class);
+        ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reportFeeMonthStatisticsDto.getRow()), count, reportFeeMonthStatisticsDtos);
         ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
-
         return responseEntity;
     }
 
@@ -904,12 +863,12 @@
 
     @Override
     public ResponseEntity<String> queryHuaningOweFeeDetail(Map paramInfo) {
-        Calendar calendar = Calendar.getInstance();
+        //Calendar calendar = Calendar.getInstance();
         int count = reportFeeMonthStatisticsInnerServiceSMOImpl.queryHuaningOweFeeDetailCount(paramInfo);
         List<Map> reportFeeMonthStatisticsDtos = null;
         if (count > 0) {
             reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryHuaningOweFeeDetail(paramInfo);
-            refreshOweFee(reportFeeMonthStatisticsDtos, paramInfo);
+            // refreshOweFee(reportFeeMonthStatisticsDtos, paramInfo);
         } else {
             reportFeeMonthStatisticsDtos = new ArrayList<>();
         }
@@ -929,44 +888,36 @@
         calendar.set(Calendar.MONTH, 0);
         Date curStart = calendar.getTime();
 
-
         for (Map paramIn : reportFeeMonthStatisticsDtos) {
-
             startTime = (Date) paramIn.get("startTime");
             endTime = (Date) paramIn.get("endTime");
             BigDecimal money = (BigDecimal) paramIn.get("oweAmount");
-            double month = Math.ceil(computeFeeSMOImpl.dayCompare(startTime, endTime));
+            double month = Math.ceil(DateUtil.dayCompare(startTime, endTime));
             if (month < 1) {
                 paramIn.put("btAmount", 0);
                 paramIn.put("bfAmount", 0);
                 continue;
             }
-
             //姣忔湀閲戦
             BigDecimal monthAmount = money.divide(new BigDecimal(month), 2, BigDecimal.ROUND_HALF_EVEN);
-
             if (startTime.getTime() < curStart.getTime()) {
                 BigDecimal btAmountDec = monthAmount.multiply(new BigDecimal(curMonth)).setScale(2, BigDecimal.ROUND_HALF_EVEN);
                 paramIn.put("btAmount", btAmountDec.doubleValue());
-                double preMonth = Math.ceil(computeFeeSMOImpl.dayCompare(startTime, curStart));
+                double preMonth = Math.ceil(DateUtil.dayCompare(startTime, curStart));
                 BigDecimal bfAmountDec = monthAmount.multiply(new BigDecimal(preMonth)).setScale(2, BigDecimal.ROUND_HALF_EVEN);
                 paramIn.put("bfAmount", bfAmountDec.doubleValue());
                 continue;
             }
-
             if (startTime.getTime() >= curStart.getTime()) {
                 paramIn.put("btAmount", money.doubleValue());
                 paramIn.put("bfAmount", 0);
             }
         }
-
     }
 
     @Override
     public ResponseEntity<String> queryPrePayment(ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto) {
-
         int count = reportFeeMonthStatisticsInnerServiceSMOImpl.queryPrePaymentNewCount(reportFeeMonthStatisticsDto);
-
         List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos = null;
         if (count > 0) {
             reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryPrePayment(reportFeeMonthStatisticsDto);
@@ -997,24 +948,20 @@
     }
 
     private void freshReportOweDay(List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos) {
+        int day = 0;
         for (ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto : reportFeeMonthStatisticsDtos) {
             try {
-                SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-                int day = DateUtil.daysBetween(DateUtil.getDateFromString(format.format(new Date()), DateUtil.DATE_FORMATE_STRING_A), DateUtil.getDateFromString(reportFeeMonthStatisticsDto.getFeeCreateTime(),
-                        DateUtil.DATE_FORMATE_STRING_A));
+                day = DateUtil.daysBetween(DateUtil.getDateFromStringA(reportFeeMonthStatisticsDto.getDeadlineTime()),
+                        DateUtil.getDateFromStringA(reportFeeMonthStatisticsDto.getFeeCreateTime()));
                 reportFeeMonthStatisticsDto.setOweDay(day);
             } catch (Exception e) {
                 logger.error("璁$畻娆犺垂澶╂暟澶辫触", e);
             }
-
         }
     }
 
-
     private void freshReportDeadlineDay(List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos) {
-
         Date nowDate = DateUtil.getCurrentDate();
-
         for (ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto : reportFeeMonthStatisticsDtos) {
             try {
                 int day = DateUtil.daysBetween(DateUtil.getDateFromString(reportFeeMonthStatisticsDto.getDeadlineTime(),
@@ -1026,6 +973,4 @@
 
         }
     }
-
-
 }

--
Gitblit v1.8.0