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());