|
@@ -82,6 +82,8 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
@Autowired
|
|
@Autowired
|
|
private IUserIncrementService userIncrementService;
|
|
private IUserIncrementService userIncrementService;
|
|
@Autowired
|
|
@Autowired
|
|
|
|
+ private IIncrementTypeService incrementTypeService;
|
|
|
|
+ @Autowired
|
|
private IScenePlusExtService scenePlusExtService;
|
|
private IScenePlusExtService scenePlusExtService;
|
|
@Autowired
|
|
@Autowired
|
|
private ISceneEditInfoService sceneEditInfoService;
|
|
private ISceneEditInfoService sceneEditInfoService;
|
|
@@ -179,15 +181,24 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
public void lockOrUnLockBySpace(CameraDetail cameraDetail, Long cameraId, Integer payStatus) {
|
|
public void lockOrUnLockBySpace(CameraDetail cameraDetail, Long cameraId, Integer payStatus) {
|
|
LambdaQueryWrapper<ScenePro> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<ScenePro> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<ScenePlus> plusWr = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<ScenePlus> plusWr = new LambdaQueryWrapper<>();
|
|
- Long count = 0L;
|
|
|
|
|
|
+ Long totalSpace = cameraDetail.getTotalSpace();
|
|
|
|
+ UserIncrement userIncrement = userIncrementService.getByCameraId(cameraId);
|
|
|
|
+ if(userIncrement!=null){
|
|
|
|
+ IncrementType incrementType = incrementTypeService.getById(userIncrement.getId());
|
|
|
|
+ if(incrementType.getCameraCapacity() == -1){
|
|
|
|
+ totalSpace = -1L;
|
|
|
|
+ }else {
|
|
|
|
+ totalSpace = incrementType.getCameraCapacity() * 1024 * 1024L;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
if(payStatus == 1){ //解封,判断用户权益,用户会员权益无限容量
|
|
if(payStatus == 1){ //解封,判断用户权益,用户会员权益无限容量
|
|
- count = userIncrementService.getValidCountByCameraId(cameraId);
|
|
|
|
wrapper.orderByAsc(ScenePro::getCreateTime);
|
|
wrapper.orderByAsc(ScenePro::getCreateTime);
|
|
plusWr.orderByAsc(ScenePlus::getCreateTime);
|
|
plusWr.orderByAsc(ScenePlus::getCreateTime);
|
|
wrapper.eq(ScenePro::getPayStatus,-2);
|
|
wrapper.eq(ScenePro::getPayStatus,-2);
|
|
plusWr.eq(ScenePlus::getPayStatus,-2);
|
|
plusWr.eq(ScenePlus::getPayStatus,-2);
|
|
}else {
|
|
}else {
|
|
- if (cameraDetail.getTotalSpace() >= cameraDetail.getUsedSpace()) {
|
|
|
|
|
|
+ if (totalSpace >= cameraDetail.getUsedSpace()) {
|
|
// 总容量大于已使用容量,不予封存
|
|
// 总容量大于已使用容量,不予封存
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -205,17 +216,17 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
List<ScenePro> list = this.list(wrapper);
|
|
List<ScenePro> list = this.list(wrapper);
|
|
List<ScenePlus> plusList = scenePlusService.list(plusWr);
|
|
List<ScenePlus> plusList = scenePlusService.list(plusWr);
|
|
|
|
|
|
- Long beyondSpace = Math.abs(cameraDetail.getUsedSpace() - cameraDetail.getTotalSpace());
|
|
|
|
|
|
+ Long beyondSpace = Math.abs(cameraDetail.getUsedSpace() - totalSpace);
|
|
Long accumulateSpace = 0L;
|
|
Long accumulateSpace = 0L;
|
|
List<Long> lockedIds = new ArrayList<>();
|
|
List<Long> lockedIds = new ArrayList<>();
|
|
if(payStatus == 1){
|
|
if(payStatus == 1){
|
|
- Long doSpace = getScenePlusLockedIds(lockedIds, plusList, count, beyondSpace, accumulateSpace);
|
|
|
|
|
|
+ Long doSpace = getScenePlusLockedIds(lockedIds, plusList, totalSpace, beyondSpace, accumulateSpace);
|
|
beyondSpace -= doSpace;
|
|
beyondSpace -= doSpace;
|
|
- getSceneLockedIds(lockedIds,list,count,beyondSpace,accumulateSpace);
|
|
|
|
|
|
+ getSceneLockedIds(lockedIds,list,totalSpace,beyondSpace,accumulateSpace);
|
|
}else {
|
|
}else {
|
|
- Long doSpace = getSceneLockedIds(lockedIds, list, count, beyondSpace, accumulateSpace);
|
|
|
|
|
|
+ Long doSpace = getSceneLockedIds(lockedIds, list, totalSpace, beyondSpace, accumulateSpace);
|
|
beyondSpace -= doSpace;
|
|
beyondSpace -= doSpace;
|
|
- getScenePlusLockedIds(lockedIds,plusList,count,beyondSpace,accumulateSpace);
|
|
|
|
|
|
+ getScenePlusLockedIds(lockedIds,plusList,totalSpace,beyondSpace,accumulateSpace);
|
|
}
|
|
}
|
|
|
|
|
|
lockOrUnLockScenes(lockedIds,payStatus);
|
|
lockOrUnLockScenes(lockedIds,payStatus);
|
|
@@ -227,7 +238,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
if (list != null && list.size() > 0){
|
|
if (list != null && list.size() > 0){
|
|
for (ScenePro scenePro : list){
|
|
for (ScenePro scenePro : list){
|
|
accumulateSpace += scenePro.getSpace();
|
|
accumulateSpace += scenePro.getSpace();
|
|
- if (count ==0 && accumulateSpace.compareTo(beyondSpace) > 0){
|
|
|
|
|
|
+ if (count ==-1 && accumulateSpace.compareTo(beyondSpace) > 0){
|
|
return accumulateSpace - scenePro.getSpace();
|
|
return accumulateSpace - scenePro.getSpace();
|
|
}
|
|
}
|
|
lockedIds.add(scenePro.getId());
|
|
lockedIds.add(scenePro.getId());
|
|
@@ -242,7 +253,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
for (ScenePlus scenePlus : list){
|
|
for (ScenePlus scenePlus : list){
|
|
ScenePlusExt scenePlusExt = byPlusIds.get(scenePlus.getId());
|
|
ScenePlusExt scenePlusExt = byPlusIds.get(scenePlus.getId());
|
|
accumulateSpace += scenePlusExt.getSpace();
|
|
accumulateSpace += scenePlusExt.getSpace();
|
|
- if (count ==0 && accumulateSpace.compareTo(beyondSpace) > 0){
|
|
|
|
|
|
+ if (count ==-1 && accumulateSpace.compareTo(beyondSpace) > 0){
|
|
return accumulateSpace - scenePlusExt.getSpace();
|
|
return accumulateSpace - scenePlusExt.getSpace();
|
|
}
|
|
}
|
|
lockedIds.add(scenePlus.getId());
|
|
lockedIds.add(scenePlus.getId());
|