|
@@ -445,47 +445,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
updateFdageNewDataSource(oldCamera.getSnCode(),param.getSnCode(),dataSource);
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public void updateFdage(String oldSnCode,String newSnCode,String dataSource) {
|
|
|
- String localPath = String.format(OssPath.localFdagePath,dataSource)+"/data.fdage";
|
|
|
- try {
|
|
|
- String fdagePaht = dataSource.replace("/mnt/data","home") +"/data.fdage";
|
|
|
- String fileContent = fYunFileServiceInterface.getFileContent(fdagePaht);
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(fileContent);
|
|
|
- JSONObject cam = jsonObject.getJSONObject("cam");
|
|
|
- if(cam != null){
|
|
|
- cam.put("uuid",newSnCode.toLowerCase()); //替换 相机sn
|
|
|
- }
|
|
|
- JSONArray points = jsonObject.getJSONArray("points"); //修改点位中的相机sn
|
|
|
- if(points !=null){
|
|
|
- for (Object point : points) {
|
|
|
- JSONObject jobj = (JSONObject) point;
|
|
|
- jobj.put("camera",newSnCode.toLowerCase());
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- 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";
|
|
|
-
|
|
|
- fYunFileServiceInterface.downloadFile(fdagePaht,localPathBack);
|
|
|
- fYunFileServiceInterface.uploadFile(localPathBack,fdagePathBack);
|
|
|
- fYunFileServiceInterface.uploadFile(localPath,fdagePaht);
|
|
|
- }catch (Exception e){
|
|
|
- log.error("updateFdage-error:oldSnCode:{},newSnCode:{},dataSource:{}",oldSnCode,newSnCode,dataSource);
|
|
|
- log.error("updateFdage-error:",e);
|
|
|
- }finally {
|
|
|
- FileUtil.del(localPath);
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
private JSONObject updateFdageJson(JSONObject jsonObject,String newSnCode){
|
|
|
JSONObject cam = jsonObject.getJSONObject("cam");
|
|
@@ -516,10 +476,11 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
String oldFdagePaht = dataSource.replace("/mnt/data","home") ;
|
|
|
String[] split = oldFdagePaht.split("/");
|
|
|
String newFdagePath = split[0] +"/"+ newSnCode +"/"+ split[2] +"/"+ newSnCode +"_" + split[3].split("_")[1];
|
|
|
-
|
|
|
- fYunFileServiceInterface.copyFileInBucket(oldFdagePaht,newFdagePath);
|
|
|
+ if(!oldFdagePaht.equals(newFdagePath)){
|
|
|
+ log.info("updateFdageCopy--复制oss资源--oldFdagePaht:{},newFdagePath:{}",oldFdagePaht,newFdagePath);
|
|
|
+ fYunFileServiceInterface.copyFileInBucket(oldFdagePaht,newFdagePath);
|
|
|
+ }
|
|
|
fYunFileServiceInterface.uploadFile(localPathFdage,newFdagePath);
|
|
|
-
|
|
|
log.info("updateFdage--localPathFdage:{},newFdagePath:{}",localPathFdage,newFdagePath);
|
|
|
String newDataSource = newFdagePath.replace("home","/mnt/data");
|
|
|
this.updateDataSource(dataSource,newDataSource);
|