|
@@ -2,7 +2,9 @@ package com.fdkankan.contro.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
+import cn.hutool.core.date.DatePattern;
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
+import cn.hutool.core.exceptions.ExceptionUtil;
|
|
import cn.hutool.core.io.FileUtil;
|
|
import cn.hutool.core.io.FileUtil;
|
|
import cn.hutool.core.lang.UUID;
|
|
import cn.hutool.core.lang.UUID;
|
|
import cn.hutool.core.thread.ThreadUtil;
|
|
import cn.hutool.core.thread.ThreadUtil;
|
|
@@ -2366,84 +2368,84 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
public ResultData noticeBuild(String uuid) throws Exception {
|
|
public ResultData noticeBuild(String uuid) throws Exception {
|
|
log.info("通知计算,uuid:{} " + uuid);
|
|
log.info("通知计算,uuid:{} " + uuid);
|
|
|
|
|
|
- String[] uuidArr = uuid.split("_");
|
|
|
|
-
|
|
|
|
- String snCode = uuidArr[0];
|
|
|
|
|
|
+ String sceneNum = null;
|
|
|
|
+ try {
|
|
|
|
+ String[] uuidArr = uuid.split("_");
|
|
|
|
|
|
- JSONObject fdageData = JSONObject.parseObject(FileUtils.readFile(sendCallAlgorithmPath.concat(uuid).concat("/data.fdage")));
|
|
|
|
- int camType = fdageData.getJSONObject("cam").getIntValue("type");
|
|
|
|
- String cameraInStoreUrl = fdServiceUrl + "/service/manage/inner/cameraInStore";
|
|
|
|
- Map<String, Object> cameraInStoreParams = new HashMap<>();
|
|
|
|
- cameraInStoreParams.put("cameraType", camType);
|
|
|
|
- cameraInStoreParams.put("snCode", snCode);
|
|
|
|
- ResultData post = myClient.post(cameraInStoreUrl, cameraInStoreParams);
|
|
|
|
- log.info("---------cameraInStore result:{}-----------", post);
|
|
|
|
|
|
+ String snCode = uuidArr[0];
|
|
|
|
|
|
- Long cameraType = 13L;//默认为看见相机
|
|
|
|
|
|
+ JSONObject fdageData = JSONObject.parseObject(FileUtils.readFile(sendCallAlgorithmPath.concat(uuid).concat("/data.fdage")));
|
|
|
|
+ int camType = fdageData.getJSONObject("cam").getIntValue("type");
|
|
|
|
+ String cameraInStoreUrl = fdServiceUrl + "/service/manage/inner/cameraInStore";
|
|
|
|
+ Map<String, Object> cameraInStoreParams = new HashMap<>();
|
|
|
|
+ cameraInStoreParams.put("cameraType", camType);
|
|
|
|
+ cameraInStoreParams.put("snCode", snCode);
|
|
|
|
+ ResultData post = myClient.post(cameraInStoreUrl, cameraInStoreParams);
|
|
|
|
+ log.info("---------cameraInStore result:{}-----------", post);
|
|
|
|
|
|
- Camera camera = cameraService.getBySnCode(snCode);
|
|
|
|
- if(Objects.isNull(camera)){
|
|
|
|
- throw new BusinessException(ErrorCode.CAMERA_BIND_NO_EXIST.code(), "相机未入库");
|
|
|
|
- }
|
|
|
|
- CameraDetail cameraDetail = cameraDetailService.getByCameraId(camera.getId());
|
|
|
|
- if(Objects.isNull(cameraDetail)){
|
|
|
|
- throw new BusinessException(ErrorCode.CAMERA_BIND_NO_EXIST.code(), "相机未入库");
|
|
|
|
- }
|
|
|
|
- camType = cameraDetail.getType();
|
|
|
|
- if(camType == 10 || camType == 11){
|
|
|
|
- cameraType = 14L;//深时或者深光
|
|
|
|
- }else if(camType == 9){
|
|
|
|
- cameraType = 13L;//看见
|
|
|
|
- }else if(camType == 5){
|
|
|
|
- cameraType = 6L;//圆周率
|
|
|
|
- }else {
|
|
|
|
- cameraType = 10L;//看看
|
|
|
|
- }
|
|
|
|
|
|
+ Long cameraType = 13L;//默认为看见相机
|
|
|
|
|
|
- String fileId = this.getFileId(snCode, uuid);
|
|
|
|
- String subFolder = snCode.concat(File.separator).concat(fileId).concat(File.separator).concat(uuid);
|
|
|
|
- String dataSource = ConstantFilePath.BUILD_MODEL_PATH.concat(subFolder);
|
|
|
|
- log.info("dataSource 为:{}", dataSource);
|
|
|
|
|
|
+ Camera camera = cameraService.getBySnCode(snCode);
|
|
|
|
+ if(Objects.isNull(camera)){
|
|
|
|
+ throw new BusinessException(ErrorCode.CAMERA_BIND_NO_EXIST.code(), "相机未入库");
|
|
|
|
+ }
|
|
|
|
+ CameraDetail cameraDetail = cameraDetailService.getByCameraId(camera.getId());
|
|
|
|
+ if(Objects.isNull(cameraDetail)){
|
|
|
|
+ throw new BusinessException(ErrorCode.CAMERA_BIND_NO_EXIST.code(), "相机未入库");
|
|
|
|
+ }
|
|
|
|
+ camType = cameraDetail.getType();
|
|
|
|
+ if(camType == 10 || camType == 11){
|
|
|
|
+ cameraType = 14L;//深时或者深光
|
|
|
|
+ }else if(camType == 9){
|
|
|
|
+ cameraType = 13L;//看见
|
|
|
|
+ }else if(camType == 5){
|
|
|
|
+ cameraType = 6L;//圆周率
|
|
|
|
+ }else {
|
|
|
|
+ cameraType = 10L;//看看
|
|
|
|
+ }
|
|
|
|
|
|
- JSONObject configJson = JSONObject.parseObject(FileUtils.readFile(sendCallAlgorithmPath.concat(uuid).concat("/config.json")));
|
|
|
|
- String folderName = configJson.getString("id");
|
|
|
|
- String customUserId = configJson.getString("customUserId");
|
|
|
|
- String customUserName = configJson.getString("customUserName");
|
|
|
|
- String customUserPwd = configJson.getString("customUserPwd");
|
|
|
|
- if(StrUtil.isBlank(folderName) || StrUtil.isBlank(snCode)){
|
|
|
|
- throw new RuntimeException("config.json 文件有误!");
|
|
|
|
- }
|
|
|
|
|
|
+ String fileId = this.getFileId(snCode, uuid);
|
|
|
|
+ String subFolder = snCode.concat(File.separator).concat(fileId).concat(File.separator).concat(uuid);
|
|
|
|
+ String dataSource = ConstantFilePath.BUILD_MODEL_PATH.concat(subFolder);
|
|
|
|
+ log.info("dataSource 为:{}", dataSource);
|
|
|
|
+
|
|
|
|
+ JSONObject configJson = JSONObject.parseObject(FileUtils.readFile(sendCallAlgorithmPath.concat(uuid).concat("/config.json")));
|
|
|
|
+ String folderName = configJson.getString("id");
|
|
|
|
+ String customUserId = configJson.getString("customUserId");
|
|
|
|
+ String customUserName = configJson.getString("customUserName");
|
|
|
|
+ String customUserPwd = configJson.getString("customUserPwd");
|
|
|
|
+ if(StrUtil.isBlank(folderName) || StrUtil.isBlank(snCode)){
|
|
|
|
+ throw new RuntimeException("config.json 文件有误!");
|
|
|
|
+ }
|
|
|
|
|
|
- //校验文件是否完整
|
|
|
|
- jmgaService.checkFileWhole(uuid, dataSource, fdageData);
|
|
|
|
|
|
+ //校验文件是否完整
|
|
|
|
+ jmgaService.checkFileWhole(uuid, dataSource, fdageData);
|
|
|
|
|
|
- //推送开始上传状态
|
|
|
|
|
|
+ //推送开始上传状态
|
|
|
|
|
|
- //调注册用户接口
|
|
|
|
- Map<String, Object> params = new HashMap<>();
|
|
|
|
- params.put("ryId", customUserId);
|
|
|
|
- params.put("ryNo", customUserName);
|
|
|
|
|
|
+ //调注册用户接口
|
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
|
+ params.put("ryId", customUserId);
|
|
|
|
+ params.put("ryNo", customUserName);
|
|
// params.put("nickName", customUserName);//去掉昵称,又燕海的接口进行判断
|
|
// params.put("nickName", customUserName);//去掉昵称,又燕海的接口进行判断
|
|
- params.put("password", AesUtil.encryptCBC(customUserPwd, userPasswordKey, userPasswordIv, AesUtil.ALMODE_CBC_NOPADDING));
|
|
|
|
- String url = fdServiceUrl.concat(URL_ADD_UCENTER_USER);
|
|
|
|
- myClient.post(url, params);
|
|
|
|
- JyUser jyUser = jyUserService.getByRyId(customUserId);
|
|
|
|
- User user = userService.getById(jyUser.getUserId());
|
|
|
|
- if(Objects.isNull(jyUser)){
|
|
|
|
- throw new RuntimeException("注册用户失败");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- String sceneNum = null;
|
|
|
|
|
|
+ params.put("password", AesUtil.encryptCBC(customUserPwd, userPasswordKey, userPasswordIv, AesUtil.ALMODE_CBC_NOPADDING));
|
|
|
|
+ String url = fdServiceUrl.concat(URL_ADD_UCENTER_USER);
|
|
|
|
+ myClient.post(url, params);
|
|
|
|
+ JyUser jyUser = jyUserService.getByRyId(customUserId);
|
|
|
|
+ User user = userService.getById(jyUser.getUserId());
|
|
|
|
+ if(Objects.isNull(jyUser)){
|
|
|
|
+ throw new RuntimeException("注册用户失败");
|
|
|
|
+ }
|
|
|
|
|
|
- int rebuild = 0;
|
|
|
|
- ScenePlus scenePlus = scenePlusService.getByFileId(dataSource);
|
|
|
|
- if (!ObjectUtils.isEmpty(scenePlus)) {
|
|
|
|
- log.info("该场景资源已存在,执行补拍逻辑!");
|
|
|
|
- rebuild = 1;
|
|
|
|
- sceneNum = scenePlus.getNum();
|
|
|
|
- }else{
|
|
|
|
- sceneNum = scene3dNumService.generateSceneNum(cameraDetail.getType());
|
|
|
|
- }
|
|
|
|
|
|
+ int rebuild = 0;
|
|
|
|
+ ScenePlus scenePlus = scenePlusService.getByFileId(dataSource);
|
|
|
|
+ if (!ObjectUtils.isEmpty(scenePlus)) {
|
|
|
|
+ log.info("该场景资源已存在,执行补拍逻辑!");
|
|
|
|
+ rebuild = 1;
|
|
|
|
+ sceneNum = scenePlus.getNum();
|
|
|
|
+ }else{
|
|
|
|
+ sceneNum = scene3dNumService.generateSceneNum(cameraDetail.getType());
|
|
|
|
+ }
|
|
|
|
|
|
// String imgViewPath = String.format(UploadFilePath.IMG_VIEW_PATH, sceneNum);
|
|
// String imgViewPath = String.format(UploadFilePath.IMG_VIEW_PATH, sceneNum);
|
|
// if(fdageData.containsKey("icon") && StringUtils.isNotEmpty(fdageData.getString("icon"))){
|
|
// if(fdageData.containsKey("icon") && StringUtils.isNotEmpty(fdageData.getString("icon"))){
|
|
@@ -2454,12 +2456,39 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
// log.info("上传icon成功....");
|
|
// log.info("上传icon成功....");
|
|
// }
|
|
// }
|
|
|
|
|
|
- buildScenePost(dataSource, fdageData, "V3", cameraType, sceneNum, camera, cameraDetail, rebuild, "", user, customUserId, "single");
|
|
|
|
|
|
+ buildScenePost(dataSource, fdageData, "V3", cameraType, sceneNum, camera, cameraDetail, rebuild, "", user, customUserId, "single");
|
|
|
|
|
|
- scenePlus = scenePlusService.getScenePlusByNum(sceneNum);
|
|
|
|
- if(cameraType == 14){
|
|
|
|
- fdkkLaserService.saveScene(scenePlus,fdageData,camera,user.getUserName(),rebuild == 1 ? true : false, scenePlus.getPayStatus());
|
|
|
|
|
|
+ scenePlus = scenePlusService.getScenePlusByNum(sceneNum);
|
|
|
|
+ if(cameraType == 14){
|
|
|
|
+ fdkkLaserService.saveScene(scenePlus,fdageData,camera,user.getUserName(),rebuild == 1 ? true : false, scenePlus.getPayStatus());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ log.error("通知计算报错,uuid:{}", uuid, e);
|
|
|
|
+ if(StrUtil.isNotEmpty(sceneNum)){
|
|
|
|
+ scenePlusService.update(new LambdaUpdateWrapper<ScenePlus>()
|
|
|
|
+ .set(ScenePlus::getSceneStatus, SceneStatus.FAILD.code())
|
|
|
|
+ .eq(ScenePlus::getNum, sceneNum));
|
|
|
|
+ String buildLogPath = String.format(UploadFilePath.BUILD_LOG_PATH, sceneNum);
|
|
|
|
+ String preLogPath = buildLogPath + "noticeBuild-error-" + DateUtil.format(new Date(), DatePattern.PURE_DATETIME_PATTERN) + ".log";
|
|
|
|
+ fYunFileService.uploadFile(ExceptionUtil.stacktraceToString(e).getBytes(StandardCharsets.UTF_8), preLogPath);
|
|
|
|
+
|
|
|
|
+ Map<String, Object> param = new HashMap<>();
|
|
|
|
+ try {
|
|
|
|
+ param.put("event_type", "通知计算失败");
|
|
|
|
+ param.put("event_content", "通知计算失败");
|
|
|
|
+ param.put("scene_num", sceneNum);
|
|
|
|
+ param.put("event_time", new Date());
|
|
|
|
+ param.put("ryid", scenePlusService.getRyIdByNum(sceneNum));
|
|
|
|
+ jmgaService.sendStatus(param);
|
|
|
|
+ }catch (Exception ex){
|
|
|
|
+ log.info("推送事件失败,param:{}", param);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ throw e;
|
|
}
|
|
}
|
|
|
|
+
|
|
return ResultData.ok();
|
|
return ResultData.ok();
|
|
}
|
|
}
|
|
|
|
|