فهرست منبع

复制场景判断相机容量和权益

lyhzzz 2 سال پیش
والد
کامیت
8e87ebfd69

+ 1 - 1
src/main/java/com/fdkankan/manage/common/ResultCode.java

@@ -45,7 +45,7 @@ public enum ResultCode  {
     TEMPLATE_TYPE_ERROR(50028, "模板格式错误"),
     EXCEL_MSG_ERROR(50029, "模板格式错误"),
     CAMERA_TYPE_ERROR(50030, "相机类型错误"),
-    CAMERA_SPACE_ERROR(50031, "相机容量不足,不能迁移"),
+    CAMERA_SPACE_ERROR(50031, "相机容量不足"),
     CAMERA_TYPE_NOT_ERROR(50032, "必须迁移至相同的类型的相机下面!"),
     MAIL_SEND_ERROR(50033, "邮件发送失败!"),
     CAMERA_SN_NOT_EXIST(50034, "sn码不存在!"),

+ 20 - 0
src/main/java/com/fdkankan/manage/service/impl/SceneProServiceImpl.java

@@ -585,6 +585,26 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         if(sceneStatus != -2){
             throw new BusinessException(ResultCode.SCENE_IS_BUILDING);
         }
+        Long totalSpace = detailEntity.getTotalSpace();
+        UserIncrement userIncrement = userIncrementService.getByCameraId(cameraId);
+        if(userIncrement != null && userIncrement.getIsExpired() ==0){
+            IncrementType incrementType = incrementTypeService.getById(userIncrement.getIncrementTypeId());
+            totalSpace = incrementType.getCameraCapacity() * 1024 * 1024 * 1024L;
+        }
+        Long needSpace = 0L;
+        if(scenePro != null){
+            needSpace = scenePro.getSpace();
+        }
+        if(scenePlus != null){
+            ScenePlusExt scenePlusExt = scenePlusExtService.getByPlusId(scenePlus.getId());
+            if(scenePlusExt != null && scenePlusExt.getSpace() != null){
+                needSpace = scenePlusExt.getSpace();
+            }
+        }
+        if( totalSpace > 0 && detailEntity.getUsedSpace() + needSpace > totalSpace){
+            throw new BusinessException(ResultCode.CAMERA_SPACE_ERROR);
+        }
+
 //        if(detailEntity.getType() == 10  ){
 //            throw new BusinessException(ResultCode.SS_NO_COPY);
 //        }