|
|
@@ -92,6 +92,29 @@ public class MetaObjectMoveService {
|
|
|
return save;
|
|
|
}
|
|
|
|
|
|
+ @Transactional
|
|
|
+ public void del(Long id) {
|
|
|
+ MetaObjectMove metaObjectMove = metaObjectMoveRepo.findById(id).orElseThrow(new BusinessException("无记录"));
|
|
|
+ Long objectId = metaObjectMove.getObjectId();
|
|
|
+ String objectMoveKey = MetaConstants.META_OBJECT_MOVE_REDIS_KEY.concat(String.valueOf(objectId));
|
|
|
+ List<MetaObjectMoveCoordinate> metaObjectMoveCoordinates = metaObjectMoveCoordinateRepo.findAllByObjectIdAndDel(objectId, false);
|
|
|
+ // 删除物体信息
|
|
|
+ if (Objects.isNull(metaObjectMoveCoordinates)) {
|
|
|
+ redisTemplate.delete(objectMoveKey);
|
|
|
+ metaObjectMoveRepo.softDelete(id);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 删除坐标信息
|
|
|
+ metaObjectMoveCoordinates.forEach(metaObjectMoveCoordinate -> {
|
|
|
+ String coordinateKey = MetaConstants.META_OBJECT_INDEX_REDIS_KEY.concat(String.valueOf(objectId)).concat("_").concat(String.valueOf(metaObjectMoveCoordinate.getCoordinateIndex()));
|
|
|
+ redisTemplate.delete(coordinateKey);
|
|
|
+ metaObjectMoveCoordinateRepo.delete(metaObjectMoveCoordinate);
|
|
|
+ });
|
|
|
+ // 删除物体信息
|
|
|
+ redisTemplate.delete(objectMoveKey);
|
|
|
+ metaObjectMoveRepo.softDelete(id);
|
|
|
+ }
|
|
|
+
|
|
|
@Transactional
|
|
|
public void handleCoordinate(Long id) {
|
|
|
MetaObjectMove metaObjectMove = metaObjectMoveRepo.findByIdAndDel(id, false);
|