Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
H
hzsomms
Project
Project
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
ZTGK
hzsomms
Commits
9e192b2f
Commit
9e192b2f
authored
Jul 26, 2024
by
hkl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:1.性能测试修改密码
parent
f15ae48d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
104 additions
and
40 deletions
+104
-40
pom.xml
jeecg-module-system/pom.xml
+4
-4
SysUserController.java
...rg/jeecg/modules/system/controller/SysUserController.java
+59
-14
UserChangePasswordDTO.java
...org/jeecg/modules/system/model/UserChangePasswordDTO.java
+23
-0
application-test.yml
jeecg-module-system/src/main/resources/application-test.yml
+18
-22
No files found.
jeecg-module-system/pom.xml
View file @
9e192b2f
...
@@ -65,10 +65,6 @@
...
@@ -65,10 +65,6 @@
<properties>
<properties>
<package.environment>
dev
</package.environment>
<package.environment>
dev
</package.environment>
</properties>
</properties>
<!-- 是否默认 true表示默认-->
<activation>
<activeByDefault>
true
</activeByDefault>
</activation>
</profile>
</profile>
<!-- 测试环境 -->
<!-- 测试环境 -->
...
@@ -77,6 +73,10 @@
...
@@ -77,6 +73,10 @@
<properties>
<properties>
<package.environment>
test
</package.environment>
<package.environment>
test
</package.environment>
</properties>
</properties>
<!-- 是否默认 true表示默认-->
<activation>
<activeByDefault>
true
</activeByDefault>
</activation>
</profile>
</profile>
<!-- 生成环境环境-->
<!-- 生成环境环境-->
...
...
jeecg-module-system/src/main/java/org/jeecg/modules/system/controller/SysUserController.java
View file @
9e192b2f
...
@@ -41,6 +41,7 @@ import org.jeecg.modules.base.service.BaseCommonService;
...
@@ -41,6 +41,7 @@ import org.jeecg.modules.base.service.BaseCommonService;
import
org.jeecg.modules.system.entity.*
;
import
org.jeecg.modules.system.entity.*
;
import
org.jeecg.modules.system.model.DepartIdModel
;
import
org.jeecg.modules.system.model.DepartIdModel
;
import
org.jeecg.modules.system.model.SysUserSysDepartModel
;
import
org.jeecg.modules.system.model.SysUserSysDepartModel
;
import
org.jeecg.modules.system.model.UserChangePasswordDTO
;
import
org.jeecg.modules.system.service.*
;
import
org.jeecg.modules.system.service.*
;
import
org.jeecg.modules.system.vo.SysDepartUsersVO
;
import
org.jeecg.modules.system.vo.SysDepartUsersVO
;
import
org.jeecg.modules.system.vo.SysUserRoleVO
;
import
org.jeecg.modules.system.vo.SysUserRoleVO
;
...
@@ -53,6 +54,7 @@ import org.jeecgframework.poi.excel.entity.ImportParams;
...
@@ -53,6 +54,7 @@ import org.jeecgframework.poi.excel.entity.ImportParams;
import
org.jeecgframework.poi.excel.view.JeecgEntityExcelView
;
import
org.jeecgframework.poi.excel.view.JeecgEntityExcelView
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartHttpServletRequest
;
import
org.springframework.web.multipart.MultipartHttpServletRequest
;
...
@@ -441,24 +443,67 @@ public class SysUserController {
...
@@ -441,24 +443,67 @@ public class SysUserController {
return
result
;
return
result
;
}
}
/**
@PutMapping
(
value
=
"/changePassword"
)
* 修改密码
@ApiOperation
(
"修改密码"
)
*/
public
Result
<?>
changePassword
(
@RequestBody
UserChangePasswordDTO
user
)
{
//@RequiresPermissions("system:user:changepwd")
if
(
ObjectUtil
.
isEmpty
(
user
.
getOldPassword
()))
{
@RequestMapping
(
value
=
"/changePassword"
,
method
=
RequestMethod
.
PUT
)
return
Result
.
error
(
"旧密码不能为空"
);
public
Result
<?>
changePassword
(
@RequestBody
SysUser
sysUser
)
{
SysUser
u
=
this
.
sysUserService
.
getOne
(
new
LambdaQueryWrapper
<
SysUser
>().
eq
(
SysUser:
:
getUsername
,
sysUser
.
getUsername
()));
if
(
u
==
null
)
{
return
Result
.
error
(
"用户不存在!"
);
}
}
sysUser
.
setId
(
u
.
getId
());
if
(
ObjectUtil
.
isEmpty
(
user
.
getNewPassword
()))
{
//update-begin---author:wangshuai ---date:20220316 for:[VUEN-234]修改密码添加敏感日志------------
return
Result
.
error
(
"新密码不能为空"
);
}
if
(
ObjectUtil
.
isEmpty
(
user
.
getConfirmNewPassword
()))
{
return
Result
.
error
(
"确认密码不能为空"
);
}
if
(!
user
.
getConfirmNewPassword
().
equals
(
user
.
getNewPassword
()))
{
return
Result
.
error
(
"新密码和确认新密码不一致"
);
}
// 获取当前用户
LoginUser
loginUser
=
(
LoginUser
)
SecurityUtils
.
getSubject
().
getPrincipal
();
LoginUser
loginUser
=
(
LoginUser
)
SecurityUtils
.
getSubject
().
getPrincipal
();
baseCommonService
.
addLog
(
"修改用户 "
+
sysUser
.
getUsername
()
+
" 的密码,操作人: "
+
loginUser
.
getUsername
(),
CommonConstant
.
LOG_TYPE_2
,
2
);
if
(
loginUser
==
null
)
{
//update-end---author:wangshuai ---date:20220316 for:[VUEN-234]修改密码添加敏感日志------------
return
Result
.
error
(
"当前登录用户失效,请登录"
);
return
sysUserService
.
changePassword
(
sysUser
);
}
}
SysUser
currentUser
=
this
.
sysUserService
.
getById
(
loginUser
.
getId
());
if
(
currentUser
==
null
)
{
return
Result
.
error
(
"当前用户不存在,请联系管理员"
);
}
String
userpassword
=
PasswordUtil
.
encrypt
(
currentUser
.
getUsername
(),
user
.
getOldPassword
(),
currentUser
.
getSalt
());
if
(!
userpassword
.
equals
(
currentUser
.
getPassword
()))
{
return
Result
.
error
(
"原密码错误请重新在输入"
);
}
// 修改密码
String
salt
=
oConvertUtils
.
randomGen
(
8
);
currentUser
.
setSalt
(
salt
);
String
password
=
user
.
getNewPassword
();
String
passwordEncode
=
PasswordUtil
.
encrypt
(
currentUser
.
getUsername
(),
password
,
salt
);
currentUser
.
setPassword
(
passwordEncode
);
this
.
sysUserService
.
updateById
(
currentUser
);
return
Result
.
ok
(
"修改成功"
);
}
// /**
// * 修改密码
// */
// //@RequiresPermissions("system:user:changepwd")
// @RequestMapping(value = "/changePassword", method = RequestMethod.PUT)
// public Result<?> changePassword(@RequestBody SysUser sysUser) {
// SysUser u = this.sysUserService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUsername, sysUser.getUsername()));
// if (u == null) {
// return Result.error("用户不存在!");
// }
// sysUser.setId(u.getId());
// //update-begin---author:wangshuai ---date:20220316 for:[VUEN-234]修改密码添加敏感日志------------
// LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
// baseCommonService.addLog("修改用户 " + sysUser.getUsername() + " 的密码,操作人: " + loginUser.getUsername(), CommonConstant.LOG_TYPE_2, 2);
// //update-end---author:wangshuai ---date:20220316 for:[VUEN-234]修改密码添加敏感日志------------
// return sysUserService.changePassword(sysUser);
// }
/**
/**
* 查询指定用户和部门关联的数据
* 查询指定用户和部门关联的数据
*
*
...
...
jeecg-module-system/src/main/java/org/jeecg/modules/system/model/UserChangePasswordDTO.java
0 → 100644
View file @
9e192b2f
package
org
.
jeecg
.
modules
.
system
.
model
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
@Data
@ApiModel
(
value
=
"UserChangePasswordDTO对象"
,
description
=
"用户管理-修改密码"
)
public
class
UserChangePasswordDTO
{
@ApiModelProperty
(
"旧密码"
)
private
String
oldPassword
;
@ApiModelProperty
(
"新密码"
)
private
String
newPassword
;
@ApiModelProperty
(
"确认新密码"
)
private
String
confirmNewPassword
;
}
jeecg-module-system/src/main/resources/application-test.yml
View file @
9e192b2f
server
:
server
:
port
:
1700
1
port
:
1700
2
tomcat
:
tomcat
:
max-swallow-size
:
-1
max-swallow-size
:
-1
error
:
error
:
...
@@ -99,12 +99,12 @@ spring:
...
@@ -99,12 +99,12 @@ spring:
datasource
:
datasource
:
druid
:
druid
:
stat-view-servlet
:
stat-view-servlet
:
enabled
:
tru
e
enabled
:
fals
e
loginUsername
:
admin
loginUsername
:
lkjxlkjslkfjl1dsaf
loginPassword
:
123456
loginPassword
:
alqw1w55+1234jkdf1234
allow
:
allow
:
web-stat-filter
:
web-stat-filter
:
enabled
:
tru
e
enabled
:
fals
e
dynamic
:
dynamic
:
druid
:
# 全局druid参数,绝大部分值和默认保持一致。(现已支持的参数如下,不清楚含义不要乱设置)
druid
:
# 全局druid参数,绝大部分值和默认保持一致。(现已支持的参数如下,不清楚含义不要乱设置)
# 连接池的配置信息
# 连接池的配置信息
...
@@ -131,20 +131,14 @@ spring:
...
@@ -131,20 +131,14 @@ spring:
connectionProperties
:
druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
connectionProperties
:
druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
datasource
:
datasource
:
master
:
master
:
url
:
jdbc:mysql://1
27.0.0.1:3306/hzgw3
?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&zeroDateTimeBehavior=convertToNull
url
:
jdbc:mysql://1
92.168.81.83:3306/hzgw
?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&zeroDateTimeBehavior=convertToNull
username
:
root
username
:
root
password
:
superAdmin&321
password
:
ABCD@abcd+1234
driver-class-name
:
com.mysql.cj.jdbc.Driver
driver-class-name
:
com.mysql.cj.jdbc.Driver
# 多数据源配置
#multi-datasource1:
#url: jdbc:mysql://localhost:3306/jeecg-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
#username: root
#password: root
#driver-class-name: com.mysql.cj.jdbc.Driver
#redis 配置
#redis 配置
redis
:
redis
:
database
:
0
database
:
9
host
:
127.0.0.1
host
:
47.94.207.62
lettuce
:
lettuce
:
pool
:
pool
:
max-active
:
8
#最大连接数据库连接数,设 0 为没有限制
max-active
:
8
#最大连接数据库连接数,设 0 为没有限制
...
@@ -167,7 +161,7 @@ mybatis-plus:
...
@@ -167,7 +161,7 @@ mybatis-plus:
table-underline
:
true
table-underline
:
true
configuration
:
configuration
:
# 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
# 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# 返回类型为Map,显示null对应的字段
# 返回类型为Map,显示null对应的字段
call-setters-on-nulls
:
true
call-setters-on-nulls
:
true
#jeecg专用配置
#jeecg专用配置
...
@@ -184,13 +178,13 @@ jeecg:
...
@@ -184,13 +178,13 @@ jeecg:
uploadType
:
local
uploadType
:
local
# 前端访问地址
# 前端访问地址
domainUrl
:
domainUrl
:
pc
:
http
://localhost:3100
pc
:
http
s://dtgwgd.mtros.cn:19908
app
:
http
://localhost:8051
app
:
http
s://dtgwgd.mtros.cn:19908
path
:
path
:
#文件上传根目录 设置
#文件上传根目录 设置
upload
:
/opt/
ztgk/
file
upload
:
/opt/file
#webapp文件路径
#webapp文件路径
webapp
:
/opt/
ztgk/
file
webapp
:
/opt/file
shiro
:
shiro
:
excludeUrls
:
/test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**
excludeUrls
:
/test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**
#阿里云oss存储和大鱼短信秘钥配置
#阿里云oss存储和大鱼短信秘钥配置
...
@@ -206,7 +200,7 @@ jeecg:
...
@@ -206,7 +200,7 @@ jeecg:
cluster-nodes
:
81.70.47.128:9200
cluster-nodes
:
81.70.47.128:9200
check-enabled
:
false
check-enabled
:
false
# 在线预览文件服务器地址配置
# 在线预览文件服务器地址配置
file-view-domain
:
http
://47.94.207.62
file-view-domain
:
http
s://dtgwgd.mtros.cn:19908
# minio文件上传
# minio文件上传
minio
:
minio
:
minio_url
:
http://minio.jeecg.com
minio_url
:
http://minio.jeecg.com
...
@@ -247,6 +241,7 @@ jeecg:
...
@@ -247,6 +241,7 @@ jeecg:
logging
:
logging
:
level
:
level
:
org.jeecg.modules.system.mapper
:
info
org.jeecg.modules.system.mapper
:
info
register-shutdown-hook
:
#cas单点登录
#cas单点登录
cas
:
cas
:
prefixUrl
:
http://cas.example.org:8443/cas
prefixUrl
:
http://cas.example.org:8443/cas
...
@@ -308,9 +303,10 @@ third-app:
...
@@ -308,9 +303,10 @@ third-app:
# appSecret
# appSecret
client-secret
:
??
client-secret
:
??
agent-id
:
??
agent-id
:
??
# 统一身份证
# 统一身份证
iam
:
iam
:
postUserInfoUrl
:
http
://47.110.134.43:15105
/common-uuv/login/user/temp-code
postUserInfoUrl
:
http
s://api.mtros.cn:8899
/common-uuv/login/user/temp-code
# 获取用户信息成功状态码
# 获取用户信息成功状态码
getUserInfoSucceed
:
ok
getUserInfoSucceed
:
ok
defaultRoleCode
:
GW_GCS
defaultRoleCode
:
GW_GCS
\ 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