|
|
@@ -38,421 +38,25 @@ import java.util.*;
|
|
|
public class SceneCommonService {
|
|
|
|
|
|
@Autowired
|
|
|
- FYunFileServiceInterface fYunFileServiceInterface;
|
|
|
- @Autowired
|
|
|
IScene3dNumService scene3dNumService;
|
|
|
@Autowired
|
|
|
IScenePlusService scenePlusService;
|
|
|
@Autowired
|
|
|
- IScenePlusExtService scenePlusExtService;
|
|
|
- @Autowired
|
|
|
- ISceneEditInfoService sceneEditInfoService;
|
|
|
- @Autowired
|
|
|
- ISceneEditInfoExtService sceneEditInfoExtService;
|
|
|
- @Autowired
|
|
|
- ISceneEditControlsService sceneEditControlsService;
|
|
|
- @Autowired
|
|
|
- ISurveillanceService surveillanceService;
|
|
|
- @Autowired
|
|
|
- LaserService laserService;
|
|
|
- @Autowired
|
|
|
ISceneProService sceneProService;
|
|
|
@Autowired
|
|
|
- ISceneProEditService sceneProEditService;
|
|
|
- @Autowired
|
|
|
- RedisUtil redisUtil;
|
|
|
- @Autowired
|
|
|
- ICameraDetailService cameraDetailService;
|
|
|
- @Autowired
|
|
|
ISceneCopyLogService sceneCopyLogService;
|
|
|
|
|
|
public String getNewNum(String oldNum ){
|
|
|
String newNum = scene3dNumService.generateNum();
|
|
|
if(oldNum.contains("-")){
|
|
|
String pre = oldNum.split("-")[0];
|
|
|
- if(!"t".equals(pre) && !"njs".equals(pre)){
|
|
|
+ if(!"t".equals(pre) && !"jp".equals(pre)){
|
|
|
return pre +"-"+ newNum;
|
|
|
}
|
|
|
}
|
|
|
return newNum;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 生成新的dataSouce
|
|
|
- */
|
|
|
- public String getNewDataSource(String oldDataSource){
|
|
|
- String newDataSource = null;
|
|
|
- if(StringUtils.isBlank(oldDataSource)){
|
|
|
- throw new BusinessException(ResultCode.SCENE_DATA_ERROR);
|
|
|
- }
|
|
|
- File oldDataSouceFile = new File(oldDataSource);
|
|
|
- if(!oldDataSouceFile.exists()){
|
|
|
- throw new BusinessException(ResultCode.SCENE_DATA_ERROR);
|
|
|
- }
|
|
|
- if(!oldDataSource.contains("/")){
|
|
|
- throw new BusinessException(ResultCode.SCENE_DATA_ERROR);
|
|
|
- }
|
|
|
-
|
|
|
- String time = com.fdkankan.common.util.DateUtil.date2String(new Date(), com.fdkankan.common.util.DateUtil.YYYYMMDDHHMMSSSSS_DATA_FORMAT);
|
|
|
- String[] split = oldDataSource.split("/");
|
|
|
- if(split.length == 6 ){
|
|
|
- String oldFileId = split[4];
|
|
|
- Long fileId = SnowflakeIdGenerator.snowflakeIdGenerator.nextId();
|
|
|
- newDataSource = oldDataSource.replace(oldFileId,fileId.toString());
|
|
|
-
|
|
|
- String snCodeTime = split[5];
|
|
|
- if(!snCodeTime.contains("_") || snCodeTime.split("_").length <= 1){
|
|
|
- throw new BusinessException(ResultCode.SCENE_DATA_ERROR);
|
|
|
- }
|
|
|
- newDataSource = newDataSource.replace(snCodeTime.split("_")[1],time);
|
|
|
- this.copyFdage(oldDataSource,newDataSource,time);
|
|
|
- }
|
|
|
- if(newDataSource == null){
|
|
|
- throw new BusinessException(ResultCode.SCENE_DATA_ERROR);
|
|
|
- }
|
|
|
- return newDataSource;
|
|
|
- }
|
|
|
-
|
|
|
- public void createNewQrCode(String sceneVersion,String logoPath ,String newNum, String webSite){
|
|
|
- String localLogoPath = null;
|
|
|
- try {
|
|
|
- if(StringUtils.isNotBlank(logoPath)){
|
|
|
- if(sceneVersion.equals(SceneVersionType.V3.code())){
|
|
|
- localLogoPath =SceneResourcePath.nasBasePath + logoPath;
|
|
|
- }else{
|
|
|
- localLogoPath = SceneResourcePath.qrCodeBasePath + newNum +"/logo/logo.png";
|
|
|
- fYunFileServiceInterface.downloadFile(logoPath,localLogoPath);
|
|
|
- }
|
|
|
- }
|
|
|
- String outPathZh = SceneResourcePath.qrCodeBasePath + newNum + ".png";
|
|
|
- String outPathEn = SceneResourcePath.qrCodeBasePath + newNum + "_en.png";
|
|
|
- QrConfig qrConfig = QrConfig.create();
|
|
|
- qrConfig.setWidth(1024);
|
|
|
- qrConfig.setHeight(1024);
|
|
|
- if(!ObjectUtils.isEmpty(localLogoPath)){
|
|
|
- qrConfig.setImg(localLogoPath);
|
|
|
- }
|
|
|
- QrCodeUtil.generate(webSite, qrConfig, FileUtil.file(outPathZh));
|
|
|
- QrCodeUtil.generate(webSite + "&lang=en", qrConfig, FileUtil.file(outPathEn));
|
|
|
-
|
|
|
- fYunFileServiceInterface.uploadFile(outPathZh, String.format(SceneResourcePath.DOWNLOADS_QRCODE, newNum) + newNum + ".png");
|
|
|
- fYunFileServiceInterface.uploadFile(outPathEn, String.format(SceneResourcePath.DOWNLOADS_QRCODE, newNum) + newNum + "_en.png");
|
|
|
- }catch (Exception e){
|
|
|
- log.info("copy-scene-error:{},newNum:{},error:{}",newNum,e);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public void updateNasSceneJson(String targetPath, String oldNum, String newNum,String oldSceneName,String newSceneName,String sceneVersion) {
|
|
|
- String localPath = SceneResourcePath.nasBasePath + targetPath + "scene.json";
|
|
|
- File file = new File(localPath);
|
|
|
- if(!file.exists()){
|
|
|
- log.error("sceneCopy-error--localFileExist:localPath:{},oldNum:{},newNum:{}",localPath,oldNum,newNum);
|
|
|
- throw new BusinessException(ResultCode.SYSTEM_ERROR);
|
|
|
- }
|
|
|
- String fileContent = cn.hutool.core.io.FileUtil.readUtf8String(file);
|
|
|
- if(StringUtils.isNotBlank(fileContent)){
|
|
|
- String newJson = fileContent.replaceAll(oldNum,newNum);
|
|
|
- newJson = newJson.replaceAll(oldSceneName,newSceneName);
|
|
|
- try {
|
|
|
- com.fdkankan.manage_jp.util.FileUtil.writeFile(localPath,newJson);
|
|
|
-
|
|
|
- }catch (Exception e){
|
|
|
- log.error("writeFile-error:{}",e);
|
|
|
- throw new BusinessException(ResultCode.SYSTEM_ERROR);
|
|
|
- }
|
|
|
- }
|
|
|
- if("v3".equals(sceneVersion)){
|
|
|
- String sceneJsonPath = String.format(SceneResourcePath.dataPath+"/scene.json", newNum);
|
|
|
- fYunFileServiceInterface.uploadFile(localPath, sceneJsonPath);
|
|
|
- }
|
|
|
- if("v4".equals(sceneVersion)){
|
|
|
- String sceneJsonPath = String.format(SceneResourcePath.DATA_VIEW_PATH+"scene.json", newNum);
|
|
|
- fYunFileServiceInterface.uploadFile(localPath, sceneJsonPath);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- public void updateOssJson(String targetPath,String oldNum, String newNum,String vision,String newTitle,String fileName) {
|
|
|
- String ossStatusJsonPath = targetPath + fileName;
|
|
|
-
|
|
|
- if(!fYunFileServiceInterface.fileExist(ossStatusJsonPath)){
|
|
|
- log.error("sceneCopy-error--ossFileExist:targetPath:{},oldNum:{},newNum:{}",ossStatusJsonPath,oldNum,newNum);
|
|
|
- throw new BusinessException(ResultCode.SYSTEM_ERROR);
|
|
|
- }
|
|
|
- String localPath = SceneResourcePath.nasBasePath + ossStatusJsonPath;
|
|
|
- File file = new File(localPath);
|
|
|
- if(!file.getParentFile().exists()){
|
|
|
- file.getParentFile().mkdirs();
|
|
|
- }
|
|
|
- String fileContent = fYunFileServiceInterface.getFileContent(ossStatusJsonPath);
|
|
|
- if(StringUtils.isNotBlank(fileContent)){
|
|
|
- String newJson = fileContent.replaceAll(oldNum,newNum);
|
|
|
- try {
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(newJson);
|
|
|
- if(fileName.contains("scene.json")){
|
|
|
- if("v3".equals(vision)){
|
|
|
- jsonObject.put("sceneName",newTitle);
|
|
|
- }
|
|
|
- if("v4".equals(vision)) {
|
|
|
- jsonObject.put("title",newTitle);
|
|
|
- }
|
|
|
- }
|
|
|
- com.fdkankan.manage_jp.util.FileUtil.writeFile(localPath,newJson);
|
|
|
- fYunFileServiceInterface.uploadFile(localPath,ossStatusJsonPath);
|
|
|
- }catch (Exception e){
|
|
|
- log.error("writeFile-error:{}",e);
|
|
|
- throw new BusinessException(ResultCode.SYSTEM_ERROR);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- public void copyFdage(String oldDataSource,String newDataSource,String time){
|
|
|
- String ossOldPath = oldDataSource.replace("/mnt/data","home");
|
|
|
- String ossNewPath = newDataSource.replace("/mnt/data","home");
|
|
|
- fYunFileServiceInterface.copyFileInBucket(ossOldPath,ossNewPath);
|
|
|
-
|
|
|
- String fileName = "/data.fdage";
|
|
|
-
|
|
|
- String fileContent = fYunFileServiceInterface.getFileContent(ossNewPath + fileName);
|
|
|
- if(StringUtils.isNotBlank(fileContent)){
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(fileContent);
|
|
|
- jsonObject.put("uuidtime",time);
|
|
|
- FileUtils.writeFile(newDataSource +fileName, jsonObject.toJSONString());
|
|
|
- fYunFileServiceInterface.uploadFile(newDataSource +fileName,ossNewPath +fileName);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @Async
|
|
|
- public void v4Async(ScenePlusExt plusExt, String oldNum, String newNum, ScenePlus scenePlus, Long plusId, String oldSceneName){
|
|
|
- try {
|
|
|
- String oldDataSource = plusExt.getDataSource();
|
|
|
-
|
|
|
- String newDataSource = this.getNewDataSource(oldDataSource);
|
|
|
-
|
|
|
- log.info("sceneCopy-V4-oldNum:{},oldDataSource:{},newNum:{},newDataSource:{}",
|
|
|
- oldNum,oldDataSource,newNum,newDataSource);
|
|
|
-
|
|
|
- String newVideos = plusExt.getVideos();
|
|
|
- if(StrUtil.isNotEmpty(newVideos)){
|
|
|
- newVideos = plusExt.getVideos().replaceAll("/data/data" + oldNum, "/scene_view_data/" + newNum + "/data").replaceAll(oldNum, newNum);
|
|
|
- }
|
|
|
- plusExt.setId(null);
|
|
|
- plusExt.setPlusId(scenePlus.getId());
|
|
|
- plusExt.setDataSource(newDataSource);
|
|
|
- plusExt.setWebSite(plusExt.getWebSite().replace(oldNum, newNum));
|
|
|
- plusExt.setThumb(plusExt.getThumb().replace(oldNum, newNum));
|
|
|
- plusExt.setVideos(newVideos);
|
|
|
- plusExt.setViewCount(0);
|
|
|
- scenePlusExtService.save(plusExt);
|
|
|
-
|
|
|
- SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(plusId);
|
|
|
- Long sceneEditInfoId = sceneEditInfo.getId();
|
|
|
-
|
|
|
- sceneEditInfo.setId(null);
|
|
|
- sceneEditInfo.setScenePlusId(scenePlus.getId());
|
|
|
- sceneEditInfo.setSceneProId(null);
|
|
|
- sceneEditInfo.setTitle(scenePlus.getTitle());
|
|
|
- sceneEditInfoService.save(sceneEditInfo);
|
|
|
-
|
|
|
- SceneEditInfoExt sceneEditInfoExt = sceneEditInfoExtService.getByEditInfoId(sceneEditInfoId);
|
|
|
- sceneEditInfoExt.setId(null);
|
|
|
- sceneEditInfoExt.setEditInfoId(sceneEditInfo.getId());
|
|
|
- sceneEditInfoExt.setScenePlusId(scenePlus.getId());
|
|
|
- sceneEditInfoExt.setSceneProId(null);
|
|
|
- sceneEditInfoExtService.save(sceneEditInfoExt);
|
|
|
-
|
|
|
- SceneEditControls sceneEditControls = sceneEditControlsService.getBySceneEditId(sceneEditInfoId);
|
|
|
- sceneEditControls.setId(null);
|
|
|
- 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(SceneSourceUtil.isLaser(scenePlus.getSceneSource())){ //深时复制
|
|
|
- laserService.copy(oldNum,newNum,newDataSource,true);
|
|
|
- }else {
|
|
|
- laserService.cloudPointBuild(oldNum,newNum);
|
|
|
- }
|
|
|
-
|
|
|
- //重新生成编辑页基础设置二维码
|
|
|
- this.createNewQrCode(SceneVersionType.V4.code(),sceneEditInfoExt.getShareLogoImg(),newNum,plusExt.getWebSite());
|
|
|
- //copyDataSource
|
|
|
- cn.hutool.core.io.FileUtil.copyContent(new File(oldDataSource),new File(newDataSource),true);
|
|
|
-
|
|
|
- this.copyOssAndNas(oldNum,newNum);
|
|
|
-
|
|
|
- //修改 oss status.json ,nas scene.json
|
|
|
- String targetData = String.format(SceneResourcePath.DATA_VIEW_PATH,newNum);
|
|
|
- this.updateOssJson(targetData,oldNum,newNum,"v4", scenePlus.getTitle(),"status.json");
|
|
|
- this.updateOssJson(targetData,oldNum,newNum,"v4", scenePlus.getTitle(),"scene.json");
|
|
|
- //修改马赛克图片
|
|
|
- this.updateOssFileName(oldNum,newNum);
|
|
|
-
|
|
|
- if(SceneSourceUtil.isLaser(scenePlus.getSceneSource())){ //深时复制
|
|
|
- laserService.copy(oldNum,newNum,newDataSource,false);
|
|
|
- }
|
|
|
- String redisKey = RedisKeyUtil.laserCopyLock + newNum;
|
|
|
- long startTime = new Date().getTime();
|
|
|
- long startTime2 = new Date().getTime();
|
|
|
- while (redisUtil.hasKey(redisKey) ){ //深时场景复制同步锁
|
|
|
- long waitTime = new Date().getTime();
|
|
|
- if(waitTime - startTime2 >1000){
|
|
|
- startTime2 = new Date().getTime();
|
|
|
- log.info("等待激光复制业务结束----:{}",(waitTime - startTime) /1000);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- scenePlus.setSceneStatus(-2);
|
|
|
- scenePlusService.updateById(scenePlus);
|
|
|
- }catch (Exception e){
|
|
|
- log.info("复制场景失败:oldNum:{},newNum:{},error:{}",oldNum,newNum,e);
|
|
|
- scenePlus.setSceneStatus(-1);
|
|
|
- scenePlusService.updateById(scenePlus);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- private void updateOssFileName(String oldNum, String newNum) {
|
|
|
- //修改图片名称
|
|
|
- try {
|
|
|
- String filePath = String.format(SceneResourcePath.USER_VIEW_PATH, newNum) ;
|
|
|
- List<String> files = fYunFileServiceInterface.listRemoteFiles(filePath);
|
|
|
- for (String ossFilePath : files) {
|
|
|
- if(ossFilePath.contains(oldNum)){
|
|
|
- String oldName = ossFilePath;
|
|
|
- ossFilePath = ossFilePath.replace(oldNum,newNum);
|
|
|
- fYunFileServiceInterface.copyFileInBucket(oldName,ossFilePath);
|
|
|
- fYunFileServiceInterface.deleteFile(oldName);
|
|
|
- }
|
|
|
- }
|
|
|
- }catch (Exception e){
|
|
|
- log.info("修改名称失败:oldName:{},newNum:{}",oldNum,newNum);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- private void copyOssAndNas(String oldNum,String newNum){
|
|
|
- // 拷贝场景编辑资源
|
|
|
- String oldEditPath = String.format(SceneResourcePath.EDIT_PATH_v4, oldNum);
|
|
|
- String newEditPath = String.format(SceneResourcePath.EDIT_PATH_v4, newNum);
|
|
|
- fYunFileServiceInterface.copyFileInBucket(oldEditPath, newEditPath);
|
|
|
-
|
|
|
- // 拷贝场景展示资源
|
|
|
- String oldViewPath = String.format(SceneResourcePath.VIEW_PATH_v4, oldNum);
|
|
|
- String newViewPath = String.format(SceneResourcePath.VIEW_PATH_v4, newNum);
|
|
|
- fYunFileServiceInterface.copyFileInBucket(oldViewPath, newViewPath);
|
|
|
-
|
|
|
- //复制计算结果文件
|
|
|
- String oldResultPath = String.format(SceneResourcePath.SCENE_RESULT_DATA_PATH, oldNum);
|
|
|
- String newResultPath = String.format(SceneResourcePath.SCENE_RESULT_DATA_PATH, newNum);
|
|
|
- fYunFileServiceInterface.copyFileInBucket(oldResultPath, newResultPath);
|
|
|
-
|
|
|
- // 拷贝本地资源
|
|
|
- String oldPath = SceneResourcePath.nasBasePath + oldNum;
|
|
|
- String newPath = SceneResourcePath.nasBasePath + newNum;
|
|
|
- if(new File(oldPath).exists()){
|
|
|
- FileUtil.copyContent(new File(oldPath), new File(newPath),true);
|
|
|
- }
|
|
|
- String oldPath_v4 = SceneResourcePath.nasBasePath_v4 + oldNum;
|
|
|
- String newPath_v4 = SceneResourcePath.nasBasePath_v4 + newNum;
|
|
|
- if(new File(oldPath_v4).exists()){
|
|
|
- FileUtil.copyContent(new File(oldPath_v4), new File(newPath_v4),true);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @Async
|
|
|
- public void v3Async(ScenePro scenePro,String oldNum,String newNum,Long sceneProId,String oldSceneName){
|
|
|
- try {
|
|
|
- String oldDataSource = scenePro.getDataSource();
|
|
|
- String newDataSource = this.getNewDataSource(oldDataSource);
|
|
|
- log.info("sceneCopy--oldNum:{},oldDataSource:{},newNum:{},newDataSource:{}",
|
|
|
- oldNum,oldDataSource,newNum,newDataSource);
|
|
|
-
|
|
|
- scenePro.setDataSource(newDataSource);
|
|
|
- sceneProService.updateById(scenePro);
|
|
|
-
|
|
|
- SceneProEdit oldEditScene = sceneProEditService.getByProId(sceneProId);
|
|
|
- oldEditScene.setId(null);
|
|
|
- oldEditScene.setProId(scenePro.getId());
|
|
|
- oldEditScene.setScreencapVoiceSrc(oldEditScene.getScreencapVoiceSrc() == null ? null : oldEditScene.getScreencapVoiceSrc().replace(oldNum, scenePro.getNum()));
|
|
|
- oldEditScene.setScreencapVoiceSound(oldEditScene.getScreencapVoiceSound() == null ? null : oldEditScene.getScreencapVoiceSound().replace(oldNum, scenePro.getNum()));
|
|
|
- oldEditScene.setScreencapVoiceSoundsync(oldEditScene.getScreencapVoiceSoundsync() == null ? null : oldEditScene.getScreencapVoiceSoundsync().replace(oldNum, scenePro.getNum()));
|
|
|
- oldEditScene.setPlayData(oldEditScene.getPlayData() == null ? null : oldEditScene.getPlayData().replace(oldNum, scenePro.getNum()));
|
|
|
- oldEditScene.setScreencapThumb(oldEditScene.getScreencapThumb() == null ? null : oldEditScene.getScreencapThumb().replace(oldNum, scenePro.getNum()));
|
|
|
- oldEditScene.setFloorPlanPng(oldEditScene.getFloorPlanPng() == null ? null : oldEditScene.getFloorPlanPng().replace(oldNum, scenePro.getNum()));
|
|
|
- sceneProEditService.save(oldEditScene);
|
|
|
-
|
|
|
- if(SceneSourceUtil.isLaser(scenePro.getSceneSource())){ //深时复制
|
|
|
- laserService.copy(oldNum,newNum,newDataSource,false);
|
|
|
- }
|
|
|
- /*
|
|
|
- *cp oss nas
|
|
|
- * data/data{SceneNum}
|
|
|
- * images/images{SceneNum}
|
|
|
- * video/video{SceneNum}
|
|
|
- * voice/voice{SceneNum}
|
|
|
- */
|
|
|
- //重新生成编辑页基础设置二维码
|
|
|
- this.createNewQrCode(SceneVersionType.V3.code(),oldEditScene.getShareLogo(),newNum,scenePro.getWebSite());
|
|
|
- //copyDataSource
|
|
|
- cn.hutool.core.io.FileUtil.copyContent(new File(oldDataSource),new File(newDataSource),true);
|
|
|
-
|
|
|
- String sourceData = String.format(SceneResourcePath.dataPath, oldNum);
|
|
|
- String targetData = String.format(SceneResourcePath.dataPath, scenePro.getNum());
|
|
|
- this.copyOssAndNas(oldNum,scenePro.getNum(),sourceData,targetData);
|
|
|
- //修改 oss status.json ,nas scene.json
|
|
|
- this.updateOssJson(targetData,oldNum,newNum,"v3", scenePro.getSceneName(),"status.json");
|
|
|
- this.updateOssJson(targetData,oldNum,newNum,"v3", scenePro.getSceneName(),"scene.json");
|
|
|
-
|
|
|
- String sourceImages = String.format(SceneResourcePath.imagesPath, oldNum);
|
|
|
- String targetImages = String.format(SceneResourcePath.imagesPath, scenePro.getNum());
|
|
|
- this.copyOssAndNas(oldNum,scenePro.getNum(),sourceImages,targetImages);
|
|
|
-
|
|
|
- String sourceVideo = String.format(SceneResourcePath.videoPath, oldNum);
|
|
|
- String targetVideo = String.format(SceneResourcePath.videoPath, scenePro.getNum());
|
|
|
- this.copyOssAndNas(oldNum,scenePro.getNum(),sourceVideo,targetVideo);
|
|
|
-
|
|
|
- String sourceVoice = String.format(SceneResourcePath.voicePath, oldNum);
|
|
|
- String targetVoice = String.format(SceneResourcePath.voicePath, scenePro.getNum());
|
|
|
- this.copyOssAndNas(oldNum,scenePro.getNum(),sourceVoice,targetVoice);
|
|
|
-
|
|
|
- if(SceneSourceUtil.isLaser(scenePro.getSceneSource())){ //深时复制
|
|
|
- laserService.copy(oldNum,newNum,newDataSource,true);
|
|
|
- }
|
|
|
- scenePro.setStatus(-2);
|
|
|
- sceneProService.updateById(scenePro);
|
|
|
- }catch (Exception e){
|
|
|
- log.info("复制场景失败:oldNum:{},newNum:{},error:{}",oldNum,newNum,e);
|
|
|
- scenePro.setStatus(-1);
|
|
|
- sceneProService.updateById(scenePro);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- private void copyOssAndNas(String oldNum ,String newNum ,String sourcePath,String targetPath){
|
|
|
- log.info("sceneCopy-ossSource-oldNum:{},newNum:{},sourcePath:{},targetPath:{}",oldNum,newNum,sourcePath,targetPath);
|
|
|
- fYunFileServiceInterface.copyFileInBucket(sourcePath,targetPath);
|
|
|
- File fileData = new File(SceneResourcePath.nasBasePath + sourcePath);
|
|
|
- if(fileData.exists()){
|
|
|
- cn.hutool.core.io.FileUtil.copyContent(fileData,new File(SceneResourcePath.nasBasePath + targetPath),true);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
public void copyResult(String newNum) {
|
|
|
ScenePro scenePro = sceneProService.getByNum(newNum);
|
|
|
ScenePlus scenePlus = scenePlusService.getByNum(newNum);
|