|
@@ -1,6 +1,7 @@
|
|
|
package com.fdkankan.scene.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.date.DateField;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
@@ -51,6 +52,7 @@ import java.nio.charset.StandardCharsets;
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
import java.util.UUID;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -89,9 +91,10 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
|
|
|
private OssUtil ossUtil;
|
|
|
@Autowired
|
|
|
FdkkLaserConfig fdkkLaserConfig;
|
|
|
-
|
|
|
@Autowired
|
|
|
private ISceneProService sceneProService;
|
|
|
+ @Autowired
|
|
|
+ private ISceneDelLogService sceneDelLogService;
|
|
|
|
|
|
@Override
|
|
|
public ScenePlus getScenePlusByNum(String num) {
|
|
@@ -379,4 +382,49 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
|
|
|
time = DateUtil.beginOfDay(DateUtil.offset(time, DateField.MONTH, -cleanOrigMonth));
|
|
|
return this.baseMapper.selectCleanOrigScene(time);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ScenePlus> getListByNums(List<String> numList) {
|
|
|
+ LambdaQueryWrapper<ScenePlus> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.in(ScenePlus::getNum,numList);
|
|
|
+ return this.list(wrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void deleteByList(List<ScenePlus> plusList,Long userId) {
|
|
|
+ HashMap<Long ,Long >cameraMap = new HashMap<>();
|
|
|
+ if(CollUtil.isEmpty(plusList)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<Long> plusIds = plusList.parallelStream().map(ScenePlus::getId).collect(Collectors.toList());
|
|
|
+ HashMap<Long, ScenePlusExt> plusMap = scenePlusExtService.getByPlusIds(plusIds);
|
|
|
+
|
|
|
+ for (ScenePlus scenePlus : plusList) {
|
|
|
+ if(scenePlus.getCameraId()!= null && plusMap.get(scenePlus.getId())!=null){
|
|
|
+ cameraMap.merge(scenePlus.getCameraId(), plusMap.get(scenePlus.getId()).getSpace(), Long::sum);
|
|
|
+ }
|
|
|
+ sceneDelLogService.saveLog(scenePlus.getNum(),userId);
|
|
|
+ }
|
|
|
+ scenePlusService.removeByIds(plusIds);
|
|
|
+ scenePlusExtService.removeByPlusIds(plusIds);
|
|
|
+// folderSceneService.delBySceneId(plusIds);
|
|
|
+//
|
|
|
+// //恢复相机使用容量
|
|
|
+// if(cameraMap.size() >0){
|
|
|
+// cameraDetailService.addUsedSpace(cameraMap);
|
|
|
+// }
|
|
|
+
|
|
|
+ //删除编辑和展示文件
|
|
|
+ plusList.stream().forEach(plus->{
|
|
|
+ ossUtil.deleteObject(String.format(UploadFilePath.VIEW_PATH, plus.getNum()));
|
|
|
+ ossUtil.deleteObject(String.format(UploadFilePath.EDIT_PATH, plus.getNum()));
|
|
|
+ });
|
|
|
+
|
|
|
+ //删除原始资源文件
|
|
|
+ plusMap.keySet().stream().forEach(key -> {
|
|
|
+ ScenePlusExt ext = plusMap.get(key);
|
|
|
+ ossUtil.deleteObject(ext.getDataSource());
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
}
|