From 6e8c95d31d85b53857e4e3ce12ea303eb0ea42eb Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期四, 19 八月 2021 00:47:48 +0800
Subject: [PATCH] 优化代码
---
service-report/src/main/java/com/java110/report/bmo/reportFeeMonthStatistics/impl/GetReportFeeMonthStatisticsBMOImpl.java | 68 +++++++++++++++++++++++++++++++++-
1 files changed, 66 insertions(+), 2 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 4d8fdb7..7522812 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
@@ -1,6 +1,7 @@
package com.java110.report.bmo.reportFeeMonthStatistics.impl;
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.fee.FeeConfigDto;
@@ -42,6 +43,9 @@
@Autowired
private IFeeConfigInnerServiceSMO feeConfigInnerServiceSMOImpl;
+
+ @Autowired
+ private IComputeFeeSMO computeFeeSMOImpl;
/**
* @param reportFeeMonthStatisticsDto
@@ -832,7 +836,7 @@
reportFeeMonthStatisticsDtos = new ArrayList<>();
}
- ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) paramInfo.get("row")), count, reportFeeMonthStatisticsDtos);
+ ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (int) paramInfo.get("row")), count, reportFeeMonthStatisticsDtos);
ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
@@ -857,7 +861,7 @@
reportFeeMonthStatisticsDtos = new ArrayList<>();
}
- ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) paramInfo.get("row")), count, reportFeeMonthStatisticsDtos);
+ ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (int) paramInfo.get("row")), count, reportFeeMonthStatisticsDtos);
ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
@@ -865,6 +869,66 @@
}
@Override
+ public ResponseEntity<String> queryHuaningOweFeeDetail(Map paramInfo) {
+ Calendar calendar = Calendar.getInstance();
+ int count = reportFeeMonthStatisticsInnerServiceSMOImpl.queryHuaningOweFeeDetailCount(paramInfo);
+ List<Map> reportFeeMonthStatisticsDtos = null;
+ if (count > 0) {
+ reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryHuaningOweFeeDetail(paramInfo);
+ refreshOweFee(reportFeeMonthStatisticsDtos, paramInfo);
+ } else {
+ reportFeeMonthStatisticsDtos = new ArrayList<>();
+ }
+
+ ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (int) paramInfo.get("row")), count, reportFeeMonthStatisticsDtos);
+
+ ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+
+ return responseEntity;
+ }
+
+ private void refreshOweFee(List<Map> reportFeeMonthStatisticsDtos, Map paramInfo) {
+ Date startTime = null;
+ Date endTime = null;
+ Calendar calendar = Calendar.getInstance();
+ int curMonth = calendar.get(Calendar.MONTH) + 1;
+ calendar.set(Calendar.MONTH, 0);
+ Date curStart = calendar.getTime();
+
+
+ for (Map paramIn : reportFeeMonthStatisticsDtos) {
+
+ startTime = (Date) paramIn.get("startTime");
+ endTime = (Date) paramIn.get("startTime");
+ BigDecimal money = (BigDecimal) paramIn.get("oweAmount");
+ double month = Math.ceil(computeFeeSMOImpl.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));
+ 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);
--
Gitblit v1.8.0