|
@@ -4,6 +4,9 @@ import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
|
|
|
+import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils;
|
|
|
+import cn.iocoder.yudao.module.employee.api.EmployeeApi;
|
|
|
+import cn.iocoder.yudao.module.employee.api.dto.EmployeeRespDTO;
|
|
|
import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileResetPasswordReqVO;
|
|
|
import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileRespVO;
|
|
|
import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO;
|
|
@@ -23,6 +26,7 @@ import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -55,6 +59,8 @@ public class UserProfileController {
|
|
|
private RoleService roleService;
|
|
|
@Resource
|
|
|
private SocialUserService socialService;
|
|
|
+ @Resource
|
|
|
+ private EmployeeApi employeeApi;
|
|
|
|
|
|
@GetMapping("/get")
|
|
|
@Operation(summary = "获得登录用户信息")
|
|
@@ -62,6 +68,12 @@ public class UserProfileController {
|
|
|
public CommonResult<UserProfileRespVO> getUserProfile() {
|
|
|
// 获得用户基本信息
|
|
|
AdminUserDO user = userService.getUser(getLoginUserId());
|
|
|
+ EmployeeRespDTO loginEmployee = employeeApi.getEmployeeByUserId(getLoginUserId());
|
|
|
+ if (user.getSex() == null) {
|
|
|
+ if (loginEmployee != null && StringUtils.isNotBlank(loginEmployee.getGender())) {
|
|
|
+ user.setSex(Integer.valueOf(loginEmployee.getGender()));
|
|
|
+ }
|
|
|
+ }
|
|
|
// 获得用户角色
|
|
|
List<RoleDO> userRoles = roleService.getRoleListFromCache(permissionService.getUserRoleIdListByUserId(user.getId()));
|
|
|
// 获得部门信息
|