|
|
|
@@ -86,7 +86,11 @@ public class WxOrderServiceImpl implements WxOrderService { |
|
|
|
orderQ.setCUserId(user.getId()); |
|
|
|
orderQ.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()); |
|
|
|
try { |
|
|
|
countOrder = wxOrderMapper.countList(orderQ); |
|
|
|
if (counpon.getType().equals(EnumCouponType.COUPON_TINGCHE.getCode())) { |
|
|
|
countOrder = wxOrderMapper.dayCountList(orderQ); |
|
|
|
} else { |
|
|
|
countOrder = wxOrderMapper.countList(orderQ); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("购买是否超限-DB, couponId: " + counpon.getId() + ", e:" + e.getMessage()); |
|
|
|
throw new MallinkException(ErrorCode.ORDER_IS_FAIL); |
|
|
|
@@ -98,7 +102,7 @@ public class WxOrderServiceImpl implements WxOrderService { |
|
|
|
Map params = new HashMap<String, Object>(); |
|
|
|
params.put("couponId", counpon.getId()); |
|
|
|
params.put("cUserId", user.getId()); |
|
|
|
countCouponOrder = wxCouponOrderMapper.countCarList(params); |
|
|
|
countCouponOrder = wxCouponOrderMapper.dayCountCarList(params); |
|
|
|
} else { |
|
|
|
WxCouponOrder couponOrderQ = new WxCouponOrder(); |
|
|
|
couponOrderQ.setTenantId(user.getTenantId()); |
|
|
|
@@ -133,24 +137,20 @@ public class WxOrderServiceImpl implements WxOrderService { |
|
|
|
} |
|
|
|
|
|
|
|
// check 购买是否超限 |
|
|
|
if (coupon.getType().equals(EnumCouponType.COUPON_TINGCHE.getCode())) { |
|
|
|
|
|
|
|
} else { |
|
|
|
int count = 0; |
|
|
|
try { |
|
|
|
count = getUserCouponOrderCount(user, coupon); |
|
|
|
} catch (Exception e) { |
|
|
|
//解锁 |
|
|
|
redisLock.unlock(couponIdStr, timeStr); |
|
|
|
throw new MallinkException(ErrorCode.DB_FAIL); |
|
|
|
} |
|
|
|
int count = 0; |
|
|
|
try { |
|
|
|
count = getUserCouponOrderCount(user, coupon); |
|
|
|
} catch (Exception e) { |
|
|
|
//解锁 |
|
|
|
redisLock.unlock(couponIdStr, timeStr); |
|
|
|
throw new MallinkException(ErrorCode.DB_FAIL); |
|
|
|
} |
|
|
|
|
|
|
|
if (count >= coupon.getUseLimitQuantity()) { |
|
|
|
//解锁 |
|
|
|
redisLock.unlock(couponIdStr, timeStr); |
|
|
|
logger.error("此券购买数量已超限, couponId: " + couponIdStr + ", count: " + count); |
|
|
|
throw new MallinkException(ErrorCode.ORDER_IS_LIMITED); |
|
|
|
} |
|
|
|
if (count >= coupon.getUseLimitQuantity()) { |
|
|
|
//解锁 |
|
|
|
redisLock.unlock(couponIdStr, timeStr); |
|
|
|
logger.error("此券购买数量已超限, couponId: " + couponIdStr + ", count: " + count); |
|
|
|
throw new MallinkException(ErrorCode.ORDER_IS_LIMITED); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|