From 6e27c1e9455efde6ff85facdf977147953eabd93 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期四, 02 二月 2023 16:22:19 +0800
Subject: [PATCH] optimize batch import history fee bug
---
service-fee/src/main/java/com/java110/fee/smo/impl/FeeDiscountInnerServiceSMOImpl.java | 53 ++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 48 insertions(+), 5 deletions(-)
diff --git a/service-fee/src/main/java/com/java110/fee/smo/impl/FeeDiscountInnerServiceSMOImpl.java b/service-fee/src/main/java/com/java110/fee/smo/impl/FeeDiscountInnerServiceSMOImpl.java
index ae4ca0f..96e9a3f 100755
--- a/service-fee/src/main/java/com/java110/fee/smo/impl/FeeDiscountInnerServiceSMOImpl.java
+++ b/service-fee/src/main/java/com/java110/fee/smo/impl/FeeDiscountInnerServiceSMOImpl.java
@@ -7,6 +7,7 @@
import com.java110.dto.fee.FeeDto;
import com.java110.dto.feeDiscount.ComputeDiscountDto;
import com.java110.dto.feeDiscount.FeeDiscountDto;
+import com.java110.dto.feeDiscount.FeeDiscountRuleDto;
import com.java110.dto.feeDiscount.FeeDiscountSpecDto;
import com.java110.dto.payFeeConfigDiscount.PayFeeConfigDiscountDto;
import com.java110.fee.dao.IFeeDiscountServiceDao;
@@ -17,16 +18,14 @@
import com.java110.utils.factory.ApplicationContextFactory;
import com.java110.utils.util.Assert;
import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.MoneyUtil;
import com.java110.utils.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
/**
* @ClassName FloorInnerServiceSMOImpl
@@ -54,12 +53,16 @@
@Autowired
private IApplyRoomDiscountInnerServiceSMO applyRoomDiscountInnerServiceSMOImpl;
+ @Autowired
+ private IFeeDiscountRuleInnerServiceSMO feeDiscountRuleInnerServiceSMOImpl;
+
//鍩�
public static final String DOMAIN_COMMON = "DOMAIN.COMMON";
//閿�
public static final String DISCOUNT_MODE = "DISCOUNT_MODE";
+ private static final String SPEC_RATE = "89002020980015"; // 璧犻�佹湀浠�
@Override
public int saveFeeDiscount(@RequestBody FeeDiscountPo feeDiscountPo) {
@@ -159,7 +162,7 @@
payFeeConfigDiscountDto.setStatusCd("0");
Date currentTime = new Date();
payFeeConfigDiscountDto.setCurrentTime(currentTime);
- //鏍规嵁璐圭敤鏌ヨ鎶樻墸
+ //鏍规嵁璐圭敤椤规煡璇㈡姌鎵o紙璇ヨ垂鐢ㄩ」涓嬬殑鎵�鏈夋姌鎵d俊鎭級
List<PayFeeConfigDiscountDto> payFeeConfigDiscountDtos =
payFeeConfigDiscountInnerServiceSMOImpl.queryPayFeeConfigDiscounts(payFeeConfigDiscountDto);
if (payFeeConfigDiscountDtos == null || payFeeConfigDiscountDtos.size() < 1) {
@@ -169,6 +172,14 @@
List<ComputeDiscountDto> computeDiscountDtoList = new ArrayList<>();
for (ComputeDiscountDto computeDiscountDto : computeDiscountDtos) {
computeDiscountDto.setValue(value);
+
+ computeDiscountDto.setDiscountPrice(
+ MoneyUtil.computePriceScale(
+ computeDiscountDto.getDiscountPrice(),
+ feeDtos.get(0).getScale(),
+ Integer.parseInt(feeDtos.get(0).getDecimalPlace())
+ )
+ );
if (!StringUtil.isEmpty(computeDiscountDto.getDiscountType()) && "3003".equals(computeDiscountDto.getDiscountType())) {
computeDiscountDto.setArdId(feeDetailDto.getArdId());
}
@@ -184,6 +195,30 @@
for (PayFeeConfigDiscountDto tmpPayFeeConfigDiscountDto : payFeeConfigDiscountDtos) {
//鑾峰彇缂磋垂鏈�澶ф埅姝㈡椂闂�
Date payMaxEndTime = tmpPayFeeConfigDiscountDto.getPayMaxEndTime();
+ FeeDiscountDto feeDiscountDto = new FeeDiscountDto();
+ feeDiscountDto.setDiscountId(tmpPayFeeConfigDiscountDto.getDiscountId());
+ //鏌ヨ鎵撴姌琛�
+ List<FeeDiscountDto> feeDiscountInfo = BeanConvertUtil.covertBeanList(feeDiscountServiceDaoImpl.getFeeDiscountInfo(BeanConvertUtil.beanCovertMap(feeDiscountDto)), FeeDiscountDto.class);
+ Assert.listOnlyOne(feeDiscountInfo, "鏌ヨ鎵撴姌琛ㄩ敊璇紒");
+ FeeDiscountRuleDto feeDiscountRuleDto = new FeeDiscountRuleDto();
+ feeDiscountRuleDto.setRuleId(feeDiscountInfo.get(0).getRuleId());
+ //鏌ヨ鎵撴姌瑙勫垯琛�
+ List<FeeDiscountRuleDto> feeDiscountRuleDtos = feeDiscountRuleInnerServiceSMOImpl.queryFeeDiscountRules(feeDiscountRuleDto);
+ Assert.listOnlyOne(feeDiscountRuleDtos, "鏌ヨ鎵撴姌瑙勫垯琛ㄩ敊璇紒");
+ if (!StringUtil.isEmpty(feeDiscountRuleDtos.get(0).getBeanImpl()) && feeDiscountRuleDtos.get(0).getBeanImpl().equals("reductionMonthFeeRule")) { //璧犻�佽鍒�
+ FeeDiscountSpecDto feeDiscountSpecDto = new FeeDiscountSpecDto();
+ feeDiscountSpecDto.setDiscountId(tmpPayFeeConfigDiscountDto.getDiscountId());
+ feeDiscountSpecDto.setSpecId(SPEC_RATE);
+ //鏌ヨ鎵撴姌瑙勬牸
+ List<FeeDiscountSpecDto> feeDiscountSpecDtos = feeDiscountSpecInnerServiceSMOImpl.queryFeeDiscountSpecs(feeDiscountSpecDto);
+ Assert.listOnlyOne(feeDiscountSpecDtos, "鏌ヨ鎵撴姌瑙勬牸琛ㄩ敊璇紒");
+ //鑾峰彇璧犻�佹湀浠�
+ String specValue = feeDiscountSpecDtos.get(0).getSpecValue();
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(finishTime);
+ cal.add(Calendar.MONTH, Integer.parseInt(specValue));
+ finishTime = cal.getTime();
+ }
if (payMaxEndTime == null) {
doCompute(tmpPayFeeConfigDiscountDto, Double.parseDouble(feeDetailDto.getCycles()), computeDiscountDtos, feeDetailDto.getFeeId());
} else if (payMaxEndTime.getTime() >= finishTime.getTime()) {
@@ -191,6 +226,7 @@
} else {
continue;
}
+ finishTime = c.getTime();
}
computeApplyRoomDiscount(feeDetailDto, simpleDateFormat, c, computeDiscountDtos);
//鍙栧嚭寮�鍏虫槧灏勭殑鍊�
@@ -198,6 +234,13 @@
List<ComputeDiscountDto> computeDiscountDtoList = new ArrayList<>();
for (ComputeDiscountDto computeDiscountDto : computeDiscountDtos) {
computeDiscountDto.setValue(value);
+ computeDiscountDto.setDiscountPrice(
+ MoneyUtil.computePriceScale(
+ computeDiscountDto.getDiscountPrice(),
+ feeDtos.get(0).getScale(),
+ Integer.parseInt(feeDtos.get(0).getDecimalPlace())
+ )
+ );
if (!StringUtil.isEmpty(computeDiscountDto.getDiscountType()) && "3003".equals(computeDiscountDto.getDiscountType())) {
computeDiscountDto.setArdId(feeDetailDto.getArdId());
}
--
Gitblit v1.8.0