| @@ -8,6 +8,7 @@ import com.iformall.domain.dto.WxCounponDto; | |||||
| import com.iformall.domain.po.WxCoupon; | import com.iformall.domain.po.WxCoupon; | ||||
| import com.iformall.domain.po.WxCouponChannel; | import com.iformall.domain.po.WxCouponChannel; | ||||
| import com.iformall.domain.po.WxMerchant; | import com.iformall.domain.po.WxMerchant; | ||||
| import com.iformall.enums.EnumCouponStatus; | |||||
| import com.iformall.service.WxCouponChannelService; | import com.iformall.service.WxCouponChannelService; | ||||
| import com.iformall.service.WxCouponService; | import com.iformall.service.WxCouponService; | ||||
| import com.iformall.service.WxMerchantService; | import com.iformall.service.WxMerchantService; | ||||
| @@ -161,7 +162,7 @@ public class WxCouponController extends BaseController { | |||||
| public ResultData sendList(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { | public ResultData sendList(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { | ||||
| if (null == wxCoupon) wxCoupon = new WxCoupon(); | if (null == wxCoupon) wxCoupon = new WxCoupon(); | ||||
| wxCoupon.setTenantId(getTenantId()); | wxCoupon.setTenantId(getTenantId()); | ||||
| wxCoupon.setStatus(0); | |||||
| wxCoupon.setStatus(EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode()); | |||||
| return new ResultData(wxCouponService.listAsPage(wxCoupon, pageNum, pageSize)); | return new ResultData(wxCouponService.listAsPage(wxCoupon, pageNum, pageSize)); | ||||
| } | } | ||||
| @@ -7,6 +7,9 @@ import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.WxCoupon; | import com.iformall.domain.po.WxCoupon; | ||||
| import com.iformall.domain.po.WxCouponChannel; | import com.iformall.domain.po.WxCouponChannel; | ||||
| import com.iformall.domain.vo.WxCouponCVo; | import com.iformall.domain.vo.WxCouponCVo; | ||||
| import com.iformall.enums.EnumCouponChannelStatus; | |||||
| import com.iformall.enums.EnumCouponSendStatus; | |||||
| import com.iformall.enums.EnumCouponStatus; | |||||
| import com.iformall.mapper.WxCouponMapper; | import com.iformall.mapper.WxCouponMapper; | ||||
| import com.iformall.service.WxCouponChannelService; | import com.iformall.service.WxCouponChannelService; | ||||
| import com.iformall.service.WxCouponSendService; | import com.iformall.service.WxCouponSendService; | ||||
| @@ -79,10 +82,13 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| public ResultData updateCoupon(WxCoupon wxCoupon) { | public ResultData updateCoupon(WxCoupon wxCoupon) { | ||||
| WxCoupon query = wxCouponMapper.selectByPrimaryKey(wxCoupon.getId()); | WxCoupon query = wxCouponMapper.selectByPrimaryKey(wxCoupon.getId()); | ||||
| if (wxCoupon.getStatus() != null) { | if (wxCoupon.getStatus() != null) { | ||||
| if (query.getStatus() == 0 && wxCoupon.getStatus() == 1) { | |||||
| if (query.getStatus().equals(EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode()) | |||||
| && wxCoupon.getStatus().equals(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode())) { | |||||
| //作废所有投放频道 | //作废所有投放频道 | ||||
| wxCouponChannelService.updateStatusByCouponId(wxCoupon.getId(), query.getTenantId(), 1); | |||||
| wxCouponSendService.updateStatusByCouponId(query.getId(), query.getTenantId(), 1); | |||||
| wxCouponChannelService | |||||
| .updateStatusByCouponId(wxCoupon.getId(), query.getTenantId(), EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()); | |||||
| wxCouponSendService | |||||
| .updateStatusByCouponId(query.getId(), query.getTenantId(), EnumCouponSendStatus.INVALID.getCode()); | |||||
| } | } | ||||
| } | } | ||||
| return new ResultData(saveOrUpdate(wxCoupon)); | return new ResultData(saveOrUpdate(wxCoupon)); | ||||
| @@ -6,6 +6,7 @@ import com.iformall.common.IdWorker; | |||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.WxCouponService; | |||||
| import com.iformall.service.WxMerchantService; | import com.iformall.service.WxMerchantService; | ||||
| import com.iformall.service.WxProfitSharingReceiverService; | import com.iformall.service.WxProfitSharingReceiverService; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| @@ -43,6 +44,12 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| @Autowired | @Autowired | ||||
| WxBillRentMapper wxBillRentMapper; | WxBillRentMapper wxBillRentMapper; | ||||
| @Autowired | |||||
| WxCouponMapper wxCouponMapper; | |||||
| @Autowired | |||||
| WxCouponService wxCouponService; | |||||
| @Autowired | @Autowired | ||||
| WxProfitSharingReceiverService wxProfitSharingReceiverService; | WxProfitSharingReceiverService wxProfitSharingReceiverService; | ||||
| @Override | @Override | ||||
| @@ -146,6 +153,16 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| wxMerchantBUser.setStatus(EnumMerchantBUserStatus.INVALID.getCode()); | wxMerchantBUser.setStatus(EnumMerchantBUserStatus.INVALID.getCode()); | ||||
| wxMerchantBUserMapper.updateByPrimaryKeySelective(wxMerchantBUser); | wxMerchantBUserMapper.updateByPrimaryKeySelective(wxMerchantBUser); | ||||
| } | } | ||||
| //作废卡券 | |||||
| WxCoupon wxCoupon = new WxCoupon(); | |||||
| wxCoupon.setMerchantId(wxMerchant.getId()); | |||||
| List<WxCoupon> wxCouponList = wxCouponMapper.findList(wxCoupon); | |||||
| for(WxCoupon c:wxCouponList){ | |||||
| c.setStatus(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode()); | |||||
| wxCouponService.updateCoupon(c); | |||||
| } | |||||
| } | } | ||||
| @Transactional | @Transactional | ||||