dsx 2 år sedan
förälder
incheckning
4e9bf36852

+ 5 - 0
src/main/java/com/fdkankan/ucenter/common/constants/UploadFilePath.java

@@ -18,6 +18,11 @@ public class UploadFilePath {
 
 
     public static final String IMG_VIEW_PATH =  "scene_view_data/%s/images/";
     public static final String IMG_VIEW_PATH =  "scene_view_data/%s/images/";
 
 
+    /**
+     * 场景计算结果数据存放路径
+     */
+    public static final String SCENE_RESULT_DATA_PATH = "scene_result_data/%s/";
+
 
 
 
 
 }
 }

+ 6 - 0
src/main/java/com/fdkankan/ucenter/service/impl/ScenePlusServiceImpl.java

@@ -185,6 +185,12 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
                 String oldViewPath = String.format(UploadFilePath.VIEW_PATH, num);
                 String oldViewPath = String.format(UploadFilePath.VIEW_PATH, num);
                 String newViewPath = String.format(UploadFilePath.VIEW_PATH, newNum);
                 String newViewPath = String.format(UploadFilePath.VIEW_PATH, newNum);
                 fYunFileServiceInterface.copyFileInBucket(oldViewPath, newViewPath);
                 fYunFileServiceInterface.copyFileInBucket(oldViewPath, newViewPath);
+
+                //复制计算结果文件
+                String oldResultPath = String.format(UploadFilePath.SCENE_RESULT_DATA_PATH, num);
+                String newResultPath = String.format(UploadFilePath.SCENE_RESULT_DATA_PATH, newNum);
+                fYunFileServiceInterface.copyFileInBucket(oldResultPath, newResultPath);
+
                 // 拷贝本地资源
                 // 拷贝本地资源
                 String oldPath = String.format("/mnt/4Dkankan/scene/%s/caches/images", num);
                 String oldPath = String.format("/mnt/4Dkankan/scene/%s/caches/images", num);
                 String newPath = String.format("/mnt/4Dkankan/scene/%s/caches/images", newNum);
                 String newPath = String.format("/mnt/4Dkankan/scene/%s/caches/images", newNum);

+ 22 - 9
src/main/java/com/fdkankan/ucenter/service/impl/SceneProServiceImpl.java

@@ -1,5 +1,6 @@
 package com.fdkankan.ucenter.service.impl;
 package com.fdkankan.ucenter.service.impl;
 
 
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.json.JSONUtil;
 import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
@@ -11,6 +12,7 @@ import com.fdkankan.common.constant.SceneConstant;
 import com.fdkankan.common.constant.SceneKind;
 import com.fdkankan.common.constant.SceneKind;
 import com.fdkankan.common.exception.BusinessException;
 import com.fdkankan.common.exception.BusinessException;
 import com.fdkankan.common.util.*;
 import com.fdkankan.common.util.*;
+import com.fdkankan.model.constants.UploadFilePath;
 import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
 import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
 import com.fdkankan.rabbitmq.util.RabbitMqProducer;
 import com.fdkankan.rabbitmq.util.RabbitMqProducer;
 import com.fdkankan.redis.constant.RedisKey;
 import com.fdkankan.redis.constant.RedisKey;
@@ -1223,17 +1225,28 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         ScenePlusExt scenePlusExt = scenePlusExtService.getByPlusId(scenePlus.getId());
         ScenePlusExt scenePlusExt = scenePlusExtService.getByPlusId(scenePlus.getId());
 
 
         // 拷贝文件
         // 拷贝文件
-        String path = scenePlusExt.getDataSource();
-        if (!new File(path + "/caches/reconstruction/final.bin").exists()
-                || !new File(path + "/caches/reconstruction/chunk.json").exists()
-                || !new File(path + "/caches/images").exists()
-                || !new File(path + "/caches/depthmap").exists()
-                || !new File(path + "/caches/depthmap_csc").exists()
-                || !new File(path + "/caches/panorama.json").exists()
-                || !new File(path + "/results/laserData/laser.ply").exists()) {
-            log.error("生成obj缺少必要文件,生成失败!");
+        String ossResultPath = String.format(UploadFilePath.scene_result_data_path, num);
+        String ossReconstruction = ossResultPath + "caches/reconstruction/";
+        if(!fYunFileService.fileExist(ossReconstruction + "final.bin")
+                || !fYunFileService.fileExist(ossReconstruction + "chunk.json")
+                || CollUtil.isEmpty(fYunFileService.listRemoteFiles(ossResultPath + "caches/images"))
+                || CollUtil.isEmpty(fYunFileService.listRemoteFiles(ossResultPath + "caches/depthmap"))
+                || CollUtil.isEmpty(fYunFileService.listRemoteFiles(ossResultPath + "caches/depthmap_csc"))
+                || !fYunFileService.fileExist(ossResultPath + "caches/panorama.json")
+                || !fYunFileService.fileExist(ossResultPath + "results/laserData/laser.ply")){
             throw new BusinessException(SceneConstant.FAILURE_CODE_5038, SceneConstant.FAILURE_MSG_5038);
             throw new BusinessException(SceneConstant.FAILURE_CODE_5038, SceneConstant.FAILURE_MSG_5038);
         }
         }
+//        String path = scenePlusExt.getDataSource();
+//        if (!new File(path + "/caches/reconstruction/final.bin").exists()
+//                || !new File(path + "/caches/reconstruction/chunk.json").exists()
+//                || !new File(path + "/caches/images").exists()
+//                || !new File(path + "/caches/depthmap").exists()
+//                || !new File(path + "/caches/depthmap_csc").exists()
+//                || !new File(path + "/caches/panorama.json").exists()
+//                || !new File(path + "/results/laserData/laser.ply").exists()) {
+//            log.error("生成obj缺少必要文件,生成失败!");
+//            throw new BusinessException(SceneConstant.FAILURE_CODE_5038, SceneConstant.FAILURE_MSG_5038);
+//        }
 
 
         // 获取最新的场景名称
         // 获取最新的场景名称
         JSONObject sceneInfo = fdkkLaserService.getSceneByNum(num);
         JSONObject sceneInfo = fdkkLaserService.getSceneByNum(num);