|
|
@@ -106,7 +106,7 @@ public class UserCouponServiceImpl extends MPJBaseServiceImpl<UserCouponMapper,
|
|
|
throw new BusinessException("优惠券不存在或已失效!");
|
|
|
}
|
|
|
|
|
|
- if (coupon.getClaimedQuantity() >= coupon.getQuantity()) {
|
|
|
+ if (coupon.getClaimedQuantity() >= coupon.getQuantity() && coupon.getQuantity() > 0) {
|
|
|
DynamicDataSourceContextHolder.poll();
|
|
|
throw new BusinessException("优惠券已领完!");
|
|
|
}
|
|
|
@@ -126,7 +126,7 @@ public class UserCouponServiceImpl extends MPJBaseServiceImpl<UserCouponMapper,
|
|
|
coupon.setClaimedQuantity(coupon.getClaimedQuantity() + 1);
|
|
|
|
|
|
// 校验优惠券数量是否已领完
|
|
|
- if (coupon.getClaimedQuantity() >= coupon.getQuantity()) {
|
|
|
+ if (coupon.getClaimedQuantity() >= coupon.getQuantity() && coupon.getQuantity() > 0) {
|
|
|
coupon.setStatus(Coupon.STATUS_已结束);
|
|
|
}
|
|
|
couponService.updateById(coupon);
|