| | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static org.springblade.common.cache.CacheNames.ARTICLE_KEY; |
| | | import static org.springblade.core.cache.constant.CacheConstant.SYS_CACHE; |
| | | |
| | | /** |
| | |
| | | |
| | | |
| | | /** |
| | | * 查询综治网格相关的网格,社区编号集合 |
| | | * 查询综治网格/公安相关的网格,社区编号集合 |
| | | * @param deptId |
| | | * @param communityCode |
| | | * @param roleName |
| | |
| | | List<String> list = new ArrayList<>(); |
| | | // 查询对应的区域编号code |
| | | Dept dept = deptService.getById(id); |
| | | // 只取综治的 |
| | | if (dept.getDeptNature() == 2) { |
| | | if (null != dept && !Strings.isBlank(dept.getRegionCode()) && !AuthUtil.isAdministrator()) { |
| | | // list = getGridRegionChildCodes(dept.getRegionCode(),communityCode,roleName); |
| | | 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 (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; |
| | | } |
| | | // finalRegionCodeList.add(dept.getRegionCode()); |
| | | } |
| | | |
| | | //行政区划不为空添加进集合 |
| | | if (list.size() > 0) { |
| | | finalRegionCodeList.addAll(list); |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | return CacheUtil.get(SYS_CACHE, REGION_CHILD_CODE, regionCode, () -> regionService.getRegionChild(regionCode,communityCode)); |
| | | } |
| | | |
| | | /** |
| | | * 查询当前文章范围对应的社区编号字符串集合 |
| | | * @param articleRange |
| | | * @return |
| | | */ |
| | | public static String getAllCommunityNameListString(String articleRange,String id) { |
| | | return CacheUtil.get(ARTICLE_KEY, "id", id ,() -> regionService.getAllCommunityNameListString(articleRange)); |
| | | } |
| | | } |