Przeglądaj źródła

v3场景生成obj从本地拉取必要文件

dsx 2 lat temu
rodzic
commit
a2461feb2d

+ 35 - 26
src/main/java/com/fdkankan/contro/mq/service/impl/BuildObjServiceImpl.java

@@ -6,10 +6,7 @@ import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.fdkankan.common.constant.CommonOperStatus;
-import com.fdkankan.common.constant.CommonStatus;
-import com.fdkankan.common.constant.ModelKind;
-import com.fdkankan.common.constant.SceneSource;
+import com.fdkankan.common.constant.*;
 import com.fdkankan.common.util.FileUtils;
 import com.fdkankan.contro.entity.ScenePlus;
 import com.fdkankan.contro.entity.ScenePlusExt;
@@ -158,28 +155,35 @@ public class BuildObjServiceImpl implements IBuildSceneService {
     @Override
     public void downLoadSource(BuildSceneCallMessage message,String path) throws Exception{
 
-        String ossResultPath = String.format(UploadFilePath.scene_result_data_path, message.getSceneNum());
-        fYunFileService.downloadFile(ossResultPath + "caches/reconstruction/final.bin", path + "/caches/reconstruction/final.bin");
-        fYunFileService.downloadFile(ossResultPath + "caches/reconstruction/chunk.json", path + "/caches/reconstruction/chunk.json");
-        fYunFileService.downloadFile(ossResultPath + "caches/floor_group_fix.json", path + "/caches/floor_group_fix.json");
-        fYunFileService.downloadFileByCommand(path + "/caches/images/", ossResultPath + "caches/images/");
-        fYunFileService.downloadFileByCommand( path + "/caches/depthmap_csc/" , ossResultPath + "caches/depthmap_csc/");
-        fYunFileService.downloadFileByCommand( path + "/caches/depthmap_vis/", ossResultPath + "caches/depthmap_vis/");
-        fYunFileService.downloadFileByCommand( path + "/caches/depthmap/", ossResultPath + "caches/depthmap/");
-        fYunFileService.downloadFile(ossResultPath + "caches/panorama.json", path + "/caches/panorama.json");
-        fYunFileService.downloadFile(ossResultPath + "results/laserData/laser.ply", path + "/results/laserData/laser.ply");
-
-//        String prevoisPath = message.getBuildContext().get("previousPath").toString();
-//        FileUtils.copyFile(prevoisPath + "/caches/reconstruction/final.bin", path + "/caches/reconstruction/final.bin", true);
-//        FileUtils.copyFile(prevoisPath + "/caches/reconstruction/chunk.json", path + "/caches/reconstruction/chunk.json", true);
-//        FileUtils.copyFile(prevoisPath + "/caches/floor_group_fix.json", path + "/caches/floor_group_fix.json", true);
-//        FileUtils.copyDirectiory(prevoisPath + "/caches/images", path + "/caches/images");
-//
-//        FileUtils.copyDirectiory(prevoisPath + "/caches/depthmap_csc", path + "/caches/depthmap_csc");
-//        FileUtils.copyDirectiory(prevoisPath + "/caches/depthmap_vis", path + "/caches/depthmap_vis");
-//        FileUtils.copyDirectiory(prevoisPath + "/caches/depthmap", path + "/caches/depthmap");
-//        FileUtils.copyFile(prevoisPath + "/caches/panorama.json", path + "/caches/panorama.json", true);
-//        FileUtils.copyFile(prevoisPath + "/results/laserData/laser.ply", path + "/results/laserData/laser.ply", true);
+        ScenePro scenePro = sceneProService.getByNum(message.getSceneNum());
+        String version = "V4";
+        if(Objects.nonNull(scenePro) && scenePro.getIsUpgrade() != CommonStatus.YES.code().intValue()){
+            version = "V3";
+        }
+
+        if(SceneVersionType.V4.code().equals(version)){
+            String ossResultPath = String.format(UploadFilePath.scene_result_data_path, message.getSceneNum());
+            fYunFileService.downloadFile(ossResultPath + "caches/reconstruction/final.bin", path + "/caches/reconstruction/final.bin");
+            fYunFileService.downloadFile(ossResultPath + "caches/reconstruction/chunk.json", path + "/caches/reconstruction/chunk.json");
+            fYunFileService.downloadFile(ossResultPath + "caches/floor_group_fix.json", path + "/caches/floor_group_fix.json");
+            fYunFileService.downloadFileByCommand(path + "/caches/images/", ossResultPath + "caches/images/");
+            fYunFileService.downloadFileByCommand( path + "/caches/depthmap_csc/" , ossResultPath + "caches/depthmap_csc/");
+            fYunFileService.downloadFileByCommand( path + "/caches/depthmap_vis/", ossResultPath + "caches/depthmap_vis/");
+            fYunFileService.downloadFileByCommand( path + "/caches/depthmap/", ossResultPath + "caches/depthmap/");
+            fYunFileService.downloadFile(ossResultPath + "caches/panorama.json", path + "/caches/panorama.json");
+            fYunFileService.downloadFile(ossResultPath + "results/laserData/laser.ply", path + "/results/laserData/laser.ply");
+        }else{
+            String prevoisPath = message.getBuildContext().get("previousPath").toString();
+            FileUtils.copyFile(prevoisPath + "/caches/reconstruction/final.bin", path + "/caches/reconstruction/final.bin", true);
+            FileUtils.copyFile(prevoisPath + "/caches/reconstruction/chunk.json", path + "/caches/reconstruction/chunk.json", true);
+            FileUtils.copyFile(prevoisPath + "/caches/floor_group_fix.json", path + "/caches/floor_group_fix.json", true);
+            FileUtils.copyDirectiory(prevoisPath + "/caches/images", path + "/caches/images");
+            FileUtils.copyDirectiory(prevoisPath + "/caches/depthmap_csc", path + "/caches/depthmap_csc");
+            FileUtils.copyDirectiory(prevoisPath + "/caches/depthmap_vis", path + "/caches/depthmap_vis");
+            FileUtils.copyDirectiory(prevoisPath + "/caches/depthmap", path + "/caches/depthmap");
+            FileUtils.copyFile(prevoisPath + "/caches/panorama.json", path + "/caches/panorama.json", true);
+            FileUtils.copyFile(prevoisPath + "/results/laserData/laser.ply", path + "/results/laserData/laser.ply", true);
+        }
     }
 
     @Override
@@ -190,6 +194,11 @@ public class BuildObjServiceImpl implements IBuildSceneService {
         String laserObjFilePath = path;
         boolean success = false;
         try {
+
+            //上传计算日志
+            String buildLogPath = String.format(UploadFilePath.BUILD_LOG_PATH, projectNum);
+            fYunFileService.uploadFile(path + File.separator + "console.log", buildLogPath + "console.log");
+
             if (!message.getBuildSuccess()) {
                 log.error("生成OBJ场景计算失败!");
                 // 发送钉钉消息,计算失败