From 8f57fe9b8f376a1601526b3bb22298129ed788d9 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Mon, 8 Apr 2024 11:29:36 +0800 Subject: [PATCH] Merge branch 'new-dev' into 2.0-dev # Conflicts: # hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderCreateHandleServiceImpl.java # hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderServiceImpl.java --- .../com/hai/config/PetroCouponConfig.java | 2 +- .../impl/HighCouponCodeServiceImpl.java | 40 +++++++++++++++++-- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/hai-service/src/main/java/com/hai/config/PetroCouponConfig.java b/hai-service/src/main/java/com/hai/config/PetroCouponConfig.java index d836f186..baa31f90 100644 --- a/hai-service/src/main/java/com/hai/config/PetroCouponConfig.java +++ b/hai-service/src/main/java/com/hai/config/PetroCouponConfig.java @@ -16,7 +16,7 @@ import java.util.Set; * @serviceName .java * @author Sum1Dream * @version 1.0.0 - * @Description // 中石油卡券 + * @Description // 中油优途中石油卡券 * @createTime 18:33 2023/11/13 **/ @Configuration diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java index 7d8732be..810583ee 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java @@ -8,10 +8,7 @@ import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.utils.DateUtil; import com.hai.common.utils.IDGenerator; -import com.hai.config.ChongQingCNPCService; -import com.hai.config.HuiLianTongConfig; -import com.hai.config.HuiLianTongUnionCardConfig; -import com.hai.config.PetroConfig; +import com.hai.config.*; import com.hai.dao.HighCouponCodeMapper; import com.hai.dao.HighCouponCodeMapperExt; import com.hai.entity.*; @@ -572,6 +569,41 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService { } else if (coupon.getCouponSource().equals(9)) { + } else if (coupon.getCouponSource().equals(10)) { + HighCouponCodeOther couponCodeOther = new HighCouponCodeOther(); + // 发放卡券 + JSONObject jsonObject = PetroCouponConfig.getCoupon(order.getOrderNo() , order.getMemPhone() , coupon.getCouponKey()); + + if (!jsonObject.getString("code").equals("200")) { + throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , jsonObject.getString("errMsg")); + } + + JSONObject object = jsonObject.getJSONObject("data"); + + couponCodeOther.setOrderId(order.getId()); + couponCodeOther.setChildOrderId(childOrder.getId()); + couponCodeOther.setCouTypeCode(object.getString("requestCode")); + couponCodeOther.setCouNo(object.getString("couponCode")); + couponCodeOther.setActiveTime(new Date()); + couponCodeOther.setValidStartDate(new Date()); + couponCodeOther.setValidEndDate(coupon.getSalesEndTime()); + couponCodeOther.setStatus(20); + couponCodeOther.setCreateTime(new Date()); + couponCodeOtherService.insertCouponCodeOther(couponCodeOther); + + // 卡卷关联用户 + HighUserCoupon highUserCoupon = new HighUserCoupon(); + highUserCoupon.setMerchantId(coupon.getMerchantId()); + highUserCoupon.setCouponId(coupon.getId()); + highUserCoupon.setOrderId(order.getId()); + highUserCoupon.setChildOrderId(childOrder.getId()); + highUserCoupon.setUserId(order.getMemId()); + highUserCoupon.setCreateTime(new Date()); + highUserCoupon.setQrCodeImg(couponCodeOther.getCouNo()); + highUserCoupon.setUseEndTime(couponCodeOther.getValidEndDate()); + highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用 + highUserCouponService.insertUserCoupon(highUserCoupon); + }else { // 查询子订单的兑换码 HighCouponCode code = getCodeByChildOrderNo(childOrder.getChildOrderNo());