| | |
| | | * |
| | | * @return regionCode |
| | | */ |
| | | public static List<String> getRegionChildCodesByDeptId(String deptId) { |
| | | public static List<String> getRegionChildCodesByDeptId(String deptId,String communityCode) { |
| | | //多个部门按逗号分割 |
| | | List<String> deptIdList = Arrays.asList(deptId.split(",")); |
| | | |
| | |
| | | // 查询对应的区域编号code |
| | | Dept dept = deptService.getById(id); |
| | | if (null!=dept && !Strings.isBlank(dept.getRegionCode()) && !AuthUtil.isAdministrator()){ |
| | | list = getRegionChildCodes(dept.getRegionCode()); |
| | | list = getRegionChildCodes(dept.getRegionCode(),communityCode); |
| | | //行政区划不为空添加进集合 |
| | | if (list.size()>0){ |
| | | allRegionList.addAll(list); |
| | |
| | | * |
| | | * @return regionCode |
| | | */ |
| | | public static List<String> getPoliceRegionChildCodesByDeptId(String deptId) { |
| | | public static List<String> getPoliceRegionChildCodesByDeptId(String deptId,String communityCode) { |
| | | // 去重 |
| | | List<String> regionCodeList = new ArrayList<>(); |
| | | if (!Strings.isBlank(deptId)) { |
| | |
| | | // 只取公安的 |
| | | if (dept.getDeptNature() == 1) { |
| | | if (null != dept && !Strings.isBlank(dept.getRegionCode()) && !AuthUtil.isAdministrator()) { |
| | | list = getPoliceRegionChildCodes(dept.getRegionCode()); |
| | | list = getPoliceRegionChildCodes(dept.getRegionCode(),communityCode); |
| | | //行政区划不为空添加进集合 |
| | | if (list.size() > 0) { |
| | | allRegionList.addAll(list); |
| | |
| | | * |
| | | * @return regionCode |
| | | */ |
| | | public static List<String> getRegionChildCodes(String regionCode) { |
| | | public static List<String> getRegionChildCodes(String regionCode,String communityCode) { |
| | | if (regionCode == null) { |
| | | return null; |
| | | } |
| | | List<String> regionCodeList = CacheUtil.get(SYS_CACHE, REGION_CHILDCODES_CODE, regionCode, List.class); |
| | | if (regionCodeList == null || regionCodeList.size()==0) { |
| | | regionCodeList = new ArrayList<>(); |
| | | List<Region> deptChild = getRegionChild(regionCode); |
| | | List<Region> deptChild = getRegionChild(regionCode,communityCode); |
| | | if (deptChild != null) { |
| | | List<String> collect = deptChild.stream().map(Region::getCode).collect(Collectors.toList()); |
| | | regionCodeList.addAll(collect); |
| | |
| | | * |
| | | * @return regionCode |
| | | */ |
| | | public static List<String> getPoliceRegionChildCodes(String regionCode) { |
| | | public static List<String> getPoliceRegionChildCodes(String regionCode,String communityCode) { |
| | | if (regionCode == null) { |
| | | return null; |
| | | } |
| | | List<String> regionCodeList = CacheUtil.get(SYS_CACHE, REGION_CHILDCODES_CODE, regionCode, List.class); |
| | | if (regionCodeList == null || regionCodeList.size()==0) { |
| | | regionCodeList = new ArrayList<>(); |
| | | List<Region> deptChild = getPoliceRegionChild(regionCode); |
| | | List<Region> deptChild = getPoliceRegionChild(regionCode,communityCode); |
| | | if (deptChild != null) { |
| | | List<String> collect = deptChild.stream().map(Region::getCode).collect(Collectors.toList()); |
| | | regionCodeList.addAll(collect); |
| | |
| | | * @param regionCode |
| | | * @return |
| | | */ |
| | | private static List<Region> getPoliceRegionChild(String regionCode) { |
| | | return CacheUtil.get(SYS_CACHE, REGION_CHILD_CODE, regionCode, () -> regionService.getPoliceRegionChild(regionCode)); |
| | | private static List<Region> getPoliceRegionChild(String regionCode,String communityCode) { |
| | | return CacheUtil.get(SYS_CACHE, REGION_CHILD_CODE, regionCode, () -> regionService.getPoliceRegionChild(regionCode,communityCode)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param regionCode |
| | | * @return |
| | | */ |
| | | private static List<Region> getRegionChild(String regionCode) { |
| | | return CacheUtil.get(SYS_CACHE, REGION_CHILD_CODE, regionCode, () -> regionService.getRegionChild(regionCode)); |
| | | private static List<Region> getRegionChild(String regionCode,String communityCode) { |
| | | return CacheUtil.get(SYS_CACHE, REGION_CHILD_CODE, regionCode, () -> regionService.getRegionChild(regionCode,communityCode)); |
| | | } |
| | | } |