Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
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
youjj
cloud-platform
Commits
375d4022
Commit
375d4022
authored
Nov 13, 2019
by
jiaorz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
获取用户信息异常
parent
021fd02b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
14 deletions
+9
-14
PublicController.java
.../github/wxiaoqi/security/admin/rest/PublicController.java
+9
-14
No files found.
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/PublicController.java
View file @
375d4022
...
@@ -10,7 +10,6 @@ import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
...
@@ -10,7 +10,6 @@ import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import
com.github.wxiaoqi.security.admin.vo.AppUserVo
;
import
com.github.wxiaoqi.security.admin.vo.AppUserVo
;
import
com.github.wxiaoqi.security.admin.vo.UserMemberVo
;
import
com.github.wxiaoqi.security.admin.vo.UserMemberVo
;
import
com.github.wxiaoqi.security.auth.client.jwt.UserAuthUtil
;
import
com.github.wxiaoqi.security.auth.client.jwt.UserAuthUtil
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
org.apache.commons.beanutils.BeanUtils
;
import
org.apache.commons.beanutils.BeanUtils
;
...
@@ -19,7 +18,6 @@ import org.springframework.web.bind.annotation.*;
...
@@ -19,7 +18,6 @@ import org.springframework.web.bind.annotation.*;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.InvocationTargetException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -55,11 +53,11 @@ public class PublicController {
...
@@ -55,11 +53,11 @@ public class PublicController {
ObjectRestResponse
userinfoByToken
(
String
token
)
throws
Exception
{
ObjectRestResponse
userinfoByToken
(
String
token
)
throws
Exception
{
String
username
=
userAuthUtil
.
getInfoFromToken
(
token
).
getUniqueName
();
String
username
=
userAuthUtil
.
getInfoFromToken
(
token
).
getUniqueName
();
if
(
username
==
null
)
{
if
(
username
==
null
)
{
throw
new
BaseException
(
ResultCode
.
NOTEXIST_CODE
);
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
USER_NOTEXIST_CODE
,
ResultCode
.
getMsg
(
ResultCode
.
USER_NOTEXIST_CODE
)
);
}
}
User
user
=
userBiz
.
getUserByUsername
(
username
);
User
user
=
userBiz
.
getUserByUsername
(
username
);
if
(
user
==
null
)
{
if
(
user
==
null
)
{
throw
new
BaseException
(
ResultCode
.
NOTEXIST_CODE
);
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
USER_NOTEXIST_CODE
,
ResultCode
.
getMsg
(
ResultCode
.
USER_NOTEXIST_CODE
)
);
}
}
return
new
ObjectRestResponse
<
User
>().
rel
(
true
).
data
(
user
);
return
new
ObjectRestResponse
<
User
>().
rel
(
true
).
data
(
user
);
}
}
...
@@ -69,8 +67,7 @@ public class PublicController {
...
@@ -69,8 +67,7 @@ public class PublicController {
ObjectRestResponse
userDetailByToken
(
String
token
)
throws
Exception
{
ObjectRestResponse
userDetailByToken
(
String
token
)
throws
Exception
{
String
username
=
userAuthUtil
.
getInfoFromToken
(
token
).
getId
();
String
username
=
userAuthUtil
.
getInfoFromToken
(
token
).
getId
();
if
(
username
==
null
)
{
if
(
username
==
null
)
{
throw
new
BaseException
(
ResultCode
.
NOTEXIST_CODE
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
USER_NOTEXIST_CODE
,
ResultCode
.
getMsg
(
ResultCode
.
USER_NOTEXIST_CODE
));
,
new
HashSet
<
String
>()
{{
add
(
"用户名不存在!"
);}});
}
}
Integer
userid
=
Integer
.
parseInt
(
username
);
Integer
userid
=
Integer
.
parseInt
(
username
);
return
ObjectRestResponse
.
succ
(
getAppUserInfoById
(
userid
));
return
ObjectRestResponse
.
succ
(
getAppUserInfoById
(
userid
));
...
@@ -90,13 +87,11 @@ public class PublicController {
...
@@ -90,13 +87,11 @@ public class PublicController {
ObjectRestResponse
<
AppUserDTO
>
userDetailByUsername
(
String
name
)
throws
Exception
{
ObjectRestResponse
<
AppUserDTO
>
userDetailByUsername
(
String
name
)
throws
Exception
{
AppUserLogin
appUserLogin
;
AppUserLogin
appUserLogin
;
if
(
StrUtil
.
isBlank
(
name
))
{
if
(
StrUtil
.
isBlank
(
name
))
{
throw
new
BaseException
(
ResultCode
.
NOTEXIST_CODE
return
ObjectRestResponse
.
paramIsEmpty
();
,
new
HashSet
<
String
>()
{{
add
(
"用户名不存在!"
);}});
}
else
{
}
else
{
appUserLogin
=
appUserLoginBiz
.
selectOne
(
new
AppUserLogin
(){{
setUsername
(
name
);}});
appUserLogin
=
appUserLoginBiz
.
selectOne
(
new
AppUserLogin
(){{
setUsername
(
name
);}});
if
(
null
==
appUserLogin
)
{
if
(
null
==
appUserLogin
)
{
throw
new
BaseException
(
ResultCode
.
NOTEXIST_CODE
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
USER_NOTEXIST_CODE
,
ResultCode
.
getMsg
(
ResultCode
.
USER_NOTEXIST_CODE
));
,
new
HashSet
<
String
>()
{{
add
(
"用户名不存在!"
);}});
}
}
}
}
return
ObjectRestResponse
.
succ
(
getAppUserInfoById
(
appUserLogin
.
getId
()));
return
ObjectRestResponse
.
succ
(
getAppUserInfoById
(
appUserLogin
.
getId
()));
...
@@ -129,15 +124,15 @@ public class PublicController {
...
@@ -129,15 +124,15 @@ public class PublicController {
@RequestMapping
(
value
=
"/userinfo-by-uid"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/userinfo-by-uid"
,
method
=
RequestMethod
.
GET
)
public
@ResponseBody
public
@ResponseBody
ObjectRestResponse
userinfoByUid
(
Integer
uid
)
throws
Exception
{
ObjectRestResponse
<
User
>
userinfoByUid
(
Integer
uid
)
throws
Exception
{
if
(
uid
==
null
||
uid
==
0
)
{
if
(
uid
==
null
||
uid
==
0
)
{
throw
new
BaseException
();
return
ObjectRestResponse
.
paramIsEmpty
();
}
}
User
user
=
userBiz
.
getUserByUid
(
uid
);
User
user
=
userBiz
.
getUserByUid
(
uid
);
if
(
user
==
null
)
{
if
(
user
==
null
)
{
throw
new
BaseException
(
);
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
USER_NOTEXIST_CODE
,
ResultCode
.
getMsg
(
ResultCode
.
USER_NOTEXIST_CODE
)
);
}
}
return
new
ObjectRestResponse
<
User
>().
rel
(
true
).
data
(
user
);
return
ObjectRestResponse
.
succ
(
user
);
}
}
@GetMapping
(
"/getByUserIds"
)
@GetMapping
(
"/getByUserIds"
)
...
...
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