Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nouiWithSpringMVC
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
gechengyang
nouiWithSpringMVC
Commits
cd48e8d3
Commit
cd48e8d3
authored
Aug 04, 2020
by
cjh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重写nouicontext的logout方法
parent
d98d9df9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
6 deletions
+19
-6
NoUiContext.java
...n/java/org/sss/presentation/noui/context/NoUiContext.java
+3
-2
LoginController.java
...org/sss/presentation/noui/controller/LoginController.java
+1
-1
OpenTransInterceptor.java
...a/org/sss/presentation/noui/jwt/OpenTransInterceptor.java
+1
-1
RedisLoginInfo.java
...in/java/org/sss/presentation/noui/jwt/RedisLoginInfo.java
+13
-1
TokenInterceptor.java
.../java/org/sss/presentation/noui/jwt/TokenInterceptor.java
+1
-1
No files found.
src/main/java/org/sss/presentation/noui/context/NoUiContext.java
View file @
cd48e8d3
...
...
@@ -2,13 +2,14 @@ package org.sss.presentation.noui.context;
import
org.sss.common.impl.AbstractContext
;
import
org.sss.presentation.noui.jwt.RedisLoginInfo
;
import
org.sss.presentation.noui.util.NoUiUtils
;
import
org.sss.presentation.noui.util.RedisUtil
;
public
class
NoUiContext
extends
AbstractContext
{
@Override
public
void
logout
()
{
// TODO Auto-generated method stub
NoUiUtils
.
logout
(
redisLoginInfo
.
getUserId
(),
redisLoginInfo
.
getTerminalType
());
}
@Override
...
...
src/main/java/org/sss/presentation/noui/controller/LoginController.java
View file @
cd48e8d3
...
...
@@ -79,7 +79,7 @@ public class LoginController {
context
.
getSession
().
chain
(
true
,
"office"
);
byte
[]
sysmodBytes
=
NoUiPresentationUtil
.
sysmodToBytes
(
context
);
// redis中存储用户相关信息
RedisLoginInfo
redisLoginInfo
=
new
RedisLoginInfo
(
userId
,
token
,
NumericUtil
.
sessionTimeOut
(),
sysmodBytes
);
RedisLoginInfo
redisLoginInfo
=
new
RedisLoginInfo
(
userId
,
token
,
NumericUtil
.
sessionTimeOut
(),
sysmodBytes
,
noUiRequest
.
getTerminalType
()
);
RedisUtil
.
set
(
StringUtil
.
userUniqueId
(
noUiRequest
),
redisLoginInfo
);
return
ResultUtil
.
result
(
ErrorCodes
.
SUCCESS
,
ErrorCodes
.
SUCCESS_INFO
,
retDatamap
);
...
...
src/main/java/org/sss/presentation/noui/jwt/OpenTransInterceptor.java
View file @
cd48e8d3
...
...
@@ -49,7 +49,7 @@ public class OpenTransInterceptor implements HandlerInterceptor {
//如果是已登录状态,要刷新超时时间
if
(
redisLoginInfo
!=
null
&&
System
.
currentTimeMillis
()
<=
redisLoginInfo
.
getExpiredTime
())
{
// 重新刷入登陆时间
RedisLoginInfo
nweRedisLoginInfo
=
new
RedisLoginInfo
(
userId
,
token
,
NumericUtil
.
sessionTimeOut
(),
redisLoginInfo
.
getSysmod
());
RedisLoginInfo
nweRedisLoginInfo
=
new
RedisLoginInfo
(
userId
,
token
,
NumericUtil
.
sessionTimeOut
(),
redisLoginInfo
.
getSysmod
()
,
noUiRequest
.
getTerminalType
()
);
RedisUtil
.
set
(
Constants
.
SESSION
+
"."
+
userId
+
"."
+
terminalType
,
nweRedisLoginInfo
);
}
...
...
src/main/java/org/sss/presentation/noui/jwt/RedisLoginInfo.java
View file @
cd48e8d3
...
...
@@ -25,6 +25,9 @@ public class RedisLoginInfo implements Serializable {
*/
private
long
expiredTime
;
//终端类型
private
String
terminalType
;
private
Object
sysmod
;
private
Map
<
String
,
Object
>
contextMap
=
new
HashMap
<
String
,
Object
>();
...
...
@@ -41,11 +44,12 @@ public class RedisLoginInfo implements Serializable {
}
public
RedisLoginInfo
(
String
userId
,
String
token
,
long
expiredTime
,
Object
sysmod
)
{
public
RedisLoginInfo
(
String
userId
,
String
token
,
long
expiredTime
,
Object
sysmod
,
String
terminalType
)
{
this
.
userId
=
userId
;
this
.
token
=
token
;
this
.
expiredTime
=
expiredTime
;
this
.
sysmod
=
sysmod
;
this
.
terminalType
=
terminalType
;
}
public
String
getToken
()
{
...
...
@@ -80,4 +84,11 @@ public class RedisLoginInfo implements Serializable {
this
.
sysmod
=
sysmod
;
}
public
String
getTerminalType
()
{
return
terminalType
;
}
public
void
setTerminalType
(
String
terminalType
)
{
this
.
terminalType
=
terminalType
;
}
}
\ No newline at end of file
src/main/java/org/sss/presentation/noui/jwt/TokenInterceptor.java
View file @
cd48e8d3
...
...
@@ -76,7 +76,7 @@ public class TokenInterceptor implements HandlerInterceptor {
}
// 重新刷入登陆时间
RedisLoginInfo
nweRedisLoginInfo
=
new
RedisLoginInfo
(
userId
,
token
,
NumericUtil
.
sessionTimeOut
(),
redisLoginInfo
.
getSysmod
());
RedisLoginInfo
nweRedisLoginInfo
=
new
RedisLoginInfo
(
userId
,
token
,
NumericUtil
.
sessionTimeOut
(),
redisLoginInfo
.
getSysmod
()
,
terminalType
);
RedisUtil
.
set
(
Constants
.
SESSION
+
"."
+
userId
+
"."
+
terminalType
,
nweRedisLoginInfo
);
return
true
;
...
...
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