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
58f923e5
Commit
58f923e5
authored
Nov 16, 2022
by
廖旭伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增管理员修改用户密码接口
parent
1e698e4a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
0 deletions
+45
-0
portal-manager/src/main/java/com/mortals/xhx/module/user/service/UserService.java
...java/com/mortals/xhx/module/user/service/UserService.java
+10
-0
portal-manager/src/main/java/com/mortals/xhx/module/user/service/impl/UserServiceImpl.java
...mortals/xhx/module/user/service/impl/UserServiceImpl.java
+21
-0
portal-manager/src/main/java/com/mortals/xhx/module/user/web/UserController.java
.../java/com/mortals/xhx/module/user/web/UserController.java
+14
-0
No files found.
portal-manager/src/main/java/com/mortals/xhx/module/user/service/UserService.java
View file @
58f923e5
...
@@ -74,4 +74,14 @@ public interface UserService extends ICRUDService<UserEntity,Long>{
...
@@ -74,4 +74,14 @@ public interface UserService extends ICRUDService<UserEntity,Long>{
*/
*/
void
synchSitesAuth
()
throws
AppException
;
void
synchSitesAuth
()
throws
AppException
;
/**
* 重置密码
*
* @param loginName
* @param newPwd
* @return
* @throws AppException
*/
boolean
resetUserPwd
(
String
loginName
,
String
newPwd
,
Context
context
)
throws
AppException
;
}
}
\ No newline at end of file
portal-manager/src/main/java/com/mortals/xhx/module/user/service/impl/UserServiceImpl.java
View file @
58f923e5
...
@@ -289,6 +289,27 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
...
@@ -289,6 +289,27 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
});
});
}
}
@Override
public
boolean
resetUserPwd
(
String
loginName
,
String
newPwd
,
Context
context
)
throws
AppException
{
if
(
context
==
null
){
throw
new
AppException
(
"登录过期!"
);
}
if
(
context
.
getUser
().
getId
()!=
1
){
throw
new
AppException
(
"当前用户非管理员,不能使用此功能"
);
}
UserEntity
sysUser
=
this
.
findByLoginName
(
loginName
);
if
(
sysUser
==
null
||
!
sysUser
.
getLoginName
().
equals
(
loginName
))
{
throw
new
AppException
(
"帐号错误!"
);
}
try
{
sysUser
.
setLoginPwd
(
SecurityUtil
.
md5DoubleEncoding
(
newPwd
));
}
catch
(
Exception
e
)
{
throw
new
AppException
(
"密码转换异常!"
,
e
);
}
dao
.
update
(
sysUser
);
return
true
;
}
private
void
updateRedisUserSession
(
UserEntity
userEntity
)
{
private
void
updateRedisUserSession
(
UserEntity
userEntity
)
{
Set
<
String
>
keys
=
cacheService
.
scan
(
Constant
.
LOGIN_TOKEN_KEY
+
userEntity
.
getId
());
Set
<
String
>
keys
=
cacheService
.
scan
(
Constant
.
LOGIN_TOKEN_KEY
+
userEntity
.
getId
());
keys
.
forEach
(
key
->
{
keys
.
forEach
(
key
->
{
...
...
portal-manager/src/main/java/com/mortals/xhx/module/user/web/UserController.java
View file @
58f923e5
...
@@ -244,4 +244,18 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
...
@@ -244,4 +244,18 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
ret
.
setMsg
(
model
.
get
(
"message_info"
)
==
null
?
""
:
model
.
remove
(
"message_info"
).
toString
());
ret
.
setMsg
(
model
.
get
(
"message_info"
)
==
null
?
""
:
model
.
remove
(
"message_info"
).
toString
());
return
ret
;
return
ret
;
}
}
@RequestMapping
(
value
=
"reset/password"
,
method
=
RequestMethod
.
POST
)
public
String
resetPassword
(
@RequestBody
UserEntity
entity
)
{
JSONObject
ret
=
new
JSONObject
();
try
{
service
.
resetUserPwd
(
entity
.
getLoginName
(),
entity
.
getNewPwd
(),
this
.
getContext
());
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
ret
.
put
(
KEY_RESULT_MSG
,
"密码修改成功!"
);
}
catch
(
Exception
e
)
{
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_FAILURE
);
ret
.
put
(
KEY_RESULT_MSG
,
super
.
convertException
(
e
));
}
return
ret
.
toJSONString
();
}
}
}
\ No newline at end of file
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