民警网格区域查询合并,网格员区域树查询修改,解决不显示网格问题
| | |
| | | |
| | | |
| | | /** |
| | | * 查询综治网格相关的网格,社区编号集合 |
| | | * 查询综治网格/公安相关的网格,社区编号集合 |
| | | * @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 (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<String> collect = deptChild.stream().map(Region::getCode).collect(Collectors.toList()); |
| | | list.addAll(collect); |
| | | } |
| | | // finalRegionCodeList.add(dept.getRegionCode()); |
| | | } |
| | | |
| | | //行政区划不为空添加进集合 |
| | | if (list.size() > 0) { |
| | | finalRegionCodeList.addAll(list); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | // 去重 |
| | | regionCodeList = finalRegionCodeList.stream().distinct().collect(Collectors.toList()); |
| | |
| | | regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId(), communityCode); |
| | | // 民警角色 |
| | | if (!Strings.isBlank(roleName) && roleName.equals("mj")) { |
| | | regionChildCodesList = SysCache.getPoliceRegionChildCodesByDeptId(AuthUtil.getDeptId(),communityCode); |
| | | regionChildCodesList = SysCache.getGridRegionChildCodesByDeptId(AuthUtil.getDeptId(),communityCode,roleName); |
| | | } |
| | | } |
| | | // 获取网格编号集合 |
| | |
| | | // 无权限 |
| | | doorplateAddressVO.setIsJur(2); |
| | | // 查询对应的社区code |
| | | list = SysCache.getPoliceRegionChildCodesByDeptId(AuthUtil.getDeptId(),null); |
| | | list = SysCache.getGridRegionChildCodesByDeptId(AuthUtil.getDeptId(),null,roleName); |
| | | if (null != list && list.size() > 0) { |
| | | boolean contains = list.contains(doorplateAddressVO.getNeiCode()); |
| | | if (contains) { |
| | |
| | | return NodeTreeUtil.getStringNodeTree(baseMapper.getPoliceTreeList()); |
| | | } |
| | | } |
| | | if (region.getDeptNature()==2){ |
| | | region.setCityCode("361100"); |
| | | } |
| | | // 非公安 |
| | | return NodeTreeUtil.getStringNodeTree(baseMapper.getTreeList(region,regionChildCodesList,isAdministrator)); |
| | | } |
| | |
| | | // 查询综治区域集合 |
| | | List<Region> regionChildList = baseMapper.getGridRegionChildList(regionCode); |
| | | list.addAll(regionChildList); |
| | | }else if (!Strings.isBlank(roleName) && roleName.equals("mj")){ |
| | | // 查询公安相关的区域数据 |
| | | List<Region> regionList = baseMapper.getPoliceList(communityCode); |
| | | if (regionList.size()>0) { |
| | | List<Region> policeList = treeRegionList(regionList,regionCode, list); |
| | | list.addAll(policeList); |
| | | } |
| | | }else { |
| | | // 查询综治区域集合 |
| | | List<Region> regionChildList = baseMapper.getRegionChildList(regionCode, communityCode, roleName); |
| | |
| | | //递归遍历下一级 |
| | | treeRegionList(regionList,region.getCode(),list); |
| | | } |
| | | if(region.getCode().equals(parentCode)){ |
| | | // 本身也加入 |
| | | list.add(region); |
| | | } |
| | | } |
| | | return list; |
| | | } |