From 4ce807bb99088dc6f41262046830fc872e772be4 Mon Sep 17 00:00:00 2001
From: cgf <2156125618@qq.com>
Date: 星期二, 02 九月 2025 14:23:33 +0800
Subject: [PATCH] 折扣已完成现有需求2025/08/09
---
service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeeConfirmCmd.java | 260 ++++++++++++++++++++-------------------------------
1 files changed, 104 insertions(+), 156 deletions(-)
diff --git a/service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeeConfirmCmd.java b/service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeeConfirmCmd.java
index daf942e..05a4a97 100644
--- a/service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeeConfirmCmd.java
+++ b/service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeeConfirmCmd.java
@@ -10,7 +10,7 @@
import com.java110.core.factory.GenerateCodeFactory;
import com.java110.dto.account.AccountDto;
import com.java110.dto.app.AppDto;
-import com.java110.dto.couponPool.CouponUserDto;
+import com.java110.dto.coupon.CouponUserDto;
import com.java110.dto.fee.FeeAttrDto;
import com.java110.dto.fee.FeeConfigDto;
import com.java110.dto.fee.FeeDetailDto;
@@ -21,28 +21,26 @@
import com.java110.dto.repair.RepairDto;
import com.java110.dto.repair.RepairUserDto;
import com.java110.fee.bmo.fee.IFeeBMO;
+import com.java110.fee.bmo.fee.IFinishFeeNotify;
import com.java110.intf.acct.IAccountInnerServiceSMO;
import com.java110.intf.acct.ICouponUserDetailV1InnerServiceSMO;
import com.java110.intf.acct.ICouponUserV1InnerServiceSMO;
import com.java110.intf.community.*;
import com.java110.intf.fee.*;
import com.java110.intf.user.IOwnerCarInnerServiceSMO;
-import com.java110.po.accountDetail.AccountDetailPo;
-import com.java110.po.applyRoomDiscount.ApplyRoomDiscountPo;
+import com.java110.po.account.AccountDetailPo;
+import com.java110.po.room.ApplyRoomDiscountPo;
import com.java110.po.car.OwnerCarPo;
-import com.java110.po.couponUser.CouponUserPo;
-import com.java110.po.couponUserDetail.CouponUserDetailPo;
-import com.java110.po.feeAccountDetail.FeeAccountDetailPo;
+import com.java110.po.coupon.CouponUserPo;
+import com.java110.po.coupon.CouponUserDetailPo;
+import com.java110.po.fee.FeeAccountDetailPo;
import com.java110.po.owner.RepairPoolPo;
import com.java110.po.owner.RepairUserPo;
-import com.java110.po.parkingSpaceApply.ParkingSpaceApplyPo;
-import com.java110.po.payFeeDetailDiscount.PayFeeDetailDiscountPo;
+import com.java110.po.parking.ParkingSpaceApplyPo;
+import com.java110.po.payFee.PayFeeDetailDiscountPo;
import com.java110.utils.cache.CommonCache;
import com.java110.utils.exception.CmdException;
-import com.java110.utils.util.Assert;
-import com.java110.utils.util.BeanConvertUtil;
-import com.java110.utils.util.DateUtil;
-import com.java110.utils.util.StringUtil;
+import com.java110.utils.util.*;
import com.java110.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
@@ -107,6 +105,9 @@
@Autowired
private IFeeAccountDetailServiceSMO feeAccountDetailServiceSMOImpl;
+ @Autowired
+ private IFinishFeeNotify finishFeeNotifyImpl;
+
//榛樿搴忓垪
protected static final int DEFAULT_SEQ = 1;
@@ -149,63 +150,14 @@
feeBMOImpl.addFeePreDetail(paramObj);
feeBMOImpl.modifyPreFee(paramObj);
- dealOwnerCartEndTime(paramObj);
+ //todo 涓哄仠杞﹁垂鍗曠嫭澶勭悊
+ finishFeeNotifyImpl.updateCarEndTime(paramObj.getString("feeId"), paramObj.getString("communityId"));
- //鍒ゆ柇鏄惁鏈夋淳鍗曞睘鎬D
- FeeAttrDto feeAttrDto = new FeeAttrDto();
- feeAttrDto.setCommunityId(paramObj.getString("communityId"));
- feeAttrDto.setFeeId(paramObj.getString("feeId"));
- feeAttrDto.setSpecCd(FeeAttrDto.SPEC_CD_REPAIR);
- List<FeeAttrDto> feeAttrDtos = feeAttrInnerServiceSMOImpl.queryFeeAttrs(feeAttrDto);
- //淇敼 娲惧崟鐘舵��
- if (feeAttrDtos != null && feeAttrDtos.size() > 0) {
- RepairPoolPo repairPoolPo = new RepairPoolPo();
- repairPoolPo.setRepairId(feeAttrDtos.get(0).getValue());
- repairPoolPo.setCommunityId(paramObj.getString("communityId"));
- repairPoolPo.setState(RepairDto.STATE_APPRAISE);
- int flag = repairPoolNewV1InnerServiceSMOImpl.updateRepairPoolNew(repairPoolPo);
- if (flag < 1) {
- throw new CmdException("鏇存柊寰俊娲惧崟姹犱俊鎭け璐�");
- }
- RepairUserDto repairUserDto = new RepairUserDto();
- repairUserDto.setRepairId(feeAttrDtos.get(0).getValue());
- repairUserDto.setState(RepairUserDto.STATE_PAY_FEE);
- //鏌ヨ寰呮敮浠樼姸鎬佺殑璁板綍
- List<RepairUserDto> repairUserDtoList = repairUserInnerServiceSMO.queryRepairUsers(repairUserDto);
- Assert.listOnlyOne(repairUserDtoList, "淇℃伅閿欒锛�");
- RepairUserPo repairUserPo = new RepairUserPo();
- repairUserPo.setRuId(repairUserDtoList.get(0).getRuId());
- repairUserPo.setState(RepairUserDto.STATE_FINISH_PAY_FEE);
- //濡傛灉鏄緟璇勪环鐘舵�侊紝灏辨洿鏂扮粨鏉熸椂闂�
- repairUserPo.setEndTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
- DecimalFormat df = new DecimalFormat("0.00");
- BigDecimal payment_amount = new BigDecimal(paramObj.getString("receivableAmount"));
- repairUserPo.setContext("宸叉敮浠�" + df.format(payment_amount) + "鍏�");
- flag = repairUserNewV1InnerServiceSMOImpl.updateRepairUserNew(repairUserPo);
- if (flag < 1) {
- throw new CmdException("鏇存柊寰俊娲惧崟姹犱俊鎭け璐�");
- }
- //鏂板寰呰瘎浠风姸鎬�
- RepairUserPo repairUser = new RepairUserPo();
- repairUser.setRuId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_ruId));
- repairUser.setStartTime(repairUserPo.getEndTime());
- repairUser.setState(RepairUserDto.STATE_EVALUATE);
- repairUser.setContext("寰呰瘎浠�");
- repairUser.setCommunityId(paramObj.getString("communityId"));
- repairUser.setCreateTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
- repairUser.setRepairId(repairUserDtoList.get(0).getRepairId());
- repairUser.setStaffId(repairUserDtoList.get(0).getStaffId());
- repairUser.setStaffName(repairUserDtoList.get(0).getStaffName());
- repairUser.setPreStaffId(repairUserDtoList.get(0).getStaffId());
- repairUser.setPreStaffName(repairUserDtoList.get(0).getStaffName());
- repairUser.setPreRuId(repairUserDtoList.get(0).getRuId());
- repairUser.setRepairEvent("auditUser");
- repairUser.setbId("-1");
- flag = repairUserNewV1InnerServiceSMOImpl.saveRepairUserNew(repairUser);
- if (flag < 1) {
- throw new CmdException("鏇存柊寰俊娲惧崟姹犱俊鎭け璐�");
- }
- }
+ //todo 淇敼鎶ヤ慨鍗�
+ finishFeeNotifyImpl.updateRepair(paramObj.getString("feeId"), paramObj.getString("communityId"), paramObj.getString("receivedAmount"));
+
+ //todo 绉熼噾寤舵湡鎴垮眿缁撴潫鏃堕棿
+ finishFeeNotifyImpl.updateRoomEndTime(paramObj.getString("feeId"), paramObj.getString("communityId"));
//鏌ヨ pay_fee_detail 鏄惁缂磋垂
FeeDetailDto feeDetailDto = new FeeDetailDto();
@@ -218,7 +170,7 @@
//List<ComputeDiscountDto> computeDiscountDtos = (List<ComputeDiscountDto>) paramObj.get("computeDiscountDtos");
JSONArray computeDiscountDtos = paramObj.getJSONArray("computeDiscountDtos");
ComputeDiscountDto computeDiscountDto = null;
- if (computeDiscountDtos != null && computeDiscountDtos.size() > 0) {
+ if (!ListUtil.isNull(computeDiscountDtos)) {
for (int accountIndex = 0; accountIndex < computeDiscountDtos.size(); accountIndex++) {
computeDiscountDto = BeanConvertUtil.covertBean(computeDiscountDtos.getJSONObject(accountIndex), ComputeDiscountDto.class);
if (!StringUtil.isEmpty(computeDiscountDto.getArdId())) {
@@ -233,7 +185,6 @@
}
}
}
-
}
//鍥炶皟鍒ゆ柇 杞︿綅鐢宠琛ㄦ槸鍚︽湁鏁版嵁锛屾湁鏁版嵁鍒欏埛鏂扮敵璇疯〃鐘舵�佷负 3003 瀹屾垚鐘舵�佸嵆鍙�
//鍒ゆ柇杞﹁締鏄惁宸茬粡鏈夌敵璇峰崟
@@ -241,7 +192,7 @@
parkingSpaceApplyDto.setFeeId(paramObj.getString("feeId"));
parkingSpaceApplyDto.setState("2002");//瀹℃牳涓�
List<ParkingSpaceApplyDto> parkingSpaceApplyDtos = parkingSpaceApplyV1InnerServiceSMOImpl.queryParkingSpaceApplys(parkingSpaceApplyDto);
- if (parkingSpaceApplyDtos != null && parkingSpaceApplyDtos.size() > 0) {
+ if (!ListUtil.isNull(parkingSpaceApplyDtos)) {
ParkingSpaceApplyPo parkingSpaceApplyPo = new ParkingSpaceApplyPo();
parkingSpaceApplyPo.setApplyId(parkingSpaceApplyDtos.get(0).getApplyId());
parkingSpaceApplyPo.setState("3003");
@@ -250,60 +201,95 @@
throw new CmdException("鏇存柊杞︿綅鐢宠琛ㄧ姸鎬佸け璐�");
}
}
-
cmdDataFlowContext.setResponseEntity(ResultVo.success());
}
private void dealAccount(JSONObject paramObj) {
-
- if (!paramObj.containsKey("deductionAmount") || paramObj.getDouble("deductionAmount") <= 0) {
+ JSONArray accountDtos = paramObj.getJSONArray("selectUserAccount");
+ if(ListUtil.isNull(accountDtos)){
return;
}
-
- BigDecimal deductionAmount = new BigDecimal(paramObj.getDouble("deductionAmount"));
-
- JSONArray accountDtos = paramObj.getJSONArray("selectUserAccount");
- BigDecimal amount = null;
AccountDto accountDto = null;
+ String accountRemark = "";
+ String pointRemark = "";
for (int accountIndex = 0; accountIndex < accountDtos.size(); accountIndex++) {
accountDto = BeanConvertUtil.covertBean(accountDtos.getJSONObject(accountIndex), AccountDto.class);
- amount = new BigDecimal(Double.parseDouble(accountDto.getAmount()));
- AccountDetailPo accountDetailPo = new AccountDetailPo();
- accountDetailPo.setAcctId(accountDto.getAcctId());
- accountDetailPo.setObjId(accountDto.getObjId());
- accountDetailPo.setObjType(accountDto.getObjType());
- if (amount.doubleValue() < deductionAmount.doubleValue()) {
- accountDetailPo.setAmount(amount.doubleValue() + "");
- deductionAmount = deductionAmount.subtract(amount).setScale(2, BigDecimal.ROUND_HALF_UP);
- } else {
- accountDetailPo.setAmount(deductionAmount.doubleValue() + "");
- deductionAmount = deductionAmount.subtract(deductionAmount).setScale(2, BigDecimal.ROUND_HALF_UP);
- }
- int flag = accountInnerServiceSMOImpl.withholdAccount(accountDetailPo);
+ if (!StringUtil.isEmpty(accountDto.getAcctType()) && accountDto.getAcctType().equals("2003")) { //2003 鐜伴噾璐︽埛 2004 绉垎璐︽埛
+ //鑾峰彇鐜伴噾璐︽埛鎶垫墸閲戦
+ BigDecimal cashMoney = new BigDecimal(0.0);
+ if (!StringUtil.isEmpty(paramObj.getString("cashMoney"))) {
+ String cashMoney1 = paramObj.getString("cashMoney");
+ cashMoney = new BigDecimal(cashMoney1);
+ if (cashMoney.compareTo(BigDecimal.ZERO) > 0) {
+ accountRemark = "鐜伴噾璐︽埛鎶垫墸" + String.format("%.2f", cashMoney) + "鍏�";
+ }
+ }
+ int i = cashMoney.compareTo(BigDecimal.ZERO);
+ if (i > 0) {
+ BigDecimal amount = new BigDecimal(Double.parseDouble(accountDto.getAmount())); //鐜伴噾璐︽埛浣欓
+ AccountDetailPo accountDetailPo = new AccountDetailPo();
+ accountDetailPo.setAcctId(accountDto.getAcctId());
+ accountDetailPo.setObjId(accountDto.getObjId());
+ accountDetailPo.setObjType(accountDto.getObjType());
+ accountDetailPo.setAmount(String.valueOf(cashMoney));
+ int flag = accountInnerServiceSMOImpl.withholdAccount(accountDetailPo);
+ if (flag < 1) {
+ throw new CmdException("鐜伴噾璐︽埛鎵f澶辫触锛�");
+ }
+ // 鐜伴噾璐︽埛鎵f璁板綍锛岀敓鎴愭姷鎵f槑缁嗚褰�
+ FeeAccountDetailPo feeAccountDetailPo = new FeeAccountDetailPo();
+ feeAccountDetailPo.setFadId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_fadId));
+ feeAccountDetailPo.setDetailId(paramObj.getString("detailId"));
+ feeAccountDetailPo.setCommunityId(paramObj.getString("communityId"));
+ feeAccountDetailPo.setState("1002"); //1001 鏃犳姷鎵� 1002 鐜伴噾璐︽埛鎶垫墸 1003 绉垎璐︽埛鎶垫墸 1004 浼樻儬鍒告姷鎵�
+ feeAccountDetailPo.setAmount(String.valueOf(cashMoney)); //鐜伴噾鎶垫墸閲戦
+ feeAccountDetailServiceSMOImpl.saveFeeAccountDetail(feeAccountDetailPo);
+ }
- if (flag < 1) {
- throw new CmdException("鎵f澶辫触");
+ } else if (!StringUtil.isEmpty(accountDto.getAcctType()) && accountDto.getAcctType().equals("2004")) { //绉垎璐︽埛
+ //鑾峰彇绉垎璐︽埛鎶垫墸鐨勭Н鍒嗘暟
+ BigDecimal pointsMoney = new BigDecimal(0.0);
+ BigDecimal pointsMoneyNow = new BigDecimal(0.0);
+ if (!StringUtil.isEmpty(paramObj.getString("pointsMoney"))) {
+ String pointsMoney1 = paramObj.getString("pointsMoney");
+ pointsMoney = new BigDecimal(pointsMoney1);
+ String pointsMoneyNow1 = paramObj.getString("pointsMoneyNow");
+ pointsMoneyNow = new BigDecimal(pointsMoneyNow1);
+ if (pointsMoneyNow.compareTo(BigDecimal.ZERO) > 0) {
+ pointRemark = "绉垎璐︽埛鎶垫墸" + String.format("%.2f", pointsMoneyNow) + "鍏�";
+ }
+
+ }
+ int i = pointsMoney.compareTo(BigDecimal.ZERO);
+ if (i > 0) {
+ BigDecimal amount = new BigDecimal(Double.parseDouble(accountDto.getAmount())); //绉垎璐︽埛绉垎鏁�
+ AccountDetailPo accountDetailPo = new AccountDetailPo();
+ accountDetailPo.setAcctId(accountDto.getAcctId());
+ accountDetailPo.setObjId(accountDto.getObjId());
+ accountDetailPo.setObjType(accountDto.getObjType());
+ accountDetailPo.setAmount(String.valueOf(pointsMoney));
+ int flag = accountInnerServiceSMOImpl.withholdAccount(accountDetailPo);
+ if (flag < 1) {
+ throw new CmdException("绉垎璐︽埛鎵f澶辫触锛�");
+ }
+
+ // 绉垎璐︽埛鎵f璁板綍锛岀敓鎴愭姷鎵f槑缁嗚褰�
+ FeeAccountDetailPo feeAccountDetailPo = new FeeAccountDetailPo();
+ feeAccountDetailPo.setFadId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_fadId));
+ feeAccountDetailPo.setDetailId(paramObj.getString("detailId"));
+ feeAccountDetailPo.setCommunityId(paramObj.getString("communityId"));
+ feeAccountDetailPo.setState("1003"); //1001 鏃犳姷鎵� 1002 鐜伴噾璐︽埛鎶垫墸 1003 绉垎璐︽埛鎶垫墸 1004 浼樻儬鍒告姷鎵�
+
+ feeAccountDetailPo.setAmount(String.valueOf(paramObj.getString("pointsMoneyNow"))); //鐜伴噾鎶垫墸閲戦
+ feeAccountDetailServiceSMOImpl.saveFeeAccountDetail(feeAccountDetailPo);
+ }
}
}
-
-
- if (deductionAmount.doubleValue() > 0) {
- throw new CmdException("璐︽埛閲戦涓嶈冻");
+ if (!StringUtil.isEmpty(accountRemark) && !StringUtil.isEmpty(pointRemark)) {
+ paramObj.put("remark", paramObj.getString("remark") + "锛�" + accountRemark + "锛�" + pointRemark);
+ } else {
+ paramObj.put("remark", paramObj.getString("remark") + "锛�" + accountRemark + pointRemark);
}
-
- // 鐜伴噾璐︽埛鎵f璁板綍锛岀敓鎴愭姷鎵f槑缁嗚褰�
- FeeAccountDetailPo feeAccountDetailPo = new FeeAccountDetailPo();
- feeAccountDetailPo.setFadId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_fadId));
- feeAccountDetailPo.setDetailId(paramObj.getString("detailId"));
- feeAccountDetailPo.setCommunityId(paramObj.getString("communityId"));
- feeAccountDetailPo.setState("1002"); //1001 鏃犳姷鎵� 1002 鐜伴噾璐︽埛鎶垫墸 1003 绉垎璐︽埛鎶垫墸 1004 浼樻儬鍒告姷鎵�
- feeAccountDetailPo.setAmount(paramObj.getDouble("deductionAmount") + ""); //鐜伴噾鎶垫墸閲戦
- feeAccountDetailServiceSMOImpl.saveFeeAccountDetail(feeAccountDetailPo);
-// BigDecimal receivedAmountDec = new BigDecimal(payFeeDetailPo.getReceivedAmount());
-// receivedAmountDec = receivedAmountDec.subtract(cashSum);
-// payFeeDetailPo.setReceivedAmount(receivedAmountDec.doubleValue() + "");
-
- paramObj.put("remark", paramObj.getString("remark") + "-鐜伴噾璐︽埛鎶垫墸" + paramObj.getDouble("deductionAmount") + "鍏�");
}
@@ -314,6 +300,9 @@
//FeeDto feeInfo = (FeeDto) paramObj.get("feeInfo");
CouponUserDto couponUserDto = null;
JSONArray couponUserDtos = paramObj.getJSONArray("couponUserDtos");
+ if(ListUtil.isNull(couponUserDtos)){
+ return ;
+ }
CouponUserDto couponUser = null;
for (int accountIndex = 0; accountIndex < couponUserDtos.size(); accountIndex++) {
couponUser = BeanConvertUtil.covertBean(couponUserDtos.getJSONObject(accountIndex), CouponUserDto.class);
@@ -356,6 +345,9 @@
return;
}
JSONArray computeDiscountDtos = paramObj.getJSONArray("computeDiscountDtos");
+ if(ListUtil.isNull(computeDiscountDtos)){
+ return;
+ }
ComputeDiscountDto computeDiscountDto = null;
for (int accountIndex = 0; accountIndex < computeDiscountDtos.size(); accountIndex++) {
computeDiscountDto = BeanConvertUtil.covertBean(computeDiscountDtos.getJSONObject(accountIndex), ComputeDiscountDto.class);
@@ -380,49 +372,5 @@
}
}
- private void dealOwnerCartEndTime(JSONObject paramObj) {
- FeeDto feeDto = new FeeDto();
- feeDto.setFeeId(paramObj.getString("feeId"));
- feeDto.setCommunityId(paramObj.getString("communityId"));
- List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
- if (feeDtos == null || feeDtos.size() < 1) {
- return;
- }
- //涓哄仠杞﹁垂鍗曠嫭澶勭悊
- if (!FeeDto.PAYER_OBJ_TYPE_CAR.equals(feeDtos.get(0).getPayerObjType())) {
- return;
- }
- Date feeEndTime = feeDtos.get(0).getEndTime();
- OwnerCarDto ownerCarDto = new OwnerCarDto();
- ownerCarDto.setCommunityId(paramObj.getString("communityId"));
- ownerCarDto.setCarId(feeDtos.get(0).getPayerObjId());
- List<OwnerCarDto> ownerCarDtos = ownerCarInnerServiceSMOImpl.queryOwnerCars(ownerCarDto);
-
-
- Calendar endTimeCalendar = null;
- //杞︿綅璐圭敤缁
- if (ownerCarDtos == null || ownerCarDtos.size() < 1) {
- return;
- }
- for (OwnerCarDto tmpOwnerCarDto : ownerCarDtos) {
- //鍚庝粯璐� 鎴栬�呬俊鐢ㄦ湡杞﹁締 鍔犱竴涓湀
- if (FeeConfigDto.PAYMENT_CD_AFTER.equals(feeDtos.get(0).getPaymentCd())
- || OwnerCarDto.CAR_TYPE_CREDIT.equals(tmpOwnerCarDto.getCarType())) {
- endTimeCalendar = Calendar.getInstance();
- endTimeCalendar.setTime(feeEndTime);
- endTimeCalendar.add(Calendar.MONTH, 1);
- feeEndTime = endTimeCalendar.getTime();
- }
- if (tmpOwnerCarDto.getEndTime().getTime() < feeEndTime.getTime()) {
- OwnerCarPo ownerCarPo = new OwnerCarPo();
- ownerCarPo.setMemberId(tmpOwnerCarDto.getMemberId());
- ownerCarPo.setEndTime(DateUtil.getFormatTimeString(feeEndTime, DateUtil.DATE_FORMATE_STRING_A));
- int fage = ownerCarNewV1InnerServiceSMOImpl.updateOwnerCarNew(ownerCarPo);
- if (fage < 1) {
- throw new CmdException("鏇存柊璐圭敤淇℃伅澶辫触");
- }
- }
- }
- }
}
--
Gitblit v1.8.0