| | |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.modules.category.dto.CategoryLabelDTO; |
| | | import org.springblade.modules.category.service.ICategoryLabelService; |
| | | import org.springblade.modules.community.entity.CommunityEntity; |
| | | import org.springblade.modules.community.service.ICommunityService; |
| | | import org.springblade.modules.district.entity.DistrictEntity; |
| | | import org.springblade.modules.district.service.IDistrictService; |
| | | import org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity; |
| | |
| | | @Autowired |
| | | private ICategoryLabelService iCategoryLabelService; |
| | | |
| | | @Autowired |
| | | private ICommunityService communityService; |
| | | |
| | | |
| | | @Override |
| | | public IPage<DoorplateAddressVO> selectDoorplateAddressPage(IPage<DoorplateAddressVO> page, DoorplateAddressVO doorplateAddress) { |
| | |
| | | String userId = AuthUtil.getUserId().toString(); |
| | | houseParam.setUserId(userId); |
| | | List<String> stringList = new ArrayList<>(); |
| | | List<String> communityList = new ArrayList<>(); |
| | | if (null!=roleName && !roleName.equals("")){ |
| | | houseParam.setRoleName(roleName); |
| | | if (roleName.equals("网格员") && !userId.equals("1726859808689696770")){ |
| | | // 查询对应的房屋地址code |
| | | stringList = gridService.getAddressCodeListByUserId(AuthUtil.getUserId()); |
| | | } |
| | | if (roleName.equals("民警")){ |
| | | // 查询对应的社区编号 |
| | | communityList = communityService.getCommunityCodeListByUserId(AuthUtil.getUserId()); |
| | | } |
| | | } |
| | | List<TreeStringNode> list = new ArrayList<>(); |
| | | if (null!=type) { |
| | | // 如果是网格管理员,系统管理员 |
| | | // 如果是网格管理员,系统管理员,民警 |
| | | if (type==1){ |
| | | // 查询街道 |
| | | List<TreeStringNode> townList = baseMapper.getRegionListByGroupTwon(houseParam,stringList); |
| | | List<TreeStringNode> townList = baseMapper.getRegionListByGroupTwon(houseParam,stringList,communityList); |
| | | // 查询社区 |
| | | List<TreeStringNode> neiList = baseMapper.getRegionListByGroupNei(houseParam,stringList); |
| | | List<TreeStringNode> neiList = baseMapper.getRegionListByGroupNei(houseParam,stringList,communityList); |
| | | // 遍历 |
| | | for (TreeStringNode treeNode : townList) { |
| | | // 遍历 |
| | |
| | | Map<String, Object> map = new HashMap<>(2); |
| | | // 获取网格员对应的地址编号集合 |
| | | List<String> stringList = getHouseCodeList(houseParam); |
| | | List<String> communityCodeList = getCommunityCodeList(houseParam); |
| | | // 获取网格员对应的网格信息 |
| | | getGridInfoByGridman(houseParam); |
| | | // 查小区,场所 |
| | | if (houseParam.getType()==1){ |
| | | // 根据社区名称查询小区集合 |
| | | list = baseMapper.getDistrictList(houseParam,stringList); |
| | | list = baseMapper.getDistrictList(houseParam,stringList,communityCodeList); |
| | | } |
| | | // 查楼栋,街路巷 |
| | | if (houseParam.getType()==2){ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 根据角色获取社区编号集合 |
| | | * @param houseParam |
| | | * @return |
| | | */ |
| | | private List<String> getCommunityCodeList(HouseParam houseParam) { |
| | | List<String> stringList = new ArrayList<>(); |
| | | String userId = AuthUtil.getUserId().toString(); |
| | | houseParam.setUserId(userId); |
| | | if (null != houseParam.getRoleName() && !houseParam.getRoleName().equals("")) { |
| | | if (houseParam.getRoleName().equals("民警") && !userId.equals("1726859808689696770")) { |
| | | // 查询对应的房屋地址code |
| | | stringList = communityService.getCommunityCodeListByUserId(AuthUtil.getUserId()); |
| | | } |
| | | } |
| | | return stringList; |
| | | } |
| | | |
| | | /** |
| | | * 房屋数据处理 |
| | | * @return |
| | | */ |
| | |
| | | if (list.size()>0) { |
| | | // 将场所数据保存到场所表中 |
| | | for (DoorplateAddressEntity addressEntity : list) { |
| | | PlaceEntity placeEntity = new PlaceEntity(); |
| | | placeEntity.setHouseCode(addressEntity.getAddressCode()); |
| | | placeEntity.setPlaceName(addressEntity.getPoi()); |
| | | placeEntity.setLng(addressEntity.getX()); |
| | | placeEntity.setLat(addressEntity.getY()); |
| | | placeEntity.setLocaltion(addressEntity.getAddressName()); |
| | | // 设置来源( 1:地址总表 2:国控采集) |
| | | placeEntity.setSource(1); |
| | | // 加入集合 |
| | | placeList.add(placeEntity); |
| | | // pio 名称不为空的进行插入操作 |
| | | if (!Strings.isBlank(addressEntity.getPoi())) { |
| | | PlaceEntity placeEntity = new PlaceEntity(); |
| | | placeEntity.setHouseCode(addressEntity.getAddressCode()); |
| | | placeEntity.setPlaceName(addressEntity.getPoi()); |
| | | placeEntity.setLng(addressEntity.getX()); |
| | | placeEntity.setLat(addressEntity.getY()); |
| | | placeEntity.setLocaltion(addressEntity.getAddressName()); |
| | | // 设置来源( 1:地址总表 2:国控采集) |
| | | placeEntity.setSource(1); |
| | | // 加入集合 |
| | | placeList.add(placeEntity); |
| | | } |
| | | } |
| | | // 批量插入 |
| | | placeService.saveBatch(placeList); |
| | |
| | | }else { |
| | | one.setIsJur(1); |
| | | } |
| | | }else if (doorplateAddress.getRoleName().equals("民警")){ |
| | | // 查询对应的社区code |
| | | list = communityService.getCommunityCodeListByUserId(AuthUtil.getUserId()); |
| | | boolean contains = list.contains(doorplateAddress.getNeiCode().replaceAll("0+$", "")); |
| | | if (list.size()==0 || !contains){ |
| | | // 无权限 |
| | | one.setIsJur(2); |
| | | }else { |
| | | one.setIsJur(1); |
| | | } |
| | | }else { |
| | | // 不限制 |
| | | one.setIsJur(1); |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 社区数据处理 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Object communityDataHandle() { |
| | | // 查询所有的社区差值 |
| | | List<DoorplateAddressEntity> doorplateAddressEntities = baseMapper.getAllCommunityList(); |
| | | // 遍历,插入库 |
| | | for (DoorplateAddressEntity doorplateAddressEntity : doorplateAddressEntities) { |
| | | QueryWrapper<CommunityEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("name",doorplateAddressEntity.getNeiName()) |
| | | .eq("code",doorplateAddressEntity.getNeiCode()) |
| | | .eq("is_deleted",0); |
| | | CommunityEntity one = communityService.getOne(queryWrapper); |
| | | if (null==one){ |
| | | // 插入 |
| | | CommunityEntity communityEntity = new CommunityEntity(); |
| | | communityEntity.setCode(doorplateAddressEntity.getNeiCode()); |
| | | communityEntity.setName(doorplateAddressEntity.getNeiName()); |
| | | communityEntity.setStreetCode(doorplateAddressEntity.getTownStreetCode().replaceAll("0+$", "")); |
| | | //新增操作 |
| | | communityService.save(communityEntity); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |