|
@@ -205,10 +205,12 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
Long accumulateSpace = 0L;
|
|
|
List<Long> lockedIds = new ArrayList<>();
|
|
|
if(payStatus == 1){
|
|
|
- getScenePlusLockedIds(lockedIds,plusList,count,beyondSpace,accumulateSpace);
|
|
|
+ Long doSpace = getScenePlusLockedIds(lockedIds, plusList, count, beyondSpace, accumulateSpace);
|
|
|
+ beyondSpace -= doSpace;
|
|
|
getSceneLockedIds(lockedIds,list,count,beyondSpace,accumulateSpace);
|
|
|
}else {
|
|
|
- getSceneLockedIds(lockedIds,list,count,beyondSpace,accumulateSpace);
|
|
|
+ Long doSpace = getSceneLockedIds(lockedIds, list, count, beyondSpace, accumulateSpace);
|
|
|
+ beyondSpace -= doSpace;
|
|
|
getScenePlusLockedIds(lockedIds,plusList,count,beyondSpace,accumulateSpace);
|
|
|
}
|
|
|
|
|
@@ -217,18 +219,19 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
|
|
|
|
|
|
|
|
|
- private void getSceneLockedIds(List<Long> lockedIds ,List<ScenePro> list,Long count,Long beyondSpace,Long accumulateSpace){
|
|
|
+ private Long getSceneLockedIds(List<Long> lockedIds ,List<ScenePro> list,Long count,Long beyondSpace,Long accumulateSpace){
|
|
|
if (list != null && list.size() > 0){
|
|
|
for (ScenePro scenePro : list){
|
|
|
accumulateSpace += scenePro.getSpace();
|
|
|
if (count ==0 && accumulateSpace.compareTo(beyondSpace) > 0){
|
|
|
- break;
|
|
|
+ return accumulateSpace - scenePro.getSpace();
|
|
|
}
|
|
|
lockedIds.add(scenePro.getId());
|
|
|
}
|
|
|
}
|
|
|
+ return accumulateSpace;
|
|
|
}
|
|
|
- private void getScenePlusLockedIds(List<Long> lockedIds ,List<ScenePlus> list,Long count,Long beyondSpace,Long accumulateSpace){
|
|
|
+ private Long getScenePlusLockedIds(List<Long> lockedIds , List<ScenePlus> list, Long count, Long beyondSpace, Long accumulateSpace){
|
|
|
if (list != null && list.size() > 0){
|
|
|
List<Long> plusIds = list.parallelStream().map(ScenePlus::getId).collect(Collectors.toList());
|
|
|
HashMap<Long, ScenePlusExt> byPlusIds = scenePlusExtService.getByPlusIds(plusIds);
|
|
@@ -236,11 +239,12 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
ScenePlusExt scenePlusExt = byPlusIds.get(scenePlus.getId());
|
|
|
accumulateSpace += scenePlusExt.getSpace();
|
|
|
if (count ==0 && accumulateSpace.compareTo(beyondSpace) > 0){
|
|
|
- break;
|
|
|
+ return accumulateSpace - scenePlusExt.getSpace();
|
|
|
}
|
|
|
lockedIds.add(scenePlus.getId());
|
|
|
}
|
|
|
}
|
|
|
+ return accumulateSpace;
|
|
|
}
|
|
|
|
|
|
|