Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
shiziyuan9527 2020-05-11 15:49:34 +08:00
commit 261f4087b7
3 changed files with 14 additions and 8 deletions

View File

@ -32,6 +32,7 @@
</if> </if>
</where> </where>
</select> </select>
<!--修改密码--> <!--修改密码-->
<update id="updatePassword" parameterType="io.metersphere.base.domain.User"> <update id="updatePassword" parameterType="io.metersphere.base.domain.User">
update user update user

View File

@ -9,8 +9,8 @@ import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager; import io.metersphere.commons.utils.Pager;
import io.metersphere.controller.request.UserRequest; import io.metersphere.controller.request.UserRequest;
import io.metersphere.controller.request.member.AddMemberRequest; import io.metersphere.controller.request.member.AddMemberRequest;
import io.metersphere.controller.request.member.QueryMemberRequest;
import io.metersphere.controller.request.member.EditPassWordRequest; import io.metersphere.controller.request.member.EditPassWordRequest;
import io.metersphere.controller.request.member.QueryMemberRequest;
import io.metersphere.controller.request.organization.AddOrgMemberRequest; import io.metersphere.controller.request.organization.AddOrgMemberRequest;
import io.metersphere.controller.request.organization.QueryOrgMemberRequest; import io.metersphere.controller.request.organization.QueryOrgMemberRequest;
import io.metersphere.dto.UserDTO; import io.metersphere.dto.UserDTO;
@ -250,6 +250,7 @@ public class UserController {
public List<User> getBesideOrgMemberList(@PathVariable String orgId) { public List<User> getBesideOrgMemberList(@PathVariable String orgId) {
return userService.getBesideOrgMemberList(orgId); return userService.getBesideOrgMemberList(orgId);
} }
/* /*
* 修改当前用户密码 * 修改当前用户密码
* */ * */
@ -257,6 +258,7 @@ public class UserController {
public int updateCurrentUserPassword(@RequestBody EditPassWordRequest request) { public int updateCurrentUserPassword(@RequestBody EditPassWordRequest request) {
return userService.updateCurrentUserPassword(request); return userService.updateCurrentUserPassword(request);
} }
/*管理员修改用户密码*/ /*管理员修改用户密码*/
@PostMapping("/special/password") @PostMapping("/special/password")
public int updateUserPassword(@RequestBody EditPassWordRequest request) { public int updateUserPassword(@RequestBody EditPassWordRequest request) {

View File

@ -277,12 +277,13 @@ public class UserService {
userMapper.updateByPrimaryKeySelective(newUser); userMapper.updateByPrimaryKeySelective(newUser);
} }
/*修改当前用户用户密码*/ /*修改当前用户用户密码*/
private User updateCurrentUserPwd(EditPassWordRequest request) { private User updateCurrentUserPwd(EditPassWordRequest request) {
if (SessionUtils.getUser() != null) { if (SessionUtils.getUser() != null) {
User user = userMapper.selectByPrimaryKey(SessionUtils.getUser().getId()); User user = userMapper.selectByPrimaryKey(SessionUtils.getUser().getId());
String pwd = user.getPassword(); String pwd = user.getPassword();
String prepwd = CodingUtil.md5(request.getPassword(),"utf-8"); String prepwd = CodingUtil.md5(request.getPassword(), "utf-8");
String newped = request.getNewpassword(); String newped = request.getNewpassword();
if (StringUtils.isNotBlank(prepwd)) { if (StringUtils.isNotBlank(prepwd)) {
if (prepwd.trim().equals(pwd.trim())) { if (prepwd.trim().equals(pwd.trim())) {
@ -300,16 +301,18 @@ public class UserService {
User user = updateCurrentUserPwd(request); User user = updateCurrentUserPwd(request);
return extUserMapper.updatePassword(user); return extUserMapper.updatePassword(user);
} }
/*管理员修改用户密码*/ /*管理员修改用户密码*/
private User updateUserPwd(EditPassWordRequest request){ private User updateUserPwd(EditPassWordRequest request) {
User user= userMapper.selectByPrimaryKey(request.getId()); User user = userMapper.selectByPrimaryKey(request.getId());
String newped = request.getNewpassword(); String newped = request.getNewpassword();
user.setPassword(CodingUtil.md5(newped)); user.setPassword(CodingUtil.md5(newped));
user.setUpdateTime(System.currentTimeMillis()); user.setUpdateTime(System.currentTimeMillis());
return user; return user;
} }
public int updateUserPassword(EditPassWordRequest request){
User user=updateUserPwd(request); public int updateUserPassword(EditPassWordRequest request) {
User user = updateUserPwd(request);
return extUserMapper.updatePassword(user); return extUserMapper.updatePassword(user);
} }