重构H5消息相关接口;修复朋友圈不能创建任务BUG

1 parent adbcb5ab
...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linkwechat.common.core.controller.BaseController; import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult; import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo; import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.CommunityTaskType;
import com.linkwechat.common.exception.CustomException; import com.linkwechat.common.exception.CustomException;
import com.linkwechat.common.utils.DateUtils; import com.linkwechat.common.utils.DateUtils;
import com.linkwechat.common.utils.SnowFlakeUtil; import com.linkwechat.common.utils.SnowFlakeUtil;
...@@ -15,6 +16,7 @@ import com.linkwechat.wecom.domain.WeCustomerSeas; ...@@ -15,6 +16,7 @@ import com.linkwechat.wecom.domain.WeCustomerSeas;
import com.linkwechat.wecom.domain.vo.CustomerSeasRecordVo; import com.linkwechat.wecom.domain.vo.CustomerSeasRecordVo;
import com.linkwechat.wecom.service.IWeCustomerMessagePushService; import com.linkwechat.wecom.service.IWeCustomerMessagePushService;
import com.linkwechat.wecom.service.IWeCustomerSeasService; import com.linkwechat.wecom.service.IWeCustomerSeasService;
import com.linkwechat.wecom.service.IWeMessagePushService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -33,8 +35,10 @@ public class WeCustomerSeasController extends BaseController { ...@@ -33,8 +35,10 @@ public class WeCustomerSeasController extends BaseController {
private IWeCustomerSeasService iWeCustomerSeasService; private IWeCustomerSeasService iWeCustomerSeasService;
@Autowired @Autowired
private IWeCustomerMessagePushService iWeCustomerMessagePushService; private IWeMessagePushService iWeMessagePushService;
/** /**
* 客户公海模版下载 * 客户公海模版下载
...@@ -140,7 +144,7 @@ public class WeCustomerSeasController extends BaseController { ...@@ -140,7 +144,7 @@ public class WeCustomerSeasController extends BaseController {
* @param ids * @param ids
* @return * @return
*/ */
@PostMapping("/remidUser/{ids}") @GetMapping("/remidUser/{ids}")
public AjaxResult remidUser(@PathVariable Long[] ids){ public AjaxResult remidUser(@PathVariable Long[] ids){
List<WeCustomerSeas> weCustomerSeas List<WeCustomerSeas> weCustomerSeas
...@@ -149,8 +153,9 @@ public class WeCustomerSeasController extends BaseController { ...@@ -149,8 +153,9 @@ public class WeCustomerSeasController extends BaseController {
if(CollectionUtil.isNotEmpty(weCustomerSeas)){ if(CollectionUtil.isNotEmpty(weCustomerSeas)){
weCustomerSeas.stream().collect(Collectors.groupingBy(WeCustomerSeas::getAddUserId)).forEach((k,v)->{ weCustomerSeas.stream().collect(Collectors.groupingBy(WeCustomerSeas::getAddUserId)).forEach((k,v)->{
String messageRemindContent="管理员给你分配了"+v.size()+"个客户还未添加,快去复制电话号码添加客户吧,<a href='%s?appid=%s&redirect_uri=%s&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect'>点击查看详情</a>"; iWeMessagePushService.pushMessageSelfH5(ListUtil.toList(k),
iWeCustomerMessagePushService.messagePushRemind(messageRemindContent,k); "管理员给你分配了"+v.size()+"个客户还未添加,快去复制电话号码添加客户吧,", CommunityTaskType.SEAS.getType());
}); });
......
...@@ -4,8 +4,10 @@ import com.linkwechat.common.constant.WeConstans; ...@@ -4,8 +4,10 @@ import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.core.controller.BaseController; import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult; import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo; import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.wecom.client.WeMomentsClient;
import com.linkwechat.wecom.constants.SynchRecordConstants; import com.linkwechat.wecom.constants.SynchRecordConstants;
import com.linkwechat.wecom.domain.WeMoments; import com.linkwechat.wecom.domain.WeMoments;
import com.linkwechat.wecom.domain.dto.moments.MomentsCreateResultDto;
import com.linkwechat.wecom.service.IWeMomentsService; import com.linkwechat.wecom.service.IWeMomentsService;
import com.linkwechat.wecom.service.IWeSynchRecordService; import com.linkwechat.wecom.service.IWeSynchRecordService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -28,6 +30,11 @@ public class WeMomentsController extends BaseController { ...@@ -28,6 +30,11 @@ public class WeMomentsController extends BaseController {
IWeSynchRecordService iWeSynchRecordService; IWeSynchRecordService iWeSynchRecordService;
@Autowired
WeMomentsClient weMomentsClient;
/** /**
* 获取朋友圈列表 * 获取朋友圈列表
* @param weMoments * @param weMoments
......
...@@ -46,4 +46,6 @@ public class WeComeConfig { ...@@ -46,4 +46,6 @@ public class WeComeConfig {
* 需要进行重试的企业微信请求错误码 * 需要进行重试的企业微信请求错误码
*/ */
private List<Integer> weNeedRetryErrorCodes; private List<Integer> weNeedRetryErrorCodes;
} }
...@@ -124,6 +124,28 @@ public class WeCorpAccount extends BaseEntity ...@@ -124,6 +124,28 @@ public class WeCorpAccount extends BaseEntity
**********************************************/ **********************************************/
/***********************************************
*******************H5跳转start******************
**********************************************/
/**JS SDK 身份校验url*/
private String authorizeUrl;
/**群sop和老客标签建群,跳转链接*/
private String sopTagRedirectUrl;
/**客户公海,跳转链接*/
private String seasRedirectUrl;
/***********************************************
*******************H5跳转end*******************
**********************************************/
/**客服密钥*/ /**客服密钥*/
private String kfSecret; private String kfSecret;
...@@ -136,4 +158,8 @@ public class WeCorpAccount extends BaseEntity ...@@ -136,4 +158,8 @@ public class WeCorpAccount extends BaseEntity
private String customerChurnNoticeSwitch = Constants.NORMAL_CODE; private String customerChurnNoticeSwitch = Constants.NORMAL_CODE;
} }
...@@ -3,7 +3,7 @@ package com.linkwechat.common.enums; ...@@ -3,7 +3,7 @@ package com.linkwechat.common.enums;
import lombok.Getter; import lombok.Getter;
/** /**
* 社群运营H5列表页数据类型 * H5列表页数据类型
* @Author Hang * @Author Hang
* @Date 2021/3/24 11:02 * @Date 2021/3/24 11:02
*/ */
...@@ -12,6 +12,8 @@ public enum CommunityTaskType { ...@@ -12,6 +12,8 @@ public enum CommunityTaskType {
TAG(1, "老客标签建群"), TAG(1, "老客标签建群"),
SEAS(3, "客户公海"),
SOP(2, "群sop"); SOP(2, "群sop");
......
...@@ -20,11 +20,6 @@ public class WeAppDto extends WeResultDto{ ...@@ -20,11 +20,6 @@ public class WeAppDto extends WeResultDto{
private String name; private String name;
//企业应用方形头像url //企业应用方形头像url
private String square_logo_url; private String square_logo_url;
} }
......
package com.linkwechat.wecom.service;
public interface IWeAuthorizeUrlService {
}
...@@ -50,4 +50,10 @@ public interface IWeMessagePushService { ...@@ -50,4 +50,10 @@ public interface IWeMessagePushService {
* @return 结果 * @return 结果
*/ */
public int deleteWeMessagePushById(Long messagePushId); public int deleteWeMessagePushById(Long messagePushId);
/**
* 推送信息给员工附带自己的url链接,跳转H5
*/
public void pushMessageSelfH5(List<String> toUser,String textContent,Integer taskType);
} }
package com.linkwechat.wecom.service.impl;
import com.linkwechat.wecom.service.IWeAuthorizeUrlService;
import org.springframework.stereotype.Service;
/**
* 认证链接生成接口
*/
@Service
public class WeAuthorizeUrlServiceImpl implements IWeAuthorizeUrlService {
}
package com.linkwechat.wecom.service.impl; package com.linkwechat.wecom.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.core.domain.entity.WeCorpAccount; import com.linkwechat.common.core.domain.entity.WeCorpAccount;
...@@ -17,6 +18,7 @@ import com.linkwechat.wecom.domain.vo.WeMaterialVo; ...@@ -17,6 +18,7 @@ import com.linkwechat.wecom.domain.vo.WeMaterialVo;
import com.linkwechat.wecom.mapper.*; import com.linkwechat.wecom.mapper.*;
import com.linkwechat.wecom.service.IWeCorpAccountService; import com.linkwechat.wecom.service.IWeCorpAccountService;
import com.linkwechat.wecom.service.IWeGroupSopService; import com.linkwechat.wecom.service.IWeGroupSopService;
import com.linkwechat.wecom.service.IWeMessagePushService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -54,17 +56,11 @@ public class WeGroupSopServiceImpl extends ServiceImpl<WeGroupSopMapper, WeGroup ...@@ -54,17 +56,11 @@ public class WeGroupSopServiceImpl extends ServiceImpl<WeGroupSopMapper, WeGroup
@Autowired @Autowired
private WeGroupSopPicMapper sopPicMapper; private WeGroupSopPicMapper sopPicMapper;
@Autowired
private IWeCorpAccountService corpAccountService;
@Autowired @Autowired
private WeMessagePushClient messagePushClient; private IWeMessagePushService weMessagePushService;
@Value("${wecome.authorizeUrl}")
private String authorizeUrl;
@Value("${wecome.authorizeRedirectUrl}")
private String authorizeRedirectUrl;
/** /**
* 通过规则id获取sop规则 * 通过规则id获取sop规则
...@@ -332,41 +328,57 @@ public class WeGroupSopServiceImpl extends ServiceImpl<WeGroupSopMapper, WeGroup ...@@ -332,41 +328,57 @@ public class WeGroupSopServiceImpl extends ServiceImpl<WeGroupSopMapper, WeGroup
@Override @Override
// @Async // @Async
public void sendMessage(List<String> groupIdList) { public void sendMessage(List<String> groupIdList) {
// 构造请求参数
WeMessagePushDto pushDto = new WeMessagePushDto();
// 查询群聊列表,获取群主列表 // 查询群聊列表,获取群主列表
LambdaQueryWrapper<WeGroup> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<WeGroup> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(WeGroup::getChatId, groupIdList); queryWrapper.in(WeGroup::getChatId, groupIdList);
List<WeGroup> groupList = groupMapper.selectList(queryWrapper); List<WeGroup> groupList = groupMapper.selectList(queryWrapper);
String toUser = groupList if(CollectionUtil.isNotEmpty(groupList)){
.stream()
.map(WeGroup::getOwner) weMessagePushService.pushMessageSelfH5(
.collect(Collectors.joining("|")); groupList.stream().map(WeGroup::getOwner).collect(Collectors.toList()),
pushDto.setTouser(toUser); "你有新的SOP待发送,",
CommunityTaskType.SOP.getType()
// 获取agentId );
WeCorpAccount validWeCorpAccount = corpAccountService.findValidWeCorpAccount();
String agentId = validWeCorpAccount.getAgentId();
String corpId = validWeCorpAccount.getCorpId();
if (StringUtils.isEmpty(agentId)) {
throw new WeComException("当前agentId不可用或不存在");
} }
pushDto.setAgentid(Integer.valueOf(agentId));
// 设置消息内容
pushDto.setMsgtype("text");
TextMessageDto text = new TextMessageDto();
String REDIRECT_URI = URLEncoder.encode(String.format("%s?corpId=%s&agentId=%s&type=%s", authorizeRedirectUrl, corpId, agentId, CommunityTaskType.SOP.getType()));
String context = String.format(
"你有新的SOP待发送,<a href='%s?appid=%s&redirect_uri=%s&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect'>请点击此链接查看</a>",
authorizeUrl, corpId, REDIRECT_URI);
text.setContent(context);
pushDto.setText(text);
// 请求消息推送接口,获取结果 [消息推送 - 发送应用消息]
messagePushClient.sendMessageToUser(pushDto, agentId); // // 构造请求参数
// WeMessagePushDto pushDto = new WeMessagePushDto();
// // 查询群聊列表,获取群主列表
// LambdaQueryWrapper<WeGroup> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.in(WeGroup::getChatId, groupIdList);
// List<WeGroup> groupList = groupMapper.selectList(queryWrapper);
// String toUser = groupList
// .stream()
// .map(WeGroup::getOwner)
// .collect(Collectors.joining("|"));
// pushDto.setTouser(toUser);
//
// // 获取agentId
// WeCorpAccount validWeCorpAccount = corpAccountService.findValidWeCorpAccount();
// String agentId = validWeCorpAccount.getAgentId();
// String corpId = validWeCorpAccount.getCorpId();
// if (StringUtils.isEmpty(agentId)) {
// throw new WeComException("当前agentId不可用或不存在");
// }
// pushDto.setAgentid(Integer.valueOf(agentId));
//
// // 设置消息内容
// pushDto.setMsgtype("text");
//
// TextMessageDto text = new TextMessageDto();
// String REDIRECT_URI = URLEncoder.encode(String.format("%s?corpId=%s&agentId=%s&type=%s", authorizeRedirectUrl, corpId, agentId, CommunityTaskType.SOP.getType()));
// String context = String.format(
// "你有新的SOP待发送,<a href='%s?appid=%s&redirect_uri=%s&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect'>请点击此链接查看</a>",
// authorizeUrl, corpId, REDIRECT_URI);
// text.setContent(context);
// pushDto.setText(text);
//
// // 请求消息推送接口,获取结果 [消息推送 - 发送应用消息]
// messagePushClient.sendMessageToUser(pushDto, agentId);
} }
} }
package com.linkwechat.wecom.service.impl; package com.linkwechat.wecom.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.base.Joiner;
import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import com.linkwechat.common.enums.CommunityTaskType;
import com.linkwechat.common.enums.PushType; import com.linkwechat.common.enums.PushType;
import com.linkwechat.common.exception.wecom.WeComException; import com.linkwechat.common.exception.wecom.WeComException;
import com.linkwechat.common.utils.DateUtils; import com.linkwechat.common.utils.DateUtils;
import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.wecom.client.WeMessagePushClient;
import com.linkwechat.wecom.domain.WeMessagePush; import com.linkwechat.wecom.domain.WeMessagePush;
import com.linkwechat.wecom.domain.dto.WeMessagePushDto;
import com.linkwechat.wecom.domain.dto.message.TextMessageDto;
import com.linkwechat.wecom.mapper.WeMessagePushMapper; import com.linkwechat.wecom.mapper.WeMessagePushMapper;
import com.linkwechat.wecom.service.IWeCorpAccountService;
import com.linkwechat.wecom.service.IWeMessagePushService; import com.linkwechat.wecom.service.IWeMessagePushService;
import com.linkwechat.wecom.strategy.MessageContext; import com.linkwechat.wecom.strategy.MessageContext;
import com.linkwechat.wecom.strategy.SendMessageToUserGroupStrategy; import com.linkwechat.wecom.strategy.SendMessageToUserGroupStrategy;
...@@ -14,6 +23,7 @@ import com.linkwechat.wecom.strategy.SendMessageToUserStrategy; ...@@ -14,6 +23,7 @@ import com.linkwechat.wecom.strategy.SendMessageToUserStrategy;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.net.URLEncoder;
import java.util.*; import java.util.*;
/** /**
...@@ -34,6 +44,12 @@ public class WeMessagePushServiceImpl implements IWeMessagePushService { ...@@ -34,6 +44,12 @@ public class WeMessagePushServiceImpl implements IWeMessagePushService {
@Autowired @Autowired
private SendMessageToUserStrategy sendMessageToUserStrategy; private SendMessageToUserStrategy sendMessageToUserStrategy;
@Autowired
private IWeCorpAccountService corpAccountService;
@Autowired
private WeMessagePushClient messagePushClient;
@Override @Override
public WeMessagePush selectWeMessagePushById(Long messagePushId) { public WeMessagePush selectWeMessagePushById(Long messagePushId) {
return weMessagePushMapper.selectById(messagePushId); return weMessagePushMapper.selectById(messagePushId);
...@@ -76,4 +92,62 @@ public class WeMessagePushServiceImpl implements IWeMessagePushService { ...@@ -76,4 +92,62 @@ public class WeMessagePushServiceImpl implements IWeMessagePushService {
return weMessagePushMapper.deleteById(messagePushId); return weMessagePushMapper.deleteById(messagePushId);
} }
@Override
public void pushMessageSelfH5(List<String> toUser,String textContent,Integer taskType) {
if(CollectionUtil.isEmpty(toUser)){
throw new WeComException("接受人不可为空");
}
WeMessagePushDto pushDto = new WeMessagePushDto();
// 获取agentId
WeCorpAccount validWeCorpAccount = corpAccountService.findValidWeCorpAccount();
String agentId = validWeCorpAccount.getAgentId();
String corpId = validWeCorpAccount.getCorpId();
if (StringUtils.isEmpty(agentId)) {
throw new WeComException("当前agentId不可用或不存在");
}
if(StringUtils.isEmpty(validWeCorpAccount.getAuthorizeUrl())){
throw new WeComException("JS SDK 身份校验url不可为空");
}
pushDto.setAgentid(Integer.valueOf(agentId));
//推送给指定员工
pushDto.setTouser(Joiner.on("|").join(toUser));
// 设置消息内容
pushDto.setMsgtype("text");
TextMessageDto text = new TextMessageDto();
String REDIRECT_URI = null;
if(taskType.equals(CommunityTaskType.SEAS.getType())){ //客户公海链接
if(StringUtils.isEmpty( validWeCorpAccount.getSeasRedirectUrl())){
throw new WeComException("客户公海H5跳转链接不可为空");
}
URLEncoder.encode(String.format("%s?corpId=%s&agentId=%s",
validWeCorpAccount.getSeasRedirectUrl()
, corpId, agentId));
}else{//群sop与老客标签建群
if(StringUtils.isEmpty( validWeCorpAccount.getSopTagRedirectUrl())){
throw new WeComException("群SOP与老客标签建群H5跳转链接不可为空");
}
REDIRECT_URI = URLEncoder.encode(String.format("%s?corpId=%s&agentId=%s&type=%s", validWeCorpAccount.getSopTagRedirectUrl(), corpId, agentId,taskType));
}
if(StringUtils.isNotEmpty(REDIRECT_URI)){
String context = String.format(
textContent+"<a href='%s?appid=%s&redirect_uri=%s&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect'>请点击此链接查看</a>",
validWeCorpAccount.getAuthorizeUrl(), corpId, REDIRECT_URI);
text.setContent(context);
pushDto.setText(text);
// 请求消息推送接口,获取结果 [消息推送 - 发送应用消息]
messagePushClient.sendMessageToUser(pushDto, agentId);
}
}
} }
...@@ -63,8 +63,6 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas ...@@ -63,8 +63,6 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas
@Autowired @Autowired
private WeCustomerMessagePushClient customerMessagePushClient; private WeCustomerMessagePushClient customerMessagePushClient;
@Autowired
private WeMessagePushClient messagePushClient;
@Autowired @Autowired
private IWeMaterialService materialService; private IWeMaterialService materialService;
...@@ -72,20 +70,14 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas ...@@ -72,20 +70,14 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas
@Autowired @Autowired
private WeGroupCodeMapper groupCodeMapper; private WeGroupCodeMapper groupCodeMapper;
@Autowired
private IWeCorpAccountService corpAccountService;
@Autowired @Autowired
private WeCustomerMapper customerMapper; private WeCustomerMapper customerMapper;
@Value("${wecome.authorizeUrl}") @Autowired
private String authorizeUrl; private IWeMessagePushService weMessagePushService;
@Value("${wecome.authorizeRedirectUrl}")
private String authorizeRedirectUrl;
@Autowired
private IWeCustomerMessagePushService weCustomerMessagePushService;
/** /**
* 添加新标签建群任务 * 添加新标签建群任务
...@@ -440,34 +432,19 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas ...@@ -440,34 +432,19 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas
* @param task 建群任务信息 * @param task 建群任务信息
*/ */
private void sendEmployeeMessage(WePresTagGroupTask task) { private void sendEmployeeMessage(WePresTagGroupTask task) {
WeMessagePushDto pushDto = new WeMessagePushDto();
// 设置toUser参数 // 设置toUser参数
List<WeCommunityTaskEmplVo> employeeList = taskScopeMapper.getScopeListByTaskId(task.getTaskId()); List<WeCommunityTaskEmplVo> employeeList = taskScopeMapper.getScopeListByTaskId(task.getTaskId());
String toUser = employeeList.stream().map(WeCommunityTaskEmplVo::getUserId).collect(Collectors.joining("|"));
pushDto.setTouser(toUser); if(CollectionUtil.isNotEmpty(employeeList)){
// 获取agentId weMessagePushService.pushMessageSelfH5(
WeCorpAccount validWeCorpAccount = corpAccountService.findValidWeCorpAccount(); employeeList.stream().map(WeCommunityTaskEmplVo::getUserId).collect(Collectors.toList()),
String agentId = validWeCorpAccount.getAgentId(); "你有一个新任务,",
String corpId = validWeCorpAccount.getCorpId(); CommunityTaskType.TAG.getType()
if (StringUtils.isEmpty(agentId)) { );
throw new WeComException("当前agentId不可用或不存在");
} }
pushDto.setAgentid(Integer.valueOf(agentId));
// 设置文本消息
TextMessageDto text = new TextMessageDto();
String REDIRECT_URI = URLEncoder.encode(String.format("%s?corpId=%s&agentId=%s&type=%s", authorizeRedirectUrl, corpId, agentId, CommunityTaskType.TAG.getType()));
String context = String.format(
"你有一个新任务,<a href='%s?appid=%s&redirect_uri=%s&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect'>请点击此链接查看</a>",
authorizeUrl, corpId, REDIRECT_URI);
text.setContent(context);
pushDto.setText(text);
pushDto.setMsgtype("text");
// 请求消息推送接口,获取结果 [消息推送 - 发送应用消息]
log.debug("发送个人群发信息 ============> ");
messagePushClient.sendMessageToUser(pushDto, agentId);
} }
} }
...@@ -308,13 +308,6 @@ ...@@ -308,13 +308,6 @@
</dependency> </dependency>
<dependency>
<groupId>com.github.jeffreyning</groupId>
<artifactId>mybatisplus-plus</artifactId>
<version>1.5.1-RELEASE</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!