lyhzzz 2 年 前
コミット
bfb6adfbc8

+ 11 - 6
src/main/java/com/fdkankan/fusion/common/util/OBJToGLBUtil.java

@@ -127,12 +127,17 @@ public class OBJToGLBUtil {
         return file;
     }
 
-    public static String OsgbToB3dm(File objPathFile) {
-        String dockerPath = FilePath.MNT_BASE_PATH +"b3dm";
-        String cmd = ShellCmd.osgbTob3dmCmd.replaceAll("@path",dockerPath);
-        cmd =cmd.replaceAll("@inputFile",objPathFile.getPath());
-        cmd =cmd.replaceAll("@outputFile",dockerPath +"/"+ objPathFile.getName());
+    public static String OsgbToB3dm(File objPathFile,Integer modelId) {
+        String targetPath = FilePath.MNT_BASE_PATH +"osgb" +"/" + modelId +"/" + objPathFile.getName();
+        String sourcePath = FilePath.MNT_BASE_PATH +"b3dm" +"/" + modelId +"/" + objPathFile.getName();
+
+        //ShellUtil.execCmd("cp -r " + objPath + " " + dockerPath+ objPathFile.getName()   );
+        FileUtil.copyContent(objPathFile,new File(targetPath),true);
+
+        String cmd = ShellCmd.osgbTob3dmCmd.replaceAll("@path",FilePath.MNT_BASE_PATH);
+        cmd =cmd.replaceAll("@inputFile",targetPath);
+        cmd =cmd.replaceAll("@outputFile",sourcePath);
         ShellUtil.execCmd(cmd);
-        return dockerPath + objPathFile.getName();
+        return sourcePath;
     }
 }

+ 1 - 1
src/main/java/com/fdkankan/fusion/service/impl/ModelServiceImpl.java

@@ -203,7 +203,7 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
                         model.setModelType("b3dm");
 
                         redisUtil.set(RedisKeyUtil.modelUpload+model.getModelId(),"60");
-                        String localPath = OBJToGLBUtil.OsgbToB3dm(objPathFile);
+                        String localPath = OBJToGLBUtil.OsgbToB3dm(objPathFile,model.getModelId());
 
                         if(!FileWriterUtil.checkB3dmTileset(new File(localPath))){
                             throw new BusinessException(-1,"缺少tileset.json文件");