|
@@ -17,6 +17,7 @@ import com.fdkankan.fusion.common.PageInfo;
|
|
|
import com.fdkankan.fusion.common.util.*;
|
|
|
import com.fdkankan.fusion.common.FilePath;
|
|
|
import com.fdkankan.fusion.common.ResultCode;
|
|
|
+import com.fdkankan.fusion.config.CacheUtil;
|
|
|
import com.fdkankan.fusion.entity.*;
|
|
|
import com.fdkankan.fusion.exception.BusinessException;
|
|
|
import com.fdkankan.fusion.mapper.IModelMapper;
|
|
@@ -68,6 +69,8 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
|
|
|
ITmCameraService tmCameraService;
|
|
|
@Autowired
|
|
|
ThreadService threadService;
|
|
|
+ @Autowired
|
|
|
+ ISceneService sceneService;
|
|
|
|
|
|
@Value("${upload.query-path}")
|
|
|
private String queryPath;
|
|
@@ -258,8 +261,12 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
|
|
|
model.setCreateStatus(1);
|
|
|
model.setIsObj(isObj);
|
|
|
if(isObj == 1){ //看看,看见
|
|
|
- String mesh3DtilesPath = String.format(FilePath.OBJ_OSS_PATH,num) + "/images/3dtiles/tileset.json";
|
|
|
- String sizePath = String.format(FilePath.OBJ_OSS_PATH,num) + "/images/3dtiles";
|
|
|
+ Scene scene = sceneService.getByNum(num);
|
|
|
+ if(scene == null){
|
|
|
+ throw new BusinessException(ResultCode.SCENE_NOT_EXIST);
|
|
|
+ }
|
|
|
+ String mesh3DtilesPath = scene.getWebPath() + 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(mesh3DtilesPath)){
|
|
|
model.setModelDateType("b3dm");
|
|
|
model.setModelType("b3dm");
|
|
@@ -267,7 +274,7 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
|
|
|
model.setModelSize(FileWriterUtil.setFileSize(localToOssUtil.getSize( sizePath)));
|
|
|
}else {
|
|
|
model.setModelObjUrl(String.format(FilePath.OBJ_LOCAL_PATH,environment ,num) +"/mesh.obj");
|
|
|
- model.setModelGlbUrl(getGlbUrl(type,num,model));
|
|
|
+ model.setModelGlbUrl(getGlbUrl(type,num,model,scene.getWebPath()));
|
|
|
model.setModelType("glb");
|
|
|
}
|
|
|
|
|
@@ -363,10 +370,11 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
|
|
|
|
|
|
|
|
|
|
|
|
- private String getGlbUrl(Integer type, String num,Model model) {
|
|
|
+ private String getGlbUrl(Integer type, String num,Model model,String scenePath) {
|
|
|
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);
|
|
|
+// String objPath = String.format(FilePath.OBJ_LOCAL_PATH ,environment,num);
|
|
|
+// ShellUtil.yunDownload(String.format(FilePath.OBJ_OSS_PATH, num)+"/data/mesh" ,objPath);
|
|
|
+ String objPath = scenePath + String.format(FilePath.OBJ_OSS_PATH, num)+"/data/mesh";
|
|
|
List<String> localGlbPaths = new ArrayList<>();
|
|
|
List<String> ossGlbPaths = new ArrayList<>();
|
|
|
File localFile = new File(objPath);
|