【7.6.0】【sys】【首页用户详情接口】获取用户基本信息

pull/57/head
fengshuonan 2023-06-18 23:09:46 +08:00
parent 2e1e4fd60b
commit 0d0954f75f
2 changed files with 39 additions and 7 deletions

View File

@ -1,8 +1,6 @@
package cn.stylefeng.roses.kernel.sys.modular.login.pojo;
import cn.stylefeng.roses.kernel.file.api.format.FileUrlFormatProcess;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import cn.stylefeng.roses.kernel.rule.annotation.SimpleFieldFormat;
import lombok.Data;
import java.util.List;
@ -31,11 +29,10 @@ public class UserIndexInfo {
private String realName;
/**
* id
*
*/
@ChineseDescription("用户头像的文件id")
@SimpleFieldFormat(processClass = FileUrlFormatProcess.class)
private Long avatarFileId;
@ChineseDescription("头像地址")
private String avatarUrl;
/**
*

View File

@ -2,9 +2,13 @@ package cn.stylefeng.roses.kernel.sys.modular.login.service;
import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
import cn.stylefeng.roses.kernel.auth.api.pojo.login.LoginUser;
import cn.stylefeng.roses.kernel.sys.api.SysUserServiceApi;
import cn.stylefeng.roses.kernel.sys.api.pojo.user.SimpleUserDTO;
import cn.stylefeng.roses.kernel.sys.modular.login.pojo.UserIndexInfo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
*
*
@ -14,6 +18,9 @@ import org.springframework.stereotype.Service;
@Service
public class UserIndexInfoService {
@Resource
private SysUserServiceApi sysUserServiceApi;
/**
*
*
@ -22,11 +29,39 @@ public class UserIndexInfoService {
*/
public UserIndexInfo getUserIndexInfo() {
// 返回结果初始化
UserIndexInfo userIndexInfo = new UserIndexInfo();
// 获取当前登录用户
LoginUser loginUser = LoginContext.me().getLoginUser();
// 1. 获取用户的姓名和头像
this.fillUserBaseInfo(loginUser.getUserId(), userIndexInfo);
return null;
// 2. 获取用户的部门和任职信息
// 3. 获取用户的权限编码集合
// 4. 获取用户的当前登录App和菜单
// 5. 获取菜单和路由的appId映射关系
// 6. 构建websocket url
return userIndexInfo;
}
/**
*
*
* @author fengshuonan
* @since 2023/6/18 23:01
*/
private void fillUserBaseInfo(Long userId, UserIndexInfo userIndexInfo) {
SimpleUserDTO simpleUserDTO = sysUserServiceApi.getUserInfoByUserId(userId);
userIndexInfo.setUserId(simpleUserDTO.getUserId());
userIndexInfo.setRealName(simpleUserDTO.getRealName());
userIndexInfo.setAvatarUrl(simpleUserDTO.getAvatarUrl());
}
}