|
@@ -113,32 +113,47 @@ public class SceneCommonService {
|
|
|
|
|
|
|
|
|
|
public void updateNasSceneJson(String targetPath, String oldNum, String newNum,String oldSceneName,String newSceneName,String sceneVersion) {
|
|
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);
|
|
|
|
- return;
|
|
|
|
|
|
+ String fileContent = null;
|
|
|
|
+ if("v3".equals(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);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ fileContent = FileUtil.readUtf8String(file);
|
|
|
|
+ }
|
|
|
|
+ if("v4".equals(sceneVersion)){
|
|
|
|
+ String ossStatusJsonPath = targetPath + "/" + "scene.json";
|
|
|
|
+ if(!fYunFileServiceInterface.fileExist(ossStatusJsonPath)){
|
|
|
|
+ log.error("sceneCopy-error--ossFileExist:targetPath:{},oldNum:{},newNum:{}",ossStatusJsonPath,oldNum,newNum);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ fileContent = fYunFileServiceInterface.getFileContent(ossStatusJsonPath);
|
|
}
|
|
}
|
|
- String fileContent = FileUtil.readUtf8String(file);
|
|
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(fileContent)){
|
|
if(StringUtils.isNotBlank(fileContent)){
|
|
|
|
+ String localPath = SceneResourcePath.nasBasePath + targetPath +"/scene.json";
|
|
|
|
+ File file = new File(localPath);
|
|
|
|
+ if(!file.getParentFile().exists()){
|
|
|
|
+ file.mkdirs();
|
|
|
|
+ }
|
|
String newJson = fileContent.replaceAll(oldNum,newNum);
|
|
String newJson = fileContent.replaceAll(oldNum,newNum);
|
|
newJson = newJson.replaceAll(oldSceneName,newSceneName);
|
|
newJson = newJson.replaceAll(oldSceneName,newSceneName);
|
|
try {
|
|
try {
|
|
com.fdkankan.ucenter.util.FileUtil.writeFile(localPath,newJson);
|
|
com.fdkankan.ucenter.util.FileUtil.writeFile(localPath,newJson);
|
|
-
|
|
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
log.error("writeFile-error:{}",e);
|
|
log.error("writeFile-error:{}",e);
|
|
}
|
|
}
|
|
- }
|
|
|
|
- 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);
|
|
|
|
|
|
+ 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);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|