|
@@ -70,8 +70,6 @@ public class CommonServiceImpl implements ICommonService {
|
|
|
@Autowired
|
|
|
private ICameraService cameraService;
|
|
|
@Autowired
|
|
|
- private FYunFileServiceInterface fYunFileService;
|
|
|
- @Autowired
|
|
|
private FYunFileConfig fYunFileConfig;
|
|
|
|
|
|
@Override
|
|
@@ -263,30 +261,8 @@ public class CommonServiceImpl implements ICommonService {
|
|
|
|
|
|
@Override
|
|
|
public int getPayStatus(Long cameraId, Long space){
|
|
|
- //查询权益统计容量的方式
|
|
|
- String unit = SpaceType.GB.code();
|
|
|
- CameraDetail cameraDetail = cameraDetailService.getByCameraId(cameraId);
|
|
|
- if(StrUtil.isNotEmpty(cameraDetail.getUnit())){
|
|
|
- unit = cameraDetail.getUnit();
|
|
|
- }
|
|
|
- Long limit = this.getSpaceLimit(cameraDetail);
|
|
|
-
|
|
|
- if(SpaceType.SP.code().equals(unit)){//如果按空间方式统计,则space置为1
|
|
|
- space = 1L;
|
|
|
- }
|
|
|
-
|
|
|
//更新相机使用用量
|
|
|
cameraDetailService.updateCameraDetailByCameraIdAndSpace(cameraId, space);
|
|
|
-
|
|
|
- if(limit == -1){
|
|
|
- return PayStatus.PAY.code();
|
|
|
- }
|
|
|
-
|
|
|
- Long usedSpace = cameraService.getUsedSpace(cameraId, unit);
|
|
|
- if(usedSpace + space > limit){
|
|
|
- return PayStatus.NO_CAPACITY.code();
|
|
|
- }
|
|
|
-
|
|
|
return PayStatus.PAY.code();
|
|
|
}
|
|
|
|
|
@@ -327,11 +303,11 @@ public class CommonServiceImpl implements ICommonService {
|
|
|
|
|
|
@Override
|
|
|
public Long getSpace(String num){
|
|
|
- Long space = fYunFileService.getSpace(fYunFileConfig.getBucket(), String.format(UploadFilePath.DATA_VIEW_PATH, num));
|
|
|
- space += fYunFileService.getSpace(fYunFileConfig.getBucket(), String.format(UploadFilePath.IMG_VIEW_PATH, num));
|
|
|
- space += fYunFileService.getSpace(fYunFileConfig.getBucket(), String.format(UploadFilePath.VIDEOS_VIEW_PATH, num));
|
|
|
- space += fYunFileService.getSpace(fYunFileConfig.getBucket(), String.format(UploadFilePath.VOICE_VIEW_PATH, num));
|
|
|
- space += fYunFileService.getSpace(fYunFileConfig.getBucket(), String.format(UploadFilePath.scene_result_data_path, num).concat("caches"));
|
|
|
+ Long space = fYunFileServiceInterface.getSpace(fYunFileConfig.getBucket(), String.format(UploadFilePath.DATA_VIEW_PATH, num));
|
|
|
+ space += fYunFileServiceInterface.getSpace(fYunFileConfig.getBucket(), String.format(UploadFilePath.IMG_VIEW_PATH, num));
|
|
|
+ space += fYunFileServiceInterface.getSpace(fYunFileConfig.getBucket(), String.format(UploadFilePath.VIDEOS_VIEW_PATH, num));
|
|
|
+ space += fYunFileServiceInterface.getSpace(fYunFileConfig.getBucket(), String.format(UploadFilePath.VOICE_VIEW_PATH, num));
|
|
|
+ space += fYunFileServiceInterface.getSpace(fYunFileConfig.getBucket(), String.format(UploadFilePath.scene_result_data_path, num).concat("caches"));
|
|
|
return space;
|
|
|
}
|
|
|
}
|