Преглед изворни кода

管理后台复制场景校验容量

lyhzzz пре 1 година
родитељ
комит
e6e21d6ca9
1 измењених фајлова са 25 додато и 1 уклоњено
  1. 25 1
      src/main/java/com/fdkankan/ucenter/service/impl/SceneProServiceImpl.java

+ 25 - 1
src/main/java/com/fdkankan/ucenter/service/impl/SceneProServiceImpl.java

@@ -691,7 +691,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         if(!canSpace){
         if(!canSpace){
             throw new BusinessException(CameraConstant.FAILURE_CODE_6008, CameraConstant.FAILURE_MSG_6008);
             throw new BusinessException(CameraConstant.FAILURE_CODE_6008, CameraConstant.FAILURE_MSG_6008);
         }
         }
-        this.copySceneNoCheck(sceneNum);
+        copyScene(sceneNum,detailEntity,scenePro,scenePlus);
 
 
     }
     }
 
 
@@ -704,7 +704,31 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         if(detailEntity == null){
         if(detailEntity == null){
             throw new BusinessException(CameraConstant.FAILURE_CODE_6029, CameraConstant.FAILURE_MSG_6029);
             throw new BusinessException(CameraConstant.FAILURE_CODE_6029, CameraConstant.FAILURE_MSG_6029);
         }
         }
+        IncrementType incrementType  = null;
+        UserIncrement userIncrement = userIncrementService.getByCameraId(cameraId);
+        if(userIncrement != null && userIncrement.getIsExpired() != 1){
+             incrementType = incrementTypeService.getById(userIncrement.getIncrementTypeId());
+        }
+        Long space = null;
+        if( scenePro != null ){
+            space = scenePro.getSpace();
+        }
+        if( scenePlus != null ){
+            ScenePlusExt ext = scenePlusExtService.getByPlusId(scenePlus.getId());
+            space = ext.getSpace();
+        }
+        CameraType cameraType = cameraTypeService.getByCameraType(detailEntity.getType());
+
+        Boolean canSpace = cameraDetailService.checkSpace(detailEntity,incrementType,space,cameraType);
+
+        if(!canSpace){
+            throw new BusinessException(CameraConstant.FAILURE_CODE_6008, CameraConstant.FAILURE_MSG_6008);
+        }
+
+        copyScene(sceneNum,detailEntity,scenePro,scenePlus);
+    }
 
 
+    private  void copyScene(String sceneNum,CameraDetail detailEntity,ScenePro scenePro,ScenePlus scenePlus) throws Exception {
         String newNum = scene3dNumService.generateSceneNum(detailEntity.getType());
         String newNum = scene3dNumService.generateSceneNum(detailEntity.getType());
 
 
         Long sceneId = scenePro == null ? scenePlus.getId() :scenePro.getId();
         Long sceneId = scenePro == null ? scenePlus.getId() :scenePro.getId();