mirror of https://gitee.com/stylefeng/roses
【7.6.0】【sys】【首页用户详情接口】获取用户基本信息
parent
2e1e4fd60b
commit
0d0954f75f
|
@ -1,8 +1,6 @@
|
||||||
package cn.stylefeng.roses.kernel.sys.modular.login.pojo;
|
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.ChineseDescription;
|
||||||
import cn.stylefeng.roses.kernel.rule.annotation.SimpleFieldFormat;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -31,11 +29,10 @@ public class UserIndexInfo {
|
||||||
private String realName;
|
private String realName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户头像的文件id
|
* 头像地址
|
||||||
*/
|
*/
|
||||||
@ChineseDescription("用户头像的文件id")
|
@ChineseDescription("头像地址")
|
||||||
@SimpleFieldFormat(processClass = FileUrlFormatProcess.class)
|
private String avatarUrl;
|
||||||
private Long avatarFileId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当前用户的部门和任职信息
|
* 当前用户的部门和任职信息
|
||||||
|
|
|
@ -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.context.LoginContext;
|
||||||
import cn.stylefeng.roses.kernel.auth.api.pojo.login.LoginUser;
|
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 cn.stylefeng.roses.kernel.sys.modular.login.pojo.UserIndexInfo;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户首页信息的业务
|
* 获取用户首页信息的业务
|
||||||
*
|
*
|
||||||
|
@ -14,6 +18,9 @@ import org.springframework.stereotype.Service;
|
||||||
@Service
|
@Service
|
||||||
public class UserIndexInfoService {
|
public class UserIndexInfoService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SysUserServiceApi sysUserServiceApi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户首页信息
|
* 获取用户首页信息
|
||||||
*
|
*
|
||||||
|
@ -22,11 +29,39 @@ public class UserIndexInfoService {
|
||||||
*/
|
*/
|
||||||
public UserIndexInfo getUserIndexInfo() {
|
public UserIndexInfo getUserIndexInfo() {
|
||||||
|
|
||||||
|
// 返回结果初始化
|
||||||
|
UserIndexInfo userIndexInfo = new UserIndexInfo();
|
||||||
|
|
||||||
// 获取当前登录用户
|
// 获取当前登录用户
|
||||||
LoginUser loginUser = LoginContext.me().getLoginUser();
|
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());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue