|
@@ -2,6 +2,7 @@ package com.fdkankan.fusion.service.impl;
|
|
|
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.fdkankan.fusion.common.FilePath;
|
|
|
import com.fdkankan.fusion.common.ResultCode;
|
|
@@ -117,9 +118,34 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNumEntit
|
|
|
model.setModelGlbUrl(JSONArray.toJSONString(Arrays.asList(queryPath +mesh3DtilesPath)));
|
|
|
model.setModelSize(FileWriterUtil.setFileSize(uploadToOssUtil.getSize( sizePath)));
|
|
|
}else {
|
|
|
- model.setModelObjUrl(String.format(FilePath.OBJ_LOCAL_PATH,environment ,num) +"/mesh.obj");
|
|
|
- model.setModelGlbUrl(getGlbUrl(param.getType(),num,model));
|
|
|
- model.setModelType("glb");
|
|
|
+ //model.setModelObjUrl(String.format(FilePath.OBJ_LOCAL_PATH,environment ,num) +"/mesh.obj");
|
|
|
+ //model.setModelGlbUrl(getGlbUrl(param.getType(),num,model));
|
|
|
+ String meshPath = String.format(FilePath.OBJ_OSS_PATH, num)+"/data/mesh";
|
|
|
+ if(uploadToOssUtil.existKey(meshPath +"/mesh.obj")){
|
|
|
+ model.setModelGlbUrl(JSONArray.toJSONString(Arrays.asList(queryPath + meshPath+"/mesh.obj")));
|
|
|
+ }else {
|
|
|
+ List<String> objPaths = new ArrayList<>();
|
|
|
+ String meshPathjs = String.format(FilePath.OBJ_OSS_PATH, num)+"/data/";
|
|
|
+
|
|
|
+ String jsonPath = meshPath + "/floors.json";
|
|
|
+ if(!uploadToOssUtil.existKey(jsonPath)){
|
|
|
+ jsonPath = meshPath +"mesh.json";
|
|
|
+ }
|
|
|
+ if(uploadToOssUtil.existKey(jsonPath)){
|
|
|
+ String objectContent = uploadToOssUtil.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(queryPath +meshPathjs + string);
|
|
|
+ }
|
|
|
+ model.setModelGlbUrl(JSONArray.toJSONString(objPaths));
|
|
|
+ Long size = uploadToOssUtil.getSize(meshPath);
|
|
|
+ model.setModelSize(FileWriterUtil.setFileSize(size));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ model.setModelType("obj");
|
|
|
}
|
|
|
|
|
|
}
|