Parcourir la source

xingxingdiandeng

release_toaliyun_real
xhxu il y a 5 ans
Parent
révision
7faff164b2
12 fichiers modifiés avec 217 ajouts et 54 suppressions
  1. +9
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/msg/WxMsgController.java
  2. +1
    -1
      mallinkMQConsumer/src/main/java/com/iformall/mq/MqBaseConsumer.java
  3. +15
    -3
      mallinkSchedule/src/main/java/com/iformall/schedule/MsgSendingSchedule.java
  4. +2
    -1
      mallinkService/src/main/java/com/iformall/common/ErrorCode.java
  5. +2
    -1
      mallinkService/src/main/java/com/iformall/enums/EnumSendWay.java
  6. +4
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumTemplateType.java
  7. +1
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicInfoMapper.java
  8. +5
    -0
      mallinkService/src/main/java/com/iformall/service/WxCUserBasicInfoService.java
  9. +2
    -0
      mallinkService/src/main/java/com/iformall/service/WxMsgService.java
  10. +16
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java
  11. +149
    -48
      mallinkService/src/main/java/com/iformall/service/impl/WxMsgServiceImpl.java
  12. +11
    -0
      mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml

+ 9
- 0
mallinkAdmin/src/main/java/com/iformall/controller/msg/WxMsgController.java Voir le fichier

@@ -1,13 +1,16 @@
package com.iformall.controller.msg;

