zhongrj
2024-04-15 e07a9002744dcd17bd08c2d96919169d0af82bf6
角色对应信息查询修改(角色为空时)
1 files modified
65 ■■■■ changed files
src/main/java/org/springblade/modules/doorplateAddress/service/impl/DoorplateAddressServiceImpl.java 65 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/doorplateAddress/service/impl/DoorplateAddressServiceImpl.java
@@ -144,43 +144,44 @@
        List<TreeStringNode> list = new ArrayList<>();
        // 获取请求头中的角色别名
        String roleName = SpringUtils.getRequestParam("roleName");
        // 如果是网格管理员,系统管理员,民警,无诈场所采集
        if (roleName.equals("admin") ||
            roleName.equals("wzcj") ||
            roleName.equals("wgy") ||
            roleName.equals("mj"))
        {
            houseParam.setRoleName(roleName);
            if ((roleName.equals("wgy") || roleName.equals("wzcj"))
                && !userId.equals("1726859808689696770")) {
                // 查询对应的网格code
        if (!Strings.isBlank(roleName)) {
            // 如果是网格管理员,系统管理员,民警,无诈场所采集
            if (roleName.equals("admin") ||
                roleName.equals("wzcj") ||
                roleName.equals("wgy") ||
                roleName.equals("mj")) {
                houseParam.setRoleName(roleName);
                if ((roleName.equals("wgy") || roleName.equals("wzcj"))
                    && !userId.equals("1726859808689696770")) {
                    // 查询对应的网格code
//                stringList = gridService.getGridListByUserId(AuthUtil.getUserId());
                stringList = SysCache.getGridRegionChildCodesByDeptId(AuthUtil.getDeptId(),null,roleName);
            }
            if (roleName.equals("mj")) {
                // 查询对应的社区编号
                communityList = SysCache.getGridRegionChildCodesByDeptId(AuthUtil.getDeptId(),null,roleName);
            }
            // 查询街道
            List<TreeStringNode> townList = baseMapper.getRegionListByGroupTwon(houseParam, stringList, communityList);
            // 查询社区
            List<TreeStringNode> neiList = baseMapper.getRegionListByGroupNei(houseParam, stringList, communityList);
            // 遍历
            for (TreeStringNode treeNode : townList) {
                    stringList = SysCache.getGridRegionChildCodesByDeptId(AuthUtil.getDeptId(), null, roleName);
                }
                if (roleName.equals("mj")) {
                    // 查询对应的社区编号
                    communityList = SysCache.getGridRegionChildCodesByDeptId(AuthUtil.getDeptId(), null, roleName);
                }
                // 查询街道
                List<TreeStringNode> townList = baseMapper.getRegionListByGroupTwon(houseParam, stringList, communityList);
                // 查询社区
                List<TreeStringNode> neiList = baseMapper.getRegionListByGroupNei(houseParam, stringList, communityList);
                // 遍历
                for (TreeStringNode node : neiList) {
                    if (treeNode.getId().equals(node.getParentId())) {
                        node.setHasChildren(false);
                        treeNode.getChildren().add(node);
                for (TreeStringNode treeNode : townList) {
                    // 遍历
                    for (TreeStringNode node : neiList) {
                        if (treeNode.getId().equals(node.getParentId())) {
                            node.setHasChildren(false);
                            treeNode.getChildren().add(node);
                        }
                    }
                }
                // 查询区域数据
                return townList;
            }
            // 查询区域数据
            return townList;
        }
        // 如果是居民
        if (roleName.equals("inhabitant")) {
            return getInhabitantInfo(list);
            // 如果是居民
            if (roleName.equals("inhabitant")) {
                return getInhabitantInfo(list);
            }
        }
        return list;
    }