|
|
|
@ -98,8 +98,12 @@ public class HighOrderController { |
|
|
|
|
log.error("HighOrderController --> addOrder() error!", "未找到卡卷信息"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_COUPON, ""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 校验优惠券是否可用
|
|
|
|
|
// 是否达到限购数量
|
|
|
|
|
if (highCouponService.userBuyLimitNumber(userInfoModel.getHighUser().getId(), coupon.getId()) == true) { |
|
|
|
|
log.error("HighOrderController --> addOrder() error!", "已达到限购数量"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, coupon.getCouponName() + ",已达到限购数量"); |
|
|
|
|
} |
|
|
|
|
// 校验优惠券是否可用 如果使用优惠券就只能使用卡券的原价
|
|
|
|
|
if (highOrder.getMemDiscountId() != null) { |
|
|
|
|
List<HighDiscountCouponRel> discountCouponRelList = highDiscountCouponRelService.getRelByCoupon(coupon.getId()); |
|
|
|
|
if (discountCouponRelList.size() > 0) { |
|
|
|
@ -109,14 +113,11 @@ public class HighOrderController { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法使用优惠券"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
childOrder.setGoodsPrice(coupon.getSalesPrice()); |
|
|
|
|
} else { |
|
|
|
|
childOrder.setGoodsPrice(coupon.getDiscountPrice()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 是否到底限购数量
|
|
|
|
|
if (highCouponService.userBuyLimitNumber(userInfoModel.getHighUser().getId(), coupon.getId()) == true) { |
|
|
|
|
log.error("HighOrderController --> addOrder() error!", "已达到限购数量"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, coupon.getCouponName() + ",已达到限购数量"); |
|
|
|
|
} |
|
|
|
|
if (highCouponCodeService.getStockCountByCoupon(coupon.getId()) <= 0) { |
|
|
|
|
log.error("HighOrderController --> addOrder() error!", "卡卷库存数量不足"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COUPON_STOCK_INSUFFICIENT, ""); |
|
|
|
@ -124,7 +125,6 @@ public class HighOrderController { |
|
|
|
|
childOrder.setGoodsName(coupon.getCouponName()); |
|
|
|
|
childOrder.setGoodsImg(coupon.getCouponImg()); |
|
|
|
|
childOrder.setGoodsSpecName("默认"); |
|
|
|
|
childOrder.setGoodsPrice(coupon.getDiscountPrice()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (childOrder.getGoodsType() == 2) { |
|
|
|
|