From 46eed722cd0431aa433bea2470b23015b8d83b3e Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期一, 21 二月 2022 10:03:25 +0800
Subject: [PATCH] 优化三亚物业 临时收费问题
---
service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeePreCmd.java | 57 +++++++++++++++++++++++++++++++--------------------------
1 files changed, 31 insertions(+), 26 deletions(-)
diff --git a/service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeePreCmd.java b/service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeePreCmd.java
index d4fed18..8118ea4 100644
--- a/service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeePreCmd.java
+++ b/service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeePreCmd.java
@@ -24,9 +24,10 @@
import com.java110.utils.exception.CmdException;
import com.java110.utils.exception.ListenerExecuteException;
import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
import com.java110.utils.util.DateUtil;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import com.java110.core.log.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -118,7 +119,8 @@
throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "鏌ヨ璐圭敤淇℃伅澶辫触锛屾湭鏌ュ埌鏁版嵁鎴栨煡鍒板鏉℃暟鎹�");
}
feeDto = feeDtos.get(0);
-
+ reqJson.put("feeTypeCd", feeDto.getFeeTypeCd());
+ reqJson.put("feeId", feeDto.getFeeId());
Map feePriceAll = computeFeeSMOImpl.getFeePrice(feeDto);
BigDecimal receivableAmount = new BigDecimal(feePriceAll.get("feePrice").toString());
BigDecimal cycles = new BigDecimal(Double.parseDouble(reqJson.getString("cycles")));
@@ -148,39 +150,42 @@
receivedAmount = 0.0;
}
paramOut.put("receivedAmount", receivedAmount);
+
ResponseEntity<String> responseEntity = new ResponseEntity<>(paramOut.toJSONString(), HttpStatus.OK);
+ reqJson.putAll(paramOut);
CommonCache.setValue("payFeePre" + paramOut.getString("oId"), reqJson.toJSONString(), 24 * 60 * 60);
cmdDataFlowContext.setResponseEntity(responseEntity);
}
/**
- * 鑰冭檻璐︽埛鎶垫秷
+ * 鑰冭檻璐︽埛鎶垫秷
+ *
* @param reqJson
*/
private double judgeAccount(JSONObject reqJson) {
- if(!reqJson.containsKey("deductionAmount")){
- reqJson.put("deductionAmount",0.0);
+ if (!reqJson.containsKey("deductionAmount")) {
+ reqJson.put("deductionAmount", 0.0);
return 0.0;
}
double deductionAmount = reqJson.getDouble("deductionAmount");
- if(deductionAmount <= 0){
- reqJson.put("deductionAmount",0.0);
+ if (deductionAmount <= 0) {
+ reqJson.put("deductionAmount", 0.0);
return 0.0;
}
- if(!reqJson.containsKey("selectUserAccount")){
- reqJson.put("deductionAmount",0.0);
+ if (!reqJson.containsKey("selectUserAccount")) {
+ reqJson.put("deductionAmount", 0.0);
return 0.0;
}
JSONArray selectUserAccount = reqJson.getJSONArray("selectUserAccount");
- if(selectUserAccount == null || selectUserAccount.size() <1){
- reqJson.put("deductionAmount",0.0);
+ if (selectUserAccount == null || selectUserAccount.size() < 1) {
+ reqJson.put("deductionAmount", 0.0);
return 0.0;
}
List<String> acctIds = new ArrayList<>();
- for(int userAccountIndex = 0 ;userAccountIndex < selectUserAccount.size(); userAccountIndex++){
+ for (int userAccountIndex = 0; userAccountIndex < selectUserAccount.size(); userAccountIndex++) {
acctIds.add(selectUserAccount.getJSONObject(userAccountIndex).getString("acctId"));
}
@@ -188,24 +193,24 @@
accountDto.setAcctIds(acctIds.toArray(new String[acctIds.size()]));
List<AccountDto> accountDtos = accountInnerServiceSMOImpl.queryAccounts(accountDto);
- if(accountDtos == null || accountDtos.size() < 1){
- reqJson.put("deductionAmount",0.0);
+ if (accountDtos == null || accountDtos.size() < 1) {
+ reqJson.put("deductionAmount", 0.0);
return 0.0;
}
BigDecimal totalAccountAmount = new BigDecimal(0);
- for(AccountDto tmpAccountDto: accountDtos){
+ for (AccountDto tmpAccountDto : accountDtos) {
totalAccountAmount = totalAccountAmount.add(new BigDecimal(tmpAccountDto.getAmount()));
}
deductionAmount = totalAccountAmount.subtract(new BigDecimal(deductionAmount)).doubleValue();
- if(deductionAmount < 0){
- reqJson.put("deductionAmount",totalAccountAmount.doubleValue());
- reqJson.put("selectUserAccount",accountDtos);
+ if (deductionAmount < 0) {
+ reqJson.put("deductionAmount", totalAccountAmount.doubleValue());
+ reqJson.put("selectUserAccount", BeanConvertUtil.beanCovertJSONArray(accountDtos));
return totalAccountAmount.doubleValue();
}
- reqJson.put("deductionAmount",deductionAmount);
- reqJson.put("selectUserAccount",accountDtos);
+ reqJson.put("deductionAmount", deductionAmount);
+ reqJson.put("selectUserAccount", BeanConvertUtil.beanCovertJSONArray(accountDtos));
return deductionAmount;
}
@@ -216,7 +221,7 @@
if (couponList == null || couponList.size() < 1) {
paramObj.put("couponPrice", couponPrice.doubleValue());
- paramObj.put("couponUserDtos", new ArrayList<CouponUserDto>()); //杩欓噷鑰冭檻绌�
+ paramObj.put("couponUserDtos", new JSONArray()); //杩欓噷鑰冭檻绌�
return couponPrice.doubleValue();
}
for (int couponIndex = 0; couponIndex < couponList.size(); couponIndex++) {
@@ -232,11 +237,11 @@
for (CouponUserDto couponUser : couponUserDtos) {
//涓嶈绠楀凡杩囨湡璐墿鍒搁噾棰�
if (couponUser.getEndTime().compareTo(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_B)) >= 0) {
- couponPrice.add(new BigDecimal(Double.parseDouble(couponUser.getActualPrice())));
+ couponPrice = couponPrice.add(new BigDecimal(Double.parseDouble(couponUser.getActualPrice())));
}
}
paramObj.put("couponPrice", couponPrice.doubleValue());
- paramObj.put("couponUserDtos", couponUserDtos);
+ paramObj.put("couponUserDtos", BeanConvertUtil.beanCovertJSONArray(couponUserDtos));
return couponPrice.doubleValue();
}
@@ -261,15 +266,15 @@
List<ComputeDiscountDto> computeDiscountDtos = feeDiscountInnerServiceSMOImpl.computeDiscount(feeDetailDto);
if (computeDiscountDtos == null || computeDiscountDtos.size() < 1) {
- paramObj.put("discountPrice",0.0);
+ paramObj.put("discountPrice", 0.0);
return 0.0;
}
BigDecimal discountPrice = new BigDecimal(0);
for (ComputeDiscountDto computeDiscountDto : computeDiscountDtos) {
discountPrice = discountPrice.add(new BigDecimal(computeDiscountDto.getDiscountPrice()));
}
- paramObj.put("discountPrice",discountPrice.doubleValue());
- paramObj.put("computeDiscountDtos", computeDiscountDtos);
+ paramObj.put("discountPrice", discountPrice.doubleValue());
+ paramObj.put("computeDiscountDtos", BeanConvertUtil.beanCovertJSONArray(computeDiscountDtos));
return discountPrice.doubleValue();
}
}
--
Gitblit v1.8.0