From da19bc056e5b58ff74e7064109251bd51a056a12 Mon Sep 17 00:00:00 2001 From: 199901012 Date: Mon, 5 Apr 2021 17:41:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cweb/controller/HighOrderController.java | 18 +++++++++--------- .../com/hai/schedule/HighCouponSchedule.java | 2 +- .../com/hai/schedule/HighDiscountSchedule.java | 2 +- .../com/hai/schedule/HighOrderSchedule.java | 2 +- .../java/com/hai/schedule/SynchronizeCNPC.java | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java index ffea0fa8..e14c3ec3 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java @@ -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 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) { diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java index ec8b0a5f..68c564db 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java @@ -30,7 +30,7 @@ public class HighCouponSchedule { * @Date 2021/4/4 22:44 **/ // @Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次 - //@Scheduled(cron = "0 0 0 * * ?") //每天 凌晨0点执行 + @Scheduled(cron = "0 0 0 * * ?") //每天 凌晨0点执行 public void expiredCoupon() { // 查询过期的卡券 List userCoupons = highUserCouponService.getOverdueCoupon(); diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighDiscountSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/HighDiscountSchedule.java index 8fd41af8..b370a79c 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighDiscountSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighDiscountSchedule.java @@ -29,7 +29,7 @@ public class HighDiscountSchedule { * @Description 处理过期的优惠券 * @Date 2021/4/4 22:44 **/ - //@Scheduled(cron = "0 0 0 * * ?") //每1分钟执行一次 + @Scheduled(cron = "0 0 0 * * ?") //每1分钟执行一次 public void expiredDiscount() { List expiredDiscount = highDiscountUserRelService.getExpiredDiscount(); for (HighDiscountUserRel rel : expiredDiscount) { diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java index 9573b7d0..789bef83 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java @@ -33,7 +33,7 @@ public class HighOrderSchedule { * @Description 取消订单 15分钟 * @Date 2021/4/4 22:45 **/ - //@Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次 + @Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次 public void cancelOrder() { List orderList = highOrderService.getCloseOrder(); if (orderList != null && orderList.size() > 0) { diff --git a/hai-schedule/src/main/java/com/hai/schedule/SynchronizeCNPC.java b/hai-schedule/src/main/java/com/hai/schedule/SynchronizeCNPC.java index 9bbdd083..21d355fe 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/SynchronizeCNPC.java +++ b/hai-schedule/src/main/java/com/hai/schedule/SynchronizeCNPC.java @@ -29,7 +29,7 @@ public class SynchronizeCNPC { private static final String[] HEX_DIGITS = {"0" ,"1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"}; - @Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次 + //@Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次 public void certification() { Map tokenMap = new HashMap<>(); tokenMap.put("appId", "jsVpwDoHZfR2rrpjhA");