|
@@ -9,12 +9,9 @@ import java.util.stream.Collectors;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.fdkankan.fusion.common.PageInfo;
|
|
|
-import com.fdkankan.fusion.common.util.JwtUtil;
|
|
|
+import com.fdkankan.fusion.common.util.*;
|
|
|
import com.fdkankan.fusion.common.FilePath;
|
|
|
import com.fdkankan.fusion.common.ResultCode;
|
|
|
-import com.fdkankan.fusion.common.util.OBJToGLBUtil;
|
|
|
-import com.fdkankan.fusion.common.util.ShellUtil;
|
|
|
-import com.fdkankan.fusion.common.util.UploadToOssUtil;
|
|
|
import com.fdkankan.fusion.entity.CaseNumEntity;
|
|
|
import com.fdkankan.fusion.entity.FusionNum;
|
|
|
import com.fdkankan.fusion.entity.Model;
|
|
@@ -106,32 +103,31 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
|
|
|
if(!objPathFile.isDirectory()){
|
|
|
throw new BusinessException(ResultCode.UPLOAD_FILE_TYPE_ERROR);
|
|
|
}
|
|
|
- File[] files = objPathFile.listFiles();
|
|
|
- for (File file1 : files) {
|
|
|
- String name = file1.getName();
|
|
|
- if(name.contains("obj") || name.contains("OBJ")){
|
|
|
- glbOssPath = glbOssPath.replace("mesh.glb",file1.getName().replace("obj","glb"));
|
|
|
- model.setModelDateType("obj");
|
|
|
- model.setModelType("glb");
|
|
|
- OBJToGLBUtil.objToGlb(objPath,name, file1.getPath().replace("obj","glb"));
|
|
|
- uploadToOssUtil.uploadOss(file1.getPath(),glbOssPath);
|
|
|
- }
|
|
|
- if(name.contains(".ply")){
|
|
|
- model.setModelDateType("ply");
|
|
|
- model.setModelType("ply");
|
|
|
- }
|
|
|
- if(name.contains(".las")){
|
|
|
- model.setModelDateType("las");
|
|
|
- model.setModelType("las");
|
|
|
- }
|
|
|
- if("las".equals(model.getModelType()) || "ply".equals(model.getModelType()) ){
|
|
|
- glbOssPath = glbOssPath.replace("model","model_"+model.getModelId());
|
|
|
- glbOssPath = glbOssPath.replace("glb","res");
|
|
|
- glbOssPath = glbOssPath.replace("mesh.glb","webcloud");
|
|
|
- File mntFile = OBJToGLBUtil.lasOrPlyToBin(file1);
|
|
|
- uploadToOssUtil.uploadFileOss(mntFile ,glbOssPath);
|
|
|
- }
|
|
|
+ File file1 = FileWriterUtil.getObjLasPlyFile(objPathFile);
|
|
|
+ String name = file1.getName();
|
|
|
+ if(name.contains("obj") || name.contains("OBJ")){
|
|
|
+ glbOssPath = glbOssPath.replace("mesh.glb",file1.getName().replace("obj","glb"));
|
|
|
+ model.setModelDateType("obj");
|
|
|
+ model.setModelType("glb");
|
|
|
+ OBJToGLBUtil.objToGlb(objPath,name, file1.getPath().replace("obj","glb"));
|
|
|
+ uploadToOssUtil.uploadOss(file1.getPath(),glbOssPath);
|
|
|
}
|
|
|
+ if(name.contains(".ply")){
|
|
|
+ model.setModelDateType("ply");
|
|
|
+ model.setModelType("ply");
|
|
|
+ }
|
|
|
+ if(name.contains(".las")){
|
|
|
+ model.setModelDateType("las");
|
|
|
+ model.setModelType("las");
|
|
|
+ }
|
|
|
+ if("las".equals(model.getModelType()) || "ply".equals(model.getModelType()) ){
|
|
|
+ glbOssPath = glbOssPath.replace("model","model_"+model.getModelId());
|
|
|
+ glbOssPath = glbOssPath.replace("glb","res");
|
|
|
+ glbOssPath = glbOssPath.replace("mesh.glb","webcloud");
|
|
|
+ File mntFile = OBJToGLBUtil.lasOrPlyToBin(file1);
|
|
|
+ uploadToOssUtil.uploadFileOss(mntFile ,glbOssPath);
|
|
|
+ }
|
|
|
+
|
|
|
model.setModelObjUrl(objPath);
|
|
|
model.setModelGlbUrl(queryPath + glbOssPath);
|
|
|
model.setCreateStatus(1); //上传成功
|