|
@@ -820,7 +820,10 @@ public class CompanyServiceImpl implements ICompanyService
|
|
|
List<DeptDataVO> result = new ArrayList<>();
|
|
|
|
|
|
Long isAdmin = companyUserRoleMapper.companyUserIsAdmin(currentCompanyUserId);
|
|
|
-
|
|
|
+ logger.info("当前用户 {} 是公司admin 返回公司所有部门树",currentDeptId);
|
|
|
+ if(isAdmin!=null){
|
|
|
+ return getDeptData(companyId);
|
|
|
+ }
|
|
|
// 1. 获取所有部门数据
|
|
|
List<CompanyDept> allCompanyDepts = companyDeptMapper.queryDeptDataAll();
|
|
|
|
|
@@ -845,7 +848,7 @@ public class CompanyServiceImpl implements ICompanyService
|
|
|
}
|
|
|
|
|
|
// 6. 如果没有可见部门,直接返回空列表
|
|
|
- if (isAdmin == null && visibleDeptIds.isEmpty()) {
|
|
|
+ if (visibleDeptIds.isEmpty()) {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -893,7 +896,7 @@ public class CompanyServiceImpl implements ICompanyService
|
|
|
visibleDeptIds,
|
|
|
deptPath,
|
|
|
currentDeptId,
|
|
|
- currentCompanyUserId,isAdmin);
|
|
|
+ currentCompanyUserId);
|
|
|
|
|
|
companyNode.setChildren(deptTree.isEmpty() ? null : deptTree);
|
|
|
result.add(companyNode);
|
|
@@ -926,8 +929,7 @@ public class CompanyServiceImpl implements ICompanyService
|
|
|
Set<Long> visibleDeptIds,
|
|
|
List<Long> deptPath,
|
|
|
Long currentDeptId,
|
|
|
- Long currentCompanyUserId,
|
|
|
- Long isAdmin) {
|
|
|
+ Long currentCompanyUserId) {
|
|
|
|
|
|
if (depts == null || depts.isEmpty()) {
|
|
|
return new ArrayList<>();
|
|
@@ -935,7 +937,7 @@ public class CompanyServiceImpl implements ICompanyService
|
|
|
List<DeptDataVO> result = new ArrayList<>();
|
|
|
for (CompanyDept dept : depts) {
|
|
|
// 如果当前部门不在用户可见范围内,且不在部门路径中,则跳过
|
|
|
- if (isAdmin == null && !visibleDeptIds.contains(dept.getDeptId()) && !deptPath.contains(dept.getDeptId())) {
|
|
|
+ if (!visibleDeptIds.contains(dept.getDeptId()) && !deptPath.contains(dept.getDeptId())) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
@@ -951,14 +953,14 @@ public class CompanyServiceImpl implements ICompanyService
|
|
|
visibleDeptIds,
|
|
|
deptPath,
|
|
|
currentDeptId,
|
|
|
- currentCompanyUserId,isAdmin);
|
|
|
+ currentCompanyUserId);
|
|
|
if (!childDeptNodes.isEmpty()) {
|
|
|
children.addAll(childDeptNodes);
|
|
|
}
|
|
|
}
|
|
|
// 添加部门下的用户(需要权限控制)
|
|
|
List<DeptDataVO> userNodes = new ArrayList<>();
|
|
|
- if (visibleDeptIds.contains(dept.getDeptId()) || ObjectUtil.isNotNull(isAdmin)) {
|
|
|
+ if (visibleDeptIds.contains(dept.getDeptId())) {
|
|
|
List<CompanyUser> deptUsers = allUsersByDeptIdMap.get(dept.getDeptId());
|
|
|
if (deptUsers != null && !deptUsers.isEmpty()) {
|
|
|
for (CompanyUser user : deptUsers) {
|