Commit 2f732dea by huangjinxin

fix:超管返回所有组织权限

1 parent bb6a2582
......@@ -7,6 +7,11 @@ package com.dituhui.pea.order.enums;
public enum OrganizationType {
/**
* 超管
*/
admin("admin"),
/**
* 大区
*/
cluster("cluster"),
......
......@@ -235,6 +235,18 @@ public class OrganizationServiceImpl implements OrganizationService {
}).collect(Collectors.toList());
}
break;
case admin:
List<OrgClusterEntity> adminCluster = orgClusterDao.findAll();
if (CollectionUtils.isNotEmpty(adminCluster)) {
return adminCluster.stream().map(c -> {
OrganizationDTO organizationDTO = new OrganizationDTO();
organizationDTO.setId(c.getClusterId());
organizationDTO.setName(c.getName());
organizationDTO.setType(OrganizationType.cluster.getValue());
return organizationDTO;
}).collect(Collectors.toList());
}
break;
default:
break;
}
......
......@@ -183,6 +183,14 @@ public class UserService {
//用户组织机构从关联表获取
List<OrganizationDTO> allOrgs = new ArrayList<>();
// 超管处理,不用配置资源自动拥有所有权限
if (ids.contains(Globals.SUPER_ADMIN_ID)) {
Result<List<OrganizationDTO>> result = organizationService.getAllOrganizations("admin", Arrays.asList("admin"));
if (StringUtils.equals(ResultEnum.SUCCESS.getCode(), result.getCode())) {
allOrgs = result.getResult();
}
} else {
List<UserOrgEntity> byUserId = userOrgDao.findByUserId(userDTO.getId());
if (CollectionUtils.isNotEmpty(byUserId)) {
List<String> collect = byUserId.stream().map(UserOrgEntity::getOrgId).collect(Collectors.toList());
......@@ -191,6 +199,7 @@ public class UserService {
allOrgs = result.getResult();
}
}
}
if (CollectionUtils.isNotEmpty(allOrgs)) {
// 设置第一个为当前权限等级
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!