From e6ad65d8c0fa90e76a737388ce28b241d06d23b8 Mon Sep 17 00:00:00 2001 From: lifenlong Date: Thu, 24 Jun 2021 15:51:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A6=82=E6=9E=9C=E5=8F=91=E8=A1=8C=E6=95=B0?= =?UTF-8?q?=E9=87=8F=E6=98=AF0,=E5=88=99=E4=B8=8D=E9=99=90=E5=88=B6?= =?UTF-8?q?=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/lili/modules/promotion/entity/dos/Coupon.java | 2 +- .../modules/promotion/serviceimpl/CouponServiceImpl.java | 6 +++--- .../promotion/serviceimpl/MemberCouponServiceImpl.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/framework/src/main/java/cn/lili/modules/promotion/entity/dos/Coupon.java b/framework/src/main/java/cn/lili/modules/promotion/entity/dos/Coupon.java index 9c9739e0..1188a79a 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/entity/dos/Coupon.java +++ b/framework/src/main/java/cn/lili/modules/promotion/entity/dos/Coupon.java @@ -66,7 +66,7 @@ public class Coupon extends BasePromotion { @ApiModelProperty(value = "活动描述") private String description; - @ApiModelProperty(value = "发行数量") + @ApiModelProperty(value = "发行数量,如果是0则是不限制") private Integer publishNum; @ApiModelProperty(value = "领取限制") diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponServiceImpl.java index 16111412..de3683db 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponServiceImpl.java @@ -271,8 +271,8 @@ public class CouponServiceImpl extends ServiceImpl 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 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("活动时间小于当前时间,不能进行编辑删除操作"); diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/MemberCouponServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/MemberCouponServiceImpl.java index 7ac348ca..b5177a18 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/MemberCouponServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/MemberCouponServiceImpl.java @@ -55,7 +55,7 @@ public class MemberCouponServiceImpl extends ServiceImpl= coupon.getPublishNum()) { + if (coupon.getPublishNum() != 0 && coupon.getReceivedNum() >= coupon.getPublishNum()) { throw new ServiceException("优惠券剩余领取数量不足"); } if (haveCoupons >= coupon.getCouponLimitNum()) {