|
@@ -232,10 +232,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
*/
|
|
|
@Override
|
|
|
public void lockOrUnLockBySpace(CameraDetail cameraDetail, Long cameraId, Integer payStatus) {
|
|
|
- LambdaQueryWrapper<ScenePro> wrapper = new LambdaQueryWrapper<>();
|
|
|
- LambdaQueryWrapper<ScenePlus> plusWr = new LambdaQueryWrapper<>();
|
|
|
- wrapper.eq(ScenePro::getStatus,-2);
|
|
|
- plusWr.eq(ScenePlus::getSceneStatus,-2);
|
|
|
+
|
|
|
Long totalSpace = cameraDetail.getTotalSpace();
|
|
|
UserIncrement userIncrement = userIncrementService.getByCameraId(cameraId);
|
|
|
if(userIncrement!=null){
|
|
@@ -248,6 +245,19 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //使用容量大于总容量,不予解封
|
|
|
+ if(payStatus == 1 && totalSpace != -1 && cameraDetail.getUsedSpace() >= cameraDetail.getTotalSpace()){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 总容量大于已使用容量,不予封存
|
|
|
+ if (payStatus == -2 && (totalSpace == -1 || totalSpace >= cameraDetail.getUsedSpace() )) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ LambdaQueryWrapper<ScenePro> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ LambdaQueryWrapper<ScenePlus> plusWr = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(ScenePro::getStatus,-2);
|
|
|
+ plusWr.eq(ScenePlus::getSceneStatus,-2);
|
|
|
|
|
|
log.info("lockOrUnLockBySpace---cameraId:{},payStatus:{},totalSpace:{},useSpace{}",
|
|
|
cameraId,payStatus,totalSpace,cameraDetail.getUsedSpace());
|
|
@@ -257,10 +267,6 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
wrapper.eq(ScenePro::getPayStatus,-2);
|
|
|
plusWr.eq(ScenePlus::getPayStatus,-2);
|
|
|
}else {
|
|
|
- if (totalSpace == -1 || totalSpace >= cameraDetail.getUsedSpace()) {
|
|
|
- // 总容量大于已使用容量,不予封存
|
|
|
- return;
|
|
|
- }
|
|
|
wrapper.orderByDesc(ScenePro::getCreateTime);
|
|
|
plusWr.orderByDesc(ScenePlus::getCreateTime);
|
|
|
wrapper.eq(ScenePro::getPayStatus,1);
|
|
@@ -277,12 +283,12 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
|
|
|
List<Long> lockedIds = new ArrayList<>();
|
|
|
|
|
|
- if(totalSpace == -1 && payStatus == 1){
|
|
|
+ if(totalSpace == -1){ // 无限容量 全部解封
|
|
|
List<Long> collect = list.stream().map(ScenePro::getId).collect(Collectors.toList());
|
|
|
List<Long> collect2 = plusList.stream().map(ScenePlus::getId).collect(Collectors.toList());
|
|
|
lockedIds.addAll(collect);
|
|
|
lockedIds.addAll(collect2);
|
|
|
- lockOrUnLockScenes(lockedIds,payStatus); // 无限容量 全部解封
|
|
|
+ lockOrUnLockScenes(lockedIds,1);
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -290,14 +296,15 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
Long accumulateSpace = 0L;
|
|
|
if(payStatus == 1){
|
|
|
beyondSpace = totalSpace - cameraDetail.getUsedSpace();
|
|
|
- getScenePlusLockedIds(lockedIds, plusList, beyondSpace, accumulateSpace);
|
|
|
getSceneLockedIds(lockedIds,list,beyondSpace,accumulateSpace);
|
|
|
+ getScenePlusLockedIds(lockedIds, plusList, beyondSpace, accumulateSpace);
|
|
|
}else {
|
|
|
beyondSpace = cameraDetail.getUsedSpace() - totalSpace;
|
|
|
getSceneLockedIds(lockedIds, list, beyondSpace, accumulateSpace);
|
|
|
getScenePlusLockedIds(lockedIds,plusList,beyondSpace,accumulateSpace);
|
|
|
}
|
|
|
-
|
|
|
+ getSceneLockedIds(lockedIds,list,beyondSpace,accumulateSpace);
|
|
|
+ getScenePlusLockedIds(lockedIds, plusList, beyondSpace, accumulateSpace);
|
|
|
lockOrUnLockScenes(lockedIds,payStatus);
|
|
|
}
|
|
|
|