| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Object placeDataHandle(String townName) { |
| | | // 查询所有的地址表和场所表差集集合 |
| | | List<DoorplateAddressEntity> list = baseMapper.getNotInPlaceList(townName); |
| | | // 创建场所集合对象 |
| | | List<PlaceEntity> placeList = new ArrayList<>(); |
| | | if (list.size() > 0) { |
| | | // 将场所数据保存到场所表中 |
| | | for (DoorplateAddressEntity addressEntity : list) { |
| | | // 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.setLocation(addressEntity.getAddressName()); |
| | | // 设置来源( 1:地址总表 2:国控采集 3:商超) |
| | | placeEntity.setSource(1); |
| | | // 待完善 |
| | | placeEntity.setStatus(1); |
| | | // 默认为非九小场所 |
| | | placeEntity.setIsNine(2); |
| | | // 默认为现场采集 |
| | | placeEntity.setIsScene(1); |
| | | // 根据位置设置网格,警格编号 |
| | | String point = "'POINT(" + addressEntity.getX() + " " + addressEntity.getY() + ")'"; |
| | | //点坐标解析网格 |
| | | List<GridEntity> gridEntityList = gridService.spatialAnalysis(point); |
| | | if (gridEntityList.size() > 0) { |
| | | GridEntity gridEntity = gridEntityList.get(0); |
| | | placeEntity.setGridId(gridEntity.getId()); |
| | | placeEntity.setGridCode(gridEntity.getGridCode()); |
| | | // 查询总数 |
| | | Integer count = baseMapper.getNotPlaceListCount(townName); |
| | | if (count > 0) { |
| | | int num = count / 1000; |
| | | for (int i = 0; i <= num + 1; i++) { |
| | | // 查询所有的地址表和场所表差集集合 |
| | | List<DoorplateAddressEntity> list = baseMapper.getNotInPlaceList(townName); |
| | | if (list.size() > 0) { |
| | | // 将场所数据保存到场所表中 |
| | | for (DoorplateAddressEntity addressEntity : list) { |
| | | // pio 名称不为空的进行插入操作 |
| | | PlaceEntity placeEntity = new PlaceEntity(); |
| | | placeEntity.setHouseCode(addressEntity.getAddressCode()); |
| | | placeEntity.setPlaceName(addressEntity.getPoi()); |
| | | placeEntity.setLng(addressEntity.getX()); |
| | | placeEntity.setLat(addressEntity.getY()); |
| | | placeEntity.setLocation(addressEntity.getAddressName()); |
| | | // 设置来源( 1:地址总表 2:国控采集 3:商超) |
| | | placeEntity.setSource(1); |
| | | // 待完善 |
| | | placeEntity.setStatus(1); |
| | | // 默认为非九小场所 |
| | | placeEntity.setIsNine(2); |
| | | // 默认为现场采集 |
| | | placeEntity.setIsScene(1); |
| | | // 根据位置设置网格,警格编号 |
| | | String point = "'POINT(" + addressEntity.getX() + " " + addressEntity.getY() + ")'"; |
| | | //点坐标解析网格 |
| | | List<GridEntity> gridEntityList = gridService.spatialAnalysis(point); |
| | | if (gridEntityList.size() > 0) { |
| | | GridEntity gridEntity = gridEntityList.get(0); |
| | | placeEntity.setGridId(gridEntity.getId()); |
| | | placeEntity.setGridCode(gridEntity.getGridCode()); |
| | | } |
| | | //点坐标解析警格 |
| | | List<PoliceAffairsGridEntity> policeAffairsGridEntityList = policeAffairsGridService.spatialAnalysis(point); |
| | | if (policeAffairsGridEntityList.size() > 0) { |
| | | PoliceAffairsGridEntity policeAffairsGridEntity = policeAffairsGridEntityList.get(0); |
| | | placeEntity.setJwGridCode(policeAffairsGridEntity.getJwGridCode()); |
| | | } |
| | | // 保存 |
| | | placeService.save(placeEntity); |
| | | // 新增场所详情 |
| | | savePlaceExtAndTaskInfo(placeEntity); |
| | | } |
| | | } |
| | | //点坐标解析警格 |
| | | List<PoliceAffairsGridEntity> policeAffairsGridEntityList = policeAffairsGridService.spatialAnalysis(point); |
| | | if (policeAffairsGridEntityList.size() > 0) { |
| | | PoliceAffairsGridEntity policeAffairsGridEntity = policeAffairsGridEntityList.get(0); |
| | | placeEntity.setJwGridCode(policeAffairsGridEntity.getJwGridCode()); |
| | | } |
| | | // 加入集合 |
| | | // placeList.add(placeEntity); |
| | | // 保存 |
| | | placeService.save(placeEntity); |
| | | // 新增场所详情 |
| | | savePlaceExtAndTaskInfo(placeEntity); |
| | | // } |
| | | } |
| | | // 批量插入 |
| | | // savePlaceExtAndTaskInfo(placeList); |
| | | } |
| | | // 返回 |
| | | return null; |