From b2b5bdf6f42597e582da96aa56707e1f68d3936e Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期二, 10 五月 2022 11:41:44 +0800
Subject: [PATCH] 优化 费用

---
 service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeeConfirmCmd.java |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 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 b351321..e19ce11 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
@@ -3,6 +3,7 @@
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.annotation.Java110Transactional;
 import com.java110.core.context.ICmdDataFlowContext;
 import com.java110.core.event.cmd.AbstractServiceCmdListener;
 import com.java110.core.event.cmd.CmdEvent;
@@ -32,7 +33,6 @@
 import com.java110.po.car.OwnerCarPo;
 import com.java110.po.couponUser.CouponUserPo;
 import com.java110.po.couponUserDetail.CouponUserDetailPo;
-import com.java110.po.fee.PayFeePo;
 import com.java110.po.owner.RepairPoolPo;
 import com.java110.po.owner.RepairUserPo;
 import com.java110.po.parkingSpaceApply.ParkingSpaceApplyPo;
@@ -112,6 +112,7 @@
     }
 
     @Override
+    @Java110Transactional
     public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
         String paramIn = CommonCache.getAndRemoveValue("payFeePre" + reqJson.getString("oId"));
         JSONObject paramObj = JSONObject.parseObject(paramIn);
@@ -131,6 +132,8 @@
 
         //澶勭悊鐜伴噾璐︽埛
         dealAccount(paramObj);
+
+        paramObj.put("detailId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_detailId));
 
         //澶勭悊 浼樻儬鎶樻墸
         addDiscount(paramObj);
@@ -160,10 +163,6 @@
             if (flag < 1) {
                 throw new CmdException("鏇存柊寰俊娲惧崟姹犱俊鎭け璐�");
             }
-        }
-        //淇敼鎶ヤ慨娲惧崟鐘舵��
-        if (feeAttrDtos != null && feeAttrDtos.size() > 0) {
-
             RepairUserDto repairUserDto = new RepairUserDto();
             repairUserDto.setRepairId(feeAttrDtos.get(0).getValue());
             repairUserDto.setState(RepairUserDto.STATE_PAY_FEE);
@@ -178,7 +177,7 @@
             DecimalFormat df = new DecimalFormat("0.00");
             BigDecimal payment_amount = new BigDecimal(paramObj.getString("receivableAmount"));
             repairUserPo.setContext("宸叉敮浠�" + df.format(payment_amount) + "鍏�");
-            int flag = repairUserNewV1InnerServiceSMOImpl.updateRepairUserNew(repairUserPo);
+            flag = repairUserNewV1InnerServiceSMOImpl.updateRepairUserNew(repairUserPo);
             if (flag < 1) {
                 throw new CmdException("鏇存柊寰俊娲惧崟姹犱俊鎭け璐�");
             }
@@ -212,9 +211,12 @@
             //鑾峰彇bId
             String bId = feeDetailDtoList.get(0).getbId();
             //鑾峰彇浼樻儬
-            List<ComputeDiscountDto> computeDiscountDtos = (List<ComputeDiscountDto>) paramObj.get("computeDiscountDtos");
-            if (computeDiscountDtos != null) {
-                for (ComputeDiscountDto computeDiscountDto : computeDiscountDtos) {
+            //List<ComputeDiscountDto> computeDiscountDtos = (List<ComputeDiscountDto>) paramObj.get("computeDiscountDtos");
+            JSONArray computeDiscountDtos = paramObj.getJSONArray("computeDiscountDtos");
+            ComputeDiscountDto computeDiscountDto = null;
+            if (computeDiscountDtos != null && computeDiscountDtos.size() > 0) {
+                for (int accountIndex = 0; accountIndex < computeDiscountDtos.size(); accountIndex++) {
+                    computeDiscountDto = BeanConvertUtil.covertBean(computeDiscountDtos.getJSONObject(accountIndex), ComputeDiscountDto.class);
                     if (!StringUtil.isEmpty(computeDiscountDto.getArdId())) {
                         ApplyRoomDiscountPo applyRoomDiscountPo = new ApplyRoomDiscountPo();
                         //灏嗕笟鍔d鏇存柊鍒扮┖缃埧浼樻儬閲岄潰
@@ -265,6 +267,7 @@
             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);

--
Gitblit v1.8.0