From 10aabc6b8a769660b69002b1abfb466ca9963905 Mon Sep 17 00:00:00 2001 From: masterspirit Date: Sun, 26 Aug 2018 17:20:02 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BF=AE=E6=94=B9=E5=88=B8=E7=8A=B6=E6=80=81]?= =?UTF-8?q?[=E4=BF=AE=E6=94=B9]=20=E5=88=B8=E7=8A=B6=E6=80=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/WxCouponChannelServiceImpl.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxCouponChannelServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxCouponChannelServiceImpl.java index 24cd6c59a..e0d098ac7 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxCouponChannelServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxCouponChannelServiceImpl.java @@ -11,6 +11,7 @@ import com.simple.domain.vo.WxCouponChannelVo; import com.simple.mapper.WxCouponChannelMapper; import com.simple.service.WxCouponChannelService; import com.simple.service.WxCouponService; +import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.simple.common.IdWorker; @@ -24,6 +25,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { @Autowired WxCouponService wxCouponService; + private Logger logger = Logger.getLogger(getClass()); /** * B端业务端 @@ -77,14 +79,23 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { @Transactional public void addCuponChannel(Long couponid,Integer channelId,String tanantId,Date beginTime,Date endTime){ WxCoupon wxCoupon = wxCouponService.getById(couponid); - if(wxCoupon.getStatus()!=1) { - wxCoupon.setStatus(1); - wxCouponService.saveOrUpdate(wxCoupon); + if(wxCoupon.getStatus()!=0) { + logger.debug(wxCoupon.getId()+"状态不对"); + return; + } + + if(wxCoupon.getValidEndDate().before(endTime)){ + logger.debug(wxCoupon.getId()+"发放时间不能晚于使用时间"); + return; } WxCouponChannel wxCouponChannel = new WxCouponChannel(); + wxCouponChannel.setEndTime(endTime); + if(wxCoupon.getValidEndDate()!=null){ + wxCouponChannel.setEndTime(wxCoupon.getValidEndDate()); + } wxCouponChannel.setStatus(0); wxCouponChannel.setBeginTime(beginTime); - wxCouponChannel.setEndTime(endTime); + wxCouponChannel.setCouponId(couponid); wxCouponChannel.setMerchantId(wxCoupon.getMerchantId()); wxCouponChannel.setType(wxCoupon.getType());