Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
head_group
xyqb-user2
Commits
41e8dbbd
Commit
41e8dbbd
authored
Feb 21, 2022
by
李健华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
每次请求不单独获取access_token
parent
8c768cca
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
13 deletions
+6
-13
WechatFollowServiceImpl.java
...oup/xyqb/service/wechat/impl/WechatFollowServiceImpl.java
+6
-13
No files found.
src/main/java/cn/quantgroup/xyqb/service/wechat/impl/WechatFollowServiceImpl.java
View file @
41e8dbbd
...
...
@@ -189,11 +189,9 @@ public class WechatFollowServiceImpl implements IWechatFollowService {
System
.
out
.
println
(
userIdList
);
if
(!
userIdList
.
isEmpty
())
{
// 批量查询客户详情
batchQueryCustomerDetailInfo
(
userIdList
,
""
,
period
);
batchQueryCustomerDetailInfo
(
accessTokenResponse
.
getAccessToken
(),
userIdList
,
""
,
period
);
}
}
System
.
out
.
println
(
departmentListResponse
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"同步企业微信数据失败--{}"
,
e
.
getMessage
());
...
...
@@ -203,14 +201,7 @@ public class WechatFollowServiceImpl implements IWechatFollowService {
return
null
;
}
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
();
private
void
batchQueryCustomerDetailInfo
(
String
accessToken
,
List
<
String
>
userIdList
,
String
cursor
,
Integer
period
)
{
// 查询客户详情
HashMap
<
String
,
Object
>
parameters
=
new
HashMap
<>();
parameters
.
put
(
"userid_list"
,
userIdList
);
...
...
@@ -219,6 +210,7 @@ public class WechatFollowServiceImpl implements IWechatFollowService {
String
customerInfoUrl
=
String
.
format
(
customerInfoListBatchUrl
,
accessToken
);
RestTemplate
restTemplate
=
new
RestTemplate
();
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
postForEntity
(
customerInfoUrl
,
parameters
,
String
.
class
);
//提交的body内容为user对象,请求的返回的body类型为String
log
.
info
(
"batchQueryCustomerDetailInfo--customerInfoUrl:{}, parameters:{}"
,
customerInfoUrl
,
parameters
);
CustomerListResponse
customerListResponse
=
JSONObject
.
parseObject
(
responseEntity
.
getBody
(),
CustomerListResponse
.
class
);
if
(
customerListResponse
.
getErrcode
()
==
0
)
{
// 获取所有unionId
...
...
@@ -235,10 +227,11 @@ public class WechatFollowServiceImpl implements IWechatFollowService {
// 根据unionid 添加现有指定信息
// 判断nextCursor不为空,继续获取更多客户
if
(!
""
.
equals
(
customerListResponse
.
getNextCursor
()))
{
batchQueryCustomerDetailInfo
(
userIdList
,
customerListResponse
.
getNextCursor
(),
period
);
batchQueryCustomerDetailInfo
(
accessToken
,
userIdList
,
customerListResponse
.
getNextCursor
(),
period
);
}
}
else
{
batchQueryCustomerDetailInfo
(
accessToken
,
userIdList
,
customerListResponse
.
getNextCursor
(),
period
);
}
return
JsonResult
.
buildSuccessResult
();
}
private
void
initTask
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment