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