|
|
|
@@ -72,14 +72,10 @@ public class WxCampaignServiceImpl implements WxCampaignService { |
|
|
|
if (StringUtils.isEmpty(wxCampaign.getDetail())) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "活动说明不能为空"); |
|
|
|
} |
|
|
|
}else if(wxCampaign.getType().equals(EnumCampaignType.FREE.getCode())) { |
|
|
|
} else { |
|
|
|
if (StringUtils.isEmpty(wxCampaign.getHtml())) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "图文不能为空"); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
if (StringUtils.isEmpty(wxCampaign.getLink())) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "链接不能为空"); |
|
|
|
} |
|
|
|
} |
|
|
|
if (wxCampaign.getId() == null) { |
|
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
|
@@ -88,9 +84,32 @@ public class WxCampaignServiceImpl implements WxCampaignService { |
|
|
|
} else { |
|
|
|
wxCampaignMapper.updateByPrimaryKeySelective(wxCampaign); |
|
|
|
} |
|
|
|
//type 为固定格式才会有券的信息 才会有投放的问题 |
|
|
|
if (wxCampaign.getType().equals(EnumCampaignType.STABLE.getCode())) { |
|
|
|
if (wxCampaign.getStatus().equals(EnumCampaignStatus.STATUS_THROW_IN.getCode())) { |
|
|
|
addOrUpdateBatch(JSONArray.parseArray(wxCampaign.getCouponIds(), String.class), wxCampaign); |
|
|
|
} else { |
|
|
|
delBatch(wxCampaign); |
|
|
|
} |
|
|
|
} |
|
|
|
return new ResultData(Result.SUCCESS,"操作成功"); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public ResultData updateStatus(WxCampaign wxCampaign) { |
|
|
|
wxCampaignMapper.updateByPrimaryKeySelective(wxCampaign); |
|
|
|
wxCampaign = wxCampaignMapper.selectByPrimaryKey(wxCampaign); |
|
|
|
//type 为固定格式才会有券的信息 才会有投放的问题 |
|
|
|
if (wxCampaign.getType().equals(EnumCampaignType.STABLE.getCode())) { |
|
|
|
if (wxCampaign.getStatus().equals(EnumCampaignStatus.STATUS_THROW_IN.getCode())) { |
|
|
|
addOrUpdateBatch(JSONArray.parseArray(wxCampaign.getCouponIds(), String.class), wxCampaign); |
|
|
|
} else { |
|
|
|
delBatch(wxCampaign); |
|
|
|
} |
|
|
|
} |
|
|
|
return new ResultData(Result.SUCCESS, "操作成功"); |
|
|
|
} |
|
|
|
|
|
|
|
public void delBatch(WxCampaign record) { |
|
|
|
// couponChannel 下架 |
|
|
|
WxCouponChannel wxCouponChannelQ = new WxCouponChannel(); |
|
|
|
@@ -188,18 +207,6 @@ public class WxCampaignServiceImpl implements WxCampaignService { |
|
|
|
return wxCampaignMapper.getMaxSortNum(tenantId); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public ResultData updateStatus(WxCampaign wxCampaign) { |
|
|
|
wxCampaignMapper.updateByPrimaryKeySelective(wxCampaign); |
|
|
|
wxCampaign = wxCampaignMapper.selectByPrimaryKey(wxCampaign); |
|
|
|
if (wxCampaign.getStatus().equals(EnumCampaignStatus.STATUS_THROW_IN.getCode())) { |
|
|
|
addOrUpdateBatch(JSONArray.parseArray(wxCampaign.getCouponIds(),String.class), wxCampaign); |
|
|
|
} else { |
|
|
|
delBatch(wxCampaign); |
|
|
|
} |
|
|
|
return new ResultData(Result.SUCCESS,"操作成功"); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void printHtmlById(Long id, HttpServletResponse response) { |
|
|
|
try { |
|
|
|
|