| | |
| | | import org.springblade.modules.system.service.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | * @return regionCode |
| | | */ |
| | | public static List<String> getRegionChildCodesByDeptId(String deptId) { |
| | | List<String> list = new ArrayList<>(); |
| | | // 查询对应的区域编号code |
| | | Dept dept = deptService.getById(deptId); |
| | | if (null!=dept && !Strings.isBlank(dept.getRegionCode()) && !AuthUtil.isAdministrator()){ |
| | | list = getRegionChildCodes(dept.getRegionCode()); |
| | | } |
| | | return list; |
| | | //多个部门按逗号分割 |
| | | List<String> deptIdList = Arrays.asList(deptId.split(",")); |
| | | |
| | | //所有行政区划code |
| | | List<String> allRegionList = new ArrayList<>(); |
| | | deptIdList.forEach(id->{ |
| | | |
| | | List<String> list = new ArrayList<>(); |
| | | // 查询对应的区域编号code |
| | | Dept dept = deptService.getById(id); |
| | | if (null!=dept && !Strings.isBlank(dept.getRegionCode()) && !AuthUtil.isAdministrator()){ |
| | | list = getRegionChildCodes(dept.getRegionCode()); |
| | | |
| | | //行政区划不为空添加进集合 |
| | | if (list.size()>0){ |
| | | allRegionList.addAll(list); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | // 去重 |
| | | List<String> collect = allRegionList.stream().distinct().collect(Collectors.toList()); |
| | | return collect; |
| | | } |
| | | |
| | | /** |