lyhzzz 1 year ago
parent
commit
c8e5f125c4

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

@@ -142,22 +142,18 @@ public class OBJToGLBUtil {
     }
 
     public static File lasOrPlyToBin(File srcFile) throws IOException {
-        String mntPath = srcFile.getPath().replace(FilePath.LOCAL_BASE_PATH,FilePath.MNT_BASE_PATH);
-        String mntPathEmt = srcFile.getParent().replace(FilePath.LOCAL_BASE_PATH,FilePath.MNT_BASE_PATH)+"/res";
-        File file = new File(mntPathEmt);
-        if(!file.exists()){
-            file.mkdirs();
+        if(!srcFile.exists()){
+            srcFile.mkdirs();
         }
-        FileUtil.copy(srcFile.getPath(),mntPath,true);
         String cmd = ShellUtil.LAS_TO_BIN;
-        cmd =  cmd.replace("@inPath",mntPath);
-        cmd = cmd.replace("@outPath",mntPathEmt);
+        cmd =  cmd.replace("@inPath",srcFile.getPath());
+        cmd = cmd.replace("@outPath",srcFile.getParentFile().getPath());
         ShellUtil.execCmd(cmd);
         log.info("lasOrPlyToBin---------cmd-over");
-        String cloudJs = mntPathEmt +"/webcloud/"+ "cloud.js";
+        String cloudJs = srcFile.getParentFile().getPath() +"/webcloud/"+ "cloud.js";
         JSONObject jsonObject = ShellUtil.fixCloud(cloudJs);
-        FileWriterUtil.writerJson(mntPathEmt +"/webcloud/","cloud.js",jsonObject.toJSONString());
-        return file;
+        FileWriterUtil.writerJson(srcFile.getParentFile().getPath() +"/webcloud/","cloud.js",jsonObject.toJSONString());
+        return srcFile.getParentFile();
     }
 
     public static String OsgbToB3dm(File objPathFile) {

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

@@ -117,7 +117,8 @@ public class ThreadService {
                 mntFile =  OBJToGLBUtil.lasOrPlyToBin(file1);
                 String ossPath = mntFile.getPath().replace("/mnt/","")+"/webcloud";
                 redisUtil.set(RedisKeyUtil.modelUpload+model.getModelId(),"65");
-                uploadToOssUtil.uploadFileOss(mntFile );
+                ShellUtil.yunUpload(mntFile.getPath(),ossPath);
+
                 model.setModelGlbUrl(JSONArray.toJSONString(Arrays.asList(queryPath + ossPath)));
                 if(!uploadToOssUtil.existKey(ossPath+"/cloud.js")){
                     throw new BusinessException(-1,"缺少cloud.js文件");