提交代码'

dev-discount
199901012 4 years ago
parent 7c5b7ed744
commit da19bc056e
  1. 18
      hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java
  2. 2
      hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java
  3. 2
      hai-schedule/src/main/java/com/hai/schedule/HighDiscountSchedule.java
  4. 2
      hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java
  5. 2
      hai-schedule/src/main/java/com/hai/schedule/SynchronizeCNPC.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<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) {

@ -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<HighUserCoupon> userCoupons = highUserCouponService.getOverdueCoupon();

@ -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<HighDiscountUserRel> expiredDiscount = highDiscountUserRelService.getExpiredDiscount();
for (HighDiscountUserRel rel : expiredDiscount) {

@ -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<HighOrder> orderList = highOrderService.getCloseOrder();
if (orderList != null && orderList.size() > 0) {

@ -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<String, Object> tokenMap = new HashMap<>();
tokenMap.put("appId", "jsVpwDoHZfR2rrpjhA");

Loading…
Cancel
Save