如果发行数量是0,则不限制数量
This commit is contained in:
		
							parent
							
								
									02becd70b2
								
							
						
					
					
						commit
						e6ad65d8c0
					
				| @ -66,7 +66,7 @@ public class Coupon extends BasePromotion { | ||||
|     @ApiModelProperty(value = "活动描述") | ||||
|     private String description; | ||||
| 
 | ||||
|     @ApiModelProperty(value = "发行数量") | ||||
|     @ApiModelProperty(value = "发行数量,如果是0则是不限制") | ||||
|     private Integer publishNum; | ||||
| 
 | ||||
|     @ApiModelProperty(value = "领取限制") | ||||
|  | ||||
| @ -271,8 +271,8 @@ public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> impleme | ||||
|         if (coupon.getCouponLimitNum() < 0) { | ||||
|             throw new ServiceException("领取限制数量不能为负数"); | ||||
|         } | ||||
| 
 | ||||
|         if (coupon.getCouponLimitNum() > coupon.getPublishNum()) { | ||||
|         //如果发行数量是0则判断领取限制数量 | ||||
|         if (coupon.getPublishNum() != 0 && coupon.getCouponLimitNum() > coupon.getPublishNum()) { | ||||
|             throw new ServiceException("领取限制数量超出发行数量"); | ||||
|         } | ||||
| 
 | ||||
| @ -282,7 +282,7 @@ public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> impleme | ||||
|             throw new ServiceException("优惠券折扣必须小于10且大于0"); | ||||
|         } | ||||
| 
 | ||||
|         if (coupon.getRangeDayType().equals(CouponRangeDayEnum.FIXEDTIME.name())) { | ||||
|         if (coupon.getRangeDayType() != null && coupon.getRangeDayType().equals(CouponRangeDayEnum.FIXEDTIME.name())) { | ||||
|             long nowTime = DateUtil.getDateline() * 1000; | ||||
|             if (coupon.getStartTime().getTime() < nowTime && coupon.getEndTime().getTime() > nowTime) { | ||||
|                 throw new ServiceException("活动时间小于当前时间,不能进行编辑删除操作"); | ||||
|  | ||||
| @ -55,7 +55,7 @@ public class MemberCouponServiceImpl extends ServiceImpl<MemberCouponMapper, Mem | ||||
|         if (!PromotionStatusEnum.START.name().equals(coupon.getPromotionStatus())) { | ||||
|             throw new ServiceException("当前优惠券状态不可领取"); | ||||
|         } | ||||
|         if (coupon.getReceivedNum() >= coupon.getPublishNum()) { | ||||
|         if (coupon.getPublishNum() != 0 && coupon.getReceivedNum() >= coupon.getPublishNum()) { | ||||
|             throw new ServiceException("优惠券剩余领取数量不足"); | ||||
|         } | ||||
|         if (haveCoupons >= coupon.getCouponLimitNum()) { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 lifenlong
						lifenlong