|
@@ -4,25 +4,22 @@ import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
-import com.fdkankan.common.constant.SceneSource;
|
|
|
-import com.fdkankan.common.util.FileUtils;
|
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
import com.fdkankan.manage_jp.common.ResultCode;
|
|
|
import com.fdkankan.manage_jp.entity.*;
|
|
|
import com.fdkankan.manage_jp.exception.BusinessException;
|
|
|
+import com.fdkankan.manage_jp.httpClient.service.LaserService;
|
|
|
import com.fdkankan.manage_jp.mapper.IScenePlusMapper;
|
|
|
import com.fdkankan.manage_jp.service.*;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fdkankan.manage_jp.util.SceneResourcePath;
|
|
|
-import com.fdkankan.manage_jp.util.SnowflakeIdGenerator;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.io.File;
|
|
|
-import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -50,6 +47,10 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
|
|
|
FYunFileServiceInterface fYunFileServiceInterface;
|
|
|
@Autowired
|
|
|
SceneCommonService sceneCommonService;
|
|
|
+ @Autowired
|
|
|
+ ISurveillanceService surveillanceService;
|
|
|
+ @Autowired
|
|
|
+ LaserService laserService;
|
|
|
|
|
|
@Override
|
|
|
public ScenePlus getByNum(String sceneNum) {
|
|
@@ -71,7 +72,7 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void copyScene(ScenePlus scenePlus) {
|
|
|
+ public ScenePlus copyScene(ScenePlus scenePlus) {
|
|
|
if(scenePlus.getSceneStatus() !=-2){
|
|
|
throw new BusinessException(ResultCode.SCENE_ERROR);
|
|
|
}
|
|
@@ -130,6 +131,19 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
|
|
|
sceneEditControls.setEditInfoId(sceneEditInfo.getId());
|
|
|
sceneEditControlsService.save(sceneEditControls);
|
|
|
|
|
|
+ List<Surveillance> list = surveillanceService.list(new LambdaQueryWrapper<Surveillance>().eq(Surveillance::getNum, oldNum));
|
|
|
+ if (!Objects.isNull(list)) {
|
|
|
+ list.stream().forEach(item -> {
|
|
|
+ item.setNum(newNum);
|
|
|
+ item.setId(null);
|
|
|
+ surveillanceService.save(item);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ if(scenePlus.getSceneSource() == 4){ //深时复制
|
|
|
+ laserService.copy(scenePlus.getCameraId(),scenePlus.getCreateTime(),newNum,0,null,
|
|
|
+ sceneEditInfo.getScenePassword(),scenePlus.getTitle(),scenePlus.getUserId(),"V4");
|
|
|
+ }
|
|
|
|
|
|
try {
|
|
|
//重新生成编辑页基础设置二维码
|
|
@@ -145,13 +159,19 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
|
|
|
|
|
|
sceneCommonService.updateNasSceneJson(targetData,oldNum,newNum,oldSceneName,scenePlus.getTitle(),"v4");
|
|
|
|
|
|
+ if(scenePlus.getSceneSource() == 4){ //深时复制
|
|
|
+ String laserPath = laserService.copyDataSource(oldDataSource,plusExt.getDataSource());
|
|
|
+ laserService.copy(scenePlus.getCameraId(),scenePlus.getCreateTime(),newNum,2,laserPath,
|
|
|
+ sceneEditInfo.getScenePassword(),scenePlus.getTitle(),scenePlus.getUserId(),"V4");
|
|
|
+ }
|
|
|
+
|
|
|
}catch (Exception e){
|
|
|
log.error("复制场景失败-V4-sceneNum:{},error:{}",oldNum,e);
|
|
|
scenePlus.setSceneStatus(-1);
|
|
|
this.updateById(scenePlus);
|
|
|
throw new BusinessException(-1,"复制失败");
|
|
|
}
|
|
|
-
|
|
|
+ return scenePlus;
|
|
|
}
|
|
|
|
|
|
private void copyOssAndNas(String oldNum,String newNum){
|