|
@@ -446,14 +446,18 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
|
|
|
@Override
|
|
|
public void updateFdage(String oldSnCode,String newSnCode,String dataSource) {
|
|
|
- String localPath = String.format(OssPath.localFdagePath,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);
|
|
|
String newJson = fileContent.replaceAll("(?i)"+oldSnCode,newSnCode.toLowerCase());
|
|
|
FileUtils.writeFile(localPath ,newJson);
|
|
|
log.info("updateFdage--localPath:{},ossPath:{}",localPath,fdagePaht);
|
|
|
- fYunFileServiceInterface.copyFileInBucket(fdagePaht, fdagePaht+"_"+oldSnCode+"-"+newSnCode+"_"+Dateutils.getDateN(new Date())+".back");
|
|
|
+ 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);
|
|
@@ -463,6 +467,46 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public void updateFdageNewDataSource(String oldSnCode,String newSnCode,String dataSource) {
|
|
|
+ String localPath = String.format(OssPath.localFdagePath,dataSource);
|
|
|
+ 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);
|
|
|
+ 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);
|
|
|
+ }finally {
|
|
|
+ FileUtil.del(localPath);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void updateDataSource(String dataSource, String newDataSource) {
|
|
|
+ LambdaUpdateWrapper<ScenePro> wrapper = new LambdaUpdateWrapper<>();
|
|
|
+ wrapper.eq(ScenePro::getDataSource,dataSource);
|
|
|
+ wrapper.set(ScenePro::getDataSource,newDataSource);
|
|
|
+ this.update(wrapper);
|
|
|
+
|
|
|
+ LambdaUpdateWrapper<ScenePlusExt> wrapperPlus = new LambdaUpdateWrapper<>();
|
|
|
+ wrapperPlus.eq(ScenePlusExt::getDataSource,dataSource);
|
|
|
+ wrapperPlus.set(ScenePlusExt::getDataSource,newDataSource);
|
|
|
+ scenePlusExtService.update(wrapperPlus);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void copy(String sceneNum) throws Exception {
|
|
|
ScenePro scenePro = this.getByNum(sceneNum);
|