| | |
| | | throw new ServiceException("系统异常", I18nKeyConstant.SYSTEM_EXCEPTION); |
| | | } |
| | | if (Boolean.TRUE.equals(existsResult.getData())) { |
| | | throw new ServiceException("操作失败,该点位有关联的巡游点位", I18nKeyConstant.POINT_DELETE_HAS_CRUISE_PLAN_POINT); |
| | | throw new ServiceException("操作失败,该点位有关联的巡游计划点位", I18nKeyConstant.POINT_DELETE_HAS_CRUISE_PLAN_POINT); |
| | | } |
| | | xpPointService.removeBatchByIds(pointIds); |
| | | return R.ok(); |
| | |
| | | @ShardingSphereTransactionType(TransactionType.BASE) |
| | | public R edit(@Validated @RequestBody PointUpdateDto pointAddDto) { |
| | | XpPoint xpPoint = xpPointService.getById(pointAddDto.getId()); |
| | | if (!xpPoint.getElectronicAreaId().equals(pointAddDto.getElectronicAreaId())) { |
| | | BeanUtils.copyProperties(pointAddDto, xpPoint); |
| | | |
| | | if (xpGeoFencingPolygonService.isInFence(pointAddDto.getPointLon(), pointAddDto.getPointLat(), pointAddDto.getFenceId(), "prohibited_area")) { |
| | | return R.ok("in_prohibited_area"); |
| | | } |
| | | |
| | | xpPointService.updateById(xpPoint); |
| | | } else { |
| | | if (xpGeoFencingPolygonService.isInFence(pointAddDto.getPointLon(), pointAddDto.getPointLat(), pointAddDto.getFenceId(), "prohibited_area")) { |
| | | return R.ok("in_prohibited_area"); |
| | | } |
| | | |
| | | //先删除原有的数据,因为会存在点位的从属区域变化的情况,所以先删除原有的数据后添加新的数据重新分片到新的库中 |
| | | BeanUtils.copyProperties(pointAddDto, xpPoint); |
| | | xpPointService.removeById(pointAddDto.getId()); |
| | | xpPoint.setId(null); |
| | | xpPointService.save(xpPoint); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |