Commit 8c768cca authored by 李健华's avatar 李健华

每次请求单独获取access_token

parent 0f30d2f1
...@@ -151,7 +151,7 @@ public class WechatFollowServiceImpl implements IWechatFollowService { ...@@ -151,7 +151,7 @@ public class WechatFollowServiceImpl implements IWechatFollowService {
} }
} }
} catch (Exception ex) { } catch (Exception ex) {
log.error("excuateWechatFollowStatus--{}", ex.getMessage()); log.error("同步微信公众号数据失败--{}", ex.getMessage());
return null; return null;
} }
return null; return null;
...@@ -189,7 +189,7 @@ public class WechatFollowServiceImpl implements IWechatFollowService { ...@@ -189,7 +189,7 @@ public class WechatFollowServiceImpl implements IWechatFollowService {
System.out.println(userIdList); System.out.println(userIdList);
if (!userIdList.isEmpty()) { if (!userIdList.isEmpty()) {
// 批量查询客户详情 // 批量查询客户详情
batchQueryCustomerDetailInfo(accessTokenResponse.getAccessToken(), userIdList, "", period); batchQueryCustomerDetailInfo(userIdList, "", period);
} }
} }
System.out.println(departmentListResponse); System.out.println(departmentListResponse);
...@@ -203,7 +203,14 @@ public class WechatFollowServiceImpl implements IWechatFollowService { ...@@ -203,7 +203,14 @@ public class WechatFollowServiceImpl implements IWechatFollowService {
return null; return null;
} }
private void batchQueryCustomerDetailInfo(String accessToken, List<String> userIdList, String cursor, Integer period) { private JsonResult batchQueryCustomerDetailInfo(List<String> userIdList, String cursor, Integer period) {
String response = httpService.get(qyAccessTokenUrl);
if (StringUtils.isEmpty(response)) {
return null;
}
AccessTokenResponse accessTokenResponse = JSONObject.parseObject(response,
AccessTokenResponse.class);
String accessToken = accessTokenResponse.getAccessToken();
// 查询客户详情 // 查询客户详情
HashMap<String, Object> parameters = new HashMap<>(); HashMap<String, Object> parameters = new HashMap<>();
parameters.put("userid_list", userIdList); parameters.put("userid_list", userIdList);
...@@ -228,9 +235,10 @@ public class WechatFollowServiceImpl implements IWechatFollowService { ...@@ -228,9 +235,10 @@ public class WechatFollowServiceImpl implements IWechatFollowService {
// 根据unionid 添加现有指定信息 // 根据unionid 添加现有指定信息
// 判断nextCursor不为空,继续获取更多客户 // 判断nextCursor不为空,继续获取更多客户
if (!"".equals(customerListResponse.getNextCursor())) { if (!"".equals(customerListResponse.getNextCursor())) {
batchQueryCustomerDetailInfo(accessToken, userIdList, customerListResponse.getNextCursor(), period); batchQueryCustomerDetailInfo(userIdList, customerListResponse.getNextCursor(), period);
} }
} }
return JsonResult.buildSuccessResult();
} }
private void initTask() { private void initTask() {
......
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