|
@@ -55,15 +55,8 @@ import com.google.common.collect.Sets;
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Calendar;
|
|
|
-import java.util.Comparator;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.Map.Entry;
|
|
|
-import java.util.Objects;
|
|
|
-import java.util.Set;
|
|
|
import java.util.stream.Collectors;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.redisson.Redisson;
|
|
@@ -801,6 +794,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
if(CollUtil.isEmpty(floorArr)){
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5069);
|
|
|
}
|
|
|
+ Set<String> floorNameSet = new HashSet<>();
|
|
|
floorArr.stream().forEach(item->{
|
|
|
JSONObject itemObj = (JSONObject) item;
|
|
|
//楼层目录是否存在
|
|
@@ -813,8 +807,30 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
if(StrUtil.isEmpty(objPath) || !FileUtil.exist(path + objPath)){
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5070);
|
|
|
}
|
|
|
+ if(floorNameSet.contains(name)){
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5069);
|
|
|
+ }
|
|
|
+ floorNameSet.add(name);
|
|
|
+ });
|
|
|
+
|
|
|
+ //读取oss上的floors.jsoon用于校验用户上传的模型楼层数是否一一对应
|
|
|
+ String ossFloorsJson = fYunFileService.getFileContent(bucket, String.format(UploadFilePath.DATA_VIEW_PATH, num) + "mesh/floors.json");
|
|
|
+ JSONObject orginFloorsJsonObj = JSON.parseObject(ossFloorsJson);
|
|
|
+ JSONArray orginFloorArr = orginFloorsJsonObj.getJSONArray("floors");
|
|
|
+ Set<String> orginFloorNameSet = orginFloorArr.stream().map(item -> {
|
|
|
+ JSONObject itemObj = (JSONObject) item;
|
|
|
+ return itemObj.getString("name");
|
|
|
+ }).collect(Collectors.toSet());
|
|
|
+ if(floorNameSet.size() != orginFloorNameSet.size()){
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5070);
|
|
|
+ }
|
|
|
+ orginFloorNameSet.stream().forEach(orginName->{
|
|
|
+ if(!floorNameSet.contains(orginName)){
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5070);
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
+
|
|
|
//调用算法
|
|
|
String command = "bash //home/ubuntu/bin/Obj2Tiles.sh " + path;
|
|
|
log.info("上传3dtiles模型开始, num:{}, targetPath:{}", num, path);
|
|
@@ -834,8 +850,10 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
|
|
|
//算法计算完后,生成压缩文件,上传到oss
|
|
|
//上传3dtiles
|
|
|
+ fYunFileService.deleteFolder(bucket, String.format(UploadFilePath.IMG_VIEW_PATH, num) + "3dtiles");
|
|
|
fYunFileService.uploadFileByCommand(bucket, tilesPath, String.format(UploadFilePath.IMG_VIEW_PATH, num) + "3dtiles");
|
|
|
//上传mesh
|
|
|
+ fYunFileService.deleteFolder(bucket, String.format(UploadFilePath.DATA_VIEW_PATH, num) + "mesh");
|
|
|
fYunFileService.uploadFileByCommand(bucket, meshPath, String.format(UploadFilePath.DATA_VIEW_PATH, num) + "mesh");
|
|
|
|
|
|
}
|