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
master
袁野 8 months ago
parent ba05c0d457
commit 8f57fe9b8f
  1. 2
      hai-service/src/main/java/com/hai/config/PetroCouponConfig.java
  2. 40
      hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.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

@ -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());

Loading…
Cancel
Save