|
@@ -1003,7 +1003,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
//如果是v3场景,不允许重算,需要升级v4后再调此接口进行重算
|
|
//如果是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())){
|
|
- throw new BusinessException(ErrorCode.FAILURE_CODE_5064);
|
|
|
|
|
|
+ return rebuildV3Scene(scenePro,num,force);
|
|
}
|
|
}
|
|
|
|
|
|
ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
|
|
ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
|
|
@@ -1077,4 +1077,73 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
|
|
|
return ResultData.ok();
|
|
return ResultData.ok();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public ResultData rebuildV3Scene(ScenePro scenePro,String num,Boolean force) throws IOException {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if (scenePro.getStatus() == 0 && (ObjectUtils.isEmpty(force) || !force)) {
|
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5033);
|
|
|
|
+ }
|
|
|
|
+ String path = scenePro.getDataSource();
|
|
|
|
+ Integer sceneSource = scenePro.getSceneSource();
|
|
|
|
+ String buildType = scenePro.getBuildType();
|
|
|
|
+ Integer sceneScheme = scenePro.getSceneScheme();
|
|
|
|
+
|
|
|
|
+ //重新计算时需要删除文件夹,否知使用缓存
|
|
|
|
+ FileUtils.delAllFile(path + File.separator + "results");
|
|
|
|
+
|
|
|
|
+ String dataFdageOssPath = ConstantFilePath.OSS_PREFIX+ path.replace(ConstantFilePath.BUILD_MODEL_PATH, "")
|
|
|
|
+ .replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "") + "/data.fdage";
|
|
|
|
+
|
|
|
|
+ JSONObject fdageData = JSONObject.parseObject(fYunFileService.getFileContent(dataFdageOssPath));
|
|
|
|
+ if(ObjectUtils.isEmpty(fdageData)){
|
|
|
|
+ log.error("data.fdage文件不存在");
|
|
|
|
+ return ResultData.error(CameraConstant.FAILURE_6009.code(), CameraConstant.FAILURE_6009.message());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String statusJsonOssPath = String.format(UploadFilePath.DATA_VIEW_PATH, num) + "status.json";
|
|
|
|
+ JSONObject statusJson = JSONObject.parseObject(fYunFileService.getFileContent(String.format(UploadFilePath.DATA_VIEW_PATH, num) + "status.json"));
|
|
|
|
+ //临时将-2改成1,app还没完全更新
|
|
|
|
+ statusJson.put("status", SceneStatus.wait.code());
|
|
|
|
+ fYunFileService.uploadFile(statusJson.toJSONString().getBytes(StandardCharsets.UTF_8),statusJsonOssPath);
|
|
|
|
+
|
|
|
|
+ Long cameraType = (long)sceneScheme == 3 ? 12 : (long)sceneScheme;
|
|
|
|
+ //判断是否转台相机
|
|
|
|
+ if(sceneSource == 3){
|
|
|
|
+ cameraType = 13L;
|
|
|
|
+ }
|
|
|
|
+ if(sceneSource == 4){
|
|
|
|
+ cameraType = 14L;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (sceneSource == 4) {
|
|
|
|
+ String userName = null;
|
|
|
|
+ Long sceneUserId = scenePro.getUserId();
|
|
|
|
+ if (!ObjectUtils.isEmpty(sceneUserId)) {
|
|
|
|
+ SSOUser user = userService.getSSOUserByUserId(sceneUserId);
|
|
|
|
+ userName = user.getUserName();
|
|
|
|
+ }
|
|
|
|
+ Camera cameraEntity = cameraService.getById(scenePro.getCameraId());
|
|
|
|
+ fdkkLaserService.saveScene(scenePro, null, cameraEntity, userName, true);
|
|
|
|
+ BuildSceneCallMessage buildSceneMqMessage = this.getBuildSceneMqMessage(
|
|
|
|
+ num, cameraType,
|
|
|
|
+ fdageData.getString("location") != null && "1".equals(fdageData.getString("location")) ? "sfm" : "slam",
|
|
|
|
+ fdageData.getInteger("resolution"), buildType, path);
|
|
|
|
+ rabbitMqProducer.sendByWorkQueue(queueV3ModelingPre, buildSceneMqMessage);
|
|
|
|
+ } else {
|
|
|
|
+ BuildSceneCallMessage buildSceneMqMessage = this.getBuildSceneMqMessage(
|
|
|
|
+ num, cameraType, fdageData.getString("location") != null && "1".equals(fdageData.getString("location")) ? "sfm" : "slam",
|
|
|
|
+ fdageData.getInteger("resolution"), buildType,
|
|
|
|
+ path);
|
|
|
|
+ rabbitMqProducer.sendByWorkQueue(queueV3ModelingPre, buildSceneMqMessage);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //重算的场景,先移除该场景对应的容量
|
|
|
|
+ sceneProService.update(new LambdaUpdateWrapper<ScenePro>()
|
|
|
|
+ .set(ScenePro::getStatus, SceneStatus.wait.code())
|
|
|
|
+ .eq(ScenePro::getSpace,0)
|
|
|
|
+ .eq(ScenePro::getNum, num));
|
|
|
|
+
|
|
|
|
+ return ResultData.ok();
|
|
|
|
+ }
|
|
}
|
|
}
|