|
@@ -35,6 +35,7 @@ import java.awt.image.BufferedImage;
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.Calendar;
|
|
|
import java.util.Comparator;
|
|
|
import java.util.HashSet;
|
|
@@ -68,6 +69,10 @@ public class BoxModelServiceImpl implements IBoxModelService {
|
|
|
@Override
|
|
|
public ResultData uploadBoxModel(String num, String sid, MultipartFile file) throws Exception {
|
|
|
|
|
|
+ if(!file.getOriginalFilename().endsWith(".zip")){
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_7015);
|
|
|
+ }
|
|
|
+
|
|
|
if(!FileUtils.checkFileSizeIsLimit(file.getSize(), 5, "M")){
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_7023, "5M");
|
|
|
}
|
|
@@ -84,14 +89,12 @@ public class BoxModelServiceImpl implements IBoxModelService {
|
|
|
FileUtils.decompress(zipPath, srcPath);
|
|
|
|
|
|
//校验是否包含目录,如果包含目录提示错误
|
|
|
- List<String> fileList = com.fdkankan.common.util.FileUtil.getFileList(srcPath);
|
|
|
- if(CollUtil.isNotEmpty(fileList)){
|
|
|
- fileList.stream().forEach(str -> {
|
|
|
- if(FileUtil.isDirectory(str)){
|
|
|
- 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);
|