From 8f61316069a6ffffb0998ed3f498bd4e3acc77e4 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期二, 10 五月 2022 11:36:15 +0800
Subject: [PATCH] 优化 费用
---
service-fee/src/main/java/com/java110/fee/cmd/fee/ListFeeCmd.java | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 50 insertions(+), 0 deletions(-)
diff --git a/service-fee/src/main/java/com/java110/fee/cmd/fee/ListFeeCmd.java b/service-fee/src/main/java/com/java110/fee/cmd/fee/ListFeeCmd.java
index 745d509..59f636f 100644
--- a/service-fee/src/main/java/com/java110/fee/cmd/fee/ListFeeCmd.java
+++ b/service-fee/src/main/java/com/java110/fee/cmd/fee/ListFeeCmd.java
@@ -5,6 +5,7 @@
import com.java110.core.context.ICmdDataFlowContext;
import com.java110.core.event.cmd.AbstractServiceCmdListener;
import com.java110.core.event.cmd.CmdEvent;
+import com.java110.core.factory.CommunitySettingFactory;
import com.java110.core.log.LoggerFactory;
import com.java110.core.smo.IComputeFeeSMO;
import com.java110.dto.fee.FeeDto;
@@ -14,6 +15,7 @@
import com.java110.intf.fee.IFeeConfigInnerServiceSMO;
import com.java110.intf.fee.IFeeInnerServiceSMO;
import com.java110.intf.user.IOwnerCarInnerServiceSMO;
+import com.java110.utils.cache.MappingCache;
import com.java110.utils.exception.CmdException;
import com.java110.utils.util.Assert;
import com.java110.utils.util.BeanConvertUtil;
@@ -51,6 +53,18 @@
@Autowired
private IComputeFeeSMO computeFeeSMOImpl;
+
+ //鍩�
+ public static final String DOMAIN_COMMON = "DOMAIN.COMMON";
+
+ //閿�
+ public static final String TOTAL_FEE_PRICE = "TOTAL_FEE_PRICE";
+
+ //閿�
+ public static final String RECEIVED_AMOUNT_SWITCH = "RECEIVED_AMOUNT_SWITCH";
+
+ //绂佺敤鐢佃剳绔彁浜ゆ敹璐规寜閽�
+ public static final String OFFLINE_PAY_FEE_SWITCH = "OFFLINE_PAY_FEE_SWITCH";
@Override
public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
@@ -102,12 +116,34 @@
}
private void computeFeePrice(List<FeeDto> feeDtos) {
+
+ if(feeDtos == null || feeDtos.size() < 1){
+ return;
+ }
+ String val = CommunitySettingFactory.getValue(feeDtos.get(0).getCommunityId(),TOTAL_FEE_PRICE);
+ if(StringUtil.isEmpty(val)){
+ val = MappingCache.getValue(DOMAIN_COMMON, TOTAL_FEE_PRICE);
+ }
+
+ //鍏堝彇鍗曞皬鍖虹殑濡傛灉娌℃湁閰嶇疆 鍙� 鍏ㄥ眬鐨�
+ String received_amount_switch = CommunitySettingFactory.getValue(feeDtos.get(0).getCommunityId(),RECEIVED_AMOUNT_SWITCH);
+ if(StringUtil.isEmpty(received_amount_switch)){
+ received_amount_switch = MappingCache.getValue(DOMAIN_COMMON, RECEIVED_AMOUNT_SWITCH);
+ }
+
+ //鍏堝彇鍗曞皬鍖虹殑濡傛灉娌℃湁閰嶇疆 鍙� 鍏ㄥ眬鐨�
+ String offlinePayFeeSwitch = CommunitySettingFactory.getValue(feeDtos.get(0).getCommunityId(),OFFLINE_PAY_FEE_SWITCH);
+ if(StringUtil.isEmpty(offlinePayFeeSwitch)){
+ offlinePayFeeSwitch = MappingCache.getValue(DOMAIN_COMMON, OFFLINE_PAY_FEE_SWITCH);
+ }
+
for (FeeDto feeDto : feeDtos) {
try {
// 杞暟 * 鍛ㄦ湡 * 30 + 寮�濮嬫椂闂� = 鐩爣 鍒版湡鏃堕棿
Map<String, Object> targetEndDateAndOweMonth = computeFeeSMOImpl.getTargetEndDateAndOweMonth(feeDto);
Date targetEndDate = (Date) targetEndDateAndOweMonth.get("targetEndDate");
double oweMonth = (double) targetEndDateAndOweMonth.get("oweMonth");
+ feeDto.setCycle(feeDto.getPaymentCycle());
if (FeeDto.PAYER_OBJ_TYPE_ROOM.equals(feeDto.getPayerObjType())) { //鎴垮眿鐩稿叧
computeFeePriceByRoom(feeDto, oweMonth);
} else if (FeeDto.PAYER_OBJ_TYPE_CAR.equals(feeDto.getPayerObjType())) {//杞︿綅鐩稿叧
@@ -116,6 +152,16 @@
computeFeePriceByContract(feeDto, oweMonth);
}
feeDto.setDeadlineTime(targetEndDate);
+
+ feeDto.setVal(val);
+ //鍏抽棴 绾夸笅鏀堕摱鍔熻兘
+ if (StringUtil.isEmpty(received_amount_switch)) {
+ feeDto.setReceivedAmountSwitch("1");//榛樿鍚敤瀹炴敹娆捐緭鍏ユ
+ } else {
+ feeDto.setReceivedAmountSwitch(received_amount_switch);
+ }
+ feeDto.setOfflinePayFeeSwitch(offlinePayFeeSwitch);
+
} catch (Exception e) {
logger.error("鏌ヨ璐圭敤淇℃伅 锛岃垂鐢ㄤ俊鎭敊璇�", e);
}
@@ -142,6 +188,8 @@
DecimalFormat df = new DecimalFormat("0.00");
Map feePriceAll = computeFeeSMOImpl.getFeePrice(feeDto);
feeDto.setFeePrice(Double.parseDouble(feePriceAll.get("feePrice").toString()));
+ feeDto.setFeeTotalPrice(Double.parseDouble(feePriceAll.get("feeTotalPrice").toString()));
+
BigDecimal curFeePrice = new BigDecimal(feeDto.getFeePrice());
curFeePrice = curFeePrice.multiply(new BigDecimal(oweMonth));
feeDto.setAmountOwed(df.format(curFeePrice));
@@ -164,6 +212,7 @@
DecimalFormat df = new DecimalFormat("0.00");
Map feePriceAll = computeFeeSMOImpl.getFeePrice(feeDto);
feeDto.setFeePrice(Double.parseDouble(feePriceAll.get("feePrice").toString()));
+ feeDto.setFeeTotalPrice(Double.parseDouble(feePriceAll.get("feeTotalPrice").toString()));
BigDecimal curFeePrice = new BigDecimal(feeDto.getFeePrice());
curFeePrice = curFeePrice.multiply(new BigDecimal(oweMonth));
feeDto.setAmountOwed((df.format(curFeePrice)));
@@ -186,6 +235,7 @@
DecimalFormat df = new DecimalFormat("0.00");
Map feePriceAll = computeFeeSMOImpl.getFeePrice(feeDto);
feeDto.setFeePrice(Double.parseDouble(feePriceAll.get("feePrice").toString()));
+ feeDto.setFeeTotalPrice(Double.parseDouble(feePriceAll.get("feeTotalPrice").toString()));
BigDecimal curFeePrice = new BigDecimal(feeDto.getFeePrice());
curFeePrice = curFeePrice.multiply(new BigDecimal(oweMonth));
feeDto.setAmountOwed(df.format(curFeePrice));
--
Gitblit v1.8.0