|
@@ -441,7 +441,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
if(cameraDetail.getType() == 10){ //深时场景
|
|
|
laserService.move(param.getNum(),oldCamera.getSnCode(),camera.getSnCode(),cameraDetail.getUserId());
|
|
|
}
|
|
|
- updateFdage(oldCamera.getSnCode(),param.getSnCode(),dataSource);
|
|
|
+ updateFdageNewDataSource(oldCamera.getSnCode(),param.getSnCode(),dataSource);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -450,8 +450,19 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
try {
|
|
|
String fdagePaht = dataSource.replace("/mnt/data","home") +"/data.fdage";
|
|
|
String fileContent = fYunFileServiceInterface.getFileContent(fdagePaht);
|
|
|
- String newJson = fileContent.replaceAll("(?i)"+oldSnCode,newSnCode.toLowerCase());
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(fileContent);
|
|
|
+ JSONObject cam = jsonObject.getJSONObject("cam");
|
|
|
+ if(cam != null){
|
|
|
+ cam.put("uuid",newSnCode); //替换 相机sn
|
|
|
+ }
|
|
|
+ String[] split = dataSource.split("/");
|
|
|
+ String creatorSn = split[3];
|
|
|
+ if(!creatorSn.equals(oldSnCode.toLowerCase())){ //修改过 creator的场景,修改回原始 creator
|
|
|
+ jsonObject.put("creator",creatorSn);
|
|
|
+ }
|
|
|
+ String newJson = jsonObject.toJSONString();
|
|
|
FileUtils.writeFile(localPath ,newJson);
|
|
|
+
|
|
|
log.info("updateFdage--localPath:{},ossPath:{}",localPath,fdagePaht);
|
|
|
String localPathBack = localPath+"_"+oldSnCode+"-"+newSnCode+"_"+Dateutils.getDateN(new Date())+".back";
|
|
|
String fdagePathBack = fdagePaht+"_"+oldSnCode+"-"+newSnCode+"_"+Dateutils.getDateN(new Date())+".back";
|
|
@@ -472,21 +483,18 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
try {
|
|
|
String localPathFdage = String.format(OssPath.localFdagePath,dataSource)+"/data.fdage";
|
|
|
|
|
|
- String homeData = dataSource.replace("/mnt/data","home");
|
|
|
- ShellUtil.yunDownload(homeData,localPath);
|
|
|
-
|
|
|
String fileContent = FileUtils.readFile(localPathFdage);
|
|
|
String newJson = fileContent.replaceAll("(?i)"+oldSnCode,newSnCode.toLowerCase());
|
|
|
FileUtils.writeFile(localPathFdage ,newJson);
|
|
|
|
|
|
String oldFdagePaht = dataSource.replace("/mnt/data","home") ;
|
|
|
String newFdagePaht = oldFdagePaht.replaceAll("(?i)"+oldSnCode,newSnCode.toLowerCase()) ;
|
|
|
- ShellUtil.yunUpload(localPath,newFdagePaht);
|
|
|
-
|
|
|
- log.info("updateFdage--localPath:{},ossPath:{}",localPath,newFdagePaht);
|
|
|
+ fYunFileServiceInterface.copyFileInBucket(oldFdagePaht,newFdagePaht);
|
|
|
+ fYunFileServiceInterface.uploadFile(localPathFdage,newFdagePaht);
|
|
|
+
|
|
|
+ log.info("updateFdage--localPath:{},ossPath:{}",localPathFdage,newFdagePaht);
|
|
|
String newDataSource = dataSource.replaceAll("(?i)"+oldSnCode,newSnCode.toLowerCase()) ;
|
|
|
this.updateDataSource(dataSource,newDataSource);
|
|
|
- fYunFileServiceInterface.deleteFolder(oldFdagePaht);
|
|
|
}catch (Exception e){
|
|
|
log.error("updateFdage-error:oldSnCode:{},newSnCode:{},dataSource:{}",oldSnCode,newSnCode,dataSource);
|
|
|
log.error("updateFdage-error:",e);
|