|
@@ -301,6 +301,23 @@ public class CameraDetailServiceImpl extends ServiceImpl<ICameraDetailMapper, Ca
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
+ public Boolean checkSpace(Long cameraId, CameraType cameraType) {
|
|
|
|
+ CameraDetail detailEntity = this.getByCameraId(cameraId);
|
|
|
|
+ if(detailEntity == null){
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ if (!"aws".equals(NacosProperty.uploadType) && cameraType.getIsLaser() == 1) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ UserIncrement userIncrement = userIncrementService.getByCameraId(detailEntity.getCameraId());
|
|
|
|
+ if(userIncrement == null || userIncrement.getIsExpired() == 1){
|
|
|
|
+ return checkSpace(detailEntity,null,cameraType,true);
|
|
|
|
+ }
|
|
|
|
+ IncrementType incrementType = incrementTypeService.getById(userIncrement.getIncrementTypeId());
|
|
|
|
+ return checkSpace(detailEntity,incrementType,cameraType,true);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
public Boolean checkSpace(CameraDetail detailEntity, Long space,CameraType cameraType) {
|
|
public Boolean checkSpace(CameraDetail detailEntity, Long space,CameraType cameraType) {
|
|
if(detailEntity == null){
|
|
if(detailEntity == null){
|
|
return false;
|
|
return false;
|
|
@@ -341,6 +358,30 @@ public class CameraDetailServiceImpl extends ServiceImpl<ICameraDetailMapper, Ca
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public Boolean checkSpace(CameraDetail detailEntity, IncrementType incrementType,CameraType cameraType,Boolean falg) {
|
|
|
|
+ Long totalSpace = 0L;
|
|
|
|
+ if (!"aws".equals(NacosProperty.uploadType) && cameraType.getIsLaser() == 1) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if("SP".equals(detailEntity.getUnit())){
|
|
|
|
+ if(incrementType!=null && incrementType.getCameraSpace() == -1){
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ totalSpace = incrementType != null ?incrementType.getCameraSpace() : detailEntity.getTotalSpace();
|
|
|
|
+ Long proCount = sceneProService.getCountByCameraId(detailEntity.getCameraId());
|
|
|
|
+ Long plusCount = scenePlusService.getCountByCameraId(detailEntity.getCameraId());
|
|
|
|
+ return proCount + plusCount <= totalSpace;
|
|
|
|
+ }
|
|
|
|
+ if("GB".equals(detailEntity.getUnit())){
|
|
|
|
+ if(incrementType!=null && incrementType.getCameraCapacity() == -1){
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ totalSpace = incrementType != null ?incrementType.getCameraCapacity() * 1024 * 1024 * 1024L: detailEntity.getTotalSpace();
|
|
|
|
+ return detailEntity.getUsedSpace() <= totalSpace;
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
public Long getTotalSpace(CameraDetail detailEntity, IncrementType incrementType) {
|
|
public Long getTotalSpace(CameraDetail detailEntity, IncrementType incrementType) {
|
|
if("SP".equals(detailEntity.getUnit())){
|
|
if("SP".equals(detailEntity.getUnit())){
|
|
if(incrementType!=null && incrementType.getCameraSpace() == -1){
|
|
if(incrementType!=null && incrementType.getCameraSpace() == -1){
|