mirror of
				https://github.com/YunaiV/ruoyi-vue-pro.git
				synced 2025-10-31 10:37:41 +08:00 
			
		
		
		
	【缺陷修复】商城:优惠劵在不限制时,无法发送的问题
This commit is contained in:
		| @ -30,6 +30,11 @@ import java.util.List; | |||||||
| @EqualsAndHashCode(callSuper = true) | @EqualsAndHashCode(callSuper = true) | ||||||
| public class CouponTemplateDO extends BaseDO { | public class CouponTemplateDO extends BaseDO { | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 不限制领取数量 | ||||||
|  |      */ | ||||||
|  |     public static final Integer TIME_LIMIT_COUNT_MAX = -1; | ||||||
|  |  | ||||||
|     // ========== 基本信息 BEGIN ========== |     // ========== 基本信息 BEGIN ========== | ||||||
|     /** |     /** | ||||||
|      * 模板编号,自增唯一 |      * 模板编号,自增唯一 | ||||||
|  | |||||||
| @ -269,7 +269,8 @@ public class CouponServiceImpl implements CouponService { | |||||||
|             throw exception(COUPON_TEMPLATE_NOT_EXISTS); |             throw exception(COUPON_TEMPLATE_NOT_EXISTS); | ||||||
|         } |         } | ||||||
|         // 校验剩余数量 |         // 校验剩余数量 | ||||||
|         if (couponTemplate.getTakeCount() + userIds.size() > couponTemplate.getTotalCount()) { |         if (ObjUtil.notEqual(couponTemplate.getTakeLimitCount(), CouponTemplateDO.TIME_LIMIT_COUNT_MAX) // 非不限制 | ||||||
|  |                 && couponTemplate.getTakeCount() + userIds.size() > couponTemplate.getTotalCount()) { | ||||||
|             throw exception(COUPON_TEMPLATE_NOT_ENOUGH); |             throw exception(COUPON_TEMPLATE_NOT_ENOUGH); | ||||||
|         } |         } | ||||||
|         // 校验"固定日期"的有效期类型是否过期 |         // 校验"固定日期"的有效期类型是否过期 | ||||||
|  | |||||||
| @ -1,5 +1,6 @@ | |||||||
| package cn.iocoder.yudao.module.promotion.service.coupon; | package cn.iocoder.yudao.module.promotion.service.coupon; | ||||||
|  |  | ||||||
|  | import cn.hutool.core.util.ObjUtil; | ||||||
| import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | ||||||
| import cn.iocoder.yudao.framework.common.pojo.PageResult; | import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||||||
| import cn.iocoder.yudao.module.product.api.category.ProductCategoryApi; | import cn.iocoder.yudao.module.product.api.category.ProductCategoryApi; | ||||||
| @ -59,7 +60,7 @@ public class CouponTemplateServiceImpl implements CouponTemplateService { | |||||||
|         CouponTemplateDO couponTemplate = validateCouponTemplateExists(updateReqVO.getId()); |         CouponTemplateDO couponTemplate = validateCouponTemplateExists(updateReqVO.getId()); | ||||||
|         // 校验发放数量不能过小(仅在 CouponTakeTypeEnum.USER 用户领取时) |         // 校验发放数量不能过小(仅在 CouponTakeTypeEnum.USER 用户领取时) | ||||||
|         if (CouponTakeTypeEnum.isUser(couponTemplate.getTakeType()) |         if (CouponTakeTypeEnum.isUser(couponTemplate.getTakeType()) | ||||||
|                 && updateReqVO.getTotalCount() > 0 // 大于 0 的原因,是因为 -1 不限制 |                 && ObjUtil.notEqual(couponTemplate.getTakeLimitCount(), CouponTemplateDO.TIME_LIMIT_COUNT_MAX) // 非不限制 | ||||||
|                 && updateReqVO.getTotalCount() < couponTemplate.getTakeCount()) { |                 && updateReqVO.getTotalCount() < couponTemplate.getTakeCount()) { | ||||||
|             throw exception(COUPON_TEMPLATE_TOTAL_COUNT_TOO_SMALL, couponTemplate.getTakeCount()); |             throw exception(COUPON_TEMPLATE_TOTAL_COUNT_TOO_SMALL, couponTemplate.getTakeCount()); | ||||||
|         } |         } | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 YunaiV
					YunaiV