lyhzzz 2 年之前
父节点
当前提交
348f615d4a

+ 1 - 5
src/main/java/com/fdkankan/fusion/common/util/OBJToGLBUtil.java

@@ -24,12 +24,8 @@ public class OBJToGLBUtil {
         ShellUtil.execCmd(command);
         ShellUtil.execCmd(command);
         log.info("obj转换glb完毕:" + command);
         log.info("obj转换glb完毕:" + command);
     }
     }
-    public static void objToGlb(String objPath, String name,String glbPath)  {
+    public static void objToGlb2(String objPath,String glbPath)  {
         log.info("obj转换glb开始,{}",objPath);
         log.info("obj转换glb开始,{}",objPath);
-        if(!checkObj(objPath)){
-            throw new BusinessException(-1,"obj文件错误");
-        }
-        objPath +="/"+name;
         log.info("obj转换glb开始");
         log.info("obj转换glb开始");
         String command = "obj2gltf -i " + objPath + " -o " + glbPath;
         String command = "obj2gltf -i " + objPath + " -o " + glbPath;
         log.info("执行obj转换glb命令路径-{}", command);
         log.info("执行obj转换glb命令路径-{}", command);

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

@@ -128,7 +128,7 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
             throw new BusinessException(ResultCode.UPLOAD_FILE_CHINA_NAME);
             throw new BusinessException(ResultCode.UPLOAD_FILE_CHINA_NAME);
         }
         }
         redisUtil.set(RedisKeyUtil.modelUpload+model.getModelId(),"20");
         redisUtil.set(RedisKeyUtil.modelUpload+model.getModelId(),"20");
-        runThread(file1,objPath,model,newObjFile,objPathFile,this);
+        runThread(file1,model,newObjFile,objPathFile,this);
         return model;
         return model;
     }
     }
 
 
@@ -138,7 +138,7 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
         redisUtil.set(RedisKeyUtil.modelUpload+model.getModelId(),status.toString());
         redisUtil.set(RedisKeyUtil.modelUpload+model.getModelId(),status.toString());
     }
     }
 
 
-    private void runThread(File file1,String objPath,Model model,File newObjFile,File objPathFile,IModelService modelService){
+    private void runThread(File file1,Model model,File newObjFile,File objPathFile,IModelService modelService){
         new Thread() {
         new Thread() {
             @Override
             @Override
             public void run() {
             public void run() {
@@ -151,7 +151,7 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
                         glbOssPath = glbOssPath.replace("mesh.glb",file1.getName().replace(".obj",".glb"));
                         glbOssPath = glbOssPath.replace("mesh.glb",file1.getName().replace(".obj",".glb"));
                         model.setModelDateType("obj");
                         model.setModelDateType("obj");
                         model.setModelType("glb");
                         model.setModelType("glb");
-                        OBJToGLBUtil.objToGlb(objPath,name,  file1.getPath().replace(".obj",".glb"));
+                        OBJToGLBUtil.objToGlb2(file1.getPath(), file1.getPath().replace(".obj",".glb"));
                         redisUtil.set(RedisKeyUtil.modelUpload+model.getModelId(),"65");
                         redisUtil.set(RedisKeyUtil.modelUpload+model.getModelId(),"65");
                         uploadToOssUtil.uploadOss(file1.getPath().replace(".obj",".glb"),glbOssPath);
                         uploadToOssUtil.uploadOss(file1.getPath().replace(".obj",".glb"),glbOssPath);
                     }
                     }
@@ -170,7 +170,6 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
                         uploadToOssUtil.uploadFileOss(mntFile );
                         uploadToOssUtil.uploadFileOss(mntFile );
                     }
                     }
 
 
-                    model.setModelObjUrl(objPath);
                     model.setModelGlbUrl(queryPath + glbOssPath);
                     model.setModelGlbUrl(queryPath + glbOssPath);
                     model.setCreateStatus(1);  //上传成功
                     model.setCreateStatus(1);  //上传成功
                     modelService.saveOrUpdate(model);
                     modelService.saveOrUpdate(model);