|
@@ -40,6 +40,7 @@ import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@@ -358,8 +359,6 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
if (StringUtils.isEmpty(params)) {
|
|
|
throw new BusinessException(ErrorCode.PARAM_REQUIRED);
|
|
|
}
|
|
|
- params = params.replaceAll("%2B", "+");
|
|
|
- params = params.replaceAll(" ", "+");
|
|
|
Base64 base64 = new Base64();
|
|
|
String cipher = params;
|
|
|
// 私钥解密过程
|
|
@@ -388,20 +387,11 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- StringBuilder filePathBuffer = new StringBuilder(routeConfig.getHardDisk()).append(mac).append(File.separator)
|
|
|
- .append(fileId).append(File.separator).append(folderName).append(File.separator).append("capture")
|
|
|
- .append(File.separator);
|
|
|
StringBuilder prefixBuffer = new StringBuilder(mac).append(File.separator).append(fileId).append(File.separator).append(folderName).append(File.separator);
|
|
|
|
|
|
- File filePath = new File(filePathBuffer.toString());
|
|
|
- if(!filePath.exists()){
|
|
|
- filePath.mkdirs();
|
|
|
- }
|
|
|
- fYunFileService.downloadFile(ConstantFilePath.OSS_PREFIX + prefixBuffer.toString() + "data.fdage",filePathBuffer.toString() + "data.fdage");
|
|
|
-
|
|
|
String buildType = "V2";
|
|
|
Long cameraType = 10L;
|
|
|
- JSONObject fdageJson = FileUtils.readJson(filePathBuffer.toString() + "data.fdage");
|
|
|
+ JSONObject fdageJson = JSONObject.parseObject(fYunFileService.getFileContent(ConstantFilePath.OSS_PREFIX + prefixBuffer + "data.fdage"));
|
|
|
if(ObjectUtils.isEmpty(fdageJson)){
|
|
|
log.info("data.fdage文件不存在");
|
|
|
throw new BusinessException(CameraConstant.FAILURE_6009);
|
|
@@ -424,8 +414,6 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
if (StringUtils.isEmpty(params)) {
|
|
|
throw new BusinessException(ErrorCode.PARAM_REQUIRED);
|
|
|
}
|
|
|
- params = params.replaceAll("%2B", "+");
|
|
|
- params = params.replaceAll(" ", "+");
|
|
|
Base64 base64 = new Base64();
|
|
|
String cipher = params;
|
|
|
// 私钥解密过程
|
|
@@ -468,17 +456,10 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
|
|
|
log.info("相机 mnt 路径 : " + hardDisk + ", 相机类型 : " + cameraDetail.getType());
|
|
|
|
|
|
- //本机目录
|
|
|
- StringBuilder filePathBuffer = new StringBuilder(hardDisk).append(mac).append(File.separator).append(fileId).append(File.separator).append(folderName).append(File.separator).append("capture").append(File.separator);
|
|
|
//云目录
|
|
|
StringBuilder prefixBuffer = new StringBuilder(mac).append(File.separator).append(fileId).append(File.separator).append(folderName).append(File.separator);
|
|
|
|
|
|
- File filePath = new File(filePathBuffer.toString());
|
|
|
- if(!filePath.exists()){
|
|
|
- filePath.mkdirs();
|
|
|
- }
|
|
|
- fYunFileService.downloadFile(ConstantFilePath.OSS_PREFIX + prefixBuffer.toString() + "data.fdage", filePathBuffer.toString() + "data.fdage");
|
|
|
- JSONObject fdageJson = FileUtils.readJson(filePathBuffer.toString() + "data.fdage");
|
|
|
+ JSONObject fdageJson = JSONObject.parseObject(fYunFileService.getFileContent(ConstantFilePath.OSS_PREFIX + prefixBuffer + "data.fdage"));
|
|
|
if(ObjectUtils.isEmpty(fdageJson)){
|
|
|
log.info("data.fdage文件不存在");
|
|
|
throw new BusinessException(CameraConstant.FAILURE_6009);
|
|
@@ -708,8 +689,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
|
|
|
ScenePro scenePro = sceneProService.getByNum(num);
|
|
|
//如果是v3场景,不允许重算,需要升级v4后再调此接口进行重算
|
|
|
- if(Objects.nonNull(scenePro)
|
|
|
- && (Objects.isNull(scenePro.getIsUpgrade())
|
|
|
+ if(Objects.nonNull(scenePro) && (Objects.isNull(scenePro.getIsUpgrade())
|
|
|
|| scenePro.getIsUpgrade() != CommonStatus.YES.code().intValue())){
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5064);
|
|
|
}
|
|
@@ -724,57 +704,28 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
|
|
|
String path = scenePlusExt.getDataSource();
|
|
|
Integer sceneSource = scenePlus.getSceneSource();
|
|
|
- String dataSource = scenePlusExt.getDataSource();
|
|
|
- Long sceneUserId = scenePlus.getUserId();
|
|
|
String buildType = scenePlusExt.getBuildType();
|
|
|
- Integer sceneStatus = scenePlus.getSceneStatus();
|
|
|
- String webSite = scenePlusExt.getWebSite();
|
|
|
- String thumb = scenePlusExt.getThumb();
|
|
|
- Integer payStatus = scenePlus.getPayStatus();
|
|
|
Integer sceneScheme = scenePlusExt.getSceneScheme();
|
|
|
- String bucket = scenePlusExt.getYunFileBucket();
|
|
|
|
|
|
//重新计算时需要删除文件夹,否知使用缓存
|
|
|
FileUtils.delAllFile(path + File.separator + "results");
|
|
|
|
|
|
- String fileId = path.split("/")[path.split("/").length - 2];
|
|
|
- log.info("fileId:" + fileId);
|
|
|
- //获取解压后的资源的data.fdage中的数据
|
|
|
- File folderPath = new File(path);
|
|
|
-
|
|
|
-
|
|
|
- String dataFdageOssPath = ConstantFilePath.OSS_PREFIX
|
|
|
- + path.replace(ConstantFilePath.BUILD_MODEL_PATH, "")
|
|
|
+ String dataFdageOssPath = ConstantFilePath.OSS_PREFIX+ path.replace(ConstantFilePath.BUILD_MODEL_PATH, "")
|
|
|
.replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "") + "/data.fdage";
|
|
|
- fYunFileService.downloadFileByCommand(bucket, path + "/capture", dataFdageOssPath);
|
|
|
|
|
|
- JSONObject jsonObject = FileUtils.readJson(folderPath.getAbsolutePath() + File.separator + "capture" + File.separator + "data.fdage");
|
|
|
- if(ObjectUtils.isEmpty(jsonObject)){
|
|
|
+ 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());
|
|
|
}
|
|
|
|
|
|
- //有points字段的是八目
|
|
|
- String cameraName = jsonObject.getJSONObject("cam").getString("uuid");
|
|
|
- String userName = null;
|
|
|
- if (!ObjectUtils.isEmpty(sceneUserId)) {
|
|
|
- SSOUser user = userService.getSSOUserByUserId(sceneUserId);
|
|
|
- userName = user.getUserName();
|
|
|
- }
|
|
|
//重算的场景,先移除该场景对应的容量
|
|
|
scenePlusService.resetSpace(num);
|
|
|
-
|
|
|
- JSONObject statusJson = new JSONObject();
|
|
|
- //临时将-2改成1,app还没完全更新
|
|
|
- statusJson.put("status", sceneStatus == -2 ? 1 : sceneStatus);
|
|
|
- statusJson.put("webSite", webSite);
|
|
|
- statusJson.put("sceneNum", num);
|
|
|
- statusJson.put("thumb", thumb);
|
|
|
- statusJson.put("payStatus", payStatus);
|
|
|
- String statusJsonLocalPath = ConstantFilePath.SCENE_PATH + "data/data" + num + File.separator + "status.json";
|
|
|
String statusJsonOssPath = String.format(UploadFilePath.DATA_VIEW_PATH, num) + "status.json";
|
|
|
- FileUtils.writeFile(statusJsonLocalPath, statusJson.toString());
|
|
|
- fYunFileService.uploadFile(bucket, statusJsonLocalPath, statusJsonOssPath);
|
|
|
+ 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;
|
|
|
//判断是否转台相机
|
|
@@ -786,18 +737,24 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
}
|
|
|
|
|
|
if(sceneSource == 4){
|
|
|
- Camera cameraEntity = cameraService.getByChildName(cameraName);
|
|
|
+ String userName = null;
|
|
|
+ Long sceneUserId = scenePlus.getUserId();
|
|
|
+ if (!ObjectUtils.isEmpty(sceneUserId)) {
|
|
|
+ SSOUser user = userService.getSSOUserByUserId(sceneUserId);
|
|
|
+ userName = user.getUserName();
|
|
|
+ }
|
|
|
+ Camera cameraEntity = cameraService.getById(scenePlus.getCameraId());
|
|
|
fdkkLaserService.saveScene(scenePlus,null,cameraEntity,userName,true);
|
|
|
BuildSceneCallMessage buildSceneMqMessage = this.getBuildSceneMqMessage(
|
|
|
num, cameraType,
|
|
|
- jsonObject.getString("location") != null && "1".equals(jsonObject.getString("location")) ? "sfm" : "slam",
|
|
|
- jsonObject.getInteger("resolution"), buildType, dataSource);
|
|
|
+ fdageData.getString("location") != null && "1".equals(fdageData.getString("location")) ? "sfm" : "slam",
|
|
|
+ fdageData.getInteger("resolution"), buildType, path);
|
|
|
rabbitMqProducer.sendByWorkQueue(queueModelingPre, buildSceneMqMessage);
|
|
|
}else{
|
|
|
BuildSceneCallMessage buildSceneMqMessage = this.getBuildSceneMqMessage(
|
|
|
- num, cameraType, jsonObject.getString("location") != null && "1".equals(jsonObject.getString("location")) ? "sfm" : "slam",
|
|
|
- jsonObject.getInteger("resolution"), buildType,
|
|
|
- dataSource);
|
|
|
+ num, cameraType, fdageData.getString("location") != null && "1".equals(fdageData.getString("location")) ? "sfm" : "slam",
|
|
|
+ fdageData.getInteger("resolution"), buildType,
|
|
|
+ path);
|
|
|
rabbitMqProducer.sendByWorkQueue(queueModelingPre, buildSceneMqMessage);
|
|
|
}
|
|
|
|