|
@@ -108,10 +108,10 @@ public class SceneCommonService {
|
|
|
}
|
|
|
|
|
|
|
|
|
- public void updateNasSceneJson(String targetPath, String oldNum, String newNum,String newSceneName,String sceneVersion) {
|
|
|
+ public void updateNasSceneJson(String targetPath, String oldNum, String newNum,String newSceneName,String sceneVersion,String fileName) {
|
|
|
String fileContent = null;
|
|
|
if("v3".equals(sceneVersion)){
|
|
|
- String localPath = SceneResourcePath.nasBasePath + targetPath + "/" + "scene.json";
|
|
|
+ String localPath = SceneResourcePath.nasBasePath + targetPath + "/" + fileName;
|
|
|
File file = new File(localPath);
|
|
|
if(!file.exists()){
|
|
|
log.error("sceneCopy-error--localFileExist:localPath:{},oldNum:{},newNum:{}",localPath,oldNum,newNum);
|
|
@@ -120,7 +120,7 @@ public class SceneCommonService {
|
|
|
fileContent = FileUtil.readUtf8String(file);
|
|
|
}
|
|
|
if("v4".equals(sceneVersion)){
|
|
|
- String ossStatusJsonPath = targetPath + "/" + "scene.json";
|
|
|
+ String ossStatusJsonPath = targetPath + "/" + fileName
|
|
|
if(!fYunFileServiceInterface.fileExist(ossStatusJsonPath)){
|
|
|
log.error("sceneCopy-error--ossFileExist:targetPath:{},oldNum:{},newNum:{}",ossStatusJsonPath,oldNum,newNum);
|
|
|
return;
|
|
@@ -130,7 +130,7 @@ public class SceneCommonService {
|
|
|
|
|
|
if(StringUtils.isNotBlank(fileContent)){
|
|
|
//v3编辑器使用
|
|
|
- String localPath = SceneResourcePath.nasBasePath + targetPath +"/scene.json";
|
|
|
+ String localPath = SceneResourcePath.nasBasePath + targetPath +"/" + fileName;
|
|
|
File file = new File(localPath);
|
|
|
if(!file.getParentFile().exists()){
|
|
|
file.getParentFile().mkdirs();
|
|
@@ -139,27 +139,32 @@ public class SceneCommonService {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(newJson);
|
|
|
try {
|
|
|
if("v3".equals(sceneVersion)){
|
|
|
- jsonObject.put("sceneName",newSceneName);
|
|
|
+ if(fileName.contains("scene.json")){
|
|
|
+ jsonObject.put("sceneName",newSceneName);
|
|
|
+ }
|
|
|
com.fdkankan.ucenter.util.FileUtil.writeFile(localPath,jsonObject.toJSONString());
|
|
|
|
|
|
- String sceneJsonPath = String.format(SceneResourcePath.dataPath+"/scene.json", newNum);
|
|
|
- fYunFileServiceInterface.uploadFile(localPath, sceneJsonPath);
|
|
|
+ if(fileName.contains("scene.json")){
|
|
|
+ String sceneJsonPath = String.format(SceneResourcePath.dataPath+"/"+fileName, newNum);
|
|
|
+ fYunFileServiceInterface.uploadFile(localPath, sceneJsonPath);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
if("v4".equals(sceneVersion)){
|
|
|
jsonObject.put("title",newSceneName);
|
|
|
com.fdkankan.ucenter.util.FileUtil.writeFile(localPath,jsonObject.toJSONString());
|
|
|
|
|
|
- String sceneJsonPath = String.format(SceneResourcePath.DATA_VIEW_PATH+"/scene.json", newNum);
|
|
|
+ String sceneJsonPath = String.format(SceneResourcePath.DATA_VIEW_PATH+"/" + fileName, newNum);
|
|
|
fYunFileServiceInterface.uploadFile(localPath, sceneJsonPath);
|
|
|
|
|
|
//修改图片名称
|
|
|
String filePath = String.format(SceneResourcePath.USER_VIEW_PATH, newNum) ;
|
|
|
List<String> files = fYunFileServiceInterface.listRemoteFiles(filePath);
|
|
|
- for (String fileName : files) {
|
|
|
- if(fileName.contains(oldNum)){
|
|
|
- String oldName = fileName;
|
|
|
- fileName = fileName.replace(oldNum,newNum);
|
|
|
- fYunFileServiceInterface.copyFileInBucket(oldName,fileName);
|
|
|
+ for (String ossFilePath : files) {
|
|
|
+ if(ossFilePath.contains(oldNum)){
|
|
|
+ String oldName = ossFilePath;
|
|
|
+ ossFilePath = ossFilePath.replace(oldNum,newNum);
|
|
|
+ fYunFileServiceInterface.copyFileInBucket(oldName,ossFilePath);
|
|
|
fYunFileServiceInterface.deleteFile(oldName);
|
|
|
}
|
|
|
}
|