|
@@ -281,6 +281,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
* 从oss中获取文件,并重写,上传替换
|
|
|
*/
|
|
|
private void updateOssStatus(String path,Integer payStatus) {
|
|
|
+ String localPath = String.format(OssPath.localStatusPath, path);
|
|
|
try {
|
|
|
if(!fYunFileServiceInterface.fileExist(path)){
|
|
|
return;
|
|
@@ -292,13 +293,13 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
jsonObject.put("payStatus",payStatus);
|
|
|
String json = JSONUtil.toJsonStr(jsonObject);
|
|
|
- FileUtils.writeFile(OssPath.localStatusPath ,json);
|
|
|
- log.info("updateOssStatus--localPath:{},ossPath:{}",OssPath.localStatusPath,path);
|
|
|
- fYunFileServiceInterface.uploadFile(OssPath.localStatusPath,path);
|
|
|
+ FileUtils.writeFile(localPath,json);
|
|
|
+ log.info("updateOssStatus--localPath:{},ossPath:{}",localPath,path);
|
|
|
+ fYunFileServiceInterface.uploadFile(localPath,path);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}finally {
|
|
|
- FileUtil.del(OssPath.localStatusPath);
|
|
|
+ FileUtil.del(localPath);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -443,14 +444,23 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
updateFdage(oldCamera.getSnCode(),param.getSnCode(),dataSource);
|
|
|
}
|
|
|
|
|
|
- private void updateFdage(String oldSnCode,String newSnCode,String dataSource) {
|
|
|
- String fdagePaht = dataSource.replace("/mnt/data","home") +"/data.fdage";
|
|
|
- String fileContent = fYunFileServiceInterface.getFileContent(fdagePaht);
|
|
|
- String newJson = fileContent.replaceAll(oldSnCode,newSnCode);
|
|
|
- FileUtils.writeFile(OssPath.localFdagePath ,newJson);
|
|
|
- log.info("updateFdage--localPath:{},ossPath:{}",OssPath.localFdagePath,fdagePaht);
|
|
|
- fYunFileServiceInterface.copyFileInBucket(fdagePaht, Dateutils.getDate(new Date()) +fdagePaht+".back");
|
|
|
- fYunFileServiceInterface.uploadFile(OssPath.localFdagePath,fdagePaht);
|
|
|
+ @Override
|
|
|
+ public void updateFdage(String oldSnCode,String newSnCode,String dataSource) {
|
|
|
+ String localPath = String.format(OssPath.localFdagePath,dataSource);
|
|
|
+ try {
|
|
|
+ String fdagePaht = dataSource.replace("/mnt/data","home") +"/data.fdage";
|
|
|
+ String fileContent = fYunFileServiceInterface.getFileContent(fdagePaht);
|
|
|
+ String newJson = fileContent.replaceAll(oldSnCode,newSnCode);
|
|
|
+ FileUtils.writeFile(localPath ,newJson);
|
|
|
+ log.info("updateFdage--localPath:{},ossPath:{}",localPath,fdagePaht);
|
|
|
+ fYunFileServiceInterface.copyFileInBucket(fdagePaht, fdagePaht+".back");
|
|
|
+ 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);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|