lyhzzz 1 tahun lalu
induk
melakukan
feb0af308f

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

@@ -194,9 +194,9 @@ public class ThreadService {
         List<String> localGlbPaths = new ArrayList<>();
         List<String> ossGlbPaths = new ArrayList<>();
         File localFile = new File(objPath);
-
-        Long sizeL = this.toGlB(localFile, localGlbPaths);
-        String size = FileWriterUtil.setFileSize(sizeL);
+        Long size = 0L;
+        this.toGlB(localFile, localGlbPaths,size);
+        String sizeStr = FileWriterUtil.setFileSize(size);
         if(!localGlbPaths.isEmpty()){
             for (String localGlbPath : localGlbPaths) {
                 String ossPath = localGlbPath.replace("/mnt/","");
@@ -212,18 +212,17 @@ public class ThreadService {
             wrapper.set(Model::getModelDateType,"b3dm");
             wrapper.set(Model::getModelType,"b3dm");
             wrapper.set(Model::getCreateStatus,1);
-            wrapper.set(Model::getModelSize,size);
+            wrapper.set(Model::getModelSize,sizeStr);
             modelService.update(wrapper);
         }
     }
 
 
-    private Long toGlB(File localFile, List<String> localGlbPath) {
-        Long size = 0L;
+    private void toGlB(File localFile, List<String> localGlbPath,Long size) {
         File[] files = localFile.listFiles();
         for (File file : files) {
             if(file.isDirectory()){
-                toGlB(file,localGlbPath);
+                toGlB(file,localGlbPath,size);
             }
             if(file.getPath().contains("lod_")  ){
                 if(file.getPath().contains("lod_0") && file.getName().contains(".obj")){
@@ -240,7 +239,6 @@ public class ThreadService {
                 localGlbPath.add(glbPath);
             }
         }
-        return size;
     }
 
 }