From c6e6ba7e6f7542d910aaecdcafca546b4788c22b Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期一, 13 三月 2023 14:32:56 +0800
Subject: [PATCH] optimize pay fee audti state
---
service-fee/src/main/java/com/java110/fee/cmd/tempCarFee/NotifyTempCarFeeOrderCmd.java | 67 +++------------------------------
1 files changed, 7 insertions(+), 60 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 dc9692a..24c1b61 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
@@ -3,8 +3,9 @@
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;
@@ -12,6 +13,7 @@
import com.java110.fee.bmo.tempCarFee.IGetTempCarFeeRules;
import com.java110.intf.acct.ICouponUserDetailV1InnerServiceSMO;
import com.java110.intf.acct.ICouponUserV1InnerServiceSMO;
+import com.java110.intf.fee.ITempCarFeeCreateOrderV1InnerServiceSMO;
import com.java110.po.couponUser.CouponUserPo;
import com.java110.po.couponUserDetail.CouponUserDetailPo;
import com.java110.utils.cache.CommonCache;
@@ -34,14 +36,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
@@ -50,59 +48,8 @@
}
@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("feeId"));
- couponUserDetailPo.setObjType(paramObj.getString("feeTypeCd"));
- 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