|
@@ -73,7 +73,7 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNumEntit
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public synchronized void addBatch(Integer caseId, List<SceneNumParam> sceneNumParam) {
|
|
|
+ public void addBatch(Integer caseId, List<SceneNumParam> sceneNumParam) {
|
|
|
|
|
|
List<String> addNumList = this.updateByNumList(caseId, sceneNumParam);
|
|
|
if(addNumList == null || addNumList.size()<=0){
|
|
@@ -81,7 +81,6 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNumEntit
|
|
|
}
|
|
|
|
|
|
List<CaseNumEntity> newCaseNums = new ArrayList<>();
|
|
|
- List<Model> modelList = new ArrayList<>();
|
|
|
|
|
|
HashMap<Integer,HashSet<String>> map = new HashMap<>();
|
|
|
for (SceneNumParam numParam : sceneNumParam) {
|
|
@@ -93,10 +92,11 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNumEntit
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
for (Integer type : map.keySet()) {
|
|
|
HashSet<String> nulList = map.get(type);
|
|
|
- for (String num : nulList) {
|
|
|
+ List<String> numList = new ArrayList<>(nulList);
|
|
|
+ HashSet<String> setNum = new HashSet<>(numList);
|
|
|
+ for (String num : setNum) {
|
|
|
if(!addNumList.contains(num)){
|
|
|
continue;
|
|
|
}
|
|
@@ -105,125 +105,22 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNumEntit
|
|
|
caseNumEntity.setNumType(type);
|
|
|
caseNumEntity.setNum(num);
|
|
|
newCaseNums.add(caseNumEntity);
|
|
|
- if(type == 3){ //用户上传三维模型跳过
|
|
|
- continue;
|
|
|
- }
|
|
|
- Model model = modelService.getIsNullNewByNum(num,type);
|
|
|
- if(model.getModelId() != null && StringUtils.isNotBlank(model.getModelGlbUrl()) && StringUtils.isNotBlank(model.getModelSize())){
|
|
|
- continue;
|
|
|
- }
|
|
|
- model.setModelDateType("obj");
|
|
|
- model.setType(type);
|
|
|
- model.setModelType("pointcloud"); //深时点云类型
|
|
|
- model.setCreateStatus(1);
|
|
|
- Scene scene = sceneService.getByNum(num);
|
|
|
- if(scene == null){
|
|
|
- continue;
|
|
|
- }
|
|
|
- if(type == 0 || type == 1 || type == 4 || type == 6 || type == 7){ //看看,看见
|
|
|
- String mesh3DtilesPath = String.format(FilePath.OBJ_OSS_PATH,num) + "/images/3dtiles/tileset.json";
|
|
|
-
|
|
|
- String sizePath = scene.getWebPath() + String.format(FilePath.OBJ_OSS_PATH,num) + "/images/3dtiles";
|
|
|
- if(localToOssUtil.existKey(scene.getWebPath() +mesh3DtilesPath)){
|
|
|
- model.setModelDateType("b3dm");
|
|
|
- model.setModelType("b3dm");
|
|
|
- model.setModelGlbUrl(JSONArray.toJSONString(Arrays.asList(scene.getMapping() +File.separator +mesh3DtilesPath)));
|
|
|
- model.setModelSize(FileWriterUtil.setFileSize(localToOssUtil.getSizeCount( sizePath)));
|
|
|
- }else {
|
|
|
- String meshPath = String.format(FilePath.OBJ_OSS_PATH, num)+"/data/mesh";
|
|
|
- if(localToOssUtil.existKey( scene.getWebPath() +meshPath +"/mesh.obj")){
|
|
|
- Long size = localToOssUtil.getSizeCount( scene.getWebPath() +meshPath);
|
|
|
- model.setModelSize(FileWriterUtil.setFileSize(size));
|
|
|
- model.setModelGlbUrl(JSONArray.toJSONString(Arrays.asList(scene.getMapping()+File.separator + meshPath+"/mesh.obj")));
|
|
|
- }else {
|
|
|
- List<String> objPaths = new ArrayList<>();
|
|
|
- String meshPathjs = String.format(FilePath.OBJ_OSS_PATH, num)+"/data/";
|
|
|
-
|
|
|
- String jsonPath =scene.getWebPath() + meshPath + "/floors.json";
|
|
|
- if(!localToOssUtil.existKey(jsonPath)){
|
|
|
- jsonPath =scene.getWebPath() + meshPath +"mesh.json";
|
|
|
- }
|
|
|
- if(localToOssUtil.existKey(jsonPath)){
|
|
|
- String objectContent = localToOssUtil.getObjectContent(meshPath + "/floors.json");
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(objectContent);
|
|
|
- JSONArray floors1 = jsonObject.getJSONArray("floors");
|
|
|
- for (Object object : floors1) {
|
|
|
- JSONObject jb = (JSONObject) object;
|
|
|
- String string = jb.getString("objPath");
|
|
|
- objPaths.add(scene.getMapping()+File.separator +meshPathjs + string);
|
|
|
- }
|
|
|
- model.setModelGlbUrl(JSONArray.toJSONString(objPaths));
|
|
|
- Long size = localToOssUtil.getSize(scene.getWebPath() +meshPath);
|
|
|
- model.setModelSize(FileWriterUtil.setFileSize(size));
|
|
|
- }
|
|
|
- }
|
|
|
- model.setModelType("obj");
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- model.setNum(num);
|
|
|
- modelList.add(model);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if(newCaseNums.size() >0){
|
|
|
this.saveBatch(newCaseNums);
|
|
|
}
|
|
|
- if(modelList.size() >0){
|
|
|
- modelService.saveOrUpdateBatch(modelList);
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- private String getGlbUrl(Integer type, String num,Model model) {
|
|
|
- if(type == 0 || type == 1 || type == 4 || type == 6 || type == 7){ //看看,看见
|
|
|
- String objPath = String.format(FilePath.OBJ_LOCAL_PATH ,environment,num);
|
|
|
- ShellUtil.yunDownload(String.format(FilePath.OBJ_OSS_PATH, num)+"/data/mesh" ,objPath);
|
|
|
- List<String> localGlbPaths = new ArrayList<>();
|
|
|
- List<String> ossGlbPaths = new ArrayList<>();
|
|
|
- File localFile = new File(objPath);
|
|
|
- this.toGlB(localFile,localGlbPaths);
|
|
|
- Long modelSize = 0L;
|
|
|
- if(localGlbPaths.size() >0){
|
|
|
- for (String localGlbPath : localGlbPaths) {
|
|
|
- String ossGlbPath = localGlbPath.replace(FilePath.LOCAL_BASE_PATH,"fusion/");
|
|
|
- localToOssUtil.uploadOss(localGlbPath,ossGlbPath);
|
|
|
- if(ossGlbPath.contains("lod_")){
|
|
|
- if(ossGlbPath.contains("lod_0")){
|
|
|
- ossGlbPaths.add(queryPath +ossGlbPath);
|
|
|
- modelSize += localToOssUtil.getSize(ossGlbPath);
|
|
|
- }
|
|
|
- continue;
|
|
|
- }
|
|
|
- modelSize += localToOssUtil.getSize(ossGlbPath);
|
|
|
- ossGlbPaths.add(queryPath +ossGlbPath);
|
|
|
- }
|
|
|
- model.setModelSize(FileWriterUtil.setFileSize(modelSize));
|
|
|
- FileUtil.del(objPath);
|
|
|
- return JSONArray.toJSONString(ossGlbPaths);
|
|
|
- }
|
|
|
- FileUtil.del(objPath);
|
|
|
- }
|
|
|
- return null;
|
|
|
- }
|
|
|
|
|
|
- private void toGlB(File localFile, List<String> localGlbPath) {
|
|
|
- File[] files = localFile.listFiles();
|
|
|
- for (File file : files) {
|
|
|
- if(file.isDirectory()){
|
|
|
- toGlB(file,localGlbPath);
|
|
|
- }
|
|
|
- if(file.getName().contains(".obj")){
|
|
|
- String glbPath = OBJToGLBUtil.objToGlb(file.getPath(),file.getPath().replace(".obj",".glb") );
|
|
|
- localGlbPath.add(glbPath);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
private List<String> updateByNumList(Integer caseId, List<SceneNumParam> sceneNumParam) {
|
|
|
List<String> addList = new ArrayList<>();
|
|
|
- HashMap<Integer, FusionNum> fusionNumHashMap = fusionNumService.getByCaseId(caseId);
|
|
|
HashMap<Integer,List<String>> delMap = new HashMap<>();
|
|
|
for (SceneNumParam param : sceneNumParam) {
|
|
|
Integer type = param.getType();
|
|
@@ -246,13 +143,6 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNumEntit
|
|
|
}
|
|
|
}
|
|
|
if(!delList.isEmpty()){
|
|
|
- HashMap<String, Model> mapByNum = modelService.getMapByNum(delList);
|
|
|
- for (String key : mapByNum.keySet()) {
|
|
|
- Model model = mapByNum.get(key);
|
|
|
- if(model != null && model.getType().equals(param.getType()) && fusionNumHashMap.containsKey(model.getModelId())){
|
|
|
- throw new BusinessException(ResultCode.DEL_NUM_ERROR);
|
|
|
- }
|
|
|
- }
|
|
|
delMap.put(param.getType(),delList);
|
|
|
}
|
|
|
}
|
|
@@ -282,11 +172,6 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNumEntit
|
|
|
LambdaQueryWrapper<CaseNumEntity> wrapper = new LambdaQueryWrapper<>();
|
|
|
wrapper.eq(CaseNumEntity::getCaseId,caseId);
|
|
|
this.remove(wrapper);
|
|
|
- fusionNumService.deleteByCaseId(caseId);
|
|
|
- caseViewService.deleteByCaseId(caseId);
|
|
|
- fusionGuidePathService.deleteByCaseId(caseId);
|
|
|
- fusionMeterService.deleteByCaseId(caseId);
|
|
|
- caseTagService.deletePointByCaseId(caseId);
|
|
|
}
|
|
|
|
|
|
@Override
|