Quellcode durchsuchen

修改obj场景构建逻辑

tianboguang vor 2 Jahren
Ursprung
Commit
45d08dbf7f

+ 8 - 21
src/main/java/com/fdkankan/contro/mq/service/impl/BuildObjServiceImpl.java

@@ -77,15 +77,16 @@ public class BuildObjServiceImpl implements IBuildSceneService {
                 log.error("data.fdage文件不存在");
                 return ;
             }
-
+            if(!jsonObject.containsKey("exportMeshObj")){
+                // 写入data.fdage 防止重算
+                jsonObject.put("exportMeshObj",1);
+                FileUtils.writeFile(folderPath.getAbsolutePath() + File.separator + "capture" + File.separator + "data.fdage", jsonObject.toJSONString());
+                fYunFileService.uploadFile(folderPath.getAbsolutePath() + File.separator + "capture" + File.separator + "data.fdage",
+                        ConstantFilePath.OSS_PREFIX + path.replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "") + "/data.fdage");
+            }
             // 重新构造datafdage文件,添加生成obt文件选项
             jsonObject.put("OnlyExportMeshObj",true);
-            // 写入data.fdage 防止重算
-            jsonObject.put("exportMeshObj",1);
-            FileUtils.writeFile(folderPath.getAbsolutePath() + File.separator + "capture" + File.separator + "data.fdage", jsonObject.toJSONString());
-
-            fYunFileService.uploadFile(folderPath.getAbsolutePath() + File.separator + "capture" + File.separator + "data.fdage",
-                    ConstantFilePath.OSS_PREFIX + path.replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "") + "/data.fdage");
+            FileUtils.writeFile(laserObjFilePath + File.separator + "capture" + File.separator + "data.fdage", jsonObject.toJSONString());
 
             //下载资源到本地
             this.downLoadSource(message, laserObjFilePath);
@@ -141,22 +142,8 @@ public class BuildObjServiceImpl implements IBuildSceneService {
 
     @Override
     public void buildScenePost(BuildSceneResultMqMessage message) throws Exception {
-        // 去除 OnlyExportMeshObj
         String path = message.getPath();
         String projectNum = message.getSceneCode();
-        String dataFdagePath = path + File.separator + "capture" + File.separator + "data.fdage";
-        log.info("dataFdagePath 文件路径 :{}", dataFdagePath);
-        String data = FileUtils.readFile(dataFdagePath);
-        //获取data.fdage的内容
-        JSONObject dataJson = new JSONObject();
-        if (data != null) {
-            dataJson = JSONObject.parseObject(data);
-        }
-        dataJson.remove("OnlyExportMeshObj");
-        FileUtils.writeFile(path + File.separator + "capture" + File.separator + "data.fdage", dataJson.toJSONString());
-        fYunFileService.uploadFile(path + File.separator + "capture" + File.separator + "data.fdage",
-                ConstantFilePath.OSS_PREFIX + path.replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "") + "/data.fdage");
-
 
         String laserObjFilePath = path + "_laser_obj";
         CreateObjUtil.convertTxtToDam(laserObjFilePath + File.separator + "results" + File.separator + "tex" + File.separator + "modeldata.txt", laserObjFilePath + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam");