|
@@ -81,6 +81,8 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
IFolderSceneService folderSceneService;
|
|
|
@Autowired
|
|
|
ISceneBuildProcessLogService sceneBuildProcessLogService;
|
|
|
+ @Autowired
|
|
|
+ ISceneMoveLogService sceneMoveLogService;
|
|
|
|
|
|
|
|
|
@Override
|
|
@@ -273,10 +275,10 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
pluWr.in(ScenePlus::getId,lockedIds);
|
|
|
List<ScenePlus> plusList = scenePlusService.list(pluWr);
|
|
|
for (ScenePro scenePro : proList) {
|
|
|
- this.updateOssStatus(String.format(OssPath.v3_statusPath,scenePro.getNum()),payStatus);
|
|
|
+ this.updateOssStatus(String.format(OssPath.v3_statusPath,scenePro.getNum()),payStatus,"payStatus");
|
|
|
}
|
|
|
for (ScenePlus scenePlus : plusList) {
|
|
|
- this.updateOssStatus(String.format(OssPath.v4_statusPath,scenePlus.getNum()),payStatus);
|
|
|
+ this.updateOssStatus(String.format(OssPath.v4_statusPath,scenePlus.getNum()),payStatus,"payStatus");
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -284,7 +286,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
/**
|
|
|
* 从oss中获取文件,并重写,上传替换
|
|
|
*/
|
|
|
- private void updateOssStatus(String path,Integer payStatus) {
|
|
|
+ private void updateOssStatus(String path,Integer payStatus,String updateStatus) {
|
|
|
String localPath = String.format(OssPath.localStatusPath, path);
|
|
|
try {
|
|
|
if(!fYunFileServiceInterface.fileExist(path)){
|
|
@@ -295,7 +297,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
return;
|
|
|
}
|
|
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
- jsonObject.put("payStatus",payStatus);
|
|
|
+ jsonObject.put(updateStatus,payStatus);
|
|
|
String json = JSONUtil.toJsonStr(jsonObject);
|
|
|
FileUtils.writeFile(localPath,json);
|
|
|
log.info("updateOssStatus--localPath:{},ossPath:{}",localPath,path);
|
|
@@ -430,8 +432,10 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
wrapper.eq(ScenePro::getId,scenePro.getId());
|
|
|
wrapper.set(ScenePro::getCameraId,camera.getId());
|
|
|
wrapper.set(ScenePro::getUserId,cameraDetail.getUserId());
|
|
|
+ wrapper.set(ScenePro::getStatus,0);
|
|
|
this.update(wrapper);
|
|
|
//场景迁移到另外的相机清除本身在的文件夹
|
|
|
+ this.updateOssStatus(String.format(OssPath.v3_statusPath,scenePro.getNum()),0,"status");
|
|
|
folderSceneService.delBySceneId(scenePro.getId());
|
|
|
}
|
|
|
if(scenePlus!=null){
|
|
@@ -439,7 +443,9 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
wrapper.eq(ScenePlus::getId,scenePlus.getId());
|
|
|
wrapper.set(ScenePlus::getCameraId,camera.getId());
|
|
|
wrapper.set(ScenePlus::getUserId,cameraDetail.getUserId());
|
|
|
+ wrapper.set(ScenePlus::getSceneStatus,0);
|
|
|
scenePlusService.update(wrapper);
|
|
|
+ this.updateOssStatus(String.format(OssPath.v4_statusPath,scenePlus.getNum()),0,"status");
|
|
|
folderSceneService.delBySceneId(scenePlus.getId());
|
|
|
}
|
|
|
if(cameraDetail.getType() == 10){ //深时场景
|
|
@@ -475,25 +481,26 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
newSnCode = newSnCode.toLowerCase();
|
|
|
String fdagePaht = dataSource.replace("/mnt/data","home") +"/data.fdage";
|
|
|
localPathFdage = String.format(OssPath.localFdagePath,fdagePaht);
|
|
|
-
|
|
|
String fileContent = fYunFileServiceInterface.getFileContent(fdagePaht);
|
|
|
-
|
|
|
+ String fdagebak = fileContent;
|
|
|
JSONObject jsonObject = updateFdageJson(JSONObject.parseObject(fileContent), newSnCode);
|
|
|
FileUtils.writeFile(localPathFdage ,JSONObject.toJSONString(jsonObject));
|
|
|
|
|
|
String oldFdagePaht = dataSource.replace("/mnt/data","home") ;
|
|
|
String[] split = oldFdagePaht.split("/");
|
|
|
String newFdagePath = split[0] +"/"+ newSnCode +"/"+ split[2] +"/"+ newSnCode +"_" + split[3].split("_")[1];
|
|
|
+ String delPath = null;
|
|
|
if(!oldFdagePaht.equals(newFdagePath)){
|
|
|
log.info("updateFdageCopy--复制oss资源--oldFdagePaht:{},newFdagePath:{}",oldFdagePaht,newFdagePath);
|
|
|
fYunFileServiceInterface.copyFileInBucket(oldFdagePaht,newFdagePath);
|
|
|
- fYunFileServiceInterface.deleteFolder(oldFdagePaht);
|
|
|
+ delPath = oldFdagePaht;
|
|
|
}
|
|
|
- fYunFileServiceInterface.copyFileInBucket(newFdagePath+"/data.fdage",newFdagePath+"/"+oldSnCode.toLowerCase()+"-"+newSnCode+"_"+Dateutils.getDate(new Date())+".data.fdage");
|
|
|
- fYunFileServiceInterface.uploadFile(localPathFdage,newFdagePath+"/data.fdage");
|
|
|
- log.info("updateFdage--localPathFdage:{},newFdagePath:{}",localPathFdage,newFdagePath);
|
|
|
String newDataSource = newFdagePath.replace("home","/mnt/data");
|
|
|
this.updateDataSource(scenePro,scenePlus,newDataSource);
|
|
|
+ if(delPath != null){
|
|
|
+ fYunFileServiceInterface.deleteFolder(oldFdagePaht);
|
|
|
+ }
|
|
|
+ sceneMoveLogService.saveLog(scenePro,scenePlus,oldSnCode,newSnCode,dataSource,newDataSource,fdagebak);
|
|
|
}catch (Exception e){
|
|
|
log.error("updateFdage-error:oldSnCode:{},newSnCode:{},dataSource:{}",oldSnCode,newSnCode,dataSource);
|
|
|
log.error("updateFdage-error:",e);
|
|
@@ -502,6 +509,21 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
if(localPathFdage != null){
|
|
|
FileUtil.del(localPathFdage);
|
|
|
}
|
|
|
+ if(scenePro!=null){
|
|
|
+ LambdaUpdateWrapper<ScenePro> wrapper = new LambdaUpdateWrapper<>();
|
|
|
+ wrapper.eq(ScenePro::getId,scenePro.getId());
|
|
|
+ wrapper.set(ScenePro::getStatus,-2);
|
|
|
+ this.update(wrapper);
|
|
|
+ this.updateOssStatus(String.format(OssPath.v3_statusPath,scenePro.getNum()),-2,"status");
|
|
|
+
|
|
|
+ }
|
|
|
+ if(scenePlus!=null){
|
|
|
+ LambdaUpdateWrapper<ScenePlus> wrapper = new LambdaUpdateWrapper<>();
|
|
|
+ wrapper.eq(ScenePlus::getId,scenePlus.getId());
|
|
|
+ wrapper.set(ScenePlus::getSceneStatus,-2);
|
|
|
+ scenePlusService.update(wrapper);
|
|
|
+ this.updateOssStatus(String.format(OssPath.v4_statusPath,scenePlus.getNum()),-2,"status");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|