lyhzzz 3 năm trước cách đây
mục cha
commit
dba6d0c00d

+ 7 - 2
src/main/java/com/fdkankan/fusion/service/impl/ModelServiceImpl.java

@@ -83,10 +83,9 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
 
         Model model = new Model();
         model.setModelTitle(modelName);
-        model.setModelDateType("obj");
-        model.setModelType("glb");
         model.setModelSize(file.getSize());
         model.setUserName(username);
+        this.save(model);
         File newObjFile = null;
         try {
             String objPath = String.format(OBJ_PATH , "modelId_"+model.getModelId()) ;
@@ -137,6 +136,12 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
             model.setModelObjUrl(objPath);
             model.setModelGlbUrl(queryPath + glbOssPath);
             model.setCreateStatus(1);  //上传成功
+            if(StringUtils.isEmpty(model.getModelDateType())){
+                model.setModelDateType("obj");
+            }
+            if(StringUtils.isEmpty(model.getModelType())){
+                model.setModelType("glb");
+            }
             this.saveOrUpdate(model);
         }catch (Exception e){
             model.setCreateStatus(-1);