|
@@ -415,6 +415,23 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
if(!oldCameraDetail.getType().equals(cameraDetail.getType())){
|
|
|
throw new BusinessException(ResultCode.CAMERA_TYPE_NOT_ERROR);
|
|
|
}
|
|
|
+ String home = dataSource.replace("/mnt/data", "home")+"/data.fdage";
|
|
|
+ if(!fYunFileServiceInterface.fileExist(home)){
|
|
|
+ throw new BusinessException(ResultCode.MOVE_ERROR);
|
|
|
+ }
|
|
|
+
|
|
|
+ HashMap<String, SceneCopyLog> byNewNumList = copyLogService.getByNewNumList(Arrays.asList(param.getNum()));
|
|
|
+ if(byNewNumList.size() >0){
|
|
|
+ throw new BusinessException(ResultCode.MOVE_ERROR_COPY);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(cameraDetail.getType() == 10 || cameraDetail.getType() == 11) { //深时场景
|
|
|
+ //迁移深时 dataSource
|
|
|
+ File file = new File(dataSource + "_laserData/laserData");
|
|
|
+ if (!file.exists()) {
|
|
|
+ throw new BusinessException(ResultCode.MOVE_ERROR);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
Long oldUseSpace = oldCameraDetail.getUsedSpace() - space < 0 ? 0 : oldCameraDetail.getUsedSpace() - space;
|
|
|
oldCameraDetail.setUsedSpace(oldUseSpace);
|
|
@@ -456,10 +473,15 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
}
|
|
|
//协作相机
|
|
|
sceneResourceCameraService.setCooperationUser(cameraDetail,param.getNum());
|
|
|
+
|
|
|
+ String newDataSource = updateFdageNewDataSource(scenePro, scenePlus, oldCamera.getSnCode(), param.getSnCode(), dataSource);
|
|
|
+
|
|
|
if(cameraDetail.getType() == 10 || cameraDetail.getType() == 11){ //深时场景
|
|
|
- laserService.move(param.getNum(),oldCamera.getSnCode(),camera.getSnCode(),cameraDetail.getUserId());
|
|
|
+ //迁移深时 dataSource
|
|
|
+ FileUtil.move(new File(dataSource +"_laserData/laserData"),new File(newDataSource+"_laserData/laserData"),true);
|
|
|
+ laserService.move(param.getNum(),oldCamera.getSnCode(),camera.getSnCode(),cameraDetail.getUserId(),newDataSource);
|
|
|
}
|
|
|
- updateFdageNewDataSource(scenePro,scenePlus,oldCamera.getSnCode(),param.getSnCode(),dataSource);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -483,7 +505,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
/**
|
|
|
* 兼容,之前迁移,不使用旧snCode 替换新snCode。重写文件
|
|
|
*/
|
|
|
- public void updateFdageNewDataSource(ScenePro scenePro,ScenePlus scenePlus,String oldSnCode,String newSnCode,String dataSource) {
|
|
|
+ public String updateFdageNewDataSource(ScenePro scenePro,ScenePlus scenePlus,String oldSnCode,String newSnCode,String dataSource) {
|
|
|
String localPathFdage = null;
|
|
|
try {
|
|
|
newSnCode = newSnCode.toLowerCase();
|
|
@@ -511,6 +533,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
fYunFileServiceInterface.deleteFolder(oldFdagePaht);
|
|
|
}
|
|
|
sceneMoveLogService.saveLog(scenePro,scenePlus,oldSnCode,newSnCode,dataSource,newDataSource, fileContent);
|
|
|
+ return newDataSource;
|
|
|
}catch (Exception e){
|
|
|
log.error("updateFdage-error:oldSnCode:{},newSnCode:{},dataSource:{}",oldSnCode,newSnCode,dataSource);
|
|
|
log.error("updateFdage-error:",e);
|
|
@@ -576,9 +599,30 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
if(sceneStatus != -2){
|
|
|
throw new BusinessException(ResultCode.SCENE_IS_BUILDING);
|
|
|
}
|
|
|
-// if(detailEntity.getType() == 10 ){
|
|
|
-// throw new BusinessException(ResultCode.SS_NO_COPY);
|
|
|
-// }
|
|
|
+ Long totalSpace = detailEntity.getTotalSpace();
|
|
|
+ UserIncrement userIncrement = userIncrementService.getByCameraId(cameraId);
|
|
|
+ if(userIncrement != null && userIncrement.getIsExpired() ==0){
|
|
|
+ IncrementType incrementType = incrementTypeService.getById(userIncrement.getIncrementTypeId());
|
|
|
+ totalSpace = incrementType.getCameraCapacity() * 1024 * 1024 * 1024L;
|
|
|
+ }
|
|
|
+ if(detailEntity.getType() == 10 || detailEntity.getType() == 11){
|
|
|
+ totalSpace = -1L;
|
|
|
+ }
|
|
|
+
|
|
|
+ Long needSpace = 0L;
|
|
|
+ if(scenePro != null){
|
|
|
+ needSpace = scenePro.getSpace();
|
|
|
+ }
|
|
|
+ if(scenePlus != null){
|
|
|
+ ScenePlusExt scenePlusExt = scenePlusExtService.getByPlusId(scenePlus.getId());
|
|
|
+ if(scenePlusExt != null && scenePlusExt.getSpace() != null){
|
|
|
+ needSpace = scenePlusExt.getSpace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if( totalSpace > 0 && detailEntity.getUsedSpace() + needSpace > totalSpace){
|
|
|
+ throw new BusinessException(ResultCode.CAMERA_SPACE_ERROR);
|
|
|
+ }
|
|
|
|
|
|
HashMap<String, Object> param = new HashMap<>();
|
|
|
param.put("num",sceneNum);
|