From ae2427a653555b7e32a417464289beef65e1c0a5 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期二, 21 六月 2022 00:12:59 +0800
Subject: [PATCH] 优化bug

---
 service-fee/src/main/java/com/java110/fee/cmd/payFeeBatch/UpdatePayFeeBatchCmd.java |   35 ++++++++++++++++++++++++++++++-----
 1 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/service-fee/src/main/java/com/java110/fee/cmd/payFeeBatch/UpdatePayFeeBatchCmd.java b/service-fee/src/main/java/com/java110/fee/cmd/payFeeBatch/UpdatePayFeeBatchCmd.java
index 04e7518..bd932d6 100644
--- a/service-fee/src/main/java/com/java110/fee/cmd/payFeeBatch/UpdatePayFeeBatchCmd.java
+++ b/service-fee/src/main/java/com/java110/fee/cmd/payFeeBatch/UpdatePayFeeBatchCmd.java
@@ -17,18 +17,21 @@
 
 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.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
+import com.java110.dto.payFeeBatch.PayFeeBatchDto;
+import com.java110.intf.fee.IFeeInnerServiceSMO;
 import com.java110.intf.fee.IPayFeeBatchV1InnerServiceSMO;
+import com.java110.po.fee.PayFeePo;
 import com.java110.po.payFeeBatch.PayFeeBatchPo;
+import com.java110.utils.constant.StateConstant;
 import com.java110.utils.exception.CmdException;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
 import com.java110.vo.ResultVo;
 import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import com.java110.core.log.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 
 
@@ -43,7 +46,7 @@
  * // modify by 寮犱笁 at 2021-09-12 绗�10琛屽湪鏌愮鍦烘櫙涓嬪瓨鍦ㄦ煇绉峛ug 闇�瑕佷慨澶嶏紝娉ㄩ噴10鑷�20琛� 鍔犲叆 20琛岃嚦30琛�
  */
 @Java110Cmd(serviceCode = "payFeeBatch.updatePayFeeBatch")
-public class UpdatePayFeeBatchCmd extends AbstractServiceCmdListener {
+public class UpdatePayFeeBatchCmd extends Cmd {
 
     private static Logger logger = LoggerFactory.getLogger(UpdatePayFeeBatchCmd.class);
 
@@ -51,23 +54,45 @@
     @Autowired
     private IPayFeeBatchV1InnerServiceSMO payFeeBatchV1InnerServiceSMOImpl;
 
+    @Autowired
+    private IFeeInnerServiceSMO feeInnerServiceSMOImpl;
+
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
         Assert.hasKeyAndValue(reqJson, "batchId", "batchId涓嶈兘涓虹┖");
         Assert.hasKeyAndValue(reqJson, "communityId", "communityId涓嶈兘涓虹┖");
+        Assert.hasKeyAndValue(reqJson, "state", "鐘舵�佷笉鑳戒负绌�");
+        Assert.hasKeyAndValue(reqJson, "msg", "娑堟伅涓嶈兘涓虹┖");
     }
 
     @Override
-    @Java110Transactional
+    //@Java110Transactional
+    //杩欓噷涓嶅紑鍚簨鍔★紝鍒犻櫎鍙兘鍑犲崈鏉� 浜嬪姟鍘嬪姏澶ぇ
+
     public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
 
         PayFeeBatchPo payFeeBatchPo = BeanConvertUtil.covertBean(reqJson, PayFeeBatchPo.class);
+        if (StateConstant.AGREE_AUDIT.equals(reqJson.getString("state"))) {
+            payFeeBatchPo.setState(PayFeeBatchDto.STATE_SUCCESS);
+        } else {
+            payFeeBatchPo.setState(PayFeeBatchDto.STATE_FAIL);
+        }
         int flag = payFeeBatchV1InnerServiceSMOImpl.updatePayFeeBatch(payFeeBatchPo);
 
         if (flag < 1) {
             throw new CmdException("鏇存柊鏁版嵁澶辫触");
         }
 
+        if (PayFeeBatchDto.STATE_FAIL.equals(payFeeBatchPo.getState())) {
+            cmdDataFlowContext.setResponseEntity(ResultVo.success());
+            return;
+        }
+
+        PayFeePo feePo = new PayFeePo();
+        feePo.setBatchId(payFeeBatchPo.getBatchId());
+        feePo.setCommunityId(payFeeBatchPo.getCommunityId());
+        feeInnerServiceSMOImpl.deleteFeesByBatch(feePo);
+
         cmdDataFlowContext.setResponseEntity(ResultVo.success());
     }
 }

--
Gitblit v1.8.0