| | |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity; |
| | | import org.springblade.modules.doorplateAddress.service.IDoorplateAddressService; |
| | | import org.springblade.modules.grid.entity.GridRangeEntity; |
| | | import org.springblade.modules.grid.service.IGridRangeService; |
| | | import org.springblade.modules.grid.service.IGridService; |
| | | import org.springblade.modules.grid.vo.GridVO; |
| | | import org.springblade.modules.place.entity.*; |
| | |
| | | |
| | | @Autowired |
| | | private IGridService gridService; |
| | | |
| | | @Autowired |
| | | private IGridRangeService gridRangeService; |
| | | |
| | | /** |
| | | * 自定义列表查询 |
| | |
| | | QueryWrapper<PlaceEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("is_deleted",0).eq("house_code",placeVO.getHouseCode()); |
| | | PlaceEntity one = getOne(wrapper); |
| | | placeVO.setId(one.getId()); |
| | | if (null!=one) { |
| | | placeVO.setId(one.getId()); |
| | | } |
| | | // 设置来源( 1:地址总表 2:国控采集),扫码采集 |
| | | placeVO.setSource(1); |
| | | // 绑定用户信息 |
| | | bindUserHandle(placeVO); |
| | | // 更新场所信息 |
| | |
| | | savePlaceExtAndTaskInfo(placeVO); |
| | | // 场所标签信息绑定(更新,调整) |
| | | placeLabelBind(placeVO); |
| | | // 网格绑定 |
| | | gridBind(placeVO); |
| | | }else { |
| | | // 设置基础数据 |
| | | placeVO.setCreateUser(AuthUtil.getUserId()); |
| | |
| | | savePlaceExtAndTaskInfo(placeVO); |
| | | // 场所标签信息绑定 |
| | | placeLabelBind(placeVO); |
| | | // 网格绑定 |
| | | gridBind(placeVO); |
| | | } |
| | | // 位置绑定,通过定位去匹配所在网格 |
| | | // 返回结果 |
| | | return flag; |
| | | } |
| | | |
| | | /** |
| | | * 网格绑定 |
| | | * @param placeVO |
| | | */ |
| | | public void gridBind(PlaceVO placeVO) { |
| | | if (null!=placeVO.getGridId()){ |
| | | // 判断关联关系表是否存在 |
| | | QueryWrapper<GridRangeEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("grid_id",placeVO.getGrid()).eq("house_code",placeVO.getHouseCode()); |
| | | GridRangeEntity one = gridRangeService.getOne(wrapper); |
| | | if (null!=one){ |
| | | // 新增 |
| | | GridRangeEntity gridRangeEntity = new GridRangeEntity(); |
| | | gridRangeEntity.setHouseCode(placeVO.getHouseCode()); |
| | | gridRangeEntity.setGridId(placeVO.getGridId()); |
| | | // 插入 |
| | | gridRangeService.save(gridRangeEntity); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | public void savePlaceLabel(PlaceVO placeVO) { |
| | | // 批量新增 |
| | | List<String> labelList = Arrays.asList(placeVO.getLabel().split(",")); |
| | | // 遍历 |
| | | labelList.forEach(labelId -> { |
| | | PlacePoiLabel placePoiLabel = new PlacePoiLabel(); |
| | | placePoiLabel.setPlaceId(placeVO.getId()); |
| | | placePoiLabel.setPoiCode(Integer.parseInt(labelId)); |
| | | placePoiLabelService.save(placePoiLabel); |
| | | }); |
| | | if (labelList.size()>1){ |
| | | // 只处理小类 |
| | | // 遍历 |
| | | labelList.forEach(labelId -> { |
| | | // 处理小类 |
| | | if (labelId.length()>4) { |
| | | // 切割成三个,分别是大类,中类,小类 |
| | | String bigString = labelId.substring(0,2); |
| | | String midString = labelId.substring(0,4); |
| | | // 大类 |
| | | PlacePoiLabel big = new PlacePoiLabel(); |
| | | big.setPlaceId(placeVO.getId()); |
| | | big.setPoiCode(Integer.parseInt(bigString)); |
| | | big.setType(1); |
| | | placePoiLabelService.save(big); |
| | | // 中类 |
| | | PlacePoiLabel mid = new PlacePoiLabel(); |
| | | mid.setPlaceId(placeVO.getId()); |
| | | mid.setPoiCode(Integer.parseInt(midString)); |
| | | mid.setType(2); |
| | | placePoiLabelService.save(mid); |
| | | // 小类 |
| | | PlacePoiLabel min = new PlacePoiLabel(); |
| | | min.setPlaceId(placeVO.getId()); |
| | | min.setPoiCode(Integer.parseInt(labelId)); |
| | | min.setType(3); |
| | | placePoiLabelService.save(min); |
| | | } |
| | | }); |
| | | }else { |
| | | // 处理单个 |
| | | String labelCode = labelList.get(0); |
| | | // 切割成三个,分别是大类,中类,小类 |
| | | String bigString = labelCode.substring(0,2); |
| | | String midString = labelCode.substring(0,4); |
| | | // 大类 |
| | | PlacePoiLabel big = new PlacePoiLabel(); |
| | | big.setPlaceId(placeVO.getId()); |
| | | big.setPoiCode(Integer.parseInt(bigString)); |
| | | big.setType(1); |
| | | placePoiLabelService.save(big); |
| | | // 中类 |
| | | PlacePoiLabel mid = new PlacePoiLabel(); |
| | | mid.setPlaceId(placeVO.getId()); |
| | | mid.setPoiCode(Integer.parseInt(midString)); |
| | | mid.setType(2); |
| | | placePoiLabelService.save(mid); |
| | | // 处理小类 |
| | | if (labelCode.length()>4) { |
| | | // 小类 |
| | | PlacePoiLabel min = new PlacePoiLabel(); |
| | | min.setPlaceId(placeVO.getId()); |
| | | min.setPoiCode(Integer.parseInt(labelCode)); |
| | | min.setType(3); |
| | | placePoiLabelService.save(min); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | List<DoorplateAddressEntity> list = doorplateAddressService.list(wrapper); |
| | | if (list.size() > 0) { |
| | | placeVO.setDoorplateAddressEntity(list.get(0)); |
| | | placeVO.setNeiCode(list.get(0).getNeiCode().replaceAll("0+$", "")); |
| | | } |
| | | // 查询网格数据 |
| | | placeVO.setGrid(gridService.getGridDetailByHouseCode(place.getHouseCode())); |
| | | GridVO gridVO = gridService.getGridDetailByHouseCode(place.getHouseCode()); |
| | | if (null!= gridVO) { |
| | | placeVO.setGrid(gridVO); |
| | | place.setGridId(gridVO.getId()); |
| | | } |
| | | } else { |
| | | // 通过定位点落面分析网格位置,反向推出社区派出所相关数据 |
| | | |
| | |
| | | // 修改场所信息 |
| | | flag = updateById(placeVO); |
| | | // 修改标签绑定信息 |
| | | |
| | | // 返回 |
| | | return flag; |
| | | } |