|
@@ -62,61 +62,66 @@ public class BuildSceneResultMQListener implements RocketMQListener<String> {
|
|
|
}
|
|
|
|
|
|
private void process(BuildSceneResultMqMessage message){
|
|
|
- int cameraType = Integer.valueOf(message.getCameraType());
|
|
|
- String sceneCode = message.getScenenCode();
|
|
|
- String fileId = message.getFileId();
|
|
|
- Long space = message.getSpace();
|
|
|
- Integer payStatus = message.getPayStatus();
|
|
|
- String videosJson = message.getVideosJson();
|
|
|
- Long computeTime = message.getComputeTime();
|
|
|
- Boolean buildSuccess = message.getBuildSuccess();
|
|
|
- if(!buildSuccess){//建模失败,修改状态为失败状态
|
|
|
-
|
|
|
- sceneService.updateStatus(sceneCode, -1);
|
|
|
-
|
|
|
- SceneFileBuild sceneFileBuild = sceneFileBuildService.findByFileId(fileId);
|
|
|
- sceneFileBuild.setBuildStatus(BuildStatus.fail.code());
|
|
|
- sceneFileBuildService.updateById(sceneFileBuild);
|
|
|
-
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- //建模成功
|
|
|
- if(cameraType < 3){
|
|
|
- sceneService.updateTime(sceneCode, space, payStatus);
|
|
|
- }else{
|
|
|
-
|
|
|
- sceneProService.updateTime(sceneCode, space, payStatus, videosJson, computeTime);
|
|
|
-
|
|
|
- SceneFileBuild sceneFileBuild = sceneFileBuildService.findByFileId(fileId);
|
|
|
- sceneFileBuild.setBuildStatus(BuildStatus.success.code());
|
|
|
- sceneFileBuildService.updateById(sceneFileBuild);
|
|
|
+ try {
|
|
|
+ int cameraType = Integer.parseInt(message.getCameraType());
|
|
|
+ String sceneCode = message.getSceneCode();
|
|
|
+ String fileId = message.getFileId();
|
|
|
+ Long space = message.getSpace();
|
|
|
+ Integer payStatus = message.getPayStatus();
|
|
|
+ String videosJson = message.getVideosJson();
|
|
|
+ Long computeTime = message.getComputeTime();
|
|
|
+ Boolean buildSuccess = message.getBuildSuccess();
|
|
|
+ Integer sceneStatus = message.getSceneStatus();
|
|
|
+ if(!buildSuccess){//建模失败,修改状态为失败状态
|
|
|
+ log.error("建模失败,修改状态为失败状态");
|
|
|
+ sceneService.updateStatus(sceneCode, -1);
|
|
|
+ SceneFileBuild sceneFileBuild = sceneFileBuildService.findByFileId(fileId);
|
|
|
+ sceneFileBuild.setBuildStatus(BuildStatus.fail.code());
|
|
|
+ sceneFileBuildService.updateById(sceneFileBuild);
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- //更改相机容量
|
|
|
- ScenePro scenePro = sceneProService.findBySceneNum(sceneCode);
|
|
|
- if(Objects.nonNull(scenePro)){
|
|
|
- SceneProExt sceneProExt = sceneProExtService.findBySceneProId(scenePro.getId());
|
|
|
- ResultData<CameraDetail> resultData = platformClient.updateCameraDetailByCameraIdAndSpace(scenePro.getCameraId(), sceneProExt.getSpace());
|
|
|
- if(resultData.getCode() != 200){
|
|
|
- log.info("调用platform服务updateCameraDetailByCameraIdAndSpace失败,参数{},{}" ,scenePro.getCameraId(), sceneProExt.getSpace());
|
|
|
- return ;
|
|
|
+ //建模成功
|
|
|
+ log.info("cameraType:{}",cameraType);
|
|
|
+ if(cameraType < 3){
|
|
|
+ sceneService.updateTime(sceneCode, space, payStatus);
|
|
|
+ }else{
|
|
|
+ sceneProService.updateTime(sceneCode, space, payStatus, videosJson, computeTime);
|
|
|
+ SceneFileBuild sceneFileBuild = sceneFileBuildService.findByFileId(fileId);
|
|
|
+ if(sceneFileBuild != null){
|
|
|
+ sceneFileBuild.setBuildStatus(BuildStatus.success.code());
|
|
|
+ sceneFileBuildService.updateById(sceneFileBuild);
|
|
|
}
|
|
|
- CameraDetail cameraDetail = JSONObject.parseObject(JSONObject.toJSONString(resultData.getData()), CameraDetail.class);
|
|
|
+ //更改相机容量
|
|
|
+ ScenePro scenePro = sceneProService.findBySceneNum(sceneCode);
|
|
|
+ if(Objects.nonNull(scenePro)){
|
|
|
+ SceneProExt sceneProExt = sceneProExtService.findBySceneProId(scenePro.getId());
|
|
|
+ ResultData<CameraDetail> resultData = platformClient.updateCameraDetailByCameraIdAndSpace(scenePro.getCameraId(), sceneProExt.getSpace());
|
|
|
+ if(resultData.getCode() != 200){
|
|
|
+ log.error("调用platform服务updateCameraDetailByCameraIdAndSpace失败,参数{},{}" ,scenePro.getCameraId(), sceneProExt.getSpace());
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ CameraDetail cameraDetail = JSONObject.parseObject(JSONObject.toJSONString(resultData.getData()), CameraDetail.class);
|
|
|
|
|
|
- UserIncrement userIncrement = platformClient.getUserIncrementByCameraId(scenePro.getCameraId());
|
|
|
- if(userIncrement == null || userIncrement.getIsExpired() == 1){
|
|
|
- // 新上传的场景,如果总容量小于使用容量,则该大场景保留在临时存储空间30天
|
|
|
- if (cameraDetail.getTotalSpace().compareTo(cameraDetail.getUsedSpace()) == -1){
|
|
|
- List<Long> ids = new ArrayList<>();
|
|
|
- ids.add(scenePro.getId());
|
|
|
- sceneProService.tempScenes(ids);
|
|
|
+ ResultData<UserIncrement> resultData1 = platformClient.getUserIncrementByCameraId(scenePro.getCameraId());
|
|
|
+ if(resultData1.getCode() != 200){
|
|
|
+ log.error("调用platform服务getUserIncrementByCameraId失败,参数{}" ,scenePro.getCameraId());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if( resultData1.getData() == null || resultData1.getData().getIsExpired() ==1) {
|
|
|
+ // 新上传的场景,如果总容量小于使用容量,则该大场景保留在临时存储空间30天
|
|
|
+ if (cameraDetail.getTotalSpace().compareTo(cameraDetail.getUsedSpace()) == -1){
|
|
|
+ List<Long> ids = new ArrayList<>();
|
|
|
+ ids.add(scenePro.getId());
|
|
|
+ sceneProService.tempScenes(ids);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
+ }catch ( Exception e){
|
|
|
+ log.error("处理消息出错:{}",e);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
}
|