mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2025-09-04 11:37:28 +00:00
fix 修复 三方登录查询用户信息参数错误问题
This commit is contained in:
@@ -21,6 +21,15 @@ public interface RemoteUserService {
|
||||
*/
|
||||
LoginUser getUserInfo(String username, String tenantId) throws UserException;
|
||||
|
||||
/**
|
||||
* 通过用户id查询用户信息
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param tenantId 租户id
|
||||
* @return 结果
|
||||
*/
|
||||
LoginUser getUserInfo(Long userId, String tenantId) throws UserException;
|
||||
|
||||
/**
|
||||
* 通过手机号查询用户信息
|
||||
*
|
||||
|
@@ -90,7 +90,7 @@ public class SocialAuthStrategy implements IAuthStrategy {
|
||||
throw new ServiceException("对不起,你没有权限登录当前租户!");
|
||||
}
|
||||
|
||||
LoginUser loginUser = remoteUserService.getUserInfo(socialVo.getUserName(), tenantId);
|
||||
LoginUser loginUser = remoteUserService.getUserInfo(socialVo.getUserId(), tenantId);
|
||||
SaLoginModel model = new SaLoginModel();
|
||||
model.setDevice(client.getDeviceType());
|
||||
// 自定义分配 不同用户体系 不同 token 授权时间 不设置默认走全局 yml 配置
|
||||
|
@@ -62,6 +62,26 @@ public class RemoteUserServiceImpl implements RemoteUserService {
|
||||
return buildLoginUser(userMapper.selectUserByUserName(username));
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoginUser getUserInfo(Long userId, String tenantId) throws UserException {
|
||||
SysUser sysUser = userMapper.selectOne(new LambdaQueryWrapper<SysUser>()
|
||||
.select(SysUser::getUserName, SysUser::getStatus)
|
||||
.eq(TenantHelper.isEnable(), SysUser::getTenantId, tenantId)
|
||||
.eq(SysUser::getUserId, userId));
|
||||
if (ObjectUtil.isNull(sysUser)) {
|
||||
throw new UserException("user.not.exists", "");
|
||||
}
|
||||
if (UserStatus.DISABLE.getCode().equals(sysUser.getStatus())) {
|
||||
throw new UserException("user.blocked", sysUser.getUserName());
|
||||
}
|
||||
// 框架登录不限制从什么表查询 只要最终构建出 LoginUser 即可
|
||||
// 此处可根据登录用户的数据不同 自行创建 loginUser 属性不够用继承扩展就行了
|
||||
if (TenantHelper.isEnable()) {
|
||||
return buildLoginUser(userMapper.selectTenantUserByUserName(sysUser.getUserName(), tenantId));
|
||||
}
|
||||
return buildLoginUser(userMapper.selectUserByUserName(sysUser.getUserName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoginUser getUserInfoByPhonenumber(String phonenumber, String tenantId) throws UserException {
|
||||
SysUser sysUser = userMapper.selectOne(new LambdaQueryWrapper<SysUser>()
|
||||
|
Reference in New Issue
Block a user