From ce64e667815b39efdc2f8bd52be0d43d49db8d84 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期日, 17 七月 2022 00:06:29 +0800
Subject: [PATCH] 优化小区位置
---
service-report/src/main/java/com/java110/report/smo/impl/GeneratorFeeMonthStatisticsInnerServiceSMOImpl.java | 104 +++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 95 insertions(+), 9 deletions(-)
diff --git a/service-report/src/main/java/com/java110/report/smo/impl/GeneratorFeeMonthStatisticsInnerServiceSMOImpl.java b/service-report/src/main/java/com/java110/report/smo/impl/GeneratorFeeMonthStatisticsInnerServiceSMOImpl.java
index 0685c30..ab4860d 100755
--- a/service-report/src/main/java/com/java110/report/smo/impl/GeneratorFeeMonthStatisticsInnerServiceSMOImpl.java
+++ b/service-report/src/main/java/com/java110/report/smo/impl/GeneratorFeeMonthStatisticsInnerServiceSMOImpl.java
@@ -2,8 +2,10 @@
import com.alibaba.fastjson.JSONObject;
import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.core.log.LoggerFactory;
import com.java110.core.smo.IComputeFeeSMO;
import com.java110.dto.RoomDto;
+import com.java110.dto.fee.FeeConfigDto;
import com.java110.dto.fee.FeeDto;
import com.java110.dto.owner.OwnerCarDto;
import com.java110.dto.report.ReportCarDto;
@@ -19,7 +21,6 @@
import com.java110.report.dao.IReportFeeServiceDao;
import com.java110.utils.util.*;
import org.slf4j.Logger;
-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;
@@ -71,6 +72,9 @@
Assert.hasLength(communityId, "鏈寘鍚皬鍖轰俊鎭�");
+ //杩欓噷澶勭悊 鎶ヨ〃涓殑璐圭敤鏄惁琚汉涓� 鍙栨秷 鎴栬�呰垂鐢ㄩ」鏄惁琚垹闄わ紝杩欑鏁版嵁 鎶ヨ〃涓仛娓呯悊锛屼互闃插奖鍝� 鎶ヨ〃鐨勫噯纭害
+ feeDataFiltering(communityId);
+
//澶勭悊鎴垮眿璐圭敤
dealRoomFee(reportFeeMonthStatisticsPo);
@@ -79,6 +83,31 @@
//澶勭悊缂磋垂缁撴潫鐨勬儏鍐�
dealFinishFee(communityId);
+ }
+
+ private void feeDataFiltering(String communityId) {
+ Map reportFeeDto = new HashMap();
+ reportFeeDto.put("communityId", communityId);
+ List<Map> feeDtos = reportFeeMonthStatisticsServiceDaoImpl.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);
+ reportFeeMonthStatisticsServiceDaoImpl.deleteInvalidFee(reportFeeDto);
+ feeIds = new ArrayList<>();
+ }
+ }
+ reportFeeDto.put("feeIds", feeIds);
+ if (feeIds.size() > 0) {
+ reportFeeMonthStatisticsServiceDaoImpl.deleteInvalidFee(reportFeeDto);
+ }
}
private void dealFinishFee(String communityId) {
@@ -215,7 +244,7 @@
reportFeeMonthStatisticsDto.setCommunityId(tmpReportCarDto.getCommunityId());
reportFeeMonthStatisticsDto.setConfigId(tmpReportFeeDto.getConfigId());
reportFeeMonthStatisticsDto.setObjId(tmpReportFeeDto.getPayerObjId());
- //reportFeeMonthStatisticsDto.setFeeId(tmpReportFeeDto.getFeeId());
+ reportFeeMonthStatisticsDto.setFeeId(tmpReportFeeDto.getFeeId());//杩欓噷涓嶈兘娉ㄩ噴 濡傛灉涓�涓垂鐢ㄥ垱寤哄鏉℃椂浼氭湁bug
reportFeeMonthStatisticsDto.setObjType(tmpReportFeeDto.getPayerObjType());
reportFeeMonthStatisticsDto.setFeeYear(DateUtil.getYear() + "");
reportFeeMonthStatisticsDto.setFeeMonth(DateUtil.getMonth() + "");
@@ -413,7 +442,7 @@
reportFeeMonthStatisticsDto.setCommunityId(reportRoomDto.getCommunityId());
reportFeeMonthStatisticsDto.setConfigId(tmpReportFeeDto.getConfigId());
reportFeeMonthStatisticsDto.setObjId(tmpReportFeeDto.getPayerObjId());
- //reportFeeMonthStatisticsDto.setFeeId(tmpReportFeeDto.getFeeId());
+ reportFeeMonthStatisticsDto.setFeeId(tmpReportFeeDto.getFeeId()); //杩欓噷涓嶈兘娉ㄩ噴锛屽洜涓轰竴涓垂鐢ㄥ娆″垱寤烘椂浼氬瓨鍦ㄨ鐩� 瀛樺湪bug闂
reportFeeMonthStatisticsDto.setObjType(tmpReportFeeDto.getPayerObjType());
reportFeeMonthStatisticsDto.setFeeYear(DateUtil.getYear() + "");
reportFeeMonthStatisticsDto.setFeeMonth(DateUtil.getMonth() + "");
@@ -485,6 +514,8 @@
reportFeeMonthStatisticsPo.setPreReceivedAmount(getReceivedAmount(tmpReportFeeDto, 3) + "");
reportFeeMonthStatisticsPo.setUpdateTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
reportFeeMonthStatisticsServiceDaoImpl.saveReportFeeMonthStatisticsInfo(BeanConvertUtil.beanCovertMap(reportFeeMonthStatisticsPo));
+ //澶勭悊姘寸數璐癸紝姘寸數璐规牴鎹紑濮嬫椂闂磋鍦ㄧ浉搴旀湀琛ュ厖鏁版嵁
+ dealMeteWater(reportFeeMonthStatisticsPo, tmpReportFeeDto);
}
@@ -496,6 +527,45 @@
tmpReportFeeMonthStatisticsPo.setCurMaxTime(DateUtil.getFormatTimeString(endTime, DateUtil.DATE_FORMATE_STRING_A));
tmpReportFeeMonthStatisticsPo.setOweAmount("0");
reportFeeMonthStatisticsServiceDaoImpl.updateReportFeeMonthStatisticsOwe(BeanConvertUtil.beanCovertMap(tmpReportFeeMonthStatisticsPo));
+ }
+
+ /**
+ * 澶勭悊姘寸數璐�
+ *
+ * @param reportFeeMonthStatisticsPo
+ * @param tmpReportFeeDto
+ */
+ private void dealMeteWater(ReportFeeMonthStatisticsPo reportFeeMonthStatisticsPo, ReportFeeDto tmpReportFeeDto) {
+
+ //濡傛灉鏄� 姘磋垂 鐢佃垂 鐓ゆ皵璐�
+ if (!FeeConfigDto.FEE_TYPE_CD_METER.equals(tmpReportFeeDto.getFeeTypeCd())
+ && !FeeConfigDto.FEE_TYPE_CD_WATER.equals(tmpReportFeeDto.getFeeTypeCd())
+ && !FeeConfigDto.FEE_TYPE_CD_GAS.equals(tmpReportFeeDto.getFeeTypeCd())
+ ) {
+ return;
+ }
+ //鏍规嵁璐圭敤寮�濮嬫椂闂� 璁$畻鏈堜唤
+ Date endTime = tmpReportFeeDto.getEndTime();
+ //鍘婚櫎 0 鍥犱负琛ㄩ噷鐨勬湀浠芥槸娌℃湁闆�
+ String curMonth = Integer.parseInt(DateUtil.getFormatTimeString(endTime, "MM"))+"";
+ String curYear = DateUtil.getFormatTimeString(endTime, "YYYY");
+ //鏌ヨ鏄惁瀛樺湪 鏁版嵁
+ ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto = new ReportFeeMonthStatisticsDto();
+ reportFeeMonthStatisticsDto.setCommunityId(tmpReportFeeDto.getCommunityId());
+ reportFeeMonthStatisticsDto.setConfigId(tmpReportFeeDto.getConfigId());
+ reportFeeMonthStatisticsDto.setObjId(tmpReportFeeDto.getPayerObjId());
+ //reportFeeMonthStatisticsDto.setFeeId(tmpReportFeeDto.getFeeId());
+ reportFeeMonthStatisticsDto.setObjType(tmpReportFeeDto.getPayerObjType());
+ reportFeeMonthStatisticsDto.setFeeYear(curYear);
+ reportFeeMonthStatisticsDto.setFeeMonth(curMonth);
+ List<ReportFeeMonthStatisticsDto> statistics = BeanConvertUtil.covertBeanList(
+ reportFeeMonthStatisticsServiceDaoImpl.getReportFeeMonthStatisticsInfo(BeanConvertUtil.beanCovertMap(reportFeeMonthStatisticsDto)),
+ ReportFeeMonthStatisticsDto.class);
+ if (!ListUtil.isNull(statistics)) {
+ return;
+ }
+ reportFeeMonthStatisticsPo.setStatisticsId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_statisticsId));
+ reportFeeMonthStatisticsServiceDaoImpl.saveReportFeeMonthStatisticsInfo(BeanConvertUtil.beanCovertMap(reportFeeMonthStatisticsPo));
}
@@ -523,11 +593,17 @@
BigDecimal feePriceDec = new BigDecimal(tmpReportFeeDto.getFeePrice());
Date curDate = DateUtil.getFirstDate();
+ Date nowDate = DateUtil.getCurrentDate();
double month = 0.0;
//宸茬粡瓒呰繃鎴鏃堕棿 鍜� 杩樻病鏈夊埌寮�濮嬫椂闂�
if (curDate.getTime() > tmpReportFeeDto.getDeadlineTime().getTime()
- || curDate.getTime() < tmpReportFeeDto.getEndTime().getTime()) {
+ || nowDate.getTime() < tmpReportFeeDto.getEndTime().getTime()) {
return 0.0;
+ }
+
+ //濡傛灉 1鍙峰皬浜� 璁¤垂璧峰鏃堕棿 閭d箞 灏哻urDate 鏀逛负 褰撳墠鏃堕棿
+ if (curDate.getTime() < tmpReportFeeDto.getEndTime().getTime()) {
+ curDate = tmpReportFeeDto.getEndTime();
}
//杩欓噷闇�瑕佸垽鏂� 缁撴潫鏃堕棿 鏄惁 澶т簬浜嗗綋鏈堟渶鍚庝竴澶╋紝褰撴湀澶╂暟 * 姣忓ぉ閲戦
@@ -776,6 +852,11 @@
}
Date endTime = ownerCarDtos.get(0).getEndTime();
+ Date maxEndDate = tmpReportFeeDto.getDeadlineTime();
+ if (FeeDto.FEE_FLAG_CYCLE.equals(tmpReportFeeDto.getFeeFlag())) {
+ maxEndDate = tmpReportFeeDto.getConfigEndTime();
+ }
+
//1.0 璐圭敤鍒版湡鏃堕棿鍜岃垂鐢ㄧ粨鏉熸椂闂� 閮戒笉鍦ㄥ綋鏈�
if (!belongCurMonth(tmpReportFeeDto.getEndTime())
&& !belongCurMonth(endTime)
@@ -795,7 +876,7 @@
if (!belongCurMonth(tmpReportFeeDto.getEndTime())
&& belongCurMonth(endTime)) {
//绠楀ぉ鏁�
- double month = computeFeeSMOImpl.dayCompare(DateUtil.getFirstDate(), tmpReportFeeDto.getConfigEndTime());
+ double month = computeFeeSMOImpl.dayCompare(DateUtil.getFirstDate(), maxEndDate);
BigDecimal curDegree = new BigDecimal(month);
return curDegree.multiply(feePriceDec).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
}
@@ -841,16 +922,21 @@
return computeOnceFee(tmpReportFeeDto);
}
+ Date maxEndDate = tmpReportFeeDto.getDeadlineTime();
+ if (FeeDto.FEE_FLAG_CYCLE.equals(tmpReportFeeDto.getFeeFlag())) {
+ maxEndDate = tmpReportFeeDto.getConfigEndTime();
+ }
+
//1.0 璐圭敤鍒版湡鏃堕棿鍜岃垂鐢ㄧ粨鏉熸椂闂� 閮戒笉鍦ㄥ綋鏈�
if (!belongCurMonth(tmpReportFeeDto.getEndTime())
- && !belongCurMonth(tmpReportFeeDto.getConfigEndTime())
+ && !belongCurMonth(maxEndDate)
&& tmpReportFeeDto.getEndTime().getTime() < DateUtil.getFirstDate().getTime()) {
return feePrice;
}
//2.0 璐圭敤鍒版湡鏃堕棿 鍦ㄥ綋鏈堬紝璐圭敤缁撴潫鏃堕棿涓嶅湪褰撴湀
if (belongCurMonth(tmpReportFeeDto.getEndTime())
- && !belongCurMonth(tmpReportFeeDto.getConfigEndTime())) {
+ && !belongCurMonth(maxEndDate)) {
//绠楀ぉ鏁�
double month = computeFeeSMOImpl.dayCompare(tmpReportFeeDto.getEndTime(), DateUtil.getNextMonthFirstDate());
BigDecimal curDegree = new BigDecimal(month);
@@ -858,9 +944,9 @@
}
//3.0 璐圭敤鍒版湡鏃堕棿 涓嶅湪褰撴湀锛岃垂鐢ㄧ粨鏉熸椂闂村湪褰撴湀
if (!belongCurMonth(tmpReportFeeDto.getEndTime())
- && belongCurMonth(tmpReportFeeDto.getConfigEndTime())) {
+ && belongCurMonth(maxEndDate)) {
//绠楀ぉ鏁�
- double month = computeFeeSMOImpl.dayCompare(DateUtil.getFirstDate(), tmpReportFeeDto.getConfigEndTime());
+ double month = computeFeeSMOImpl.dayCompare(DateUtil.getFirstDate(), maxEndDate);
BigDecimal curDegree = new BigDecimal(month);
return curDegree.multiply(feePriceDec).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
}
--
Gitblit v1.8.0