| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import liquibase.pro.packaged.W; |
| | | import liquibase.repackaged.org.apache.commons.lang3.StringUtils; |
| | | import org.apache.logging.log4j.util.Strings; |
| | | import org.springblade.common.cache.SysCache; |
| | |
| | | import org.springblade.common.param.CommonParamSet; |
| | | import org.springblade.common.utils.IdUtils; |
| | | import org.springblade.common.utils.SpringUtils; |
| | | import org.springblade.core.log.exception.ServiceException; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.utils.SpringUtil; |
| | |
| | | import org.springblade.modules.place.excel.NinePlaceExcel; |
| | | import org.springblade.modules.place.excel.PlaceAndRelExcel; |
| | | import org.springblade.modules.place.excel.PlaceExcel; |
| | | import org.springblade.modules.place.service.IPlaceExtService; |
| | | import org.springblade.modules.place.service.IPlacePoiLabelService; |
| | | import org.springblade.modules.place.service.IPlaceRelService; |
| | | import org.springblade.modules.place.service.*; |
| | | import org.springblade.modules.place.vo.PlaceCheckVO; |
| | | import org.springblade.modules.place.vo.PlacePoiLabelVO; |
| | | import org.springblade.modules.place.vo.PlaceVO; |
| | | import org.springblade.modules.place.mapper.PlaceMapper; |
| | | import org.springblade.modules.place.service.IPlaceService; |
| | | import org.springblade.modules.police.entity.PoliceAffairsGridEntity; |
| | | import org.springblade.modules.police.service.IPoliceAffairsGridService; |
| | | import org.springblade.modules.system.entity.Dept; |
| | |
| | | |
| | | @Autowired |
| | | private IPlaceRelService placeRelService; |
| | | |
| | | @Autowired |
| | | private IPlaceDoorService placeDoorService; |
| | | |
| | | @Autowired |
| | | private IDoorplateAddressService doorplateAddressService; |
| | |
| | | bindUserHandle(placeVO); |
| | | // 设置完善状态 |
| | | setPlaceStatus(placeVO); |
| | | // 房屋编号绑定处理 |
| | | // houseCodeBindHandle(placeVO); |
| | | // 更新场所信息 |
| | | flag = updateById(placeVO); |
| | | } else { |
| | |
| | | gridCodeBind(placeVO); |
| | | // 警务网格绑定 |
| | | jwGridCodeBind(placeVO); |
| | | // 房屋编号绑定 |
| | | // houseCodeBind(placeVO); |
| | | // 返回结果 |
| | | return flag; |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 房屋绑定 |
| | | * 房屋绑定处理 |
| | | * |
| | | * @param placeVO |
| | | */ |
| | | public void houseCodeBind(PlaceVO placeVO) { |
| | | String houseCode = placeVO.getHouseCode(); |
| | | List<String> list = Arrays.asList(houseCode.split(",")); |
| | | if (list.size() > 1) { |
| | | // 处理对应的绑定房屋数据 |
| | | List<Long> longs = new ArrayList<>(); |
| | | // 把其他单个的场所数据删除 |
| | | for (String code : list) { |
| | | public void houseCodeBindHandle(PlaceVO placeVO) { |
| | | List<String> list = Arrays.asList(placeVO.getHouseCodeBinds().split(",")); |
| | | // 先删除原有的绑定 |
| | | QueryWrapper<PlaceDoorEntity> removeQw = new QueryWrapper<>(); |
| | | removeQw.eq("place_id",placeVO.getId()); |
| | | // 删除 |
| | | placeDoorService.remove(removeQw); |
| | | // 遍历更新 |
| | | for (String houseCode : list) { |
| | | // 查询是否已存在关联关系 |
| | | QueryWrapper<PlaceDoorEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("house_code",houseCode); |
| | | // 查询 |
| | | List<PlaceDoorEntity> placeDoorEntityList = placeDoorService.list(wrapper); |
| | | if (placeDoorEntityList.size()>0){ |
| | | // 该houseCode 已被绑定 |
| | | // errorList.add(houseCode); |
| | | for (PlaceDoorEntity placeDoorEntity : placeDoorEntityList) { |
| | | placeDoorEntity.setPlaceId(placeVO.getId()); |
| | | // 更新 |
| | | placeDoorService.updateById(placeDoorEntity); |
| | | } |
| | | }else { |
| | | PlaceDoorEntity placeDoorEntity = new PlaceDoorEntity(); |
| | | placeDoorEntity.setHouseCode(houseCode); |
| | | placeDoorEntity.setPlaceId(placeVO.getId()); |
| | | // 对应插入到关联关系表中 |
| | | placeDoorService.save(placeDoorEntity); |
| | | } |
| | | } |
| | | // 处理原场所表houseCode 绑定数据 |
| | | handlePlaceOne(list,placeVO); |
| | | } |
| | | |
| | | /** |
| | | * 处理对应的绑定房屋数据 |
| | | * @param list |
| | | */ |
| | | public void handlePlaceOne(List<String> list,PlaceVO place) { |
| | | // 处理对应的绑定房屋数据 |
| | | List<Long> longs = new ArrayList<>(); |
| | | // 把其他单个的场所数据删除 |
| | | for (String code : list) { |
| | | if (!code.equals(place.getHouseCode())) { |
| | | // 先查询对应的场所id |
| | | QueryWrapper<PlaceEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("house_code", code).eq("is_deleted", 0); |
| | |
| | | removeById(one.getId()); |
| | | } |
| | | } |
| | | if (longs.size() > 0) { |
| | | // 删除对应的详情 |
| | | removePlaceExt(longs); |
| | | // 删除对应的标签绑定信息 |
| | | removePlaceLabel(longs); |
| | | } |
| | | } else { |
| | | // 一对一,暂时不处理,后续考虑需加绑定关系表 |
| | | |
| | | } |
| | | if (longs.size() > 0) { |
| | | // 删除对应的详情 |
| | | removePlaceExt(longs); |
| | | // 删除对应的标签绑定信息 |
| | | removePlaceLabel(longs); |
| | | // 删除对应的场所门牌绑定关系信息 |
| | | removePlaceDoor(longs); |
| | | } |
| | | } |
| | | |
| | |
| | | removePlaceExt(longs); |
| | | // 删除对应的标签绑定信息 |
| | | removePlaceLabel(longs); |
| | | // 删除对应的门牌绑定信息 |
| | | removePlaceDoor(longs); |
| | | // 返回 |
| | | return removeByIds; |
| | | } |
| | |
| | | QueryWrapper<PlacePoiLabel> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("place_id", id); |
| | | placePoiLabelService.remove(wrapper); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 删除对应的门牌绑定信息 |
| | | * |
| | | * @param longs |
| | | */ |
| | | public void removePlaceDoor(List<Long> longs) { |
| | | for (Long id : longs) { |
| | | QueryWrapper<PlaceDoorEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("place_id", id); |
| | | placeDoorService.remove(wrapper); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 场所综治网格处理 |
| | | */ |
| | | @Override |
| | | public Object placeGridCodeHandle() { |
| | | // 查询 综治网格为空的数据 |
| | | List<PlaceEntity> list = baseMapper.getPlaceNotGridCode(); |
| | | // 遍历 |
| | | for (PlaceEntity placeEntity : list) { |
| | | if (!Strings.isBlank(placeEntity.getLng())) { |
| | | // 空间分析 |
| | | //点坐标解析 |
| | | String point = "'POINT(" + placeEntity.getLng() + " " + placeEntity.getLat() + ")'"; |
| | | //String point = "'POINT(" + villageInfoExcel.getLatitude() + " " + villageInfoExcel.getLongitude() +")'"; |
| | | List<GridEntity> gridEntityList = gridService.spatialAnalysis(point); |
| | | if (gridEntityList.size() > 0) { |
| | | GridEntity gridEntity = gridEntityList.get(0); |
| | | placeEntity.setGridCode(gridEntity.getGridCode()); |
| | | // 更新 |
| | | updateById(placeEntity); |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |