|
@@ -278,8 +278,28 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
log.error("大场景序号为空:" + sceneNum);
|
|
log.error("大场景序号为空:" + sceneNum);
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
}
|
|
}
|
|
|
|
+ String dataSource = cameraName.replace("4DKKPRO_", "").replace("-fdage", "").toLowerCase() + File.separator +
|
|
|
|
+ fileId + File.separator + unicode;
|
|
|
|
+ if (cameraType == 14) {
|
|
|
|
+ dataSource = ConstantFilePath.BUILD_MODEL_LASER_PATH +dataSource;
|
|
|
|
+ } else {
|
|
|
|
+ dataSource = ConstantFilePath.BUILD_MODEL_PATH + dataSource;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ String imgViewPath = String.format(UploadFilePath.IMG_VIEW_PATH, sceneNum);
|
|
|
|
|
|
|
|
+ String icon = null;
|
|
|
|
+ if (!ObjectUtils.isEmpty(jsonObject.getString("icon"))) {
|
|
|
|
+ fYunFileService.copyFileInBucket(ConstantFilePath.OSS_PREFIX + prefix + jsonObject.getString("icon"),imgViewPath + jsonObject.getString("icon"));
|
|
|
|
+ icon = fYunFileConfig.getHost() + imgViewPath + jsonObject.getString("icon");
|
|
|
|
+ log.info("上传icon成功....");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return buildScenePost(dataSource, jsonObject, buildType, cameraType, sceneNum, cameraDetail, rebuild,icon);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private ScenePlusVO buildScenePost(String dataSource, JSONObject jsonObject, String buildType, long cameraType,
|
|
|
|
+ String sceneNum, CameraDetail cameraDetail, int rebuild,String icon) throws Exception {
|
|
String localDataPath = String.format(ConstantFilePath.DATABUFFER_FORMAT, sceneNum);
|
|
String localDataPath = String.format(ConstantFilePath.DATABUFFER_FORMAT, sceneNum);
|
|
String imgViewPath = String.format(UploadFilePath.IMG_VIEW_PATH, sceneNum);
|
|
String imgViewPath = String.format(UploadFilePath.IMG_VIEW_PATH, sceneNum);
|
|
String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, sceneNum);
|
|
String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, sceneNum);
|
|
@@ -290,13 +310,6 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
userName = ObjectUtils.isEmpty(user) ? null : user.getUserName();
|
|
userName = ObjectUtils.isEmpty(user) ? null : user.getUserName();
|
|
}
|
|
}
|
|
|
|
|
|
- String icon = null;
|
|
|
|
- if (!ObjectUtils.isEmpty(jsonObject.getString("icon"))) {
|
|
|
|
- fYunFileService.copyFileInBucket(ConstantFilePath.OSS_PREFIX + prefix + jsonObject.getString("icon"),imgViewPath + jsonObject.getString("icon"));
|
|
|
|
- icon = fYunFileConfig.getHost() + imgViewPath + jsonObject.getString("icon");
|
|
|
|
- log.info("上传icon成功....");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
JSONObject firmwareVersion = new JSONObject();
|
|
JSONObject firmwareVersion = new JSONObject();
|
|
if (!ObjectUtils.isEmpty(jsonObject.getString("camSoftwareVersion"))) {
|
|
if (!ObjectUtils.isEmpty(jsonObject.getString("camSoftwareVersion"))) {
|
|
firmwareVersion.put("camSoftwareVersion", jsonObject.getString("camSoftwareVersion"));
|
|
firmwareVersion.put("camSoftwareVersion", jsonObject.getString("camSoftwareVersion"));
|
|
@@ -311,7 +324,6 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
//重算的场景,先移除该场景对应的容量
|
|
//重算的场景,先移除该场景对应的容量
|
|
if (rebuild == 1) {
|
|
if (rebuild == 1) {
|
|
scenePlusService.resetSpace(sceneNum);
|
|
scenePlusService.resetSpace(sceneNum);
|
|
-
|
|
|
|
//删除oss的houst_floor.json(国际版可能会卡住)
|
|
//删除oss的houst_floor.json(国际版可能会卡住)
|
|
fYunFileService.deleteFile(dataViewPath + "houst_floor.json");
|
|
fYunFileService.deleteFile(dataViewPath + "houst_floor.json");
|
|
} else {
|
|
} else {
|
|
@@ -321,8 +333,8 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
}
|
|
}
|
|
String algorithm = jsonObject.getString("location") != null && "1".equals(jsonObject.getString("location")) ? "sfm" : "slam";
|
|
String algorithm = jsonObject.getString("location") != null && "1".equals(jsonObject.getString("location")) ? "sfm" : "slam";
|
|
|
|
|
|
- ScenePlusVO scenePlusVO = this.createScenePlus(sceneNum, camera.getId(), camera.getChildName(), jsonObject.getString("creator"),
|
|
|
|
- jsonObject.getString("pwd"), unicode,cameraType, fileId, icon, cameraDetail.getUserId(), userName,algorithm,
|
|
|
|
|
|
+ ScenePlusVO scenePlusVO = this.createScenePlus(sceneNum, cameraDetail.getCameraId(), jsonObject.getString("creator"),
|
|
|
|
+ jsonObject.getString("pwd"),cameraType, dataSource, icon, cameraDetail.getUserId(), userName,algorithm,
|
|
jsonObject.getJSONArray("points").size(), jsonObject.getString("name"), jsonObject.getString("info"),
|
|
jsonObject.getJSONArray("points").size(), jsonObject.getString("name"), jsonObject.getString("info"),
|
|
jsonObject.getInteger("scenetype"), jsonObject.getString("gps"), rebuild,
|
|
jsonObject.getInteger("scenetype"), jsonObject.getString("gps"), rebuild,
|
|
jsonObject.getInteger("resolution"), firmwareVersion.toString(), sceneUrl, buildType, cameraDetail.getCooperationUser());
|
|
jsonObject.getInteger("resolution"), firmwareVersion.toString(), sceneUrl, buildType, cameraDetail.getCooperationUser());
|
|
@@ -696,8 +708,8 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
return ResultData.ok();
|
|
return ResultData.ok();
|
|
}
|
|
}
|
|
|
|
|
|
- public ScenePlusVO createScenePlus(String projectNum, Long cameraId, String cameraName, String phoneId, String sceneKey,
|
|
|
|
- String unicode, Long cameraType, String fileId, String pic, Long userId, String userName,
|
|
|
|
|
|
+ public ScenePlusVO createScenePlus(String projectNum, Long cameraId, String phoneId, String sceneKey,
|
|
|
|
+ Long cameraType, String dataSource, String pic, Long userId, String userName,
|
|
String algorithm, Integer sceneShootCount, String sceneName,
|
|
String algorithm, Integer sceneShootCount, String sceneName,
|
|
String sceneDec, Integer sceneType, String gps,Integer type,
|
|
String sceneDec, Integer sceneType, String gps,Integer type,
|
|
Integer resolution, String firmwareVersion, String url, String buildType,
|
|
Integer resolution, String firmwareVersion, String url, String buildType,
|
|
@@ -710,17 +722,8 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
scenePlus.setCameraId(cameraId);
|
|
scenePlus.setCameraId(cameraId);
|
|
scenePlus.setPhoneId(phoneId);
|
|
scenePlus.setPhoneId(phoneId);
|
|
scenePlus.setNum(projectNum);
|
|
scenePlus.setNum(projectNum);
|
|
-
|
|
|
|
scenePlus.setSceneSource(1);
|
|
scenePlus.setSceneSource(1);
|
|
- if(cameraType.longValue() == 14){
|
|
|
|
- scenePlusExt.setDataSource(ConstantFilePath.BUILD_MODEL_LASER_PATH +
|
|
|
|
- cameraName.replace("4DKKPRO_", "").replace("-fdage", "").toLowerCase() + File.separator +
|
|
|
|
- fileId + File.separator + unicode);
|
|
|
|
- }else{
|
|
|
|
- scenePlusExt.setDataSource(ConstantFilePath.BUILD_MODEL_PATH +
|
|
|
|
- cameraName.replace("4DKKPRO_", "").replace("-fdage", "").toLowerCase() + File.separator +
|
|
|
|
- fileId + File.separator + unicode);
|
|
|
|
- }
|
|
|
|
|
|
+ scenePlusExt.setDataSource(dataSource);
|
|
|
|
|
|
if(resolution == null || resolution.intValue() == 0){
|
|
if(resolution == null || resolution.intValue() == 0){
|
|
scenePlusExt.setSceneScheme(cameraType.intValue());
|
|
scenePlusExt.setSceneScheme(cameraType.intValue());
|
|
@@ -1164,19 +1167,13 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
}
|
|
}
|
|
Camera cameraEntity = cameraService.getById(scenePro.getCameraId());
|
|
Camera cameraEntity = cameraService.getById(scenePro.getCameraId());
|
|
fdkkLaserService.saveScene(scenePro, null, cameraEntity, userName, true);
|
|
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);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ 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>()
|
|
sceneProService.update(new LambdaUpdateWrapper<ScenePro>()
|
|
.set(ScenePro::getStatus, SceneStatus.wait.code())
|
|
.set(ScenePro::getStatus, SceneStatus.wait.code())
|
|
@@ -1185,4 +1182,358 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
|
|
|
return ResultData.ok();
|
|
return ResultData.ok();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ResultData copyDataAndBuild(String sourceBucet,String dataSource,String num,String sceneVer) throws Exception {
|
|
|
|
+ if(!StringUtils.equals(sceneVer,"V3") && ! StringUtils.equals(sceneVer,"V4")){
|
|
|
|
+ throw new BusinessException(ErrorCode.PARAM_FORMAT_ERROR.code(),"版本有误,请填写 V3 或者 V4");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String fYunPath = ConstantFilePath.OSS_PREFIX + dataSource.replace(ConstantFilePath.BUILD_MODEL_PATH, "")
|
|
|
|
+ .replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "");
|
|
|
|
+ if(!ObjectUtils.isEmpty(sourceBucet)){
|
|
|
|
+ fYunFileService.copyFileBetweenBucket(sourceBucet,fYunPath,fYunFileConfig.getBucket(),fYunPath);
|
|
|
|
+ }
|
|
|
|
+ // 下载data.fdage
|
|
|
|
+ JSONObject fdageData = JSONObject.parseObject(fYunFileService.getFileContent(fYunPath + "/data.fdage"));
|
|
|
|
+ if(ObjectUtils.isEmpty(fdageData)){
|
|
|
|
+ throw new BusinessException(ErrorCode.SYSTEM_ERROR.code(),"4dage 文件不存在");
|
|
|
|
+ }
|
|
|
|
+ String cameraName = fdageData.getJSONObject("cam").getString("uuid");
|
|
|
|
+ Camera cameraEntity = cameraService.getByChildName(cameraName);
|
|
|
|
+ if(cameraEntity == null){
|
|
|
|
+ log.error("该相机不存在:" + cameraName);
|
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_6003);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ CameraDetail detailEntity = cameraDetailService.getByCameraId(cameraEntity.getId());
|
|
|
|
+ if(detailEntity == null){
|
|
|
|
+ log.error("该相机详情不存在:" + cameraName);
|
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_6003);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Long cameraType = 11L;
|
|
|
|
+ //判断是否转台相机
|
|
|
|
+ if (detailEntity.getType() == 9) {
|
|
|
|
+ cameraType = 13L;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (detailEntity.getType() == 10) {
|
|
|
|
+ cameraType = 14L;
|
|
|
|
+ }
|
|
|
|
+ String sceneNum = scene3dNumService.generateSceneNum(detailEntity.getType());
|
|
|
|
+
|
|
|
|
+ String icon = null;
|
|
|
|
+ String imgViewPath = null;
|
|
|
|
+ switch (sceneVer) {
|
|
|
|
+ case "V3":
|
|
|
|
+ List<ScenePro> pros = sceneProService.list(new LambdaQueryWrapper<ScenePro>()
|
|
|
|
+ .like(ScenePro::getDataSource, dataSource));
|
|
|
|
+ if (pros.size() > 0) {
|
|
|
|
+ return ResultData.error(ErrorCode.PARAM_ERROR.code(),"该场景资源已存在,请勿重复添加!");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ imgViewPath = String.format(ConstantFilePath.IMAGE_PATH_FORMAT, sceneNum);
|
|
|
|
+ if(fdageData.containsKey("icon") && StringUtils.isNotEmpty(fdageData.getString("icon"))){
|
|
|
|
+ String ossPath = ConstantFilePath.OSS_PREFIX + dataSource.replace(ConstantFilePath.BUILD_MODEL_PATH, "")
|
|
|
|
+ .replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "");
|
|
|
|
+ fYunFileService.copyFileInBucket(ossPath + fdageData.getString("icon"),imgViewPath + fdageData.getString("icon"));
|
|
|
|
+ icon = fYunFileConfig.getHost() + fdageData + fdageData.getString("icon");
|
|
|
|
+ log.info("上传icon成功....");
|
|
|
|
+ }
|
|
|
|
+ buildV3Scene2(dataSource,fdageData,cameraType,sceneNum,cameraEntity,detailEntity,icon);
|
|
|
|
+ break;
|
|
|
|
+ case "V4":
|
|
|
|
+ List<ScenePlusExt> plusExts = scenePlusExtService.list(new LambdaQueryWrapper<ScenePlusExt>()
|
|
|
|
+ .like(ScenePlusExt::getDataSource, dataSource));
|
|
|
|
+ if (plusExts.size() > 0) {
|
|
|
|
+ return ResultData.error(ErrorCode.PARAM_ERROR.code(),"该场景资源已存在,请勿重复添加!");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ imgViewPath = String.format(UploadFilePath.IMG_VIEW_PATH, sceneNum);
|
|
|
|
+ if(fdageData.containsKey("icon") && StringUtils.isNotEmpty(fdageData.getString("icon"))){
|
|
|
|
+ String ossPath = ConstantFilePath.OSS_PREFIX + dataSource.replace(ConstantFilePath.BUILD_MODEL_PATH, "")
|
|
|
|
+ .replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "");
|
|
|
|
+ fYunFileService.copyFileInBucket(ossPath + fdageData.getString("icon"),imgViewPath + fdageData.getString("icon"));
|
|
|
|
+ icon = fYunFileConfig.getHost() + fdageData + fdageData.getString("icon");
|
|
|
|
+ log.info("上传icon成功....");
|
|
|
|
+ }
|
|
|
|
+ buildScenePost(dataSource,fdageData,"V3",cameraType,sceneNum,detailEntity,0,icon);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ Map<String,Object> result = new HashMap<>();
|
|
|
|
+ result.put("code",sceneNum);
|
|
|
|
+ result.put("web_site",sceneNum);
|
|
|
|
+ return ResultData.ok(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void buildV3Scene2(String dataSource,JSONObject jsonObject,long cameraType,String sceneNum,Camera cameraEntity,CameraDetail detailEntity,String icon) throws Exception {
|
|
|
|
+
|
|
|
|
+ String cameraName = jsonObject.getJSONObject("cam").getString("uuid");
|
|
|
|
+
|
|
|
|
+ log.info("查询相机:" + cameraName);
|
|
|
|
+
|
|
|
|
+ String userName = null;
|
|
|
|
+ if(detailEntity.getUserId() != null){
|
|
|
|
+ SSOUser user = userService.getSSOUserByUserId(detailEntity.getUserId());
|
|
|
|
+ userName = user.getUserName();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ JSONObject firmwareVersion = new JSONObject();
|
|
|
|
+ if(jsonObject.containsKey("camSoftwareVersion") && StringUtils.isNotEmpty(jsonObject.getString("camSoftwareVersion"))){
|
|
|
|
+ firmwareVersion.put("camSoftwareVersion", jsonObject.getString("camSoftwareVersion"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(jsonObject.containsKey("version") && StringUtils.isNotEmpty(jsonObject.getString("version"))){
|
|
|
|
+ firmwareVersion.put("version", jsonObject.getString("version"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ String buildType = "V3";
|
|
|
|
+ String sceneUrl = mainUrl + "/" + sceneProNewUrl;
|
|
|
|
+
|
|
|
|
+ boolean isObj = jsonObject.containsKey("exportMeshObj") && jsonObject.getIntValue("exportMeshObj") == 1;
|
|
|
|
+
|
|
|
|
+ ScenePro scenePro = createScenePro(sceneNum, detailEntity.getCameraId(), jsonObject.getString("creator"),
|
|
|
|
+ jsonObject.getString("pwd"),
|
|
|
|
+ cameraType, dataSource, "", icon, detailEntity.getUserId(), userName,
|
|
|
|
+ jsonObject.getString("location") != null && "1".equals(jsonObject.getString("location")) ? "sfm" : "slam",
|
|
|
|
+ jsonObject.getJSONArray("points").size(), jsonObject.getString("name"), jsonObject.getString("info"),
|
|
|
|
+ jsonObject.getInteger("scenetype"), jsonObject.getString("gps"), 0,
|
|
|
|
+ jsonObject.getInteger("resolution"), firmwareVersion.toString(), sceneUrl, buildType,
|
|
|
|
+ detailEntity.getCooperationUser(), isObj);
|
|
|
|
+
|
|
|
|
+ // 通知激光场景系统开始构建场景
|
|
|
|
+ if(cameraType == 14){
|
|
|
|
+ fdkkLaserService.saveScene(scenePro, null, cameraEntity, userName, true);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ BuildSceneCallMessage buildSceneMqMessage = this.getBuildSceneMqMessage(
|
|
|
|
+ sceneNum, cameraType, jsonObject.getString("location") != null && "1".equals(jsonObject.getString("location")) ? "sfm" : "slam",
|
|
|
|
+ jsonObject.getInteger("resolution"), buildType, dataSource);
|
|
|
|
+ rabbitMqProducer.sendByWorkQueue(queueV3ModelingPre, buildSceneMqMessage);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public ScenePro createScenePro(String projectNum, Long cameraId, String phoneId, String sceneKey,
|
|
|
|
+ Long cameraType, String dataSource, String imgsName,
|
|
|
|
+ String pic, Long userId, String userName, String algorithm,
|
|
|
|
+ Integer sceneShootCount, String sceneName, String sceneDec, Integer sceneType,
|
|
|
|
+ String gps, Integer type, Integer resolution, String firmwareVersion, String url,
|
|
|
|
+ String buildType, Long cooperationUser,Boolean isObj) throws Exception {
|
|
|
|
+ ScenePro scene;
|
|
|
|
+ SceneProEdit sceneEdit;
|
|
|
|
+ if (type == 0) {
|
|
|
|
+ scene = new ScenePro();
|
|
|
|
+ sceneEdit = new SceneProEdit();
|
|
|
|
+ } else {
|
|
|
|
+ scene = sceneProService.getByNum(projectNum);
|
|
|
|
+ sceneEdit = sceneProEditService.getByProId(scene.getId());
|
|
|
|
+ }
|
|
|
|
+ //先返回链接地址
|
|
|
|
+ scene.setWebSite(url + projectNum);
|
|
|
|
+ scene.setCameraId(cameraId);
|
|
|
|
+ scene.setPhoneId(phoneId);
|
|
|
|
+ scene.setNum(projectNum);
|
|
|
|
+
|
|
|
|
+ scene.setSceneSource(1);
|
|
|
|
+ scene.setDataSource(dataSource);
|
|
|
|
+ if (cameraType.longValue() == 5 || cameraType.longValue() == 6) {
|
|
|
|
+ //场景来源双目相机
|
|
|
|
+ scene.setSceneSource(2);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (resolution == null || resolution.intValue() == 0) {
|
|
|
|
+ scene.setSceneScheme(cameraType.intValue());
|
|
|
|
+ } else {
|
|
|
|
+ scene.setSceneScheme(4);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //场景来源双目相机,sceneScheme为4,加载high,low图
|
|
|
|
+ if (cameraType.longValue() == 5 || cameraType.longValue() == 6) {
|
|
|
|
+ scene.setSceneScheme(4);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //转台相机用4k图
|
|
|
|
+ if (cameraType.longValue() == 13) {
|
|
|
|
+ scene.setSceneSource(3);
|
|
|
|
+ scene.setSceneScheme(10);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //激光相机
|
|
|
|
+ if (cameraType.longValue() == 14) {
|
|
|
|
+ scene.setSceneSource(4);
|
|
|
|
+ scene.setSceneScheme(10);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (pic != null && pic.length() > 5) {
|
|
|
|
+ scene.setThumb(pic);
|
|
|
|
+ } else {
|
|
|
|
+ scene.setThumb(ConstantUrl.DEFAULT_SCENE_PIC);
|
|
|
|
+ }
|
|
|
|
+ scene.setThumb(scene.getThumb().concat("?t=") + System.currentTimeMillis());
|
|
|
|
+ if (!ObjectUtils.isEmpty(userName)) {
|
|
|
|
+ scene.setUserId(userId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (sceneShootCount == null) {
|
|
|
|
+ scene.setShootCount(0);
|
|
|
|
+ } else {
|
|
|
|
+ scene.setShootCount(sceneShootCount);
|
|
|
|
+ }
|
|
|
|
+ if (sceneName != null) {
|
|
|
|
+ scene.setSceneName(sceneName);
|
|
|
|
+ }
|
|
|
|
+ if (sceneDec != null) {
|
|
|
|
+ scene.setSceneDec("<p>" + new String(sceneDec.getBytes("UTF-8")) + "</p>");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (sceneType != null) {
|
|
|
|
+ scene.setSceneType(sceneType);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (gps != null && !gps.trim().equals("")) {
|
|
|
|
+ scene.setGps(gps);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ scene.setAlgorithm(algorithm);
|
|
|
|
+ scene.setFilesName(imgsName);
|
|
|
|
+ if (!org.springframework.util.StringUtils.isEmpty(firmwareVersion)) {
|
|
|
|
+ scene.setFirmwareVersion(firmwareVersion);
|
|
|
|
+ }
|
|
|
|
+ scene.setBuildType(buildType);
|
|
|
|
+ log.info("场景记录添加到数据库:" + projectNum);
|
|
|
|
+ //type=0为新生成场景,其余为重新计算场景
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if (type == 0) {
|
|
|
|
+ scene.setIsObj(ObjectUtils.isEmpty(isObj) || !isObj ? 0 : 1);
|
|
|
|
+ sceneProService.save(scene);
|
|
|
|
+
|
|
|
|
+ sceneEdit = new SceneProEdit();
|
|
|
|
+ sceneEdit.setNeedKey(0);
|
|
|
|
+
|
|
|
|
+ if (sceneKey == null) {
|
|
|
|
+ sceneKey = "";
|
|
|
|
+ }
|
|
|
|
+ sceneEdit.setSceneKey(sceneKey);
|
|
|
|
+ if (!sceneKey.equals("")) {
|
|
|
|
+ sceneEdit.setNeedKey(1);
|
|
|
|
+ } else {
|
|
|
|
+ sceneEdit.setNeedKey(0);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ sceneEdit.setProId(scene.getId());
|
|
|
|
+ sceneEdit.setMapVisi(1);
|
|
|
|
+ sceneEdit.setTourVisi(1);
|
|
|
|
+ sceneEdit.setVrVisi(1);
|
|
|
|
+ sceneEdit.setRulerVisi(0);
|
|
|
|
+ sceneEdit.setCadImgVisi(1);
|
|
|
|
+ sceneEdit.setPanoVisi(1);
|
|
|
|
+ sceneEdit.setM2dVisi(1);
|
|
|
|
+ sceneEdit.setM3dVisi(1);
|
|
|
|
+ sceneEdit.setMeasureVisi(0);
|
|
|
|
+ sceneEdit.setFloorLogoSize(100);
|
|
|
|
+ sceneEdit.setCreateTime(new Date());
|
|
|
|
+ sceneProEditService.save(sceneEdit);
|
|
|
|
+
|
|
|
|
+ //新增场景时,同时新增场景协作信息
|
|
|
|
+ if (cooperationUser != null) {
|
|
|
|
+ SceneCooperation sceneCooperationEntity = new SceneCooperation();
|
|
|
|
+ sceneCooperationEntity.setNum(projectNum);
|
|
|
|
+ sceneCooperationEntity.setUserId(cooperationUser);
|
|
|
|
+ sceneCooperationService.save(sceneCooperationEntity);
|
|
|
|
+
|
|
|
|
+ List<SceneResourceCamera> resourceCameraList = sceneResourceCameraService.findListByCameraId(cameraId);
|
|
|
|
+
|
|
|
|
+ SceneResourceCooperation sceneResourceCooperationEntity = null;
|
|
|
|
+ if (resourceCameraList != null && resourceCameraList.size() > 0) {
|
|
|
|
+ for (SceneResourceCamera sceneResourceCameraEntity : resourceCameraList) {
|
|
|
|
+ sceneResourceCooperationEntity = new SceneResourceCooperation();
|
|
|
|
+ sceneResourceCooperationEntity.setSceneResourceId(sceneResourceCameraEntity.getSceneResourceId());
|
|
|
|
+ sceneResourceCooperationEntity.setSceneCooperationId(sceneCooperationEntity.getId());
|
|
|
|
+ sceneResourceCooperationService.save(sceneResourceCooperationEntity);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ scene.setStatus(0);
|
|
|
|
+ scene.setPayStatus(0);
|
|
|
|
+ scene.setRecStatus("A");
|
|
|
|
+ scene.setCreateTime(new Date());
|
|
|
|
+ if (sceneName != null) {
|
|
|
|
+ scene.setSceneName(sceneName);
|
|
|
|
+ }
|
|
|
|
+ if (sceneType != null) {
|
|
|
|
+ scene.setSceneType(sceneType);
|
|
|
|
+ }
|
|
|
|
+ sceneProService.updateById(scene);
|
|
|
|
+
|
|
|
|
+ sceneEdit.setNeedKey(0);
|
|
|
|
+ if (cameraType.longValue() != 14 && !ObjectUtils.isEmpty(sceneKey)) {
|
|
|
|
+ sceneEdit.setNeedKey(1);
|
|
|
|
+ sceneEdit.setSceneKey(sceneKey);
|
|
|
|
+ }
|
|
|
|
+ sceneEdit.setProId(scene.getId());
|
|
|
|
+ sceneEdit.setMapVisi(1);
|
|
|
|
+ sceneEdit.setTourVisi(1);
|
|
|
|
+ sceneEdit.setVrVisi(1);
|
|
|
|
+ sceneEdit.setCadImgVisi(1);
|
|
|
|
+ sceneEdit.setPanoVisi(1);
|
|
|
|
+ sceneEdit.setOverlay(null);
|
|
|
|
+ sceneEdit.setM2dVisi(1);
|
|
|
|
+ sceneEdit.setPlayData(null);
|
|
|
|
+ sceneEdit.setFloorLogo("0");
|
|
|
|
+ sceneEdit.setM3dVisi(1);
|
|
|
|
+ sceneEdit.setJumpScene(false);
|
|
|
|
+ sceneEdit.setMeasureVisi(0);
|
|
|
|
+ sceneEdit.setFloorLogoSize(100);
|
|
|
|
+ sceneEdit.setUpdateTime(new Date());
|
|
|
|
+ sceneEdit.setRecStatus("A");
|
|
|
|
+ sceneEdit.setFloorPublishVer(sceneEdit.getFloorEditVer() + 1);
|
|
|
|
+ sceneEdit.setFloorEditVer(sceneEdit.getFloorEditVer() + 1);
|
|
|
|
+ sceneEdit.setVersion(sceneEdit.getVersion() + 1);
|
|
|
|
+ sceneEdit.setImagesVersion(sceneEdit.getImagesVersion() + 1);
|
|
|
|
+
|
|
|
|
+ sceneProEditService.updateById(sceneEdit);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ JSONObject scenejson = JSONObject.parseObject(JSONObject.toJSONString(scene));
|
|
|
|
+ scenejson.put("thumbImg", 0);
|
|
|
|
+ scenejson.put("version", sceneEdit.getVersion());
|
|
|
|
+ scenejson.put("floorLogo", 0);
|
|
|
|
+ if (!ObjectUtils.isEmpty(sceneKey)) {
|
|
|
|
+ scenejson.put("sceneKey", sceneKey);
|
|
|
|
+ scenejson.put("public", 1);
|
|
|
|
+ } else {
|
|
|
|
+ scenejson.put("sceneKey", "");
|
|
|
|
+ scenejson.put("public", 0);
|
|
|
|
+ }
|
|
|
|
+ if (cameraType.longValue() < 4 || cameraType.longValue() == 5 || cameraType.longValue() == 6) {
|
|
|
|
+ scenejson.put("visions", 1);
|
|
|
|
+ } else {
|
|
|
|
+ scenejson.put("visions", 2);
|
|
|
|
+ }
|
|
|
|
+ scenejson.put("createTime", new DateTime(new Date()).toString("yyyy-MM-dd HH:mm"));
|
|
|
|
+
|
|
|
|
+ scenejson.put("floorPublishVer", sceneEdit.getFloorPublishVer());
|
|
|
|
+ scenejson.put("floorEditVer", sceneEdit.getFloorEditVer());
|
|
|
|
+ scenejson.put("rulerVisi", sceneEdit.getRulerVisi());
|
|
|
|
+ scenejson.put("entry", null);
|
|
|
|
+
|
|
|
|
+ if (!org.springframework.util.StringUtils.isEmpty(sceneEdit.getHotsIds())) {
|
|
|
|
+ scenejson.put("hots", 1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ File file = new File(ConstantFilePath.SCENE_PATH + "data/data" + projectNum);
|
|
|
|
+ if (!file.exists() || !file.isDirectory()) {
|
|
|
|
+ file.mkdirs();
|
|
|
|
+ }
|
|
|
|
+ FileUtils.writeFile(ConstantFilePath.SCENE_PATH + "data/data" + projectNum + File.separator + "scene.json", scenejson.toString());
|
|
|
|
+
|
|
|
|
+ return scene;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|