From e22b074fc02a7ae484139c0ab0bc202d987ad984 Mon Sep 17 00:00:00 2001 From: xhxu Date: Tue, 13 Apr 2021 14:59:03 +0800 Subject: [PATCH] bug --- .../service/impl/WxCampaignServiceImpl.java | 47 ++++++++++++++----- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCampaignServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCampaignServiceImpl.java index 96afb0770..39a7121bf 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCampaignServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCampaignServiceImpl.java @@ -7,16 +7,14 @@ import com.iformall.common.ErrorCode; import com.iformall.common.IdWorker; import com.iformall.common.Result; 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.vo.WxCouponChannelVo; import com.iformall.enums.*; import com.iformall.mapper.WxActivityMapper; import com.iformall.mapper.WxCampaignMapper; import com.iformall.mapper.WxCouponChannelMapper; +import com.iformall.mapper.WxQuestionOneselfMapper; import com.iformall.service.QrCodeService; import com.iformall.service.WxCampaignService; import com.iformall.service.WxCouponService; @@ -58,6 +56,9 @@ public class WxCampaignServiceImpl implements WxCampaignService { @Autowired WxActivityMapper wxActivityMapper; + @Autowired + WxQuestionOneselfMapper wxQuestionOneselfMapper; + @Override public PageInfo listAsPage(WxCampaign record, Integer pageIndex, Integer pageSize) { return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCampaignMapper.findList(record)); @@ -111,8 +112,7 @@ public class WxCampaignServiceImpl implements WxCampaignService { if (wxCampaign.getProduceType() == null) { 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不能为空"); } if (StringUtils.isBlank(wxCampaign.getPagePath())) { @@ -151,8 +151,7 @@ public class WxCampaignServiceImpl implements WxCampaignService { if (wxCampaign.getProduceType() == null) { 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不能为空"); } if (StringUtils.isBlank(wxCampaign.getPagePath())) { @@ -180,17 +179,39 @@ public class WxCampaignServiceImpl implements WxCampaignService { wxCampaignMapper.updateById(wxCampaign); if (wxCampaign.getType().equals(EnumCampaignType.PAGEPATH.getCode())) { 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 为固定格式才会有券的信息 才会有投放的问题 couponInject(wxCampaign); 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) { wxCampaign = wxCampaignMapper.selectById(wxCampaign.getId()); if (wxCampaign.getType().equals(EnumCampaignType.STABLE.getCode())) {