Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
smart_gov_platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
smart_gov_platform
Commits
d6cebe55
Commit
d6cebe55
authored
Aug 05, 2022
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改门户登录redistoken生成方案
parent
7fe649b7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
portal-manager/src/main/java/com/mortals/xhx/base/login/web/LoginController.java
.../java/com/mortals/xhx/base/login/web/LoginController.java
+11
-4
No files found.
portal-manager/src/main/java/com/mortals/xhx/base/login/web/LoginController.java
View file @
d6cebe55
...
...
@@ -12,6 +12,7 @@ import com.mortals.framework.util.DateUtils;
import
com.mortals.framework.util.StringUtils
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.common.code.YesNoEnum
;
import
com.mortals.xhx.common.key.Constant
;
import
com.mortals.xhx.common.pdu.SitePdu
;
import
com.mortals.xhx.feign.model.IApiModelFeign
;
import
com.mortals.xhx.feign.rsp.ApiResp
;
...
...
@@ -60,13 +61,15 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
loginForm
.
validate
();
userEntity
=
userService
.
doLogin
(
loginName
,
password
,
ip
);
userEntity
.
setLastLoginAddress
(
ip
);
List
<
MenuEntity
>
menuList
=
menuService
.
findTreeMenuByUser
(
userEntity
);
userEntity
.
setMenuList
(
menuList
);
userEntity
.
setLoginTime
(
System
.
currentTimeMillis
());
userEntity
.
setToken
(
IdUtil
.
fastSimpleUUID
());
String
tmpToken
=
userEntity
.
getId
()
+
":"
+
IdUtil
.
fastSimpleUUID
();
userEntity
.
setToken
(
tmpToken
);
userEntity
.
setExpireTime
(
DateUtils
.
addCurrDate
(
7
).
getTime
());
String
token
=
authTokenService
.
createToken
(
userEntity
);
data
.
put
(
"token"
,
token
);
List
<
MenuEntity
>
menuList
=
menuService
.
findTreeMenuByUser
(
userEntity
);
userEntity
.
setMenuList
(
menuList
);
data
.
put
(
"user"
,
userEntity
);
if
(
StringUtils
.
isNotEmpty
(
userEntity
.
getAreaCodes
())){
SitePdu
sitePdu
=
new
SitePdu
();
...
...
@@ -81,11 +84,15 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
data
.
put
(
"siteList"
,
apiResp
.
getData
().
get
(
"data"
));
}
recordSysLog
(
request
,
userEntity
,
"用户登录系统成功!"
);
ret
.
put
(
KEY_RESULT_DATA
,
data
);
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
ret
.
put
(
KEY_RESULT_MSG
,
"用户登录系统成功!"
);
//测试模糊获取所有redis中当前用户token
Set
<
String
>
hkeys
=
cacheService
.
hkeys
(
Constant
.
LOGIN_TOKEN_KEY
+
userEntity
.
getId
()
+
":*"
);
log
.
info
(
"loginKeys:{}"
,
JSON
.
toJSONString
(
hkeys
));
return
ret
.
toJSONString
();
}
catch
(
Exception
e
)
{
log
.
error
(
"login error "
,
e
);
...
...
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