| @@ -7,11 +7,13 @@ import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.WxTemplateMsg; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.po.msg.WxMsg; | |||
| import com.iformall.enums.EnumSendWay; | |||
| import com.iformall.service.WxMsgService; | |||
| import com.iformall.service.WxTemplateMsgService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| @@ -40,6 +42,9 @@ public class WxMsgController extends BaseController { | |||
| @Autowired | |||
| private WxMsgService wxMsgService; | |||
| @Autowired | |||
| WxTemplateMsgService wxTemplateMsgService; | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @@ -56,6 +61,36 @@ public class WxMsgController extends BaseController { | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("模板分页列表接口") | |||
| @GetMapping("templateList") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| @SystemControllerLog(description = "moban-列表") | |||
| public ResultData templateList(@ModelAttribute WxTemplateMsg wxTemplateMsg, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgController::list"); | |||
| if (null == wxTemplateMsg) wxTemplateMsg = new WxTemplateMsg(); | |||
| wxTemplateMsg.updateTenantInfo(getTenantInfo()); | |||
| final PageInfo<WxTemplateMsg> page = wxTemplateMsgService.listAsPage(wxTemplateMsg, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("修改模板接口") | |||
| @PostMapping("tempUpd") | |||
| @SystemControllerLog(description = "moban xiugai") | |||
| public ResultData tempUpd(@RequestBody WxTemplateMsg wxTemplateMsg) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgController::tempUpd"); | |||
| if(wxTemplateMsg.getId() == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| wxTemplateMsg.updateTenantInfo(getTenantInfo()); | |||
| // if(null == wxTemplateMsg.getOnOff()){ | |||
| // wxTemplateMsg.setOnOff(1); | |||
| // } | |||
| wxTemplateMsgService.saveOrUpdate(wxTemplateMsg); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| @SystemControllerLog(description = "标签短信-新增") | |||
| @@ -1,7 +1,9 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumTemplateType; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| @@ -27,4 +29,16 @@ public class WxTemplateMsg extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="消息开关(0/1)",name="onOff") | |||
| private Integer onOff; | |||
| @io.swagger.annotations.ApiModelProperty(value="模板类型1:核销成功消息,2:核销失败消息, 101:公众号审核结果消息, 102:公众号卡券核销消息",name="type") | |||
| @TableField(exist = false) | |||
| private String typeName; | |||
| public String getTypeName(){ | |||
| if(this.getType() != null) { | |||
| this.typeName = EnumTemplateType.getEnum(this.getType()).getMessage(); | |||
| } | |||
| return typeName; | |||
| } | |||
| } | |||
| @@ -521,7 +521,8 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||
| return wxCUserBasicInfoMapper.findCountByFilter1(tenantEntity,wxCUserBasicInfoDto); | |||
| }else{ | |||
| //直接查询本表 | |||
| wxCUserBasicInfoDto.undateFinalTenantId(tenantEntity); | |||
| wxCUserBasicInfoDto.setTenantId(tenantEntity.getFinalTenantId()); | |||
| wxCUserBasicInfoDto.setFinalTenantId(tenantEntity.getFinalTenantId()); | |||
| return wxCUserBasicInfoMapper.findCountByFilter(wxCUserBasicInfoDto); | |||
| } | |||
| } | |||
| @@ -534,7 +535,8 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||
| return wxCUserBasicInfoMapper.findListByFilter1(tenantEntity,wxCUserBasicInfoDto); | |||
| }else{ | |||
| //直接查询本表 | |||
| wxCUserBasicInfoDto.undateFinalTenantId(tenantEntity); | |||
| wxCUserBasicInfoDto.setTenantId(tenantEntity.getFinalTenantId()); | |||
| wxCUserBasicInfoDto.setFinalTenantId(tenantEntity.getFinalTenantId()); | |||
| return wxCUserBasicInfoMapper.findListByFilter(wxCUserBasicInfoDto); | |||
| } | |||
| } | |||
| @@ -692,7 +694,8 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||
| return wxCUserBasicInfoMapper.findCountBySex1(tenantInfo,dto); | |||
| }else{ | |||
| //直接查询本表 | |||
| dto.undateFinalTenantId(tenantInfo); | |||
| dto.setTenantId(tenantInfo.getFinalTenantId()); | |||
| dto.setFinalTenantId(tenantInfo.getFinalTenantId()); | |||
| return wxCUserBasicInfoMapper.findCountBySex(dto); | |||
| } | |||
| } | |||
| @@ -709,7 +712,8 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||
| return wxCUserBasicInfoMapper.findCountByAge1(tenantInfo,dto); | |||
| }else{ | |||
| //直接查询本表 | |||
| dto.undateFinalTenantId(tenantInfo); | |||
| dto.setTenantId(tenantInfo.getFinalTenantId()); | |||
| dto.setFinalTenantId(tenantInfo.getFinalTenantId()); | |||
| return wxCUserBasicInfoMapper.findCountByAge(dto); | |||
| } | |||
| } | |||
| @@ -726,7 +730,8 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||
| return wxCUserBasicInfoMapper.findCountByScore1(tenantInfo,dto); | |||
| }else{ | |||
| //直接查询本表 | |||
| dto.undateFinalTenantId(tenantInfo); | |||
| dto.setTenantId(tenantInfo.getFinalTenantId()); | |||
| dto.setFinalTenantId(tenantInfo.getFinalTenantId()); | |||
| return wxCUserBasicInfoMapper.findCountByScore(dto); | |||
| } | |||
| } | |||
| @@ -1127,7 +1132,8 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||
| return wxCUserBasicInfoMapper.findCount1(tenantInfo,dto); | |||
| }else{ | |||
| //直接查询本表 | |||
| dto.undateFinalTenantId(tenantInfo); | |||
| dto.setTenantId(tenantInfo.getFinalTenantId()); | |||
| dto.setFinalTenantId(tenantInfo.getFinalTenantId()); | |||
| return wxCUserBasicInfoMapper.findCount(dto); | |||
| } | |||
| } | |||
| @@ -1144,7 +1150,8 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||
| return wxCUserBasicInfoMapper.findCountHistory1(tenantInfo,dto); | |||
| }else{ | |||
| //直接查询本表 | |||
| dto.undateFinalTenantId(tenantInfo); | |||
| dto.setTenantId(tenantInfo.getFinalTenantId()); | |||
| dto.setFinalTenantId(tenantInfo.getFinalTenantId()); | |||
| return wxCUserBasicInfoMapper.findCountHistory(dto); | |||
| } | |||
| } | |||
| @@ -1211,7 +1218,8 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||
| return wxCUserBasicInfoMapper.findListByScore1(tenantEntity,wxCUserBasicInfoDto); | |||
| }else{ | |||
| //直接查询本表 | |||
| wxCUserBasicInfoDto.undateFinalTenantId(tenantEntity); | |||
| wxCUserBasicInfoDto.setTenantId(tenantEntity.getFinalTenantId()); | |||
| wxCUserBasicInfoDto.setFinalTenantId(tenantEntity.getFinalTenantId()); | |||
| return wxCUserBasicInfoMapper.findListByScore(wxCUserBasicInfoDto); | |||
| } | |||
| } | |||
| @@ -12,6 +12,7 @@ import com.iformall.domain.po.WxCampaign; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.WxCouponChannel; | |||
| 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; | |||
| @@ -249,8 +250,17 @@ public class WxCampaignServiceImpl implements WxCampaignService { | |||
| wxCouponChannelMapper.updateById(wxCouponChannel); | |||
| wxCouponChannelsMap.remove(couponId); | |||
| } else { | |||
| WxCouponChannel wxCouponChannelQ = new WxCouponChannel(); | |||
| wxCouponChannelQ.updateTenantInfo(wxCoupon); | |||
| wxCouponChannelQ.setCouponId(couponId); | |||
| wxCouponChannelQ.setStatus(EnumCampaignStatus.STATUS_THROW_IN.getCode()); | |||
| wxCouponChannelQ.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_LIST.getCode()); | |||
| List<WxCouponChannelVo> voList = wxCouponChannelMapper.findVoList(wxCouponChannelQ); | |||
| // 不存在的, 新增 | |||
| wxCouponChannel = new WxCouponChannel(); | |||
| if(voList != null && voList.size() > 0){ | |||
| wxCouponChannel.setShowBeginTime(voList.get(0).getShowBeginTime()); | |||
| } | |||
| wxCouponChannel.setBeginTime(record.getValidStartDate()); | |||
| wxCouponChannel.setEndTime(record.getValidEndDate()); | |||
| wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); | |||
| @@ -42,6 +42,9 @@ public class WxMsgServiceImpl implements WxMsgService { | |||
| @Autowired | |||
| WxMsgMapper wxMsgMapper; | |||
| @Autowired | |||
| WxCUserMapper wxCUserMapper; | |||
| @Autowired | |||
| WxMsgConfigMapper wxMsgConfigMapper; | |||
| @@ -244,10 +247,14 @@ public class WxMsgServiceImpl implements WxMsgService { | |||
| //2、通过标签 | |||
| String phones = wxMsg.getPhones(); | |||
| List<WxCUserBasicInfoFilterListDto> filter = wxMsg.getFilterList(); | |||
| if (!phones.isEmpty() && !filter.isEmpty()) {//两种方式只能选其一 | |||
| if(StringUtils.isNotBlank(phones) && filter != null && !filter.isEmpty()){ | |||
| return new ResultData(ErrorCode.MSG_SEND_WAY_CHOOSE_ERROR); | |||
| } | |||
| if (phones.isEmpty() && filter.isEmpty()) {//两种方式必须选其一 | |||
| if (StringUtils.isBlank(phones) && (filter==null || filter.isEmpty())) {//两种方式必须选其一 | |||
| if(wxMsg.getWay() == EnumSendWay.APPINFOR.getCode()){ | |||
| saveOrUpdate(wxMsg,null); | |||
| return new ResultData(); | |||
| } | |||
| return new ResultData(ErrorCode.MSG_SEND_WAY_CHOOSE_ERROR); | |||
| } | |||
| @@ -395,10 +402,23 @@ public class WxMsgServiceImpl implements WxMsgService { | |||
| }else{ | |||
| return; | |||
| } | |||
| String[] split = wxMsg.getPhones().split(","); | |||
| for (String s:split) { | |||
| smartAppMsg.setTo(s); | |||
| mqBaseProducer.sendMessage(smartAppMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||
| if(StringUtils.isNotBlank(wxMsg.getPhones())){ | |||
| String[] split = wxMsg.getPhones().split(","); | |||
| for (String s:split) { | |||
| smartAppMsg.setTo(s); | |||
| mqBaseProducer.sendMessage(smartAppMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||
| } | |||
| }else{ | |||
| WxCUser wxCUserQ = new WxCUser(); | |||
| wxCUserQ.updateTenantInfo(tenantEntity); | |||
| List<WxCUser> list = wxCUserMapper.findList(wxCUserQ); | |||
| wxMsg.setExpectSendNumber(list.size()); | |||
| for (WxCUser u:list) { | |||
| smartAppMsg.setTo(u.getOpenId()); | |||
| mqBaseProducer.sendMessage(smartAppMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||
| } | |||
| } | |||
| } | |||