| | |
| | | import com.doumee.biz.system.SystemUserBiz; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.utils.PwdCheckUtil; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.system.dto.CreateSystemUserDTO; |
| | | import com.doumee.dao.system.dto.CreateUserRoleDTO; |
| | |
| | | |
| | | @Override |
| | | public void updatePwd(UpdatePwdDto dto) { |
| | | if(StringUtils.isBlank(dto.getNewPwd()) |
| | | ||dto.getNewPwd().length()>20 |
| | | ||dto.getNewPwd().length()<6 |
| | | ||!PwdCheckUtil.checkPassword(dto.getNewPwd())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,密码复杂度不满足要求:6-20个字符,至少包含字母、数字及特殊字符2种"); |
| | | } |
| | | SystemUser user = systemUserService.findById(dto.getUserId()); |
| | | if (user.getDeleted()) { |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "用户不存在或已被删除"); |
| | |
| | | |
| | | @Override |
| | | public void resetPwd(ResetSystemUserPwdDTO dto) { |
| | | if(StringUtils.isBlank(dto.getPassword()) |
| | | ||dto.getPassword().length()>20 |
| | | ||dto.getPassword().length()<6 |
| | | ||!PwdCheckUtil.checkPassword(dto.getPassword())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,密码复杂度不满足要求:6-20个字符,至少包含字母、数字及特殊字符2种"); |
| | | } |
| | | // 查询用户 |
| | | SystemUser systemUser = systemUserService.findById(dto.getId()); |
| | | if (systemUser == null || systemUser.getDeleted()) { |
| | |
| | | @Override |
| | | @Transactional |
| | | public void create(CreateSystemUserDTO systemUser) { |
| | | if(StringUtils.isBlank(systemUser.getPassword()) |
| | | ||systemUser.getPassword().length()>20 |
| | | ||systemUser.getPassword().length()<6 |
| | | ||!PwdCheckUtil.checkPassword(systemUser.getPassword())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,密码复杂度不满足要求:6-20个字符,至少包含字母、数字及特殊字符2种"); |
| | | } |
| | | // 验证用户名 |
| | | SystemUser queryUserDto = new SystemUser(); |
| | | queryUserDto.setUsername(systemUser.getUsername()); |
| | |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "工号已存在"); |
| | | } |
| | | } |
| | | |
| | | // 生成密码盐 |
| | | String salt = RandomStringUtils.randomAlphabetic(6); |
| | | // 生成密码 |