lyhzzz 3 gadi atpakaļ
vecāks
revīzija
e744196dad

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

@@ -89,7 +89,7 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
         File newObjFile = null;
         File newObjFile = null;
         try {
         try {
             String objPath = String.format(OBJ_PATH , "modelId_"+model.getModelId()) ;
             String objPath = String.format(OBJ_PATH , "modelId_"+model.getModelId()) ;
-            String glbPath = String.format(GLB_PATH , "modelId_"+model.getModelId());
+            StringBuilder glbPath = new StringBuilder(String.format(GLB_PATH, "modelId_" + model.getModelId()));
             String glbOssPath = String.format(FilePath.GLB_OSS_PATH, model.getModelId());
             String glbOssPath = String.format(FilePath.GLB_OSS_PATH, model.getModelId());
 
 
             newObjFile = new File(objPath +"/" + fileName);
             newObjFile = new File(objPath +"/" + fileName);
@@ -112,27 +112,30 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
                 String name = file1.getName();
                 String name = file1.getName();
                 if(name.contains("obj") || name.contains("OBJ")){
                 if(name.contains("obj") || name.contains("OBJ")){
                     String glbName = "";
                     String glbName = "";
-                    if(glbPath.contains(".obj")){
+                    if(glbPath.toString().contains(".obj")){
                         glbName = name.replace(".obj",".glb");
                         glbName = name.replace(".obj",".glb");
                     }
                     }
-                    if(glbPath.contains(".OBJ")){
+                    if(glbPath.toString().contains(".OBJ")){
                         glbName = name.replace(".OBJ",".glb");
                         glbName = name.replace(".OBJ",".glb");
                     }
                     }
                     OBJToGLBUtil.objToGlb(objPath,name,  glbPath+"/"+glbName);
                     OBJToGLBUtil.objToGlb(objPath,name,  glbPath+"/"+glbName);
                     glbOssPath = glbOssPath.replace("mesh.glb",glbName);
                     glbOssPath = glbOssPath.replace("mesh.glb",glbName);
+                    glbPath.append("/").append(glbName);
                 }
                 }
                 if(name.contains(".ply")){
                 if(name.contains(".ply")){
                     glbOssPath = glbOssPath.replace("mesh.glb",name);
                     glbOssPath = glbOssPath.replace("mesh.glb",name);
+                    glbPath.append("/").append(name);
                     model.setModelDateType("ply");
                     model.setModelDateType("ply");
                     model.setModelType("ply");
                     model.setModelType("ply");
                 }
                 }
                 if(name.contains(".las")){
                 if(name.contains(".las")){
                     glbOssPath = glbOssPath.replace("mesh.glb",name);
                     glbOssPath = glbOssPath.replace("mesh.glb",name);
+                    glbPath.append("/").append(name);
                     model.setModelDateType("las");
                     model.setModelDateType("las");
                     model.setModelType("las");
                     model.setModelType("las");
                 }
                 }
             }
             }
-            uploadToOssUtil.upload(glbPath,glbOssPath);
+            uploadToOssUtil.upload(glbPath.toString(),glbOssPath);
             model.setModelObjUrl(objPath);
             model.setModelObjUrl(objPath);
             model.setModelGlbUrl(queryPath + glbOssPath);
             model.setModelGlbUrl(queryPath + glbOssPath);
             model.setCreateStatus(1);  //上传成功
             model.setCreateStatus(1);  //上传成功