lin
2024-04-11 dd60de8d90f05c64e3cf166bc617b95a82102c52
src/main/java/org/springblade/modules/doorplateAddress/service/impl/DoorplateAddressServiceImpl.java
@@ -129,53 +129,57 @@
   /**
    * 根据角色获取功能集合数据
    *
    * @param type     1:查社区  2:查房屋和场所(居民角色)
    * @param roleName
    * @param type     1:查社区  2:查房屋和场所(居民角色)--2024/04/10  弃用
    * @param roleNames --2024/04/10  弃用
    * @return
    */
   @Override
   public Object getFuncList(Integer type, String roleName) {
   public Object getFuncList(Integer type, String roleNames) {
      HouseParam houseParam = new HouseParam();
      String userId = AuthUtil.getUserId().toString();
      houseParam.setUserId(userId);
      List<String> stringList = new ArrayList<>();
      List<String> communityList = new ArrayList<>();
      List<TreeStringNode> list = new ArrayList<>();
      if (null != type) {
         // 如果是网格管理员,系统管理员,民警
         if (type == 1) {
            if (null != roleName && !roleName.equals("")) {
               houseParam.setRoleName(roleName);
               if (roleName.equals("网格员") && !userId.equals("1726859808689696770")) {
                  // 查询对应的网格code
                  stringList = gridService.getGridListByUserId(AuthUtil.getUserId());
               }
               if (roleName.equals("民警")) {
                  // 查询对应的社区编号
                  communityList = SysCache.getPoliceRegionChildCodesByDeptId(AuthUtil.getDeptId(),null);
               }
            }
            // 查询街道
            List<TreeStringNode> townList = baseMapper.getRegionListByGroupTwon(houseParam, stringList, communityList);
            // 查询社区
            List<TreeStringNode> neiList = baseMapper.getRegionListByGroupNei(houseParam, stringList, communityList);
      // 获取请求头中的角色别名
      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
//            stringList = gridService.getGridListByUserId(AuthUtil.getUserId());
            stringList = SysCache.getGridRegionChildCodesByDeptId(AuthUtil.getDeptId(),null,roleName);
         }
         if (roleName.equals("mj")) {
            // 查询对应的社区编号
            communityList = SysCache.getPoliceRegionChildCodesByDeptId(AuthUtil.getDeptId(),null);
         }
         // 查询街道
         List<TreeStringNode> townList = baseMapper.getRegionListByGroupTwon(houseParam, stringList, communityList);
         // 查询社区
         List<TreeStringNode> neiList = baseMapper.getRegionListByGroupNei(houseParam, stringList, communityList);
         // 遍历
         for (TreeStringNode treeNode : townList) {
            // 遍历
            for (TreeStringNode treeNode : townList) {
               // 遍历
               for (TreeStringNode node : neiList) {
                  if (treeNode.getId().equals(node.getParentId())) {
                     node.setHasChildren(false);
                     treeNode.getChildren().add(node);
                  }
            for (TreeStringNode node : neiList) {
               if (treeNode.getId().equals(node.getParentId())) {
                  node.setHasChildren(false);
                  treeNode.getChildren().add(node);
               }
            }
            // 查询区域数据
            return townList;
         }
         // 如果是居民
         if (type == 2 || type == 3) {
            return getInhabitantInfo(list);
         }
         // 查询区域数据
         return townList;
      }
      // 如果是居民
      if (roleName.equals("inhabitant")) {
         return getInhabitantInfo(list);
      }
      return list;
   }
@@ -225,7 +229,7 @@
         list.add(houseNode);
         TreeStringNode placeNode = new TreeStringNode();
         placeNode.setName("场所");
         placeNode.setName("经营场所");
         placeNode.setId("2");
         placeNode.setHasChildren(true);
         placeNode.setChildren(placeNodeList);