|
|
@ -176,15 +176,15 @@ public class DeptServiceImpl implements IDeptService |
|
|
ztrees = ztrees.stream() |
|
|
ztrees = ztrees.stream() |
|
|
.peek(i -> i.setpId(Objects.equals(i.getZone(), 1) || |
|
|
.peek(i -> i.setpId(Objects.equals(i.getZone(), 1) || |
|
|
Objects.equals(i.getZone(), 2) ? String.valueOf(i.getZone()) : i.getpId())) |
|
|
Objects.equals(i.getZone(), 2) ? String.valueOf(i.getZone()) : i.getpId())) |
|
|
.peek(i -> i.setpId(Objects.equals(i.getZone(), 15) ? "1" : i.getpId())) |
|
|
.peek(i -> i.setpId((Objects.equals(i.getZone(), 15)||Objects.equals(i.getZone(), 16)) ? "1" : i.getpId())) |
|
|
.collect(Collectors.toList()); |
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, String> map = ztrees.stream() |
|
|
Map<String, String> map = ztrees.stream() |
|
|
.filter(item -> Objects.equals(item.getZone(), 2)) |
|
|
.filter(item -> Objects.equals(item.getZone(), 2)) |
|
|
.collect(Collectors.toMap(Ztree::getId, Ztree::getName)); |
|
|
.collect(Collectors.toMap(Ztree::getId, Ztree::getName)); |
|
|
List<String> collect = ztrees.stream() |
|
|
List<String> checkDept = ztrees.stream() |
|
|
.filter(item -> Objects.equals(item.getZone(), 2)) |
|
|
.filter(item -> (Objects.equals(item.getZone(), 3)||Objects.equals(item.getZone(), 5)||Objects.equals(item.getZone(), 6))) |
|
|
.map(Ztree::getId).collect(Collectors.toList()); |
|
|
.map(Ztree::getId).collect(Collectors.toList()); |
|
|
List<Ztree> finalZtrees = ztrees; |
|
|
List<Ztree> finalZtrees = ztrees; |
|
|
map.forEach((pid, value)->{ |
|
|
map.forEach((pid, value)->{ |
|
|
@ -197,11 +197,14 @@ public class DeptServiceImpl implements IDeptService |
|
|
finalZtrees.add(ztree1); |
|
|
finalZtrees.add(ztree1); |
|
|
//给所有区下面的部门 挂到区-区直下
|
|
|
//给所有区下面的部门 挂到区-区直下
|
|
|
for (Ztree ztree2 : finalZtrees) { |
|
|
for (Ztree ztree2 : finalZtrees) { |
|
|
if (Objects.equals(ztree2.getZone(), 3)) { |
|
|
//zone为3是区直类型 zone为6是消防类的区直 zone为6是公安类的区直
|
|
|
if(StringUtils.isNotEmpty(ztree2.getAncestors()) && ztree2.getAncestors().contains(pid)) { |
|
|
if (Objects.equals(ztree2.getZone(), 3) || Objects.equals(ztree2.getZone(), 6) || Objects.equals(ztree2.getZone(), 5)) { |
|
|
|
|
|
if (checkDept.contains(ztree2.getpId())) { |
|
|
|
|
|
//
|
|
|
|
|
|
} else if(StringUtils.isNotEmpty(ztree2.getAncestors()) && ztree2.getAncestors().contains(pid)) { |
|
|
ztree2.setpId(ztree1.getId()); |
|
|
ztree2.setpId(ztree1.getId()); |
|
|
}else if (StringUtils.isEmpty(ztree2.getAncestors()) |
|
|
}else if (StringUtils.isEmpty(ztree2.getAncestors()) |
|
|
|| collect.stream().noneMatch(i -> ztree2.getAncestors().contains(i))) { |
|
|
|| map.values().stream().noneMatch(i -> ztree2.getAncestors().contains(i))) { |
|
|
if (ztree2.getName().contains(value.substring(0,2))) { |
|
|
if (ztree2.getName().contains(value.substring(0,2))) { |
|
|
ztree2.setpId(ztree1.getId()); |
|
|
ztree2.setpId(ztree1.getId()); |
|
|
} |
|
|
} |
|
|
|