Browse Source

merge 新增专家可控角色列表

tags/24080901
niohe·erbao 1 year ago
parent
commit
8f566a4475
1 changed files with 40 additions and 1 deletions
  1. +40
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java

+ 40
- 1
pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java View File

@@ -10,6 +10,7 @@ import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.common.constant.RegionConst;
import com.ningdatech.pmapi.common.helper.RegionCacheHelper;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.common.util.BizUtils;
import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo;
import com.ningdatech.pmapi.organization.model.entity.DingOrganization;
import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService;
@@ -206,7 +207,7 @@ public class UserInfoManage {
return new ArrayList<>();
}
return iUserInfoService.list(Wrappers.lambdaQuery(UserInfo.class)
.in(UserInfo::getId, compliantUserIdList))
.in(UserInfo::getId, compliantUserIdList))
.stream().map(UserInfo::getId).collect(Collectors.toList());

}
@@ -497,4 +498,42 @@ public class UserInfoManage {
return processInstanceUserDto;
}

/**
* 获取当前用户可控角色列表
*
* @return
*/
public List<UserRoleVO> getControlledRoleList() {
Long userId = LoginUserUtil.getUserId();
// 装配用户角色信息列表
List<UserRole> userRoleList = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class)
.eq(UserRole::getUserId, userId));

List<UserRoleVO> controlledRoleVOList = new ArrayList<>();
List<Long> controlledRoleIdList = new ArrayList<>();
if (CollUtil.isNotEmpty(userRoleList)) {
List<Long> roleIdList = userRoleList.stream().map(UserRole::getRoleId).distinct().collect(Collectors.toList());
controlledRoleIdList.addAll(roleIdList);
List<Role> roleList = iRoleService.list(Wrappers.lambdaQuery(Role.class).in(Role::getId, roleIdList));

for (Role role : roleList) {
List<Long> manageRoleIdList = BizUtils.splitToLong(role.getManageRoleIds());
if (CollUtil.isNotEmpty(manageRoleIdList)) {
controlledRoleIdList.addAll(manageRoleIdList);
}
}
controlledRoleIdList = controlledRoleIdList.stream().distinct().collect(Collectors.toList());
List<Role> controlledRoleList = iRoleService.list(Wrappers.lambdaQuery(Role.class).in(Role::getId, controlledRoleIdList));

controlledRoleVOList = controlledRoleList.stream().map(r -> {
UserRoleVO userRoleVO = new UserRoleVO();
userRoleVO.setId(r.getId());
userRoleVO.setName(r.getName());
userRoleVO.setCode(r.getCode());
return userRoleVO;
}).collect(Collectors.toList());
}
return controlledRoleVOList;
}

}

Loading…
Cancel
Save