|
|
@@ -7,8 +7,12 @@ import java.util.List;
|
|
7
|
7
|
import java.util.stream.Collectors;
|
|
8
|
8
|
|
|
9
|
9
|
import cn.hutool.core.collection.CollUtil;
|
|
|
10
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
10
|
11
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
12
|
+import cn.hutool.core.util.StrUtil;
|
|
11
|
13
|
import com.sundot.airport.common.config.LevelConfig;
|
|
|
14
|
+import com.sundot.airport.common.dto.DeptInfo;
|
|
|
15
|
+import com.sundot.airport.common.enums.DeptType;
|
|
12
|
16
|
import com.sundot.airport.common.enums.DeptTypeEnum;
|
|
13
|
17
|
import com.sundot.airport.common.enums.RoleTypeEnum;
|
|
14
|
18
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -565,4 +569,33 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
|
565
|
569
|
List<SysUser> result = deptMapper.deptRole(deptId, roleKeyList);
|
|
566
|
570
|
return result;
|
|
567
|
571
|
}
|
|
|
572
|
+
|
|
|
573
|
+ /**
|
|
|
574
|
+ * 查询指定部门的上级部门信息
|
|
|
575
|
+ *
|
|
|
576
|
+ * @param deptId 部门ID
|
|
|
577
|
+ * @return 上级部门信息
|
|
|
578
|
+ */
|
|
|
579
|
+ @Override
|
|
|
580
|
+ public DeptInfo getDeptInfoByDeptId(Long deptId) {
|
|
|
581
|
+ DeptInfo result = new DeptInfo();
|
|
|
582
|
+ List<SysDept> deptList = selectAllDept(deptId);
|
|
|
583
|
+ if (CollectionUtil.isEmpty(deptList)) {
|
|
|
584
|
+ return result;
|
|
|
585
|
+ }
|
|
|
586
|
+ Collections.reverse(deptList);
|
|
|
587
|
+ SysDept teams = deptList.stream().filter(x -> StrUtil.equals(DeptType.TEAMS.getCode(), x.getDeptType())).findFirst().orElse(new SysDept());
|
|
|
588
|
+ SysDept department = deptList.stream().filter(x -> StrUtil.equals(DeptType.MANAGER.getCode(), x.getDeptType())).findFirst().orElse(new SysDept());
|
|
|
589
|
+ SysDept brigade = deptList.stream().filter(x -> StrUtil.equals(DeptType.BRIGADE.getCode(), x.getDeptType())).findFirst().orElse(new SysDept());
|
|
|
590
|
+ SysDept station = deptList.stream().filter(x -> StrUtil.equals(DeptType.STATION.getCode(), x.getDeptType())).findFirst().orElse(new SysDept());
|
|
|
591
|
+ result.setTeamId(teams.getDeptId());
|
|
|
592
|
+ result.setTeamName(teams.getDeptName());
|
|
|
593
|
+ result.setDepartmentId(department.getDeptId());
|
|
|
594
|
+ result.setDepartmentName(department.getDeptName());
|
|
|
595
|
+ result.setBrigadeId(brigade.getDeptId());
|
|
|
596
|
+ result.setBrigadeName(brigade.getDeptName());
|
|
|
597
|
+ result.setStationId(station.getDeptId());
|
|
|
598
|
+ result.setStationName(station.getDeptName());
|
|
|
599
|
+ return result;
|
|
|
600
|
+ }
|
|
568
|
601
|
}
|