|
@@ -91,33 +91,33 @@ public class BoxModelServiceImpl implements IBoxModelService {
|
|
String srcPath = path + "data/";
|
|
String srcPath = path + "data/";
|
|
String glbPath = path + sid + ".glb";
|
|
String glbPath = path + sid + ".glb";
|
|
|
|
|
|
- FileUtil.del(path);
|
|
|
|
|
|
+ FileUtil.del(path);
|
|
|
|
|
|
- if(file.getOriginalFilename().endsWith(".zip")){
|
|
|
|
- FileUtil.mkParentDirs(zipPath);
|
|
|
|
- file.transferTo(new File(zipPath));
|
|
|
|
|
|
+ if(file.getOriginalFilename().endsWith(".zip")){
|
|
|
|
+ FileUtil.mkParentDirs(zipPath);
|
|
|
|
+ file.transferTo(new File(zipPath));
|
|
|
|
|
|
- //解压
|
|
|
|
- ZipUtil.unzip(zipPath,srcPath, CharsetUtil.CHARSET_GBK);
|
|
|
|
|
|
+ //解压
|
|
|
|
+ ZipUtil.unzip(zipPath,srcPath, CharsetUtil.CHARSET_GBK);
|
|
|
|
|
|
- //校验是否包含目录,如果包含目录提示错误
|
|
|
|
- File srcFile = new File(srcPath);
|
|
|
|
- Arrays.stream(srcFile.listFiles()).forEach(subFile->{
|
|
|
|
- if(subFile.isDirectory()){
|
|
|
|
- throw new BusinessException(ErrorCode.FAILURE_CODE_5065);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ //校验是否包含目录,如果包含目录提示错误
|
|
|
|
+ File srcFile = new File(srcPath);
|
|
|
|
+ Arrays.stream(srcFile.listFiles()).forEach(subFile->{
|
|
|
|
+ if(subFile.isDirectory()){
|
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5065);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
|
|
- //转glb
|
|
|
|
- OBJToGLBUtil.objToGlb(srcPath, glbPath);
|
|
|
|
- }else{
|
|
|
|
- FileUtil.mkParentDirs(glbPath);
|
|
|
|
- file.transferTo(new File(glbPath));
|
|
|
|
- }
|
|
|
|
|
|
+ //转glb
|
|
|
|
+ OBJToGLBUtil.objToGlb(srcPath, glbPath);
|
|
|
|
+ }else{
|
|
|
|
+ FileUtil.mkParentDirs(glbPath);
|
|
|
|
+ file.transferTo(new File(glbPath));
|
|
|
|
+ }
|
|
|
|
|
|
- if(!ComputerUtil.checkComputeCompleted(glbPath, 10, 2000)){
|
|
|
|
- throw new BusinessException(ErrorCode.FAILURE_CODE_7013);
|
|
|
|
- }
|
|
|
|
|
|
+ if(!ComputerUtil.checkComputeCompleted(glbPath, 10, 2000)){
|
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_7013);
|
|
|
|
+ }
|
|
|
|
|
|
//上传glb
|
|
//上传glb
|
|
fYunFileService.uploadFile(bucket, glbPath, String.format(UploadFilePath.USER_EDIT_PATH, num) + "boxModels/" + sid + ".glb");
|
|
fYunFileService.uploadFile(bucket, glbPath, String.format(UploadFilePath.USER_EDIT_PATH, num) + "boxModels/" + sid + ".glb");
|