Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cloud-backend
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
framework
cloud-backend
Commits
d82c2710
Commit
d82c2710
authored
Jan 27, 2022
by
袁伟铭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.0.0
parent
c689db66
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
19 deletions
+12
-19
user-server/src/main/java/com/zq/user/config/TokenProvider.java
+1
-1
user-server/src/main/java/com/zq/user/service/UserService.java
+1
-1
xxx-common-utils/src/main/java/com/zq/common/context/ContextUtils.java
+1
-1
xxx-common-utils/src/main/java/com/zq/common/utils/PagingUtils.java
+4
-15
xxx-common-utils/src/main/java/com/zq/common/vo/ApiTokenVo.java
+5
-1
No files found.
user-server/src/main/java/com/zq/user/config/TokenProvider.java
View file @
d82c2710
...
...
@@ -25,6 +25,7 @@ import io.jsonwebtoken.Jwts;
import
io.jsonwebtoken.SignatureAlgorithm
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.security.authentication.UsernamePasswordAuthenticationToken
;
import
org.springframework.security.core.Authentication
;
...
...
@@ -32,7 +33,6 @@ import org.springframework.security.core.GrantedAuthority;
import
org.springframework.security.core.authority.SimpleGrantedAuthority
;
import
org.springframework.security.core.userdetails.User
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.StringUtils
;
import
javax.crypto.spec.SecretKeySpec
;
import
javax.servlet.http.HttpServletRequest
;
...
...
user-server/src/main/java/com/zq/user/service/UserService.java
View file @
d82c2710
...
...
@@ -109,7 +109,7 @@ public class UserService {
private
ApiTokenVo
getApiToken
(
AppUser
appUser
)
{
ApiTokenVo
tokenVo
=
ApiTokenVo
.
builder
()
.
userId
(
appUser
.
getId
())
.
userId
(
appUser
.
getId
()
.
toString
()
)
.
account
(
appUser
.
getAccount
())
.
phone
(
appUser
.
getPhone
())
.
realname
(
appUser
.
getRealname
())
...
...
xxx-common-utils/src/main/java/com/zq/common/context/ContextUtils.java
View file @
d82c2710
...
...
@@ -27,7 +27,7 @@ public class ContextUtils {
return
ThreadContext
.
get
(
APP_TOKEN_CONTEXT_KEY
);
}
public
static
Lo
ng
getUserUserId
()
{
public
static
Stri
ng
getUserUserId
()
{
ApiTokenVo
apiTokenVo
=
ThreadContext
.
get
(
APP_TOKEN_CONTEXT_KEY
);
return
apiTokenVo
==
null
?
null
:
apiTokenVo
.
getUserId
();
}
...
...
xxx-common-utils/src/main/java/com/zq/common/utils/PagingUtils.java
View file @
d82c2710
...
...
@@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.github.pagehelper.PageHelper
;
import
com.zq.common.exception.BusinessException
;
import
com.zq.common.vo.PageReqVo
;
import
com.zq.common.vo.PageVo
;
...
...
@@ -49,13 +48,8 @@ public class PagingUtils {
* @return
*/
public
static
<
R
,
Q
extends
PageReqVo
>
PageVo
<
R
>
paging
(
Q
reqVo
,
BaseMapper
<
R
>
mapper
,
Class
<
R
>
clazz
)
{
R
instance
;
try
{
instance
=
clazz
.
newInstance
();
}
catch
(
InstantiationException
|
IllegalAccessException
e
)
{
throw
new
BusinessException
(
"分页类型转换错误"
);
}
BeanUtil
.
copyProperties
(
reqVo
,
instance
);
R
instance
=
BeanUtil
.
copyProperties
(
reqVo
,
clazz
);
IPage
<
R
>
page
=
new
Page
<>(
reqVo
.
getPage
(),
reqVo
.
getSize
());
page
=
mapper
.
selectPage
(
page
,
Wrappers
.
lambdaQuery
(
instance
));
return
PageVo
.
ofReqVo
(
reqVo
,
page
.
getRecords
(),
Long
.
valueOf
(
page
.
getTotal
()).
intValue
());
...
...
@@ -90,13 +84,8 @@ public class PagingUtils {
*/
@SuppressWarnings
(
"all"
)
public
static
<
R
,
Q
extends
PageReqVo
>
PageVo
<
R
>
paging
(
Q
reqVo
,
BaseMapper
<
R
>
mapper
,
Class
<
R
>
clazz
,
LambdaQueryWrapper
<
R
>
lambdaQuery
)
{
R
instance
;
try
{
instance
=
clazz
.
newInstance
();
}
catch
(
InstantiationException
|
IllegalAccessException
e
)
{
throw
new
BusinessException
(
"分页类型转换错误"
);
}
BeanUtil
.
copyProperties
(
reqVo
,
instance
);
R
instance
=
BeanUtil
.
copyProperties
(
reqVo
,
clazz
);
IPage
<
R
>
page
=
new
Page
<>(
reqVo
.
getPage
(),
reqVo
.
getSize
());
page
=
mapper
.
selectPage
(
page
,
lambdaQuery
.
setEntity
(
instance
));
return
PageVo
.
ofReqVo
(
reqVo
,
page
.
getRecords
(),
Long
.
valueOf
(
page
.
getTotal
()).
intValue
());
...
...
xxx-common-utils/src/main/java/com/zq/common/vo/ApiTokenVo.java
View file @
d82c2710
...
...
@@ -5,13 +5,17 @@ import lombok.Builder;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @author wilmiam
* @since 2022-01-27 11:13
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public
class
ApiTokenVo
{
private
Lo
ng
userId
;
private
Stri
ng
userId
;
private
String
account
;
...
...
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