| @@ -143,7 +143,7 @@ public class WxCampaignController extends BaseController { | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| return wxCampaignService.updateStatus(wxCampaign); | |||||
| return wxCampaignService.updateStatus(wxCampaign,EnumProjectPlat.FM); | |||||
| } | } | ||||
| @ApiOperation("根据id删除接口") | @ApiOperation("根据id删除接口") | ||||
| @@ -65,7 +65,7 @@ public interface WxCampaignService { | |||||
| int getMaxSortNum(TenantEntity tenantEntity); | int getMaxSortNum(TenantEntity tenantEntity); | ||||
| ResultData updateStatus(WxCampaign wxCampaign); | |||||
| ResultData updateStatus(WxCampaign wxCampaign,EnumProjectPlat projectPlat); | |||||
| void printHtmlById(Long id, HttpServletResponse response); | void printHtmlById(Long id, HttpServletResponse response); | ||||
| @@ -170,6 +170,7 @@ public class WxCampaignServiceImpl implements WxCampaignService { | |||||
| } else { | } else { | ||||
| wxCampaignMapper.updateById(wxCampaign); | wxCampaignMapper.updateById(wxCampaign); | ||||
| } | } | ||||
| //type 为固定格式才会有券的信息 才会有投放的问题 | //type 为固定格式才会有券的信息 才会有投放的问题 | ||||
| couponInject(wxCampaign); | couponInject(wxCampaign); | ||||
| return new ResultData(Result.SUCCESS,"操作成功"); | return new ResultData(Result.SUCCESS,"操作成功"); | ||||
| @@ -177,14 +178,16 @@ public class WxCampaignServiceImpl implements WxCampaignService { | |||||
| @Transactional(propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | ||||
| @Override | @Override | ||||
| public ResultData updateStatus(WxCampaign wxCampaign) { | |||||
| public ResultData updateStatus(WxCampaign wxCampaign,EnumProjectPlat projectPlat) { | |||||
| wxCampaignMapper.updateById(wxCampaign); | wxCampaignMapper.updateById(wxCampaign); | ||||
| if (wxCampaign.getType().equals(EnumCampaignType.PAGEPATH.getCode())) { | if (wxCampaign.getType().equals(EnumCampaignType.PAGEPATH.getCode())) { | ||||
| WxCampaign campaign = wxCampaignMapper.selectById(wxCampaign.getId()); | WxCampaign campaign = wxCampaignMapper.selectById(wxCampaign.getId()); | ||||
| this.updateOtherStatus(campaign.getProduceId(),campaign.getStatus(),campaign.getProduceType()); | this.updateOtherStatus(campaign.getProduceId(),campaign.getStatus(),campaign.getProduceType()); | ||||
| } | } | ||||
| //type 为固定格式才会有券的信息 才会有投放的问题 | |||||
| couponInject(wxCampaign); | |||||
| if(EnumProjectPlat.FM.equals(projectPlat)){ | |||||
| //type 为固定格式才会有券的信息 才会有投放的问题 | |||||
| couponInject(wxCampaign); | |||||
| } | |||||
| return new ResultData(Result.SUCCESS, "操作成功"); | return new ResultData(Result.SUCCESS, "操作成功"); | ||||
| } | } | ||||
| @@ -127,28 +127,28 @@ public class WxCampaignController extends BaseController { | |||||
| ifParentUpdateAloneTenantInfo(); | ifParentUpdateAloneTenantInfo(); | ||||
| WxCampaign campaign = wxCampaignService.getById(wxCampaign.getId()); | WxCampaign campaign = wxCampaignService.getById(wxCampaign.getId()); | ||||
| // check coupon 状态 | // check coupon 状态 | ||||
| if (campaign.getType().equals(EnumCampaignType.STABLE.getCode())) { | |||||
| if (campaign.getStatus().equals(EnumCampaignStatus.STATUS_THROW_IN.getCode()) | |||||
| && !wxCampaign.getStatus().equals(EnumCampaignStatus.STATUS_TAKE_OFFF.getCode())) { | |||||
| // 宣传页 - 下架不检查状态 | |||||
| List<String> ids = JSONArray.parseArray(campaign.getCouponIds(), String.class); | |||||
| for (String couponIdStr : ids) { | |||||
| Long couponId = Long.parseLong(couponIdStr); | |||||
| WxCoupon wxCoupon = wxCouponService.getById(couponId,campaign.getTenantId()); | |||||
| if (wxCoupon == null) { | |||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY); | |||||
| } | |||||
| if (wxCoupon.getStatus() != EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode()) { | |||||
| return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF); | |||||
| } | |||||
| if (wxCoupon.getValidEndDate() != null && wxCoupon.getValidEndDate().before(new Date())) { | |||||
| return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| return wxCampaignService.updateStatus(wxCampaign); | |||||
| // if (campaign.getType().equals(EnumCampaignType.STABLE.getCode())) { | |||||
| // if (campaign.getStatus().equals(EnumCampaignStatus.STATUS_THROW_IN.getCode()) | |||||
| // && !wxCampaign.getStatus().equals(EnumCampaignStatus.STATUS_TAKE_OFFF.getCode())) { | |||||
| // // 宣传页 - 下架不检查状态 | |||||
| // List<String> ids = JSONArray.parseArray(campaign.getCouponIds(), String.class); | |||||
| // for (String couponIdStr : ids) { | |||||
| // Long couponId = Long.parseLong(couponIdStr); | |||||
| // | |||||
| // WxCoupon wxCoupon = wxCouponService.getById(couponId,campaign.getTenantId()); | |||||
| // if (wxCoupon == null) { | |||||
| // return new ResultData(ErrorCode.COUPON_IS_EMPTY); | |||||
| // } | |||||
| // if (wxCoupon.getStatus() != EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode()) { | |||||
| // return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF); | |||||
| // } | |||||
| // if (wxCoupon.getValidEndDate() != null && wxCoupon.getValidEndDate().before(new Date())) { | |||||
| // return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF); | |||||
| // } | |||||
| // } | |||||
| // } | |||||
| // } | |||||
| return wxCampaignService.updateStatus(wxCampaign,EnumProjectPlat.TT); | |||||
| } | } | ||||
| @ApiOperation("根据id删除接口") | @ApiOperation("根据id删除接口") | ||||