diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java index cbb1376..856f9da 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java @@ -15,24 +15,17 @@ import com.ningdatech.pmapi.sys.model.entity.Role; import com.ningdatech.pmapi.sys.model.entity.UserRole; import com.ningdatech.pmapi.sys.service.IRoleService; import com.ningdatech.pmapi.sys.service.IUserRoleService; -import com.ningdatech.pmapi.user.constant.LoginTypeEnum; import com.ningdatech.pmapi.user.constant.UserAvailableEnum; import com.ningdatech.pmapi.user.entity.UserInfo; import com.ningdatech.pmapi.user.model.po.*; import com.ningdatech.pmapi.user.model.vo.ResUserDetailVO; import com.ningdatech.pmapi.user.model.vo.ResUserInfoListVO; import com.ningdatech.pmapi.user.model.vo.UserRoleVO; -import com.ningdatech.pmapi.user.security.auth.constants.UserDeatilsServiceConstant; -import com.ningdatech.pmapi.user.security.auth.credential.CredentialAuthToken; import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; import com.ningdatech.pmapi.user.service.IUserInfoService; import com.ningdatech.pmapi.user.util.LoginUserUtil; import lombok.RequiredArgsConstructor; -import org.springframework.security.core.AuthenticationException; -import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.UserDetailsService; -import org.springframework.security.web.authentication.WebAuthenticationDetails; -import org.springframework.security.web.context.HttpSessionSecurityContextRepository; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -232,8 +225,32 @@ public class UserInfoManage { public ResUserDetailVO currentUserInfo() { Long userId = LoginUserUtil.getUserId(); - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - return null; + UserInfo userInfo = iUserInfoService.getById(userId); + if (Objects.isNull(userInfo)) { + return null; + } + ResUserDetailVO resUserDetailVO = new ResUserDetailVO(); + resUserDetailVO.setRealName(userInfo.getRealName()); + resUserDetailVO.setUserId(userInfo.getId()); + resUserDetailVO.setPhoneNo(userInfo.getMobile()); + resUserDetailVO.setStatus(userInfo.getAvailable()); + + // 装配用户角色信息列表 + List userRoleList = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class) + .eq(UserRole::getUserId, userId)); + List userRoleInfoList = new ArrayList<>(); + if (CollUtil.isNotEmpty(userRoleList)) { + List roleIdList = userRoleList.stream().map(UserRole::getRoleId).collect(Collectors.toList()); + List roleList = iRoleService.list(Wrappers.lambdaQuery(Role.class).in(Role::getId, roleIdList)); + userRoleInfoList = roleList.stream().map(r -> { + UserRoleVO userRoleVO = new UserRoleVO(); + userRoleVO.setId(r.getId()); + userRoleVO.setName(r.getName()); + return userRoleVO; + }).collect(Collectors.toList()); + } + resUserDetailVO.setUserRoleInfoList(userRoleInfoList); + return resUserDetailVO; } public void generationLogin(ReqGenerationLoginPO reqGenerationLoginPO) { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserDetailVO.java index f5badb4..c688a76 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserDetailVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserDetailVO.java @@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.time.LocalDateTime; import java.util.List; /** @@ -23,9 +24,27 @@ public class ResUserDetailVO { @ApiModelProperty("手机号") private String phoneNo; + @ApiModelProperty("用户角色信息列表") + private List userRoleInfoList; + + @ApiModelProperty("浙政钉 用户编码") + private String employeeCode; + + @ApiModelProperty("所在单位(主职)") + private String orgName; + + @ApiModelProperty("所在单位(主职)code") + private String orgCode; + + @ApiModelProperty("所属区域") + private Long regionId; + + @ApiModelProperty("用户角色") + private List userRoleList; + @ApiModelProperty("状态 启用 ENABLE/禁用 DISABLE") private String status; - @ApiModelProperty("用户角色信息列表") - private List userRoleInfoList; + @ApiModelProperty("更新时间") + private LocalDateTime updateTime; }