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
ab4d1bed
Commit
ab4d1bed
authored
4 years ago
by
fukai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加userinr至redisinfo。支持登出
parent
decb74c4
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
3 deletions
+27
-3
LoginController.java
...org/sss/presentation/noui/controller/LoginController.java
+14
-2
RedisLoginInfo.java
...in/java/org/sss/presentation/noui/jwt/RedisLoginInfo.java
+12
-0
NoUiUtils.java
src/main/java/org/sss/presentation/noui/util/NoUiUtils.java
+1
-1
No files found.
src/main/java/org/sss/presentation/noui/controller/LoginController.java
View file @
ab4d1bed
...
...
@@ -5,6 +5,7 @@ import log.LogFactory;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.*
;
import
org.sss.common.model.IDatafield
;
import
org.sss.common.model.ILoginContext
;
import
org.sss.common.model.IMenuItem
;
import
org.sss.presentation.noui.api.model.Menu
;
...
...
@@ -89,7 +90,11 @@ public class LoginController {
context
.
getSession
().
chain
(
true
,
"office"
);
byte
[]
sysmodBytes
=
NoUiPresentationUtil
.
sysmodToBytes
(
context
);
// redis中存储用户相关信息
IDatafield
inridf
=
(
IDatafield
)
context
.
getSession
().
getBaseObject
(
context
.
getRoot
(),
"sysmod\\usr\\inr"
);
RedisLoginInfo
redisLoginInfo
=
new
RedisLoginInfo
(
userId
,
token
,
NumericUtil
.
sessionTimeOut
(),
sysmodBytes
,
noUiRequest
.
getTerminalType
());
redisLoginInfo
.
setUserInr
((
String
)
inridf
.
getValue
());
//设置当前用户主键
RedisUtil
.
set
(
StringUtil
.
userUniqueId
(
noUiRequest
),
redisLoginInfo
);
//解决初次登陆,超期限登陆
...
...
@@ -147,10 +152,17 @@ public class LoginController {
@ResponseBody
@RequestMapping
(
value
=
"/logout"
,
method
=
RequestMethod
.
POST
)
public
Object
logout
(
@RequestBody
Map
<
String
,
Object
>
dataMap
,
HttpServletRequest
request
,
HttpSession
session
)
{
public
Object
logout
(
HttpServletRequest
request
,
HttpSession
session
)
{
try
{
NoUiRequest
noUiRequest
=
new
NoUiRequest
(
request
,
""
,
null
);
RedisUtil
.
delete
(
StringUtil
.
userUniqueId
(
noUiRequest
));
return
ResultUtil
.
result
(
ErrorCodes
.
SUCCESS
,
"退出成功"
,
null
);
}
catch
(
Exception
e
)
{
return
"ok"
;
}
return
ResultUtil
.
result
(
ErrorCodes
.
ERROR
,
"退出失败"
,
null
);
}
}
This diff is collapsed.
Click to expand it.
src/main/java/org/sss/presentation/noui/jwt/RedisLoginInfo.java
View file @
ab4d1bed
...
...
@@ -10,6 +10,10 @@ public class RedisLoginInfo implements Serializable {
*/
private
static
final
long
serialVersionUID
=
8116817810829835862L
;
private
String
userInr
;
/**
* 用户id
*/
...
...
@@ -91,4 +95,11 @@ public class RedisLoginInfo implements Serializable {
public
void
setTerminalType
(
String
terminalType
)
{
this
.
terminalType
=
terminalType
;
}
public
void
setUserInr
(
String
value
)
{
this
.
userInr
=
value
;
}
public
String
getUserInr
()
{
return
userInr
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main/java/org/sss/presentation/noui/util/NoUiUtils.java
View file @
ab4d1bed
...
...
@@ -153,7 +153,7 @@ public class NoUiUtils {
public
static
String
genSafeCode
(
String
[]
keyParams
)
{
StringBuilder
sb
=
new
StringBuilder
();
sb
=
sb
.
append
(
tl
.
get
().
getUserI
d
()).
reverse
();
sb
=
sb
.
append
(
tl
.
get
().
getUserI
nr
()).
reverse
();
for
(
String
item
:
keyParams
)
{
sb
.
append
(
item
);
...
...
This diff is collapsed.
Click to expand it.
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