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