lyhzzz 1 年之前
父節點
當前提交
bdebd4066c

+ 12 - 8
src/main/java/com/fdkankan/fusion/common/util/OBJToGLBUtil.java

@@ -36,21 +36,25 @@ public class OBJToGLBUtil {
     }
 
     public static String objToB3dm(String objPath, String glbPath)  {
+        Integer lodNum = getLodNum(objPath);
         log.info("obj转换b3dm开始,{}",objPath);
         log.info("obj转换b3dm开始");
-        String command = "Obj2Tiles --lods 8 --divisions 3 " + objPath + " " + glbPath;
+        String command = "Obj2Tiles --lods "+lodNum+" --divisions 3 " + objPath + " " + glbPath;
         log.info("执行obj转换glb命令路径-{}", command);
         ShellUtil.execCmd(command);
         log.info("obj转换b3dm完毕:" + command);
         return glbPath;
     }
-    public static void objToB3dm2(String objPath,String glbPath)  {
-        log.info("obj转换b3dm开始,{}",objPath);
-        log.info("obj转换b3dm开始");
-        String command = "Obj2Tiles --lods 8 --divisions 3 " + objPath + " " + glbPath;
-        log.info("执行obj转换b3dm命令路径-{}", command);
-        ShellUtil.execCmd(command);
-        log.info("obj转换b3dm完毕:" + command);
+
+    private static Integer getLodNum(String objPath) {
+
+        long length = new File(objPath).length();
+        long mb = length / 1024 /1024;
+        if(mb >0){
+            return  (mb /10) >10 ?10:Integer.parseInt(String.valueOf(mb /10));
+        }
+
+        return 3;
     }
 
     public static boolean checkObj(String objPath) {

+ 3 - 0
src/main/java/com/fdkankan/fusion/service/impl/CaseNumServiceImpl.java

@@ -95,6 +95,9 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNumEntit
                     continue;
                 }
                 Model model = modelService.getIsNullNewByNum(num,param.getType());
+                if(model.getModelId() != null && StringUtils.isNotBlank(model.getModelGlbUrl())){
+                    continue;
+                }
                 model.setModelDateType("obj");
                 model.setType(param.getType());
                 model.setModelType("pointcloud");    //深时点云类型

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

@@ -85,7 +85,7 @@ public class ThreadService {
                 model.setModelType("b3dm");
                 String localPath = file1.getParentFile().getPath()+"/b3dm";
 
-                OBJToGLBUtil.objToB3dm2(file1.getPath(),localPath);
+                OBJToGLBUtil.objToB3dm(file1.getPath(),localPath);
                 redisUtil.set(RedisKeyUtil.modelUpload+model.getModelId(),"65");
                 ossPath = localPath.replace("/mnt/","");
                 ShellUtil.yunUpload(localPath,ossPath);