Commit 08be6010 authored by 李健华's avatar 李健华

获取企业微信token更改为从消息中心获取

parent 6d2502a3
......@@ -193,7 +193,7 @@ public class UserRegisterServiceImpl implements IUserRegisterService {
@Override
public User register(String phoneNo, Long channelId, Long registerFrom, String appChannel, Long btRegisterChannelId, String dimension) {
// deregisterCheck(phoneNo);
deregisterCheck(phoneNo);
UserRegisterParam userRegisterParam = UserRegisterParam.builder()
.registerFrom(registerFrom)
......
......@@ -68,6 +68,8 @@ public class WechatFollowServiceImpl implements IWechatFollowService {
private String customerInfoListBatchUrl;
// 消息中心
private String msgEnterpriseToken;
@Resource
......@@ -80,6 +82,9 @@ public class WechatFollowServiceImpl implements IWechatFollowService {
@Qualifier("stringRedisTemplate")
private RedisTemplate<String, String> redisTemplate;
@Value("${mo-msg.http}")
private String msgCenter;
@Resource
private ApplicationEventPublisher applicationEventPublisher;
......@@ -110,6 +115,9 @@ public class WechatFollowServiceImpl implements IWechatFollowService {
//批量获取客户详情
customerInfoListBatchUrl = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/batch/get_by_user?access_token=%s";
// 消息中心获取企业微信Token
msgEnterpriseToken = String.format("%s/middle_office/token/enterprise?corpId=%s", msgCenter, corpid);
}
@Override
......@@ -189,14 +197,16 @@ public class WechatFollowServiceImpl implements IWechatFollowService {
private JsonResult executeEnterpriseFollowStatus(String s, String period) {
try {
String response = httpService.get(qyAccessTokenUrl);
// String response = httpService.get(qyAccessTokenUrl);
String response = httpService.get(msgEnterpriseToken);
if (StringUtils.isEmpty(response)) {
log.info("请求消息中心企业微信Token为空---{}", response);
return null;
}
AccessTokenResponse accessTokenResponse = JSONObject.parseObject(response,
AccessTokenResponse.class);
if (accessTokenResponse.getAccessToken() != null) {
String deparmentList = String.format(departmentUserListUrl, accessTokenResponse.getAccessToken(), departmentId);
Map<String, Object> tokenReponseMap = JSONObject.parseObject(response, Map.class);
String token = tokenReponseMap.get("data").toString();
if (token != null && !"".equals(token)) {
String deparmentList = String.format(departmentUserListUrl, token, departmentId);
String departmentRep = httpService.get(deparmentList);
DepartmentListResponse departmentListResponse = JSONObject.parseObject(departmentRep, DepartmentListResponse.class);
if (!departmentListResponse.getUserlist().isEmpty()) {
......@@ -204,7 +214,7 @@ public class WechatFollowServiceImpl implements IWechatFollowService {
System.out.println(userIdList);
if (!userIdList.isEmpty()) {
// 批量查询客户详情
batchQueryCustomerDetailInfo2(accessTokenResponse.getAccessToken(), userIdList, "", period);
batchQueryCustomerDetailInfo2(token, userIdList, "", period);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment