Browse Source

更新对应权限相关

tags/v2.4.1
xiaoying 1 year ago
parent
commit
d4d166c748
1 changed files with 17 additions and 16 deletions
  1. +17
    -16
      tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/TenantServiceImpl.java

+ 17
- 16
tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/TenantServiceImpl.java View File

@@ -153,7 +153,7 @@ public class TenantServiceImpl implements TenantService {
vo.setPlatformName(PlatformName.substring(CommonConstant.ZERO, PlatformName.lastIndexOf(CommonConstant.SIGN)));
log.info("租户实例表添加完毕");
//1.开始判断租户对应需要的平台并进行匹对
List<ClientRoleDto> clientRoleDtoList = getClientRoleDtos(createClientTenantDto);
List<ClientRoleDto> clientRoleDtoList = getClientRoleDtos(createClientTenantDto.getClientRoleDtoList());
List<AuthoritiesPo> authoritiesPos = new ArrayList<>();
List<ClientUserRolePo> clientUserRolePoArrayList = new ArrayList<>();
//2.添加租户对应相关信息
@@ -200,38 +200,38 @@ public class TenantServiceImpl implements TenantService {
/**
* 匹配对应业务系统对应的标识,并封装返回方便后续操作
*
* @param createClientTenantDto
* @param clientRoleDtoList
* @return
*/
private List<ClientRoleDto> getClientRoleDtos(CreateClientTenantDto createClientTenantDto) {
List<ClientRoleDto> clientRoleDtoList = new ArrayList<>();
private List<ClientRoleDto> getClientRoleDtos(List<ClientRoleDto> clientRoleDtoList) {
List<ClientRoleDto> list = new ArrayList<>();
//遍历获取参数进项封装
for (ClientRoleDto dto : createClientTenantDto.getClientRoleDtoList()) {
for (ClientRoleDto dto : clientRoleDtoList) {

switch (dto.getClientId()) {
//暂时河湖长,动态匹配其他平台
case HhzUrlConstant.HHZ_CLIENT:
addClientRoleDtoList(HhzUrlConstant.HHZ_CLIENT_MP, dto, clientRoleDtoList);
addClientRoleDtoList(HhzUrlConstant.HHZ_CLIENT_ADMIN, dto, clientRoleDtoList);
addClientRoleDtoList(HhzUrlConstant.HHZ_CLIENT_MP, dto, list);
addClientRoleDtoList(HhzUrlConstant.HHZ_CLIENT_ADMIN, dto, list);
break;
case PilotConstant.PILOT_CLIENT:
addClientRoleDtoList(PilotConstant.PILOT_CLIENT_ADMIN, dto, clientRoleDtoList);
addClientRoleDtoList(PilotConstant.PILOT_CLIENT_MP, dto, clientRoleDtoList);
addClientRoleDtoList(PilotConstant.PILOT_CLIENT_ADMIN, dto, list);
addClientRoleDtoList(PilotConstant.PILOT_CLIENT_MP, dto, list);
break;
case FreeWayConstant.FREEWAY_CLIENT:
addClientRoleDtoList(FreeWayConstant.FREEWAY_CLIENT_ADMIN, dto, clientRoleDtoList);
addClientRoleDtoList(FreeWayConstant.FREEWAY_CLIENT_MP, dto, clientRoleDtoList);
addClientRoleDtoList(FreeWayConstant.FREEWAY_CLIENT_ADMIN, dto, list);
addClientRoleDtoList(FreeWayConstant.FREEWAY_CLIENT_MP, dto, list);
break;
case WaterWayConstant.WATERWAY_CLIENT:
addClientRoleDtoList(WaterWayConstant.WATERWAY_CLIENT_ADMIN, dto, clientRoleDtoList);
addClientRoleDtoList(WaterWayConstant.WATERWAY_CLIENT_MP, dto, clientRoleDtoList);
addClientRoleDtoList(WaterWayConstant.WATERWAY_CLIENT_ADMIN, dto, list);
addClientRoleDtoList(WaterWayConstant.WATERWAY_CLIENT_MP, dto, list);
break;
default:
break;
}

}
return clientRoleDtoList;
return list;
}

/**
@@ -623,13 +623,14 @@ public class TenantServiceImpl implements TenantService {
}
log.info("业务系统新增租户成功");
//原有集合
List<ClientRoleDto> clientRoleDtos = getClientRoleDtos(dto.getClientRoleDtoList());
List<ClientRoleDto> finalClientRoleDtoList = clientRoleDtoList;
list= list.stream().filter(t -> !finalClientRoleDtoList.contains(t)).collect(Collectors.toList());
clientRoleDtos= clientRoleDtos.stream().filter(t -> !finalClientRoleDtoList.contains(t)).collect(Collectors.toList());

List<AuthoritiesPo> authoritiesPos = new ArrayList<>();
List<ClientUserRolePo> clientUserRolePoArrayList = new ArrayList<>();

for (ClientRoleDto clientRoleDto : list) {
for (ClientRoleDto clientRoleDto : clientRoleDtos) {
//添加角色权限相关
AuthoritiesPo authoritiesPo = new AuthoritiesPo()
.setUserId(tenant.getUserId())

Loading…
Cancel
Save