Forráskód Böngészése

Merge branch 'hotfix-兼容旧的生成obj逻辑' into hotfix-33844-20221215-lxh

tianboguang 2 éve
szülő
commit
c455f705b4

+ 23 - 3
src/main/java/com/fdkankan/contro/mq/service/impl/BuildSceneServiceImpl.java

@@ -126,10 +126,25 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
             //下载资源到本地
             this.downLoadSource(message, message.getPath());
 
+            JSONObject fdageJson = JSONObject.parseObject(FileUtils.readFile(message.getPath().concat("/capture/data.fdage")));
+
+            boolean rewrite = false;
+            // 兼容旧的数据,防止OnlyExportMeshObj标志未删除掉
+            if (fdageJson.containsKey("OnlyExportMeshObj")) {
+                // 写入data.fdage 防止重算
+                fdageJson.remove("OnlyExportMeshObj");
+                String ossPath = getOssPath(message.getPath());
+                fYunFileService.uploadFile(fdageJson.toJSONString().getBytes(), ossPath + "data.fdage");
+                rewrite = true;
+            }
+
             if (!ObjectUtils.isEmpty(modelType)) {
                 // 修改dataFdage文件
-                JSONObject fdageJson = JSONObject.parseObject(FileUtils.readFile(message.getPath().concat("/capture/data.fdage")));
                 fdageJson.put("modelType", modelType);
+                rewrite = true;
+            }
+
+            if (rewrite) {
                 FileUtils.writeFile(message.getPath().concat("/capture/data.fdage"), fdageJson.toJSONString());
             }
 
@@ -159,14 +174,19 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
         }
     }
 
-    @Override
-    public void downLoadSource(BuildSceneCallMessage buildSceneMqMessage,String path){
+    private String getOssPath(String path) {
         String ossPath = ConstantFilePath.OSS_PREFIX
                 + path.replace(ConstantFilePath.BUILD_MODEL_PATH, "")
                 .replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "");
         if (!ossPath.endsWith("/")) {
             ossPath = ossPath.concat("/");
         }
+        return ossPath;
+    }
+
+    @Override
+    public void downLoadSource(BuildSceneCallMessage buildSceneMqMessage,String path){
+        String ossPath = getOssPath(path);
         fYunFileService.downloadFileByCommand(path + File.separator + "capture", ossPath);
     }
 

+ 21 - 3
src/main/java/com/fdkankan/contro/mq/service/impl/BuildV3SceneServiceImpl.java

@@ -105,11 +105,24 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
             //根据相机类型,组装资源路径
             //下载资源到本地
             this.downLoadSource(message, message.getPath());
+            JSONObject fdageJson = JSONObject.parseObject(FileUtils.readFile(message.getPath().concat("/capture/data.fdage")));
+            // 兼容旧的数据,防止OnlyExportMeshObj标志未删除掉
+            boolean rewrite = false;
+            if (fdageJson.containsKey("OnlyExportMeshObj")) {
+                // 写入data.fdage 防止重算
+                fdageJson.remove("OnlyExportMeshObj");
+                String ossPath = getOssPath(message.getPath());
+                fYunFileService.uploadFile(fdageJson.toJSONString().getBytes(), ossPath + "data.fdage");
+                rewrite = true;
+            }
 
             if (!ObjectUtils.isEmpty(modelSceneKind)) {
                 // 修改dataFdage文件
-                JSONObject fdageJson = JSONObject.parseObject(FileUtils.readFile(message.getPath().concat("/capture/data.fdage")));
                 fdageJson.put("modelType", modelSceneKind);
+                rewrite = true;
+            }
+
+            if (rewrite) {
                 FileUtils.writeFile(message.getPath().concat("/capture/data.fdage"), fdageJson.toJSONString());
             }
 
@@ -135,14 +148,19 @@ public class BuildV3SceneServiceImpl implements IBuildSceneService {
         }
     }
 
-    @Override
-    public void downLoadSource(BuildSceneCallMessage buildSceneMqMessage,String path){
+    private String getOssPath(String path) {
         String ossPath = ConstantFilePath.OSS_PREFIX
                 + path.replace(ConstantFilePath.BUILD_MODEL_PATH, "")
                 .replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "");
         if (!ossPath.endsWith("/")) {
             ossPath = ossPath.concat("/");
         }
+        return ossPath;
+    }
+
+    @Override
+    public void downLoadSource(BuildSceneCallMessage buildSceneMqMessage,String path){
+        String ossPath = getOssPath(path);
         fYunFileService.downloadFileByCommand(path + File.separator + "capture", ossPath);
     }