Ver código fonte

场景模型大小

lyhzzz 3 anos atrás
pai
commit
49434b6755

+ 6 - 2
src/main/java/com/fdkankan/fusion/service/impl/CaseNumServiceImpl.java

@@ -83,7 +83,7 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNumEntit
                 model.setModelType("pointcloud");    //深时点云类型
                 if(param.getType() != 2){           //不为深时
                     model.setModelObjUrl(String.format(OBJ_PATH ,num) +"/mesh.obj");
-                    model.setModelGlbUrl(getGlbUrl(param.getType(),num));
+                    model.setModelGlbUrl(getGlbUrl(param.getType(),num,model));
                     model.setModelType("glb");
                 }
                 model.setNum(num);
@@ -102,7 +102,7 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNumEntit
         caseViewService.deleteByNumList(caseId,updateNumList);
     }
 
-    private String getGlbUrl(Integer type, String num) {
+    private String getGlbUrl(Integer type, String num,Model model) {
         if(type == 0 || type == 1){ //看看,看见
             String objPath = String.format(OBJ_PATH ,num);
             String glbPath = String.format(GLB_PATH,num) +"/mesh.glb";
@@ -120,6 +120,10 @@ public class CaseNumServiceImpl extends ServiceImpl<ICaseNumMapper, CaseNumEntit
                 String localPath = objPath +"/"+split[split.length-1];
                 uploadToOssUtil.downFormAli(fileName,localPath);
             }
+            File file = new File(glbPath);
+            if(file!=null){
+                model.setModelSize(file.length());
+            }
             OBJToGLBUtil.objToGlb(objPath,glbPath );
             uploadToOssUtil.uploadOss(glbPath,glbOssPath);
             FileUtil.del(objPath);