From 0b3ff378a9faaf9d7a4831b7f0de67378fe0dfea Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期二, 30 五月 2023 12:20:15 +0800
Subject: [PATCH] optimize 统计

---
 service-fee/src/main/java/com/java110/fee/cmd/tempCarFee/NotifyTempCarFeeOrderCmd.java |   80 ++-------------------------------------
 1 files changed, 5 insertions(+), 75 deletions(-)

diff --git a/service-fee/src/main/java/com/java110/fee/cmd/tempCarFee/NotifyTempCarFeeOrderCmd.java b/service-fee/src/main/java/com/java110/fee/cmd/tempCarFee/NotifyTempCarFeeOrderCmd.java
index a88a98e..25c7b3b 100644
--- a/service-fee/src/main/java/com/java110/fee/cmd/tempCarFee/NotifyTempCarFeeOrderCmd.java
+++ b/service-fee/src/main/java/com/java110/fee/cmd/tempCarFee/NotifyTempCarFeeOrderCmd.java
@@ -1,28 +1,14 @@
 package com.java110.fee.cmd.tempCarFee;
 
-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.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
-import com.java110.core.factory.GenerateCodeFactory;
-import com.java110.dto.couponUser.CouponUserDto;
-import com.java110.dto.tempCarFeeConfig.TempCarPayOrderDto;
-import com.java110.fee.bmo.tempCarFee.IGetTempCarFeeRules;
-import com.java110.intf.acct.ICouponUserDetailV1InnerServiceSMO;
-import com.java110.intf.acct.ICouponUserV1InnerServiceSMO;
-import com.java110.po.couponUser.CouponUserPo;
-import com.java110.po.couponUserDetail.CouponUserDetailPo;
-import com.java110.utils.cache.CommonCache;
+import com.java110.intf.fee.ITempCarFeeCreateOrderV1InnerServiceSMO;
 import com.java110.utils.exception.CmdException;
-import com.java110.utils.util.BeanConvertUtil;
-import com.java110.utils.util.StringUtil;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.ResponseEntity;
-
-import java.util.List;
 
 /**
  * 绫昏〃杩帮細閫氱煡
@@ -35,14 +21,10 @@
  * // modify by 寮犱笁 at 2021-09-12 绗�10琛屽湪鏌愮鍦烘櫙涓嬪瓨鍦ㄦ煇绉峛ug 闇�瑕佷慨澶嶏紝娉ㄩ噴10鑷�20琛� 鍔犲叆 20琛岃嚦30琛�
  */
 @Java110Cmd(serviceCode = "tempCarFee.notifyTempCarFeeOrder")
-public class NotifyTempCarFeeOrderCmd extends AbstractServiceCmdListener {
+public class NotifyTempCarFeeOrderCmd extends Cmd {
 
     @Autowired
-    private IGetTempCarFeeRules getTempCarFeeRulesImpl;
-    @Autowired
-    private ICouponUserV1InnerServiceSMO couponUserV1InnerServiceSMOImpl;
-    @Autowired
-    private ICouponUserDetailV1InnerServiceSMO couponUserDetailV1InnerServiceSMOImpl;
+    private ITempCarFeeCreateOrderV1InnerServiceSMO tempCarFeeCreateOrderV1InnerServiceSMOImpl;
     //{"amount":20.0,"payType":"2","orderId":"19c4321c-b5d5-405f-b2ff-20e86a2e7f3e",
     // "payTime":"2021-10-17 17:29:54","paId":"102021101160020175","carNum":"闈扐88888","oId":"102021101724760012"}
     @Override
@@ -53,58 +35,6 @@
     @Override
     @Java110Transactional
     public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
-        String paramIn = CommonCache.getAndRemoveValue("queryTempCarFeeOrder" + reqJson.getString("oId"));
-        if (StringUtil.isEmpty(paramIn)) {
-            throw new CmdException("宸茬粡澶勭悊杩囦簡 鍐嶄笉澶勭悊");
-        }
-        JSONObject paramObj = JSONObject.parseObject(paramIn);
-        System.out.println("鑾峰彇鍒板唴瀛樹腑鐨勬暟鎹簡++++++++++++==銆�"+paramObj.toJSONString());
-        modifyCouponUser(paramObj);
-        TempCarPayOrderDto tempCarPayOrderDto = BeanConvertUtil.covertBean(reqJson, TempCarPayOrderDto.class);
-        ResponseEntity<String> responseEntity = getTempCarFeeRulesImpl.notifyTempCarFeeOrder(tempCarPayOrderDto);
-        cmdDataFlowContext.setResponseEntity(responseEntity);
-    }
-
-    private void modifyCouponUser(JSONObject paramObj) {
-        if (!paramObj.containsKey("couponPrice") || paramObj.getDouble("couponPrice") <= 0) {
-            return;
-        }
-        //FeeDto feeInfo = (FeeDto) paramObj.get("feeInfo");
-        CouponUserDto couponUserDto = null;
-        JSONArray couponUserDtos = paramObj.getJSONArray("couponUserDtos");
-        CouponUserDto couponUser = null;
-        for (int accountIndex = 0; accountIndex < couponUserDtos.size(); accountIndex++) {
-            couponUser = BeanConvertUtil.covertBean(couponUserDtos.getJSONObject(accountIndex), CouponUserDto.class);
-            couponUserDto = new CouponUserDto();
-            couponUserDto.setCouponId(couponUser.getCouponId());
-            couponUserDto.setState(CouponUserDto.COUPON_STATE_RUN);
-            List<CouponUserDto> couponUserDtos1 = couponUserV1InnerServiceSMOImpl.queryCouponUsers(couponUserDto);
-            if (couponUserDtos1 == null || couponUserDtos1.size() < 1) {
-                throw new CmdException("浼樻儬鍒歌浣跨敤");
-            }
-            CouponUserPo couponUserPo = new CouponUserPo();
-            couponUserPo.setState(CouponUserDto.COUPON_STATE_STOP);
-            couponUserPo.setCouponId(couponUser.getCouponId());
-            int fage = couponUserV1InnerServiceSMOImpl.updateCouponUser(couponUserPo);
-            if (fage < 1) {
-                throw new CmdException("鏇存柊浼樻儬鍗蜂俊鎭け璐�");
-            }
-            CouponUserDetailPo couponUserDetailPo = new CouponUserDetailPo();
-            couponUserDetailPo.setUoId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_usId));
-            couponUserDetailPo.setCouponId(couponUser.getCouponId());
-            couponUserDetailPo.setUserId(couponUser.getUserId());
-            couponUserDetailPo.setCouponName(couponUser.getCouponName());
-            couponUserDetailPo.setUserName(couponUser.getUserName());
-            couponUserDetailPo.setObjId(paramObj.getString("carNum"));
-            couponUserDetailPo.setObjType("杞﹁締");
-            couponUserDetailPo.setOrderId(paramObj.getString("oId"));
-            fage = couponUserDetailV1InnerServiceSMOImpl.saveCouponUserDetail(couponUserDetailPo);
-            if (fage < 1) {
-                throw new CmdException("鏂板浼樻儬鍗蜂娇鐢ㄨ褰曚俊鎭け璐�");
-            }
-        }
-
-        paramObj.put("remark", paramObj.getString("remark") + "-浼樻儬鍔垫姷鎵�" + paramObj.getDouble("couponPrice") + "鍏�");
-
+        cmdDataFlowContext.setResponseEntity(tempCarFeeCreateOrderV1InnerServiceSMOImpl.notifyOrder(reqJson));
     }
 }

--
Gitblit v1.8.0