From d83188e2aef047f3b6146152fb025e414b8e51a7 Mon Sep 17 00:00:00 2001 From: xhxu Date: Fri, 5 May 2023 16:12:41 +0800 Subject: [PATCH] =?UTF-8?q?//=E5=94=AE=E5=8D=96=E6=9C=89=E6=95=88=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/WxCouponChannelServiceImpl.java | 39 ++++++++++++++----- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java index 90dbfce6d..581a19e47 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java @@ -615,13 +615,31 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { WxCoupon wxCoupon = wxCouponService.getById(couponid,tenantEntity.getTenantId()); - if(wxCoupon==null){ + if(wxCoupon == null){ logger.debug(couponid+ErrorCode.COUPON_IS_EMPTY.getMessage()); vo.toCouponChannnelVo(null,channelId); vo.setErrorMsg(ErrorCode.COUPON_IS_EMPTY.getMessage()); return vo; } + if(wxCoupon.getSoldStartTime() != null && wxCoupon.getSoldEndTime() != null){ + if(showBeginTime != null && showBeginTime.after(wxCoupon.getSoldEndTime())){ + vo.toCouponChannnelVo(null,channelId); + vo.setErrorMsg("上架时间不得晚于售卖结束时间"); + return vo; + } + if(beginTime != null && beginTime.before(wxCoupon.getSoldStartTime())){ + vo.toCouponChannnelVo(null,channelId); + vo.setErrorMsg("活动开始时间不得早于售卖开始时间"); + return vo; + } + if(endTime != null && endTime.after(wxCoupon.getSoldEndTime())){ + vo.toCouponChannnelVo(null,channelId); + vo.setErrorMsg("活动结束时间不得晚于售卖结束时间"); + return vo; + } + } + if(null != channelPrice) { if (wxCoupon.getSalePrice() <= 0 && channelPrice > 0) { vo.toCouponChannnelVo(null,channelId); @@ -683,14 +701,14 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { } } - if(channelId.equals(EnumCouponChannelType.COUPON_CHANNEL_ID_TIMED.getCode())){ // 限时抢购 - if(wxCoupon.getValidEndDate() != null && wxCoupon.getValidEndDate().before(endTime)){ - logger.debug(wxCoupon.getId()+ErrorCode.COUPON_SEND_IS_INVALID_TIME.getMessage()); - vo.toCouponChannnelVo(wxCoupon,channelId); - vo.setErrorMsg(ErrorCode.COUPON_SEND_IS_INVALID_TIME.getMessage()); - return vo; - } - } +// if(channelId.equals(EnumCouponChannelType.COUPON_CHANNEL_ID_TIMED.getCode())){ // 限时抢购 +// if(wxCoupon.getValidEndDate() != null && wxCoupon.getValidEndDate().before(endTime)){ +// logger.debug(wxCoupon.getId()+ErrorCode.COUPON_SEND_IS_INVALID_TIME.getMessage()); +// vo.toCouponChannnelVo(wxCoupon,channelId); +// vo.setErrorMsg(ErrorCode.COUPON_SEND_IS_INVALID_TIME.getMessage()); +// return vo; +// } +// } if(channelStock != null && channelStock.intValue() > 0){ int num = wxCouponMapper.reduceInventory(wxCoupon.getId(),tenantEntity.getTenantId(), channelStock); @@ -705,9 +723,10 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { }else { wxCouponChannel.setShowBeginTime(showBeginTime); } - wxCouponChannel.setEndTime(endTime); + wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); wxCouponChannel.setBeginTime(beginTime); + wxCouponChannel.setEndTime(endTime); wxCouponChannel.setCouponId(couponid); wxCouponChannel.setMakeMerchantId(wxCoupon.getMakeMerchantId()); wxCouponChannel.setType(wxCoupon.getType());