| | |
| | | * @return regionCode |
| | | */ |
| | | public static List<String> getPoliceRegionChildCodesByDeptId(String deptId,String communityCode) { |
| | | // 去重 |
| | | List<String> regionCodeList = new ArrayList<>(); |
| | | if (!Strings.isBlank(deptId)) { |
| | | //多个部门按逗号分割 |
| | |
| | | } |
| | | return regionCodeList; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询综治网格/公安相关的网格,社区编号集合 |
| | | * @param deptId |
| | | * @param communityCode |
| | | * @param roleName |
| | | * @return |
| | | */ |
| | | public static List<String> getGridRegionChildCodesByDeptId(String deptId, String communityCode,String roleName) { |
| | | List<String> regionCodeList = new ArrayList<>(); |
| | | if (!Strings.isBlank(deptId)) { |
| | | //多个部门按逗号分割 |
| | | List<String> deptIdList = Arrays.asList(deptId.split(",")); |
| | | List<String> finalRegionCodeList = regionCodeList; |
| | | String key = AuthUtil.getUserId().toString(); |
| | | if (!Strings.isBlank(roleName)){ |
| | | key = key + ":" + roleName; |
| | | } |
| | | String finalKey = key; |
| | | deptIdList.forEach(id -> { |
| | | List<String> list = new ArrayList<>(); |
| | | // 查询对应的区域编号code |
| | | Dept dept = deptService.getById(id); |
| | | if (null != dept) { |
| | | if ( |
| | | (roleName.equals("mj") && dept.getDeptNature()==1) || |
| | | ( |
| | | (roleName.equals("wgy") || roleName.equals("wzcj")) && dept.getDeptNature()==2 |
| | | ) |
| | | ){ |
| | | if (!AuthUtil.isAdministrator()) { |
| | | if (dept.getRegionCode() == null) { |
| | | return; |
| | | } |
| | | list = CacheUtil.get(SYS_CACHE, REGION_CHILDCODES_CODE, finalKey, List.class); |
| | | if (list == null || list.size() == 0) { |
| | | list = new ArrayList<>(); |
| | | List<Region> deptChild = getGridRegionChild(dept.getRegionCode(), communityCode, roleName); |
| | | if (deptChild != null) { |
| | | List<String> collect = deptChild.stream().map(Region::getCode).collect(Collectors.toList()); |
| | | list.addAll(collect); |
| | | } |
| | | } |
| | | //行政区划不为空添加进集合 |
| | | if (list.size() > 0) { |
| | | finalRegionCodeList.addAll(list); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | // 去重 |
| | | regionCodeList = finalRegionCodeList.stream().distinct().collect(Collectors.toList()); |
| | | CacheUtil.put(SYS_CACHE, REGION_CHILDCODES_CODE, key, regionCodeList); |
| | | } |
| | | return regionCodeList; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取下级所有区域code |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取综治下级区域 |
| | | * @param regionCode |
| | | * @return |
| | | */ |
| | | private static List<Region> getGridRegionChild(String regionCode, String communityCode,String roleName) { |
| | | return CacheUtil.get(SYS_CACHE, REGION_CHILD_CODE, regionCode, () -> regionService.getGridRegionChild(regionCode,communityCode,roleName)); |
| | | } |
| | | |
| | | /** |
| | | * 获取民警下级区域 |
| | | * @param regionCode |
| | | * @return |
| | |
| | | private static List<Region> getRegionChild(String regionCode,String communityCode) { |
| | | return CacheUtil.get(SYS_CACHE, REGION_CHILD_CODE, regionCode, () -> regionService.getRegionChild(regionCode,communityCode)); |
| | | } |
| | | |
| | | } |