|
|
|
@ -8,12 +8,14 @@ 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.dao.HighChildOrderMapper; |
|
|
|
|
import com.hai.dao.HighCouponCodeMapper; |
|
|
|
|
import com.hai.dao.HighCouponCodeMapperExt; |
|
|
|
|
import com.hai.entity.*; |
|
|
|
|
import com.hai.enum_type.OrderPushType; |
|
|
|
|
import com.hai.model.GzSinopecModel; |
|
|
|
|
import com.hai.model.UserInfoModel; |
|
|
|
|
import com.hai.service.*; |
|
|
|
@ -358,6 +360,42 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService { |
|
|
|
|
highUserCouponService.insertUserCoupon(highUserCoupon); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else if (coupon.getCouponSource().equals(5)) { |
|
|
|
|
// 预发码
|
|
|
|
|
JSONObject preSendCoupon = ChongQingCNPCService.preSendCoupon(coupon.getCouponKey(), order.getOrderNo(), childOrder.getSaleCount(), order.getMemPhone()); |
|
|
|
|
if (preSendCoupon.getInteger("status").equals(1)) { |
|
|
|
|
// 给用户发码
|
|
|
|
|
JSONObject response = ChongQingCNPCService.sendCNPCTicket(coupon.getCouponKey(), order.getOrderNo(), childOrder.getSaleCount(), order.getMemPhone()); |
|
|
|
|
JSONObject couponDetail = response.getJSONObject("ticketDetail"); |
|
|
|
|
JSONArray codeList = response.getJSONArray("codeList"); |
|
|
|
|
for (Object data : codeList) { |
|
|
|
|
HighCouponCodeOther couponCodeOther = new HighCouponCodeOther(); |
|
|
|
|
couponCodeOther.setType(2); |
|
|
|
|
couponCodeOther.setOrderId(order.getId()); |
|
|
|
|
couponCodeOther.setChildOrderId(childOrder.getId()); |
|
|
|
|
couponCodeOther.setCouTypeCode(couponDetail.getString("requestCode")); |
|
|
|
|
couponCodeOther.setCouNo(ChongQingCNPCService.decryptCouponCode(String.valueOf(data))); |
|
|
|
|
couponCodeOther.setActiveTime(DateUtil.format(couponDetail.getString("effectiveTime"), "yyyy-MM-dd")); |
|
|
|
|
couponCodeOther.setValidStartDate(DateUtil.format(couponDetail.getString("effectiveTime"), "yyyy-MM-dd")); |
|
|
|
|
couponCodeOther.setValidEndDate(DateUtil.format(couponDetail.getString("expiredDate"), "yyyy-MM-dd")); |
|
|
|
|
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()); |
|
|
|
|