Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
brandkbs2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
shenjunjie
brandkbs2
Commits
0b8513ef
Commit
0b8513ef
authored
Mar 20, 2023
by
shenjunjie
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature' into 'release'
Feature See merge request
!256
parents
86d9e539
a09866e0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
src/main/java/com/zhiwei/brandkbs2/service/impl/UserServiceImpl.java
+7
-2
No files found.
src/main/java/com/zhiwei/brandkbs2/service/impl/UserServiceImpl.java
View file @
0b8513ef
...
@@ -25,6 +25,8 @@ import com.zhiwei.brandkbs2.util.MongoUtil;
...
@@ -25,6 +25,8 @@ import com.zhiwei.brandkbs2.util.MongoUtil;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.middleware.auth.pojo.CenterUser
;
import
com.zhiwei.middleware.auth.pojo.CenterUser
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
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
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Criteria
;
...
@@ -48,6 +50,7 @@ import java.util.stream.Collectors;
...
@@ -48,6 +50,7 @@ import java.util.stream.Collectors;
*/
*/
@Service
(
"userServiceImpl"
)
@Service
(
"userServiceImpl"
)
public
class
UserServiceImpl
implements
UserService
{
public
class
UserServiceImpl
implements
UserService
{
public
static
final
Logger
log
=
LogManager
.
getLogger
(
UserServiceImpl
.
class
);
@Resource
(
name
=
"userDao"
)
@Resource
(
name
=
"userDao"
)
private
UserDao
userDao
;
private
UserDao
userDao
;
...
@@ -356,14 +359,16 @@ public class UserServiceImpl implements UserService {
...
@@ -356,14 +359,16 @@ public class UserServiceImpl implements UserService {
// 解析code获取手机号
// 解析code获取手机号
ResponseEntity
<
String
>
entity
=
restTemplate
.
getForEntity
(
wechatAccessTokenUrl
,
String
.
class
);
ResponseEntity
<
String
>
entity
=
restTemplate
.
getForEntity
(
wechatAccessTokenUrl
,
String
.
class
);
if
(
null
==
entity
.
getBody
())
{
if
(
null
==
entity
.
getBody
())
{
return
ResponseResult
.
failure
(
"手机号
获取
失败"
);
return
ResponseResult
.
failure
(
"手机号
解析
失败"
);
}
}
String
accessToken
=
JSON
.
parseObject
(
entity
.
getBody
()).
getJSONObject
(
"data"
).
getString
(
"accessToken"
);
String
accessToken
=
JSON
.
parseObject
(
entity
.
getBody
()).
getJSONObject
(
"data"
).
getString
(
"accessToken"
);
log
.
info
(
"解析手机号,accessToken:{},loginVO:{}"
,
accessToken
,
JSONObject
.
toJSONString
(
loginVO
));
JSONObject
info
=
new
JSONObject
();
JSONObject
info
=
new
JSONObject
();
info
.
put
(
"code"
,
loginVO
.
getCode
());
info
.
put
(
"code"
,
loginVO
.
getCode
());
HttpEntity
<
JSONObject
>
phoneNumberEntity
=
restTemplate
.
postForEntity
(
wxGetUserPhoneNumberUrl
+
accessToken
,
info
,
JSONObject
.
class
);
HttpEntity
<
JSONObject
>
phoneNumberEntity
=
restTemplate
.
postForEntity
(
wxGetUserPhoneNumberUrl
+
accessToken
,
info
,
JSONObject
.
class
);
log
.
info
(
"解析手机号,accessToken:{},wxGetUserPhoneNumberUrl:{},response:{}"
,
accessToken
,
wxGetUserPhoneNumberUrl
,
JSON
.
toJSONString
(
phoneNumberEntity
));
if
(
null
==
phoneNumberEntity
.
getBody
())
{
if
(
null
==
phoneNumberEntity
.
getBody
())
{
return
ResponseResult
.
failure
(
"手机号
获取
失败"
);
return
ResponseResult
.
failure
(
"手机号
解析
失败"
);
}
}
phoneNumber
=
Long
.
valueOf
(
phoneNumberEntity
.
getBody
().
getJSONObject
(
"phone_info"
).
getString
(
"purePhoneNumber"
));
phoneNumber
=
Long
.
valueOf
(
phoneNumberEntity
.
getBody
().
getJSONObject
(
"phone_info"
).
getString
(
"purePhoneNumber"
));
}
}
...
...
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