|
@@ -0,0 +1,87 @@
|
|
|
+package com.fdkankan.scene.service.impl;
|
|
|
+
|
|
|
+import cn.hutool.core.io.FileUtil;
|
|
|
+import cn.hutool.core.lang.UUID;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.fdkankan.common.constant.ErrorCode;
|
|
|
+import com.fdkankan.model.constants.ConstantFilePath;
|
|
|
+import com.fdkankan.rabbitmq.util.RabbitMqProducer;
|
|
|
+import com.fdkankan.scene.entity.SceneMarkShape;
|
|
|
+import com.fdkankan.scene.entity.SceneMarkShapeBox;
|
|
|
+import com.fdkankan.scene.httpclient.ShapesBoxClient;
|
|
|
+import com.fdkankan.scene.mapper.MarkShapeBoxMapper;
|
|
|
+import com.fdkankan.scene.mapper.MarkShapeMapper;
|
|
|
+import com.fdkankan.scene.service.ISceneMarkShapeBoxService;
|
|
|
+import com.fdkankan.scene.service.ISceneMarkShapeService;
|
|
|
+import com.fdkankan.scene.util.ConverxyUtil;
|
|
|
+import com.fdkankan.scene.vo.SceneMarkShapeBoxPostVO;
|
|
|
+import com.fdkankan.scene.vo.SceneMarkShapeParamVO;
|
|
|
+import com.fdkankan.scene.vo.SceneMarkShapeReDetectParamVO;
|
|
|
+import com.fdkankan.web.response.ResultData;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.io.File;
|
|
|
+import java.io.IOException;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * Created by Xiewj on 2023-8-31 10:44:46
|
|
|
+ */
|
|
|
+@Slf4j
|
|
|
+@Service
|
|
|
+public class SceneMarkShapeBoxServiceImpl extends ServiceImpl<MarkShapeBoxMapper, SceneMarkShapeBox> implements ISceneMarkShapeBoxService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ ISceneMarkShapeService sceneMarkShapeService;
|
|
|
+ @Resource
|
|
|
+ ShapesBoxClient shapesBoxClient;
|
|
|
+
|
|
|
+ @Value("${4dkk.nodeService.basePath}")
|
|
|
+ private String planeCovertBasePathUrl;
|
|
|
+ @Value("${4dkk.nodeService.api.planeCovert}")
|
|
|
+ private String planeCovert;
|
|
|
+ @Override
|
|
|
+ public SceneMarkShapeBox findBySceneNum(String sceneNum) {
|
|
|
+ LambdaQueryWrapper<SceneMarkShapeBox> wrapper = Wrappers.lambdaQuery();
|
|
|
+ wrapper.eq(SceneMarkShapeBox::getSceneNum,sceneNum);
|
|
|
+ return getOne(wrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void planeCovert(String sceneNum) {
|
|
|
+ List<SceneMarkShape> sceneMarkShapes = sceneMarkShapeService.findByNum(sceneNum);
|
|
|
+ SceneMarkShapeBoxPostVO sceneMarkShapeBoxPostVO =new SceneMarkShapeBoxPostVO(sceneNum,sceneMarkShapes);
|
|
|
+ ResultData res = shapesBoxClient.post(planeCovertBasePathUrl + planeCovert, JSONObject.toJSONString(sceneMarkShapeBoxPostVO));
|
|
|
+ log.info("请求node转换服务-{}",res);
|
|
|
+ if (res.getCode()==200){
|
|
|
+ SceneMarkShapeBox data = (SceneMarkShapeBox)res.getData();
|
|
|
+ SceneMarkShapeBox sceneMarkShapeBox = findBySceneNum(sceneNum);
|
|
|
+ if (ObjectUtil.isNotNull(sceneMarkShapeBox)){
|
|
|
+ log.info("存在shapesBox数据进行替换");
|
|
|
+ sceneMarkShapeBox.setBoxes(data.getBoxes());
|
|
|
+ sceneMarkShapeBox.setBoundingBox(data.getBoundingBox());
|
|
|
+ updateById(sceneMarkShapeBox);
|
|
|
+ }else {
|
|
|
+ log.info("不存在shapesBox数据进行保存");
|
|
|
+ save(data);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+}
|