|
@@ -107,8 +107,6 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
@Autowired
|
|
@Autowired
|
|
private RedisUtil redisUtil;
|
|
private RedisUtil redisUtil;
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private IScenePlusExtService scenePlusExtService;
|
|
private IScenePlusExtService scenePlusExtService;
|
|
|
|
|
|
@@ -169,6 +167,12 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
@Autowired
|
|
@Autowired
|
|
private ISceneCopyDistinctEnvService sceneCopyDistinctEnvService;
|
|
private ISceneCopyDistinctEnvService sceneCopyDistinctEnvService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ISceneCopyLogService sceneCopyLogService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private ISceneCleanOrigService sceneCleanOrigService;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public SceneFileBuild findByFileId(String fileId) {
|
|
public SceneFileBuild findByFileId(String fileId) {
|
|
|
|
|
|
@@ -221,14 +225,23 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
|
|
|
// 检测是否有生成
|
|
// 检测是否有生成
|
|
String fileId = redisUtil.get(String.format(RedisConstants.FOLDER_FILEID_BUILD, folderName));
|
|
String fileId = redisUtil.get(String.format(RedisConstants.FOLDER_FILEID_BUILD, folderName));
|
|
- if (!ObjectUtils.isEmpty(fileId)) {
|
|
|
|
- responseSceneFile.setFileId(fileId);
|
|
|
|
- return responseSceneFile;
|
|
|
|
|
|
+ if (StrUtil.isEmpty(fileId)) {
|
|
|
|
+ SceneFileBuild sceneFileBuild = this.findByUnicode(folderName);
|
|
|
|
+ if (sceneFileBuild != null) {
|
|
|
|
+ fileId = sceneFileBuild.getFileId();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ if(StrUtil.isNotEmpty(fileId)){
|
|
|
|
+
|
|
|
|
+ //校验目录是否被上锁,如果上锁,抛出错误(避免删除原始资源定时任务执行过程中,有场景补拍重新上传)
|
|
|
|
+ String homePath = redisUtil.get(String.format(RedisKey.SCENE_OSS_HOME_DIR_DELETE, folderName));
|
|
|
|
+ if(StrUtil.isNotEmpty(homePath)){
|
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5073);
|
|
|
|
+ }
|
|
|
|
+ //如果原始资源目录不是正在被定时任务删除中,就加上上传锁,并正常返回
|
|
|
|
+ homePath = ConstantFilePath.OSS_PREFIX.concat(mac).concat("/").concat(fileId).concat("/").concat(folderName);
|
|
|
|
+ redisUtil.set(String.format(RedisKey.SCENE_OSS_HOME_DIR_UPLOAD, folderName), homePath, RedisKey.CAMERA_EXPIRE_7_TIME);
|
|
|
|
|
|
- SceneFileBuild sceneFileBuild = this.findByUnicode(folderName);
|
|
|
|
- if (sceneFileBuild != null) {
|
|
|
|
- fileId = sceneFileBuild.getFileId();
|
|
|
|
responseSceneFile.setFileId(fileId);
|
|
responseSceneFile.setFileId(fileId);
|
|
redisUtil.set(String.format(RedisConstants.FOLDER_FILEID_BUILD, folderName), fileId, 2 * 24 * 60 * 60);
|
|
redisUtil.set(String.format(RedisConstants.FOLDER_FILEID_BUILD, folderName), fileId, 2 * 24 * 60 * 60);
|
|
return responseSceneFile;
|
|
return responseSceneFile;
|
|
@@ -242,7 +255,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
|
|
|
// 查找场景表
|
|
// 查找场景表
|
|
LambdaQueryWrapper<ScenePro> proWrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<ScenePro> proWrapper = new LambdaQueryWrapper<>();
|
|
- proWrapper.like(ScenePro::getDataSource, "/" + folderName).eq(ScenePro::getRecStatus, 'A');
|
|
|
|
|
|
+ proWrapper.like(ScenePro::getDataSource, "/" + folderName);
|
|
ScenePro pro = sceneProService.getOne(proWrapper);
|
|
ScenePro pro = sceneProService.getOne(proWrapper);
|
|
|
|
|
|
String dataSource = null;
|
|
String dataSource = null;
|
|
@@ -265,7 +278,8 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
fileId = new SnowflakeIdGenerator(0, 0).nextId() + "";
|
|
fileId = new SnowflakeIdGenerator(0, 0).nextId() + "";
|
|
log.info("新生成build数据,{}", fileId);
|
|
log.info("新生成build数据,{}", fileId);
|
|
}
|
|
}
|
|
- sceneFileBuild = new SceneFileBuild();
|
|
|
|
|
|
+
|
|
|
|
+ SceneFileBuild sceneFileBuild = new SceneFileBuild();
|
|
sceneFileBuild.setChildName(mac);
|
|
sceneFileBuild.setChildName(mac);
|
|
sceneFileBuild.setFileId(fileId);
|
|
sceneFileBuild.setFileId(fileId);
|
|
sceneFileBuild.setRecStatus("A");
|
|
sceneFileBuild.setRecStatus("A");
|
|
@@ -1112,35 +1126,44 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
public ResultData rebuildScene(String num,Boolean force,Boolean deleteExtras) throws IOException {
|
|
public ResultData rebuildScene(String num,Boolean force,Boolean deleteExtras) throws IOException {
|
|
|
|
|
|
ScenePro scenePro = sceneProService.getByNum(num);
|
|
ScenePro scenePro = sceneProService.getByNum(num);
|
|
|
|
+ ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
|
|
|
|
|
|
- // TODO: 2023/1/12 3dtiles临时上激光场景
|
|
|
|
-// if(Objects.nonNull(scenePro) && (Objects.isNull(scenePro.getIsUpgrade())
|
|
|
|
-// || scenePro.getIsUpgrade() != CommonStatus.YES.code().intValue())){
|
|
|
|
-// if(scenePro.getSceneSource() == SceneSource.JG.code().intValue()){
|
|
|
|
-// return rebuildV3Scene(scenePro,num,force);
|
|
|
|
-// }else{
|
|
|
|
-// return rebuildV3SceneToMini(scenePro);
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
|
|
+ //复制出来的场景不支持重算
|
|
|
|
+ List<SceneCopyLog> sceneCopyLogs = sceneCopyLogService.listByNewNum(num);
|
|
|
|
+ if(CollUtil.isNotEmpty(sceneCopyLogs)){
|
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5071);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //已删除原始资源的场景不支持重算
|
|
|
|
+ Date laseCallTime = null;
|
|
|
|
+ ScenePlusExt scenePlusExt = null;
|
|
|
|
+ if(Objects.nonNull(scenePlus)){
|
|
|
|
+ scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
|
|
|
|
+ laseCallTime = scenePlusExt.getAlgorithmTime();
|
|
|
|
+ }else{
|
|
|
|
+ laseCallTime = scenePro.getCreateTime();
|
|
|
|
+ }
|
|
|
|
+ //查询最后一次计算时间后是否有删除过目录,如果有,则不支持重算
|
|
|
|
+ List<SceneCleanOrig> sceneCleanOrigs = sceneCleanOrigService.lisByNumAfterLastCall(num, laseCallTime);
|
|
|
|
+ if(CollUtil.isNotEmpty(sceneCleanOrigs)){
|
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5072);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
//激光场景校验是否能够计算
|
|
//激光场景校验是否能够计算
|
|
this.checkJgCanBuild(scenePro);
|
|
this.checkJgCanBuild(scenePro);
|
|
|
|
|
|
- //如果是v3场景,不允许重算,需要升级v4后再调此接口进行重算
|
|
|
|
if(Objects.nonNull(scenePro) && (Objects.isNull(scenePro.getIsUpgrade())
|
|
if(Objects.nonNull(scenePro) && (Objects.isNull(scenePro.getIsUpgrade())
|
|
|| scenePro.getIsUpgrade() != CommonStatus.YES.code().intValue())){
|
|
|| scenePro.getIsUpgrade() != CommonStatus.YES.code().intValue())){
|
|
return rebuildV3Scene(scenePro,num,force);
|
|
return rebuildV3Scene(scenePro,num,force);
|
|
}
|
|
}
|
|
|
|
|
|
- ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
|
|
|
|
if(Objects.isNull(scenePlus)){
|
|
if(Objects.isNull(scenePlus)){
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
}
|
|
}
|
|
if (scenePlus.getSceneStatus() == 0 && (ObjectUtils.isEmpty(force) || !force)) {
|
|
if (scenePlus.getSceneStatus() == 0 && (ObjectUtils.isEmpty(force) || !force)) {
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5033);
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5033);
|
|
}
|
|
}
|
|
- ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
|
|
|
|
String path = scenePlusExt.getDataSource();
|
|
String path = scenePlusExt.getDataSource();
|
|
Integer sceneSource = scenePlus.getSceneSource();
|
|
Integer sceneSource = scenePlus.getSceneSource();
|
|
String buildType = scenePlusExt.getBuildType();
|
|
String buildType = scenePlusExt.getBuildType();
|