|
@@ -8,6 +8,7 @@ import com.fdkankan.fusion.common.util.OBJToGLBUtil;
|
|
import com.fdkankan.fusion.common.util.UploadToOssUtil;
|
|
import com.fdkankan.fusion.common.util.UploadToOssUtil;
|
|
import com.fdkankan.fusion.entity.CaseNumEntity;
|
|
import com.fdkankan.fusion.entity.CaseNumEntity;
|
|
import com.fdkankan.fusion.entity.Model;
|
|
import com.fdkankan.fusion.entity.Model;
|
|
|
|
+import com.fdkankan.fusion.httpClient.client.FdKKClient;
|
|
import com.fdkankan.fusion.mapper.ICaseNumMapper;
|
|
import com.fdkankan.fusion.mapper.ICaseNumMapper;
|
|
import com.fdkankan.fusion.request.SceneNumParam;
|
|
import com.fdkankan.fusion.request.SceneNumParam;
|
|
import com.fdkankan.fusion.service.*;
|
|
import com.fdkankan.fusion.service.*;
|
|
@@ -16,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
import java.io.File;
|
|
import java.io.File;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
@@ -51,6 +53,8 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNumEntit
|
|
ICaseTagService caseTagService;
|
|
ICaseTagService caseTagService;
|
|
@Autowired
|
|
@Autowired
|
|
ICaseTagPointService caseTagPointService;
|
|
ICaseTagPointService caseTagPointService;
|
|
|
|
+ @Resource
|
|
|
|
+ FdKKClient fdKKClient;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -96,8 +100,7 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNumEntit
|
|
model.setModelType("glb");
|
|
model.setModelType("glb");
|
|
}
|
|
}
|
|
if(param.getType() == 4){ //深时obj场景
|
|
if(param.getType() == 4){ //深时obj场景
|
|
- // model.setModelObjUrl(); todo
|
|
|
|
- //model.setModelObjUrl();
|
|
|
|
|
|
+ getGlbSsObj(model,num);
|
|
model.setModelType("glb");
|
|
model.setModelType("glb");
|
|
}
|
|
}
|
|
model.setNum(num);
|
|
model.setNum(num);
|
|
@@ -114,6 +117,28 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNumEntit
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void getGlbSsObj(Model model, String num) {
|
|
|
|
+ String dataSource = fdKKClient.querySceneDataSource(num);
|
|
|
|
+ String meshPath = dataSource +"/results/mesh";
|
|
|
|
+
|
|
|
|
+ String objPath = String.format(FilePath.OBJ_LOCAL_PATH ,environment,num);
|
|
|
|
+ String glbPath = String.format(FilePath.GLB_LOCAL_PATH,environment,num) +"/mesh.glb";
|
|
|
|
+ String glbOssPath = String.format(FilePath.GLB_OSS_PATH ,environment, num);
|
|
|
|
+
|
|
|
|
+ FileUtil.copy(meshPath,objPath,true);
|
|
|
|
+ OBJToGLBUtil.objToGlb(objPath +"/mesh",glbPath );
|
|
|
|
+ File file = new File(glbPath);
|
|
|
|
+ if(file!=null){
|
|
|
|
+ model.setModelSize(FileWriterUtil.setFileSize(file.length()));
|
|
|
|
+ }
|
|
|
|
+ uploadToOssUtil.uploadOss(glbPath,glbOssPath);
|
|
|
|
+ FileUtil.del(objPath);
|
|
|
|
+ String ossglbPath = queryPath + "/"+glbOssPath;
|
|
|
|
+ model.setModelObjUrl(objPath +"/mesh");
|
|
|
|
+ model.setModelObjUrl(ossglbPath);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
private String getGlbUrl(Integer type, String num,Model model) {
|
|
private String getGlbUrl(Integer type, String num,Model model) {
|
|
if(type == 0 || type == 1){ //看看,看见
|
|
if(type == 0 || type == 1){ //看看,看见
|