|
@@ -9,19 +9,17 @@ import com.fdkankan.common.constant.CommonStatus;
|
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
|
import com.fdkankan.common.constant.ServerCode;
|
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
|
-import com.fdkankan.scene.entity.SceneEditInfo;
|
|
|
-import com.fdkankan.scene.entity.SceneEditInfoExt;
|
|
|
-import com.fdkankan.scene.entity.ScenePlus;
|
|
|
-import com.fdkankan.scene.entity.Surveillance;
|
|
|
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
+import com.fdkankan.model.constants.UploadFilePath;
|
|
|
+import com.fdkankan.scene.entity.*;
|
|
|
import com.fdkankan.scene.mapper.ISurveillanceMapper;
|
|
|
-import com.fdkankan.scene.service.ISceneEditInfoExtService;
|
|
|
-import com.fdkankan.scene.service.ISceneEditInfoService;
|
|
|
-import com.fdkankan.scene.service.IScenePlusService;
|
|
|
-import com.fdkankan.scene.service.ISurveillanceService;
|
|
|
+import com.fdkankan.scene.service.*;
|
|
|
import com.fdkankan.scene.vo.BaseSidParamVO;
|
|
|
import com.fdkankan.scene.vo.SurveillanceParamVO;
|
|
|
import com.fdkankan.scene.vo.SurveillanceVO;
|
|
|
import com.fdkankan.web.response.ResultData;
|
|
|
+
|
|
|
+import java.io.IOException;
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -45,6 +43,10 @@ public class SurveillanceServiceImpl extends ServiceImpl<ISurveillanceMapper, Su
|
|
|
private ISceneEditInfoExtService sceneEditInfoExtService;
|
|
|
@Autowired
|
|
|
private ISceneEditInfoService sceneEditInfoService;
|
|
|
+ @Autowired
|
|
|
+ private FYunFileServiceInterface yunFileService;
|
|
|
+ @Autowired
|
|
|
+ private IScenePlusExtService scenePlusExtService;
|
|
|
|
|
|
@Override
|
|
|
public ResultData saveSurveillance(SurveillanceParamVO param) {
|
|
@@ -91,13 +93,17 @@ public class SurveillanceServiceImpl extends ServiceImpl<ISurveillanceMapper, Su
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ResultData deleteSurveillance(BaseSidParamVO param) {
|
|
|
+ public ResultData deleteSurveillance(BaseSidParamVO param) throws IOException {
|
|
|
ScenePlus scenePlus = scenePlusService.getScenePlusByNum(param.getNum());
|
|
|
if(Objects.isNull(scenePlus)){
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
}
|
|
|
+ ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
|
|
|
SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
|
|
|
SceneEditInfoExt sceneEditInfoExt = sceneEditInfoExtService.getByScenePlusId(scenePlus.getId());
|
|
|
+ String bucket = scenePlusExt.getYunFileBucket();
|
|
|
+
|
|
|
+ Surveillance surveillance = this.getBySid(param.getNum(), param.getSid());
|
|
|
|
|
|
this.remove(new LambdaQueryWrapper<Surveillance>().eq(Surveillance::getSid, param.getSid()));
|
|
|
|
|
@@ -105,6 +111,18 @@ public class SurveillanceServiceImpl extends ServiceImpl<ISurveillanceMapper, Su
|
|
|
if(count < 1){
|
|
|
sceneEditInfoExt.setSurveillances(CommonStatus.NO.code().intValue());
|
|
|
}
|
|
|
+
|
|
|
+ //如果是视频类型监控,需要删除oss文件
|
|
|
+ if(surveillance.getUrlType() == 2){
|
|
|
+ String userEditPath = String.format(UploadFilePath.USER_EDIT_PATH, param.getNum());
|
|
|
+ if(StrUtil.isNotEmpty(surveillance.getFileName())){
|
|
|
+ yunFileService.deleteFile(bucket, userEditPath.concat(surveillance.getFileName()));
|
|
|
+ }
|
|
|
+ if(StrUtil.isNotEmpty(surveillance.getPoster())){
|
|
|
+ yunFileService.deleteFile(bucket, userEditPath.concat(surveillance.getPoster()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
sceneEditInfoExtService.updateById(sceneEditInfoExt);
|
|
|
|
|
|
sceneEditInfoService.upgradeVersionById(sceneEditInfo.getId());
|