|
@@ -204,28 +204,6 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
.in(ScenePlus::getId,lockedIds);
|
|
.in(ScenePlus::getId,lockedIds);
|
|
scenePlusService.update(updatePlusWrapper);
|
|
scenePlusService.update(updatePlusWrapper);
|
|
|
|
|
|
- LambdaQueryWrapper<ScenePro> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
- wrapper.in(ScenePro::getId,lockedIds);
|
|
|
|
- List<ScenePro> list = this.list(wrapper);
|
|
|
|
- for (ScenePro scenePro : list) {
|
|
|
|
- try{
|
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
|
- map.put("payStatus", payStatus);
|
|
|
|
- FileUtils.writeJsonFile(ConstantFilePath.SCENE_PATH + "data/data" + scenePro.getNum() + "/scene.json", map);
|
|
|
|
- JSONObject statusJson = new JSONObject();
|
|
|
|
- //临时将-2改成1,app还没完全更新
|
|
|
|
- statusJson.put("status", scenePro.getStatus() == -2 ? 1 : scenePro.getStatus());
|
|
|
|
- statusJson.put("webSite", scenePro.getWebSite());
|
|
|
|
- statusJson.put("sceneNum", scenePro.getNum());
|
|
|
|
- statusJson.put("thumb", scenePro.getThumb());
|
|
|
|
- statusJson.put("payStatus", scenePro.getPayStatus());
|
|
|
|
- FileUtils.writeFile(ConstantFilePath.SCENE_PATH+"data/data"+scenePro.getNum()+ File.separator+"status.json", statusJson.toString());
|
|
|
|
- uploadToOssUtil.upload(ConstantFilePath.SCENE_PATH+"data/data"+scenePro.getNum()+File.separator+"status.json",
|
|
|
|
- "data/data"+scenePro.getNum()+File.separator+"status.json");
|
|
|
|
- }catch (Exception e){
|
|
|
|
- e.printStackTrace();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -528,7 +506,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void delete(String sceneNum, String username) {
|
|
|
|
|
|
+ public void delete(String sceneNum) {
|
|
if(StringUtils.isEmpty(sceneNum)){
|
|
if(StringUtils.isEmpty(sceneNum)){
|
|
throw new BusinessException(LoginConstant.FAILURE_CODE_3001,LoginConstant.FAILURE_MSG_3001);
|
|
throw new BusinessException(LoginConstant.FAILURE_CODE_3001,LoginConstant.FAILURE_MSG_3001);
|
|
}
|
|
}
|
|
@@ -541,19 +519,25 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
|
|
|
private void deleteByList(List<ScenePro> proList,List<ScenePlus> plusList) {
|
|
private void deleteByList(List<ScenePro> proList,List<ScenePlus> plusList) {
|
|
HashMap<Long ,Long >cameraMap = new HashMap<>();
|
|
HashMap<Long ,Long >cameraMap = new HashMap<>();
|
|
- for (ScenePro scenePro : proList) {
|
|
|
|
- cameraMap.merge(scenePro.getCameraId(), scenePro.getSpace(), Long::sum);
|
|
|
|
|
|
+ if(proList.size() >0){
|
|
|
|
+ for (ScenePro scenePro : proList) {
|
|
|
|
+ cameraMap.merge(scenePro.getCameraId(), scenePro.getSpace(), Long::sum);
|
|
|
|
+ }
|
|
|
|
+ List<Long> proIds = proList.parallelStream().map(ScenePro::getId).collect(Collectors.toList());
|
|
|
|
+ this.removeByIds(proIds);
|
|
}
|
|
}
|
|
- List<Long> proIds = proList.parallelStream().map(ScenePro::getId).collect(Collectors.toList());
|
|
|
|
- List<Long> plusIds = plusList.parallelStream().map(ScenePlus::getId).collect(Collectors.toList());
|
|
|
|
- HashMap<Long, ScenePlusExt> plusMap = scenePlusExtService.getByPlusIds(plusIds);
|
|
|
|
|
|
+ if(plusList.size() >0){
|
|
|
|
+ List<Long> plusIds = plusList.parallelStream().map(ScenePlus::getId).collect(Collectors.toList());
|
|
|
|
+ HashMap<Long, ScenePlusExt> plusMap = scenePlusExtService.getByPlusIds(plusIds);
|
|
|
|
|
|
- for (ScenePlus scenePlus : plusList) {
|
|
|
|
- cameraMap.merge(scenePlus.getCameraId(), plusMap.get(scenePlus.getId()).getSpace(), Long::sum);
|
|
|
|
|
|
+ for (ScenePlus scenePlus : plusList) {
|
|
|
|
+ cameraMap.merge(scenePlus.getCameraId(), plusMap.get(scenePlus.getId()).getSpace(), Long::sum);
|
|
|
|
+ }
|
|
|
|
+ scenePlusService.removeByIds(plusIds);
|
|
}
|
|
}
|
|
- this.removeByIds(proIds);
|
|
|
|
- scenePlusService.removeByIds(plusIds);
|
|
|
|
//恢复相机使用容量
|
|
//恢复相机使用容量
|
|
- cameraDetailService.addUsedSpace(cameraMap);
|
|
|
|
|
|
+ if(cameraMap.size() >0){
|
|
|
|
+ cameraDetailService.addUsedSpace(cameraMap);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|