【7.6.0】【sys】【auth】整理用于校验用户密码的查询用户信息接口

pull/57/head
fengshuonan 2023-06-17 22:02:55 +08:00
parent 44b9871c47
commit e616839a72
4 changed files with 93 additions and 1 deletions

View File

@ -26,6 +26,7 @@ package cn.stylefeng.roses.kernel.sys.api;
import cn.stylefeng.roses.kernel.sys.api.pojo.user.SimpleUserDTO;
import cn.stylefeng.roses.kernel.sys.api.pojo.user.UserOrgDTO;
import cn.stylefeng.roses.kernel.sys.api.pojo.user.UserValidateDTO;
import java.util.List;
@ -89,4 +90,12 @@ public interface SysUserServiceApi {
*/
String getUserRealName(Long userId);
/**
*
*
* @author fengshuonan
* @since 2023/6/17 21:56
*/
UserValidateDTO getUserValidateDTO(Long account);
}

View File

@ -0,0 +1,58 @@
/*
* Copyright [2020-2030] [https://www.stylefeng.cn]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* GunsAPACHE LICENSE 2.0使
*
* 1.LICENSE
* 2.Guns
* 3.
* 4. https://gitee.com/stylefeng/guns
* 5. https://gitee.com/stylefeng/guns
* 6.
*/
package cn.stylefeng.roses.kernel.sys.api.pojo.user;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import lombok.Data;
/**
*
*
* @author fengshuonan
* @since 2023/6/17 21:55
*/
@Data
public class UserValidateDTO {
/**
* sys_userpassword
*/
@ChineseDescription("加密后的密码")
private String userPasswordHexed;
/**
* UserStatusEnum
*/
@ChineseDescription("用户状态")
private Integer userStatus;
public UserValidateDTO() {
}
public UserValidateDTO(String userPasswordHexed, Integer userStatus) {
this.userPasswordHexed = userPasswordHexed;
this.userStatus = userStatus;
}
}

View File

@ -4,13 +4,16 @@ import cn.hutool.core.util.ObjectUtil;
import cn.stylefeng.roses.kernel.db.api.DbOperatorApi;
import cn.stylefeng.roses.kernel.file.api.FileInfoApi;
import cn.stylefeng.roses.kernel.rule.enums.YesOrNotEnum;
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
import cn.stylefeng.roses.kernel.sys.api.SysUserServiceApi;
import cn.stylefeng.roses.kernel.sys.api.exception.SysException;
import cn.stylefeng.roses.kernel.sys.api.pojo.user.SimpleUserDTO;
import cn.stylefeng.roses.kernel.sys.api.pojo.user.UserOrgDTO;
import cn.stylefeng.roses.kernel.sys.api.pojo.user.UserValidateDTO;
import cn.stylefeng.roses.kernel.sys.modular.user.entity.SysUser;
import cn.stylefeng.roses.kernel.sys.modular.user.entity.SysUserOrg;
import cn.stylefeng.roses.kernel.sys.modular.user.entity.SysUserRole;
import cn.stylefeng.roses.kernel.sys.modular.user.enums.SysUserExceptionEnum;
import cn.stylefeng.roses.kernel.sys.modular.user.factory.UserOrgFactory;
import cn.stylefeng.roses.kernel.sys.modular.user.service.SysUserOrgService;
import cn.stylefeng.roses.kernel.sys.modular.user.service.SysUserRoleService;
@ -174,4 +177,19 @@ public class UserIntegrationService implements SysUserServiceApi {
return sysUser.getRealName();
}
@Override
public UserValidateDTO getUserValidateDTO(Long account) {
LambdaQueryWrapper<SysUser> sysUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
sysUserLambdaQueryWrapper.eq(SysUser::getAccount, account);
sysUserLambdaQueryWrapper.select(SysUser::getPassword, SysUser::getStatusFlag);
SysUser sysUserServiceOne = this.sysUserService.getOne(sysUserLambdaQueryWrapper, false);
if (sysUserServiceOne == null) {
throw new ServiceException(SysUserExceptionEnum.ACCOUNT_NOT_EXIST);
}
return new UserValidateDTO(sysUserServiceOne.getPassword(), sysUserServiceOne.getStatusFlag());
}
}

View File

@ -21,7 +21,14 @@ public enum SysUserExceptionEnum implements AbstractExceptionEnum {
/**
*
*/
USER_CAN_NOT_DELETE_ADMIN(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + "10002", "不能删除超级管理员");
USER_CAN_NOT_DELETE_ADMIN(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + "10002", "不能删除超级管理员"),
/**
*
* <p>
*
*/
ACCOUNT_NOT_EXIST(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + "10003", "用户账号或密码错误,请重新输入");
/**
*