diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysUserServiceImpl.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysUserServiceImpl.java index edea42caf..8590a0edc 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysUserServiceImpl.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysUserServiceImpl.java @@ -204,11 +204,9 @@ public Boolean deleteUserByIds(Long[] ids) { @Override @CacheEvict(value = CacheConstants.USER_DETAILS, key = "#userDto.username") public R updateUserInfo(UserDTO userDto) { - UserVO userVO = baseMapper.getUserVoById(SecurityUtils.getUser().getId()); - SysUser sysUser = new SysUser(); sysUser.setPhone(userDto.getPhone()); - sysUser.setUserId(userVO.getUserId()); + sysUser.setUserId(SecurityUtils.getUser().getId()); sysUser.setAvatar(userDto.getAvatar()); sysUser.setNickname(userDto.getNickname()); sysUser.setName(userDto.getName()); @@ -259,7 +257,7 @@ public List listUser(UserDTO userDTO) { // 根据数据权限查询全部的用户信息 List voList = baseMapper.selectVoList(userDTO); // 转换成execl 对象输出 - List userExcelVOList = voList.stream().map(userVO -> { + return voList.stream().map(userVO -> { UserExcelVO excelVO = new UserExcelVO(); BeanUtils.copyProperties(userVO, excelVO); String roleNameList = userVO.getRoleList() @@ -274,7 +272,6 @@ public List listUser(UserDTO userDTO) { excelVO.setPostNameList(postNameList); return excelVO; }).collect(Collectors.toList()); - return userExcelVOList; } /** @@ -412,8 +409,8 @@ public R lockUser(String username) { @Override @CacheEvict(value = CacheConstants.USER_DETAILS, key = "#userDto.username") public R changePassword(UserDTO userDto) { - UserVO userVO = baseMapper.getUserVoById(SecurityUtils.getUser().getId()); - if (Objects.isNull(userVO)) { + SysUser sysUser = baseMapper.selectById(SecurityUtils.getUser().getId()); + if (Objects.isNull(sysUser)) { return R.failed("用户不存在"); } @@ -421,7 +418,7 @@ public R changePassword(UserDTO userDto) { return R.failed("原密码不能为空"); } - if (!ENCODER.matches(userDto.getPassword(), userVO.getPassword())) { + if (!ENCODER.matches(userDto.getPassword(), sysUser.getPassword())) { log.info("原密码错误,修改个人信息失败:{}", userDto.getUsername()); return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_USER_UPDATE_PASSWORDERROR)); } @@ -433,7 +430,7 @@ public R changePassword(UserDTO userDto) { this.update(Wrappers.lambdaUpdate() .set(SysUser::getPassword, password) - .eq(SysUser::getUserId, userVO.getUserId())); + .eq(SysUser::getUserId, sysUser.getUserId())); return R.ok(); }