Browse Source

生成obj场景资源准备优化

dsx 2 years ago
parent
commit
efd08d833e

+ 9 - 10
src/main/java/com/fdkankan/contro/mq/service/impl/BuildObjServiceImpl.java

@@ -107,8 +107,8 @@ public class BuildObjServiceImpl implements IBuildSceneService {
 
             //获取解压后的资源的data.fdage中的数据
             File folderPath = new File(path);
-            fYunFileService.downloadFile(ConstantFilePath.OSS_PREFIX + path.replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "") + "/data.fdage", path + "/capture/data.fdage");
-            JSONObject jsonObject = FileUtils.readJson(folderPath.getAbsolutePath() + File.separator + "capture" + File.separator + "data.fdage");
+            fYunFileService.downloadFile(ConstantFilePath.OSS_PREFIX + path.replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "") + "/data.fdage", laserObjFilePath + "/capture/data.fdage");
+            JSONObject jsonObject = FileUtils.readJson(laserObjFilePath + File.separator + "capture" + File.separator + "data.fdage");
             if(ObjectUtils.isEmpty(jsonObject)){
                 log.error("data.fdage文件不存在");
                 return ;
@@ -116,8 +116,7 @@ public class BuildObjServiceImpl implements IBuildSceneService {
             if (!jsonObject.containsKey("exportMeshObj") || jsonObject.getIntValue("exportMeshObj") != 1) {
                 // 写入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",
+                fYunFileService.uploadFile(laserObjFilePath + File.separator + "capture" + File.separator + "data.fdage",
                         ConstantFilePath.OSS_PREFIX + path.replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "") + "/data.fdage");
             }
             // 重新构造datafdage文件,添加生成obt文件选项
@@ -254,12 +253,12 @@ public class BuildObjServiceImpl implements IBuildSceneService {
                         .eq(SceneProEdit::getProId,scenePro.getId()));
             }
 
-                ScenePlus scenePlus = scenePlusService.getScenePlusByNum(projectNum);
-                if(!ObjectUtils.isEmpty(scenePlus)){
-                    LambdaUpdateWrapper<ScenePlus> plusUpdateWrapper = new LambdaUpdateWrapper<ScenePlus>()
-                            .set(ScenePlus::getSceneStatus, -2).eq(ScenePlus::getNum, projectNum);
-                    scenePlusService.update(plusUpdateWrapper);
-                }
+            ScenePlus scenePlus = scenePlusService.getScenePlusByNum(projectNum);
+            if(!ObjectUtils.isEmpty(scenePlus)){
+                LambdaUpdateWrapper<ScenePlus> plusUpdateWrapper = new LambdaUpdateWrapper<ScenePlus>()
+                        .set(ScenePlus::getSceneStatus, -2).eq(ScenePlus::getNum, projectNum);
+                scenePlusService.update(plusUpdateWrapper);
+            }
 
             // 如果未升级V4,则升级V4
             if("v3".equals(version)){