mirror of
https://gitee.com/yudaocode/yudao-boot-mini.git
synced 2025-12-26 07:06:22 +08:00
fix: 【coupon】更新发放数量校验逻辑,确保用户领取时剩余数量充足
This commit is contained in:
parent
887594ec2e
commit
073ffb5c71
@ -282,10 +282,11 @@ public class CouponServiceImpl implements CouponService {
|
||||
if (ObjUtil.notEqual(couponTemplate.getTakeType(), takeType.getType())) {
|
||||
throw exception(COUPON_TEMPLATE_CANNOT_TAKE);
|
||||
}
|
||||
// 校验发放数量不能过小(仅在 CouponTakeTypeEnum.USER 用户领取时)
|
||||
// 校验剩余发放数量是否充足(仅在 CouponTakeTypeEnum.USER 用户领取时)
|
||||
// 关联案例:https://t.zsxq.com/mElGQ、https://t.zsxq.com/6pLzr
|
||||
if (CouponTakeTypeEnum.isUser(couponTemplate.getTakeType())
|
||||
&& ObjUtil.notEqual(couponTemplate.getTakeLimitCount(), CouponTemplateDO.TAKE_LIMIT_COUNT_MAX) // 校验不限制领取数
|
||||
&& ObjUtil.notEqual(couponTemplate.getTotalCount(), CouponTemplateDO.TOTAL_COUNT_MAX)) { // 校验不限制发放数量
|
||||
&& couponTemplate.getTakeCount() > couponTemplate.getTotalCount()) { // 已领取数量 >= 总发放数量
|
||||
throw exception(COUPON_TEMPLATE_NOT_ENOUGH);
|
||||
}
|
||||
// 校验"固定日期"的有效期类型是否过期
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user