| | |
| | | return userInfo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 登录 |
| | | */ |
| | | public LoginUser login(String username, HttpServletRequest request) { |
| | | username = username.trim(); |
| | | // 查询用户信息 |
| | | SysUser user = userService.selectUserByUserName(username); |
| | | SysUser user = userService.selectUserByPhone(username); |
| | | if (StringUtils.isNull(user)) { |
| | | throw new ServiceException("帐号不存在或已被删除", I18nKeyConstant.ACCOUNT_NOT_EXISTS); |
| | | } |
| | |
| | | } |
| | | return userInfo; |
| | | } |
| | | |
| | | |
| | | public void logout(String loginName, HttpServletRequest request) { |
| | | recordLogService.recordLogininfor(request, null, loginName, Constants.LOGIN_SUCCESS_STATUS, "退出成功"); |
| | |
| | | } |
| | | |
| | | |
| | | public LoginOperationUser verificationCodeLogin(String phoneNumber, String code, Integer deviceType, HttpServletRequest request) { |
| | | |
| | | public LoginOperationUser verificationCodeLogin(String phoneNumber, String code, Integer deviceType, HttpServletRequest request) { |
| | | LoginOperationUser loginOperationUser = new LoginOperationUser(); |
| | | phoneNumber = phoneNumber.trim(); |
| | | if (StringUtils.isAnyBlank(phoneNumber, code)) { |
| | |
| | | return loginOperationUser; |
| | | } |
| | | |
| | | |
| | | public LoginOperationUser verificationCodeLogin(String phoneNumber, Integer deviceType, HttpServletRequest request) { |
| | | LoginOperationUser loginOperationUser = new LoginOperationUser(); |
| | | phoneNumber = phoneNumber.trim(); |
| | | // 查询运维用户信息 |
| | | XpOperationsUser operationsUser = operationsUserService.lambdaQuery().eq( |
| | | XpOperationsUser::getPhoneNumber, phoneNumber |
| | | XpOperationsUser::getPhoneNumber, SensitiveDataCryptoUtil.encrypt(phoneNumber) |
| | | ).last("limit 1").one(); |
| | | if (StringUtils.isNull(operationsUser)) { |
| | | throw new ServiceException("验证码错误!"); |
| | | throw new ServiceException("查询用户失败!"); |
| | | } |
| | | if (!operationsUser.getStatus()){ |
| | | throw new ServiceException("账号已禁用!"); |
| | | } |
| | | loginOperationUser.setXpOperationsUser(operationsUser); |
| | | //更新用户登录设备类型 |
| | | operationsUser.setDeviceType(deviceType); |
| | | operationsUserService.updateById(operationsUser); |
| | | loginOperationUser.setXpOperationsUser(operationsUser); |
| | | operationsUser.setPhoneNumber(SensitiveDataCryptoUtil.decryptIfPossible(operationsUser.getPhoneNumber())); |
| | | return loginOperationUser; |
| | | } |
| | | |
| | | |
| | | |
| | | public Boolean verificationCodeUpdate(UpdatePasswordDTO updatePasswordDTO, HttpServletRequest request) { |
| | | String phoneNumber = updatePasswordDTO.getPhoneNumber(); |
| | | String code = updatePasswordDTO.getVerificationCode(); |