【获取项目结构列表;登录机构接口调整】
This commit is contained in:
parent
051eaf4776
commit
ea47f926be
@ -63,15 +63,19 @@ public class OrgProjectService implements IOrgProjectService {
|
||||
}
|
||||
// 用户关联组织ID列表
|
||||
List<Long> orgIdList = orgUserList.stream().map(OrgUser::getOrgId).distinct().collect(Collectors.toList());
|
||||
// 项目关联顶级组织ID
|
||||
List<Long> orgTopIdList = orgProjectList.stream().map(OrgProject::getOrgId).distinct().collect(Collectors.toList());
|
||||
// 用户关联组织信息
|
||||
OrgExample orgExample = new OrgExample();
|
||||
orgExample.createCriteria().andStatusEqualTo(BusinessConsts.Org.Status.VALID).andIdIn(orgIdList).andRootIdIn(orgTopIdList);
|
||||
List<Org> orgList = orgDAO.selectByExample(orgExample);
|
||||
// 筛选出有权限的顶级组织
|
||||
orgIdList = orgList.stream().map(Org::getRootId).distinct().collect(Collectors.toList());
|
||||
orgExample.createCriteria().andStatusEqualTo(BusinessConsts.Org.Status.VALID).andIdIn(orgIdList);
|
||||
List<Org> orgList = orgDAO.selectByExample(orgExample);
|
||||
if (CollectionUtils.isEmpty(orgUserList)) {
|
||||
return List.of();
|
||||
}
|
||||
List<Long> userOrgTopIdList = orgList.stream().map(Org::getRootId).distinct().collect(Collectors.toList());
|
||||
// 有权限的组织ID
|
||||
List<Long> authOrgIdList = orgProjectList.stream().filter(orgProject -> userOrgTopIdList.contains(orgProject.getOrgId()))
|
||||
.map(OrgProject::getOrgId).collect(Collectors.toList());
|
||||
orgExample = new OrgExample();
|
||||
orgExample.createCriteria().andStatusEqualTo(BusinessConsts.Org.Status.VALID).andIdIn(authOrgIdList);
|
||||
orgList = orgDAO.selectByExample(orgExample);
|
||||
return orgList.stream().map(OrgProjectVO::new).collect(Collectors.toList());
|
||||
}
|
||||
@ -89,14 +93,14 @@ public class OrgProjectService implements IOrgProjectService {
|
||||
orgExample.createCriteria().andStatusEqualTo(BusinessConsts.Org.Status.VALID).andRootIdEqualTo(orgId);
|
||||
List<Org> orgList = orgDAO.selectByExample(orgExample);
|
||||
// 没有顶级项目
|
||||
Org topOrg = orgList.stream().filter(o -> o.getId() == o.getRootId()).findFirst().orElse(null);
|
||||
Org topOrg = orgList.stream().filter(o -> o.getId().equals(o.getRootId())).findFirst().orElse(null);
|
||||
if (topOrg == null) {
|
||||
throw new SimulationException(SimulationExceptionType.Illegal_Argument);
|
||||
}
|
||||
List<Long> orgIdList = orgList.stream().map(Org::getId).distinct().collect(Collectors.toList());
|
||||
// 检验用户是否有组织信息
|
||||
OrgUserExample example = new OrgUserExample();
|
||||
example.createCriteria().andUserIdEqualTo(loginInfo.getAccountVO().getId()).andIdIn(orgIdList);
|
||||
example.createCriteria().andUserIdEqualTo(loginInfo.getAccountVO().getId()).andOrgIdIn(orgIdList);
|
||||
List<OrgUser> orgUserList = orgUserDAO.selectByExample(example);
|
||||
if (CollectionUtils.isEmpty(orgUserList)) {
|
||||
throw new SimulationException(SimulationExceptionType.Illegal_Argument);
|
||||
|
Loading…
Reference in New Issue
Block a user