| @@ -7,16 +7,14 @@ import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxActivity; | |||||
| import com.iformall.domain.po.WxCampaign; | |||||
| import com.iformall.domain.po.WxCoupon; | |||||
| import com.iformall.domain.po.WxCouponChannel; | |||||
| import com.iformall.domain.po.*; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.vo.WxCouponChannelVo; | import com.iformall.domain.vo.WxCouponChannelVo; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.mapper.WxActivityMapper; | import com.iformall.mapper.WxActivityMapper; | ||||
| import com.iformall.mapper.WxCampaignMapper; | import com.iformall.mapper.WxCampaignMapper; | ||||
| import com.iformall.mapper.WxCouponChannelMapper; | import com.iformall.mapper.WxCouponChannelMapper; | ||||
| import com.iformall.mapper.WxQuestionOneselfMapper; | |||||
| import com.iformall.service.QrCodeService; | import com.iformall.service.QrCodeService; | ||||
| import com.iformall.service.WxCampaignService; | import com.iformall.service.WxCampaignService; | ||||
| import com.iformall.service.WxCouponService; | import com.iformall.service.WxCouponService; | ||||
| @@ -58,6 +56,9 @@ public class WxCampaignServiceImpl implements WxCampaignService { | |||||
| @Autowired | @Autowired | ||||
| WxActivityMapper wxActivityMapper; | WxActivityMapper wxActivityMapper; | ||||
| @Autowired | |||||
| WxQuestionOneselfMapper wxQuestionOneselfMapper; | |||||
| @Override | @Override | ||||
| public PageInfo<WxCampaign> listAsPage(WxCampaign record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxCampaign> listAsPage(WxCampaign record, Integer pageIndex, Integer pageSize) { | ||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCampaignMapper.findList(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCampaignMapper.findList(record)); | ||||
| @@ -111,8 +112,7 @@ public class WxCampaignServiceImpl implements WxCampaignService { | |||||
| if (wxCampaign.getProduceType() == null) { | if (wxCampaign.getProduceType() == null) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "produceType不能为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "produceType不能为空"); | ||||
| } | } | ||||
| if (wxCampaign.getProduceType().equals(EnumCampaignProductType.ACTIVITY_JOIN.getCode()) | |||||
| && wxCampaign.getProduceId() == null) { | |||||
| if (wxCampaign.getProduceId() == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "produceId不能为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "produceId不能为空"); | ||||
| } | } | ||||
| if (StringUtils.isBlank(wxCampaign.getPagePath())) { | if (StringUtils.isBlank(wxCampaign.getPagePath())) { | ||||
| @@ -151,8 +151,7 @@ public class WxCampaignServiceImpl implements WxCampaignService { | |||||
| if (wxCampaign.getProduceType() == null) { | if (wxCampaign.getProduceType() == null) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "produceType不能为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "produceType不能为空"); | ||||
| } | } | ||||
| if (wxCampaign.getProduceType().equals(EnumCampaignProductType.ACTIVITY_JOIN.getCode()) | |||||
| && wxCampaign.getProduceId() == null) { | |||||
| if (wxCampaign.getProduceId() == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "produceId不能为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "produceId不能为空"); | ||||
| } | } | ||||
| if (StringUtils.isBlank(wxCampaign.getPagePath())) { | if (StringUtils.isBlank(wxCampaign.getPagePath())) { | ||||
| @@ -180,17 +179,39 @@ public class WxCampaignServiceImpl implements WxCampaignService { | |||||
| 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()); | ||||
| WxActivity wxActivity = new WxActivity(); | |||||
| wxActivity.setId(campaign.getProduceId()); | |||||
| wxActivity.setStatus(wxCampaign.getStatus()); | |||||
| wxActivity.setUpdateTime(new Date()); | |||||
| wxActivityMapper.updateById(wxActivity); | |||||
| this.updateOtherStatus(campaign.getProduceId(),campaign.getStatus(),campaign.getProduceType()); | |||||
| } | } | ||||
| //type 为固定格式才会有券的信息 才会有投放的问题 | //type 为固定格式才会有券的信息 才会有投放的问题 | ||||
| couponInject(wxCampaign); | couponInject(wxCampaign); | ||||
| return new ResultData(Result.SUCCESS, "操作成功"); | return new ResultData(Result.SUCCESS, "操作成功"); | ||||
| } | } | ||||
| private void updateOtherStatus(Long produceId, Integer status,Integer produceType) { | |||||
| if(produceType.equals(EnumCampaignProductType.ACTIVITY_JOIN.getCode())){ | |||||
| WxActivity wxActivity = new WxActivity(); | |||||
| wxActivity.setId(produceId); | |||||
| if (status.equals(EnumCampaignStatus.STATUS_THROW_IN.getCode())){ | |||||
| wxActivity.setStatus(EnumActivityStatus.INJECT_CAMPAIGN.getCode()); | |||||
| } | |||||
| if(status.equals(EnumCampaignStatus.STATUS_TAKE_OFFF.getCode())){ | |||||
| wxActivity.setStatus(EnumActivityStatus.INJECT_ONLINE.getCode()); | |||||
| } | |||||
| wxActivity.setUpdateTime(new Date()); | |||||
| wxActivityMapper.updateById(wxActivity); | |||||
| }else if(produceType.equals(EnumCampaignProductType.QUESTION_ONESEL.getCode())){ | |||||
| WxQuestionOneself wxQuestionOneself = new WxQuestionOneself(); | |||||
| wxQuestionOneself.setId(produceId); | |||||
| if (status.equals(EnumCampaignStatus.STATUS_THROW_IN.getCode())){ | |||||
| wxQuestionOneself.setStatus(EnumActivityStatus.INJECT_CAMPAIGN.getCode()); | |||||
| } | |||||
| if(status.equals(EnumCampaignStatus.STATUS_TAKE_OFFF.getCode())){ | |||||
| wxQuestionOneself.setStatus(EnumActivityStatus.INJECT_ONLINE.getCode()); | |||||
| } | |||||
| wxQuestionOneself.setUpdateDate(new Date()); | |||||
| wxQuestionOneselfMapper.updateById(wxQuestionOneself); | |||||
| } | |||||
| } | |||||
| public void couponInject(WxCampaign wxCampaign) { | public void couponInject(WxCampaign wxCampaign) { | ||||
| wxCampaign = wxCampaignMapper.selectById(wxCampaign.getId()); | wxCampaign = wxCampaignMapper.selectById(wxCampaign.getId()); | ||||
| if (wxCampaign.getType().equals(EnumCampaignType.STABLE.getCode())) { | if (wxCampaign.getType().equals(EnumCampaignType.STABLE.getCode())) { | ||||