import com.aliyun.openservices.shade.com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.iformall.annotation.SystemControllerLog;
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.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 io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@@ -59,6 +62,12 @@ public class WxMsgController extends BaseController {
public ResultData add(@RequestBody WxMsg wxMsg) {
logger.debug("[" + getIpAddr() + "] WxMsgController::add");
wxMsg.updateTenantInfo(getTenantInfo());
if(null == wxMsg.getWay()){
wxMsg.setWay(EnumSendWay.TAG.getCode());
}
if(wxMsg.getWay() == EnumSendWay.APPINFOR.getCode() && !JSONObject.isValidObject(wxMsg.getMsg())){
return new ResultData(ErrorCode.TEMPLATE_DATA_ERROR);
}
return wxMsgService.add(wxMsg);
}



+ 1
- 1
mallinkMQConsumer/src/main/java/com/iformall/mq/MqBaseConsumer.java Voir le fichier

@@ -69,7 +69,7 @@ public class MqBaseConsumer {
sendEmailService.send(msg);
// } else if(EnumMsgRecordType.SMART_APP.getCode().equals(baseMsg.getMsgType())){
} else if(EnumMsgRecordType.SMART_APP_TO.getCode().equals(baseMsg.getMsgType())){
//微信小程序-模板消息
//微信小程序-订阅消息
SmartAppMsg msg = (SmartAppMsg)JsonUtil.readValue(message,SmartAppMsg.class);
sendSmartAppMsgService.send(msg);
} else if(EnumMsgRecordType.PUBLIC.getCode().equals(baseMsg.getMsgType())) {


+ 15
- 3
mallinkSchedule/src/main/java/com/iformall/schedule/MsgSendingSchedule.java Voir le fichier

@@ -1,12 +1,15 @@
package com.iformall.schedule;

import com.alibaba.fastjson.JSONArray;
import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData;
import com.iformall.domain.po.msg.WxMsg;
import com.iformall.enums.*;
import com.iformall.mapper.WxMsgConfigMapper;
import com.iformall.mapper.WxMsgMapper;
import com.iformall.mapper.WxMsgModelMapper;
import com.iformall.mq.MqBaseProducer;
import com.iformall.service.WxMsgService;
import com.iformall.utils.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -34,6 +37,8 @@ public class MsgSendingSchedule {

@Autowired
private MqBaseProducer mqBaseProducer;
@Autowired
private WxMsgService WxMsgService;

/**
* 每小时第一分钟执行
@@ -49,9 +54,16 @@ public class MsgSendingSchedule {
logger.info("将要发送的短信列表:" + JSONArray.toJSONString(list));
for (WxMsg msg : list) {
//sendmsg(msg);
msg.setMsgType(EnumMsgRecordType.SMS_CALLBACK.getCode());
msg.setReceiver(msg.getPhones());
mqBaseProducer.sendMessage(msg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(),null);
wxMsg.setStatus(EnumMsgStatus.MSG_STATUS_SENDED.getCode());
if(wxMsg.getWay() == EnumSendWay.TAG.getCode()){
msg.setMsgType(EnumMsgRecordType.SMS_CALLBACK.getCode());
msg.setReceiver(msg.getPhones());
mqBaseProducer.sendMessage(msg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(),null);
}else if(wxMsg.getWay() == EnumSendWay.APPINFOR.getCode()){
WxMsgService.batchSendAppinfo(wxMsg);
}
wxMsgMapper.updateById(wxMsg);

}
logger.info("sendmsg定时任务结束");
}


+ 2
- 1
mallinkService/src/main/java/com/iformall/common/ErrorCode.java Voir le fichier

@@ -358,6 +358,7 @@ public enum ErrorCode{
*/
TEMPLATE_NOT_FOUND(12090, "模板不存在"),
TEMPLATE_FORMID_NOT_FOUND(12091, "formId不存在"),
TEMPLATE_DATA_ERROR(12092, "数据格式错误"),

/**
*
@@ -377,7 +378,7 @@ public enum ErrorCode{
MSG_SEND_WAY_CHOOSE_ERROR(12110,"请确定发送的方式"),
MSG_SUM_ZERO(12111,"短信数量为0"),
MSG_SUM_INSUFFICENT(12112,"短信数量不足"),
MSG_NO_VALID_PHONE(12113,"没有可以发送的手机号"),
MSG_NO_VALID_PHONE(12113,"没有可以发送的用户"),
MSG_SEND_INTERFACE_ERROR(12114,"短信运营商返回错误"),
/**
* 会员


+ 2
- 1
mallinkService/src/main/java/com/iformall/enums/EnumSendWay.java Voir le fichier

@@ -7,7 +7,8 @@ public enum EnumSendWay {

// 1、标签短信 2:精准发券
TAG(1,"标签短信"),
COUPON(2, "精准发券")
COUPON(2, "精准发券"),
APPINFOR(3, "小程序订阅消息")
;

public static EnumSendWay getEnum(Integer code) {


+ 4
- 0
mallinkService/src/main/java/com/iformall/enums/EnumTemplateType.java Voir le fichier

@@ -10,6 +10,10 @@ public enum EnumTemplateType {
VERIFY_SUCCESS(1, "核销成功消息"), // 小程序
VERIFY_FAIL(2, "核销失败消息"), // 小程序
PRESS_SUCCESS(3, "砍价成功消息"), // 小程序

ACTIVITY_REMIND(4, "活动开始提醒"), // 小程序
LIVE_REMIND(5, "直播开播提醒"), // 小程序

AUDIT_MESSAGE(101, "公众号审核结果通知"), // 公众号
VERIFY_RESULT(102, "公众号卡券核销通知"), // 公众号
GIFT_MESSAGE(103, "公众号购票成功通知"), // 公众号


+ 1
- 0
mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicInfoMapper.java Voir le fichier

@@ -80,5 +80,6 @@ public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, S
void cuserOldToNew(@Param(value = "oldCuserId")Long oldCuserId, @Param(value = "newCuserId")Long newCuserId,
@Param("tableIndex")Integer tableIndex,@Param("finalTableIndex")Integer finalTableIndex);

List<String> findOpenIdByFilter(WxCUserBasicInfoDto wxCUserBasicInfoDto);
}


+ 5
- 0
mallinkService/src/main/java/com/iformall/service/WxCUserBasicInfoService.java Voir le fichier

@@ -28,7 +28,11 @@ public interface WxCUserBasicInfoService {

List<WxCUserBasicInfo> listByFilter(TenantEntity tenantEntity, List<WxCUserBasicInfoFilterDto> filterList);

List<String> findOpenIdByFilter(TenantEntity tenantEntity, List<WxCUserBasicInfoFilterDto> filterList);

List<WxCUserBasicInfo> listByFilterList(TenantEntity tenantEntity, List<WxCUserBasicInfoFilterListDto> filterList);

List<String> listOpenIdByFilter(TenantEntity tenantEntity, List<WxCUserBasicInfoFilterListDto> filterList);
/**
* 根据实体查询分页列表
*
@@ -170,5 +174,6 @@ public interface WxCUserBasicInfoService {
List<WxCUserBasicInfo> findBirthdayList(TenantEntity tenantEntity, String format, String format1);

void cuserOldToNew(Long oldCuserId, Long newCuserId,TenantEntity tenantinfo);

}


+ 2
- 0
mallinkService/src/main/java/com/iformall/service/WxMsgService.java Voir le fichier

@@ -39,4 +39,6 @@ public interface WxMsgService {
void sendMsgFromCouponInject(WxMsg wxmsg, WxMsgConfig wxMsgConfig, WxCouponInject record);

void addMsgCallback(WxMsg wxmsg, String batchNo);

void batchSendAppinfo(WxMsg wxMsg);
}

+ 16
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java Voir le fichier

@@ -538,6 +538,15 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc
return wxCUserBasicInfoMapper.findListByFilter(wxCUserBasicInfoDto);
}
}

@Override
public List<String> findOpenIdByFilter(TenantEntity tenantEntity, List<WxCUserBasicInfoFilterDto> filterList) {
WxCUserBasicInfoDto wxCUserBasicInfoDto = filtersToDto(tenantEntity, filterList);
wxCUserBasicInfoDto.updateTenantInfo(tenantEntity);
wxCUserBasicInfoDto.setFinalTenantId(tenantEntity.getFinalTenantId());
return wxCUserBasicInfoMapper.findOpenIdByFilter(wxCUserBasicInfoDto);
}

@Override
public List<WxCUserBasicInfo> listByFilterList(TenantEntity tenantEntity, List<WxCUserBasicInfoFilterListDto> filterList) {
HashSet<WxCUserBasicInfo> userSet = new HashSet<>();
@@ -545,6 +554,13 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc
return new ArrayList<>(userSet);
}

@Override
public List<String> listOpenIdByFilter(TenantEntity tenantEntity, List<WxCUserBasicInfoFilterListDto> filterList) {
HashSet<String> openSet = new HashSet<>();
filterList.stream().forEach(f->openSet.addAll(findOpenIdByFilter(tenantEntity,f.getTagList())));
return new ArrayList<>(openSet);
}



/***************user filter end******************************************/


+ 149
- 48
mallinkService/src/main/java/com/iformall/service/impl/WxMsgServiceImpl.java Voir le fichier

@@ -1,9 +1,11 @@
package com.iformall.service.impl;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import com.iformall.common.ErrorCode;
import com.iformall.common.IdWorker;
import com.iformall.common.Result;
@@ -11,15 +13,13 @@ import com.iformall.common.ResultData;
import com.iformall.domain.dto.WxCUserBasicInfoFilterListDto;
import com.iformall.domain.po.*;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.po.msg.SmartAppMsg;
import com.iformall.domain.po.msg.WxMsg;
import com.iformall.enums.*;
import com.iformall.exception.MallinkException;
import com.iformall.mapper.*;
import com.iformall.mq.MqBaseProducer;
import com.iformall.service.PushLimitService;
import com.iformall.service.WxCUserBasicInfoService;
import com.iformall.service.WxCUserTagsService;
import com.iformall.service.WxMsgService;
import com.iformall.service.*;
import com.iformall.utils.DateUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@@ -56,6 +56,8 @@ public class WxMsgServiceImpl implements WxMsgService {

@Autowired
WxMsgModelMapper wxMsgModelMapper;
@Autowired
WxTemplateMsgMapper wxTemplateMsgMapper;

@Autowired
MqBaseProducer mqBaseProducer;
@@ -66,6 +68,9 @@ public class WxMsgServiceImpl implements WxMsgService {
@Autowired
PushLimitService pushLimitService;

@Autowired
WxAppinfoService wxAppinfoService;

@Override
public PageInfo<WxMsg> listAsPage(WxMsg record, Integer pageIndex, Integer pageSize) {
PageHelper.startPage(pageIndex, pageSize);
@@ -120,17 +125,28 @@ public class WxMsgServiceImpl implements WxMsgService {
//是否立即发送
if (wxMsg.getIsright().equals(EnumMsgSend.MSG_SEND_IMMEDIATELY.getCode())) {
wxMsg.setStatus(EnumMsgStatus.MSG_STATUS_SENDED.getCode());
if (wxMsg.getExpectSendNumber().intValue() > 1000) {
batchSendMsg(wxMsg, wxMsgConfig, null);
} else {
//sendmsg(wxMsg, wxMsgConfig, null);
wxMsg.setWxMsgConfig(wxMsgConfig);
wxMsg.setCouponInject(null);
wxMsg.setMsgType(EnumMsgRecordType.SMS_CALLBACK.getCode());
wxMsg.setReceiver(wxMsg.getPhones());
mqBaseProducer.sendMessage(wxMsg, EnumMsgMqTopic.DEFAULT.getCode(),EnumMsgMqTag.DEFAULT.getCode(),null);
if(wxMsg.getWay() == EnumSendWay.TAG.getCode()){
if (wxMsg.getExpectSendNumber().intValue() > 1000) {
batchSendMsg(wxMsg, wxMsgConfig, null);
} else {
//sendmsg(wxMsg, wxMsgConfig, null);
wxMsg.setWxMsgConfig(wxMsgConfig);
wxMsg.setCouponInject(null);
wxMsg.setMsgType(EnumMsgRecordType.SMS_CALLBACK.getCode());
wxMsg.setReceiver(wxMsg.getPhones());
mqBaseProducer.sendMessage(wxMsg, EnumMsgMqTopic.DEFAULT.getCode(),EnumMsgMqTag.DEFAULT.getCode(),null);
}
}else if(wxMsg.getWay() == EnumSendWay.APPINFOR.getCode()){
batchSendAppinfo(wxMsg);
}else{
return new ResultData(ErrorCode.MSG_REQUEST_PARAMS_ERROR);
}
return new ResultData(Result.SUCCESS, "短信已发送");

final IdWorker idWorker = IdWorker.get();
wxMsg.setId(idWorker.nextId());
wxMsg.setCreatetime(new Date());
wxMsgMapper.insert(wxMsg);
return new ResultData(Result.SUCCESS, "消息已发送");
} else {
wxMsg.setStatus(EnumMsgStatus.MSG_STATUS_NOT_SEND.getCode());
final IdWorker idWorker = IdWorker.get();
@@ -138,7 +154,7 @@ public class WxMsgServiceImpl implements WxMsgService {
wxMsg.setId(id);
wxMsg.setCreatetime(new Date());
wxMsgMapper.insert(wxMsg);
return new ResultData(Result.SUCCESS, "短信会在预设时间发送", id);
return new ResultData(Result.SUCCESS, "消息会在预设时间发送", id);
}

} else {
@@ -151,21 +167,31 @@ public class WxMsgServiceImpl implements WxMsgService {
//是否立即发送
if (wxMsg.getIsright().equals(EnumMsgSend.MSG_SEND_IMMEDIATELY.getCode())) {
wxMsg.setStatus(EnumMsgStatus.MSG_STATUS_SENDED.getCode());
if (wxMsg.getExpectSendNumber().intValue() > 1000) {
batchSendMsg(wxMsg, wxMsgConfig, null);
} else {
//sendmsg(wxMsg, wxMsgConfig, null);
wxMsg.setWxMsgConfig(wxMsgConfig);
wxMsg.setMsgType(EnumMsgRecordType.SMS_CALLBACK.getCode());
wxMsg.setReceiver(wxMsg.getPhones());
mqBaseProducer.sendMessage(wxMsg, EnumMsgMqTopic.DEFAULT.getCode(),EnumMsgMqTag.DEFAULT.getCode(),EnumMsgMqKey.DEFAULT.getCode());
if(wxMsg.getWay() == EnumSendWay.TAG.getCode()){
if (wxMsg.getExpectSendNumber().intValue() > 1000) {
batchSendMsg(wxMsg, wxMsgConfig, null);
} else {
//sendmsg(wxMsg, wxMsgConfig, null);
wxMsg.setWxMsgConfig(wxMsgConfig);
wxMsg.setMsgType(EnumMsgRecordType.SMS_CALLBACK.getCode());
wxMsg.setReceiver(wxMsg.getPhones());
mqBaseProducer.sendMessage(wxMsg, EnumMsgMqTopic.DEFAULT.getCode(),EnumMsgMqTag.DEFAULT.getCode(),EnumMsgMqKey.DEFAULT.getCode());
}
}else if(wxMsg.getWay() == EnumSendWay.APPINFOR.getCode()){
batchSendAppinfo(wxMsg);
}else{
return new ResultData(ErrorCode.MSG_REQUEST_PARAMS_ERROR);
}
return new ResultData(Result.SUCCESS, "短信已发送");
final IdWorker idWorker = IdWorker.get();
wxMsg.setId(idWorker.nextId());
wxMsg.setCreatetime(new Date());
wxMsgMapper.insert(wxMsg);
return new ResultData(Result.SUCCESS, "消息已发送");
} else {
//定时
wxMsg.setStatus(EnumMsgStatus.MSG_STATUS_NOT_SEND.getCode());
wxMsgMapper.updateById(wxMsg);
return new ResultData(Result.SUCCESS, "短信会在预设时间发送");
return new ResultData(Result.SUCCESS, "消息会在预设时间发送");
}

}
@@ -226,14 +252,27 @@ public class WxMsgServiceImpl implements WxMsgService {
}

if (phones.isEmpty()) {//没有手工输入手机号时解析标签,有,继续流转
List<WxCUserBasicInfo> list =
wxCUserBasicInfoService.listByFilterList(tenantEntity,wxMsg.getFilterList());
wxMsg.setExpectSendNumber(list.size());//预计发送数量
phones = list.stream().map(u -> u.getPhone()).collect(Collectors.joining(","));
if (phones==null || phones.isEmpty()) {//解析之后手机号依然不存在时返回
return new ResultData(ErrorCode.MSG_NO_VALID_PHONE);
if(wxMsg.getWay() == EnumSendWay.TAG.getCode()){
List<WxCUserBasicInfo> list =
wxCUserBasicInfoService.listByFilterList(tenantEntity,wxMsg.getFilterList());
wxMsg.setExpectSendNumber(list.size());//预计发送数量
phones = list.stream().map(u -> u.getPhone()).collect(Collectors.joining(","));
if (phones==null || phones.isEmpty()) {//解析之后手机号依然不存在时返回
return new ResultData(ErrorCode.MSG_NO_VALID_PHONE);
}
wxMsg.setPhones(StringUtils.join(phones));
}else if(wxMsg.getWay() == EnumSendWay.APPINFOR.getCode()){
List<String> list = wxCUserBasicInfoService.listOpenIdByFilter(tenantEntity,wxMsg.getFilterList());
wxMsg.setExpectSendNumber(list.size());//预计发送数量
String opens = StringUtils.join(list, ",");
if (opens==null || opens.isEmpty()) {//解析之后手机号依然不存在时返回
return new ResultData(ErrorCode.MSG_NO_VALID_PHONE);
}
wxMsg.setPhones(opens);
}else{
return new ResultData(ErrorCode.MSG_REQUEST_PARAMS_ERROR);
}
wxMsg.setPhones(StringUtils.join(phones));
wxMsg.setTags(JSON.toJSONString(wxMsg.getFilterList()));
} else {
String[] phoneSplit = phones.split(",");
@@ -242,24 +281,32 @@ public class WxMsgServiceImpl implements WxMsgService {
wxMsg.setPhones(StringUtils.join(phoneSet,","));
}

//从短信配置中查询密钥 bid 等信息
WxMsgConfig wxMsgConfig = new WxMsgConfig();
wxMsgConfig.setTenantId(wxMsg.getTenantId());
List<WxMsgConfig> wxMsgConfigs = wxMsgConfigMapper.findList(wxMsgConfig);
if (wxMsgConfigs.size() == 0) return new ResultData(ErrorCode.MSG_SERVER_NOT_FIND, "您还未接入短信运营商,请联系平台管理员");
wxMsgConfig = wxMsgConfigs.get(0);

if (wxMsgConfig.getRemains() == 0) {
logger.info("短信数量为0");
return new ResultData(ErrorCode.MSG_SUM_ZERO);
}
if(wxMsg.getWay() == EnumSendWay.TAG.getCode()){
//从短信配置中查询密钥 bid 等信息
WxMsgConfig wxMsgConfig = new WxMsgConfig();
wxMsgConfig.setTenantId(wxMsg.getTenantId());
List<WxMsgConfig> wxMsgConfigs = wxMsgConfigMapper.findList(wxMsgConfig);
if (wxMsgConfigs.size() == 0) return new ResultData(ErrorCode.MSG_SERVER_NOT_FIND, "您还未接入短信运营商,请联系平台管理员");
wxMsgConfig = wxMsgConfigs.get(0);

if (wxMsgConfig.getRemains() == 0) {
logger.info("短信数量为0");
return new ResultData(ErrorCode.MSG_SUM_ZERO);
}

if (wxMsgConfig.getRemains() < wxMsg.getExpectSendNumber()) {
logger.info("短信数量不足");
return new ResultData(ErrorCode.MSG_SUM_INSUFFICENT);
if (wxMsgConfig.getRemains() < wxMsg.getExpectSendNumber()) {
logger.info("短信数量不足");
return new ResultData(ErrorCode.MSG_SUM_INSUFFICENT);
}
saveOrUpdate(wxMsg, wxMsgConfig);
return new ResultData();
}else if(wxMsg.getWay() == EnumSendWay.APPINFOR.getCode()){

saveOrUpdate(wxMsg,null);
return new ResultData();
}else{
return new ResultData(ErrorCode.MSG_REQUEST_PARAMS_ERROR);
}
saveOrUpdate(wxMsg, wxMsgConfig);
return new ResultData();
}


@@ -302,6 +349,60 @@ public class WxMsgServiceImpl implements WxMsgService {
}
}

@Override
public void batchSendAppinfo(WxMsg wxMsg) {
TenantEntity tenantEntity = new TenantEntity();
tenantEntity.setTenantId(wxMsg.getTenantId());
tenantEntity.setParentTenantId(wxMsg.getParentTenantId());
WxAppinfo cAppInfo = wxAppinfoService.getCAppInfo(tenantEntity, EnumPayWay.PAY_WAY_WECHAT);
SmartAppMsg smartAppMsg = new SmartAppMsg();
smartAppMsg.updateTenantInfo(tenantEntity);
smartAppMsg.setMsgType(EnumMsgRecordType.SMART_APP_TO.getCode());
smartAppMsg.setAppId(cAppInfo.getAppId());

WxTemplateMsg wxTemplateMsg = wxTemplateMsgMapper.selectById(wxMsg.getModelId());

smartAppMsg.setTemplateType(wxTemplateMsg.getType());
JSONObject customParam = JSON.parseObject(wxMsg.getMsg());
if(wxTemplateMsg.getType() == EnumTemplateType.ACTIVITY_REMIND.getCode()){
/**
* 活动名称:{{thing13.DATA}}
* 活动时间:{{date5.DATA}}
* 商户名称:{{thing12.DATA}}
* 活动内容:{{thing1.DATA}}
* 温馨提示:{{thing11.DATA}}"
*/
smartAppMsg.setDataList(Lists.newArrayList(
customParam.getString("thing13"),
customParam.getString("date5"),
customParam.getString("thing12"),
customParam.getString("thing1"),
customParam.getString("thing11")
));
}else if(wxTemplateMsg.getType() == EnumTemplateType.LIVE_REMIND.getCode()){
/**
* 直播标题:{{thing1.DATA}}
* 开播时间:{{date3.DATA}}
* 主播昵称:{{thing4.DATA}}
* 温馨提示:{{thing5.DATA}}
*/
smartAppMsg.setDataList(Lists.newArrayList(
customParam.getString("thing1"),
customParam.getString("date3"),
customParam.getString("thing4"),
customParam.getString("thing5")
));
}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());
}

}


@Override
public void addMsgCallback(WxMsg wxmsg, String batchNo) {


+ 11
- 0
mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml Voir le fichier

@@ -992,6 +992,17 @@
<include refid="filterWhereConditions"/>
</select>

<select id="findOpenIdByFilter" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="String">
select distinct open_id from wx_c_user where user_id in (
select id
from wx_c_user_basic_info cu
<if test=" null != tagIds ">
join wx_c_user_tags cut on cut.`id` = cu.`tag_id`
</if>
<include refid="filterWhereConditions"/>
)
</select>

<select id="findListByFilter1" resultMap="BaseResultMap">
select <include refid="msgColumns"/>
from wx_c_user_basic_info cu


Chargement…
Annuler
Enregistrer