|
@@ -19,6 +19,7 @@ import org.springframework.stereotype.Service;
|
|
|
import java.io.File;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
|
|
|
@Service
|
|
@@ -194,8 +195,10 @@ public class ThreadService {
|
|
|
List<String> localGlbPaths = new ArrayList<>();
|
|
|
List<String> ossGlbPaths = new ArrayList<>();
|
|
|
File localFile = new File(objPath);
|
|
|
- Long size = 0L;
|
|
|
- String sizeStr = FileWriterUtil.setFileSize(this.toGlB(localFile, localGlbPaths,size));
|
|
|
+ HashMap<String,Long> sizeMap = new HashMap<>();
|
|
|
+ sizeMap.put("size",0L);
|
|
|
+ this.toGlB(localFile, localGlbPaths,sizeMap);
|
|
|
+ String sizeStr = FileWriterUtil.setFileSize(sizeMap.get("size"));
|
|
|
if(!localGlbPaths.isEmpty()){
|
|
|
for (String localGlbPath : localGlbPaths) {
|
|
|
String ossPath = localGlbPath.replace("/mnt/","");
|
|
@@ -217,16 +220,16 @@ public class ThreadService {
|
|
|
}
|
|
|
|
|
|
|
|
|
- private Long toGlB(File localFile, List<String> localGlbPath,Long size) {
|
|
|
+ private void toGlB(File localFile, List<String> localGlbPath, HashMap<String,Long> sizeMap ) {
|
|
|
File[] files = localFile.listFiles();
|
|
|
for (File file : files) {
|
|
|
if(file.isDirectory()){
|
|
|
- return toGlB(file,localGlbPath,size);
|
|
|
+ toGlB(file,localGlbPath,sizeMap);
|
|
|
}
|
|
|
if(file.getPath().contains("lod_") ){
|
|
|
if(file.getPath().contains("lod_0") && file.getName().contains(".obj")){
|
|
|
String glbPath = OBJToGLBUtil.objToB3dm(file.getPath(),file.getParentFile().getPath()+"/b3dm");
|
|
|
- size += file.length();
|
|
|
+ sizeMap.put("size",sizeMap.get("size") + file.length());
|
|
|
localGlbPath.add(glbPath);
|
|
|
}
|
|
|
continue;
|
|
@@ -234,11 +237,10 @@ public class ThreadService {
|
|
|
|
|
|
if(file.getName().contains(".obj")){
|
|
|
String glbPath = OBJToGLBUtil.objToB3dm(file.getPath(),file.getParentFile().getPath()+"/b3dm");
|
|
|
- size += file.length();
|
|
|
+ sizeMap.put("size",sizeMap.get("size") + file.length());
|
|
|
localGlbPath.add(glbPath);
|
|
|
}
|
|
|
}
|
|
|
- return size;
|
|
|
}
|
|
|
|
|
|
}
|