|
@@ -3,6 +3,7 @@ package com.fdkankan.contro.service.impl;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
+import cn.hutool.core.exceptions.ExceptionUtil;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.lang.UUID;
|
|
|
import cn.hutool.core.thread.ThreadUtil;
|
|
@@ -247,6 +248,10 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
@Autowired
|
|
|
private IJmgaService jmgaService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ISceneOrigBdService sceneOrigBdService;
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public SceneFileBuild findByFileId(String fileId) {
|
|
|
|
|
@@ -923,6 +928,9 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
}else {
|
|
|
scenePlusExt.setSceneScheme(SceneScheme.BM.code());
|
|
|
}
|
|
|
+ if(cameraType == 6){
|
|
|
+ scenePlusVO.setThreeCamType("yzl");
|
|
|
+ }
|
|
|
|
|
|
//转台相机用4k图
|
|
|
if(cameraType.longValue() == 13){
|
|
@@ -1587,7 +1595,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
icon = fYunFileConfig.getHost() + imgViewPath + fdageData.getString("icon");
|
|
|
log.info("上传icon成功....");
|
|
|
}
|
|
|
- buildScenePost(dataSource, fdageData, "V3", cameraType, sceneNum, cameraEntity, detailEntity, rebuild, icon, user, customUserId, "zip");
|
|
|
+// buildScenePost(dataSource, fdageData, "V3", cameraType, sceneNum, cameraEntity, detailEntity, rebuild, icon, user, customUserId, "zip");
|
|
|
|
|
|
scenePlus = scenePlusService.getScenePlusByNum(sceneNum);
|
|
|
fdkkLaserService.saveScene(scenePlus,fdageData,cameraEntity,user.getUserName(),rebuild == 1 ? true : false, scenePlus.getPayStatus());
|
|
@@ -1600,10 +1608,8 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
}
|
|
|
|
|
|
private ScenePlusVO buildScenePost(String dataSource, JSONObject jsonObject, String buildType, long cameraType,
|
|
|
- String sceneNum, Camera camera, CameraDetail cameraDetail, int rebuild,String icon,User user, String customUserId, String uploadType) throws Exception {
|
|
|
- String localDataPath = String.format(ConstantFilePath.DATABUFFER_FORMAT, sceneNum);
|
|
|
+ String sceneNum, Camera camera, CameraDetail cameraDetail, int rebuild,String icon,User user) throws Exception {
|
|
|
String imgViewPath = String.format(UploadFilePath.IMG_VIEW_PATH, sceneNum);
|
|
|
- String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, sceneNum);
|
|
|
|
|
|
JSONObject firmwareVersion = new JSONObject();
|
|
|
if (!ObjectUtils.isEmpty(jsonObject.getString("camSoftwareVersion"))) {
|
|
@@ -1639,21 +1645,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
jsonObject.getInteger("scenetype"), jsonObject.getString("gps"), rebuild,
|
|
|
jsonObject.getInteger("resolution"), firmwareVersion.toString(), sceneUrl, buildType, cameraDetail.getCooperationUser());
|
|
|
|
|
|
-// if (Objects.nonNull(scenePlusVO)) {
|
|
|
-// JSONObject statusJson = new JSONObject();
|
|
|
-// //临时将-2改成1,app还没完全更新
|
|
|
-// statusJson.put("status", scenePlusVO.getSceneStatus() == -2 ? 1 : scenePlusVO.getSceneStatus());
|
|
|
-// statusJson.put("webSite", scenePlusVO.getWebSite());
|
|
|
-// statusJson.put("sceneNum", scenePlusVO.getNum());
|
|
|
-// statusJson.put("thumb", scenePlusVO.getThumb());
|
|
|
-// statusJson.put("payStatus", 0);
|
|
|
-// statusJson.put("recStatus", 'A');
|
|
|
-// FileUtils.writeFile(localDataPath + "status.json", statusJson.toString());
|
|
|
-// fYunFileService.uploadFile(localDataPath + "status.json", dataViewPath + "status.json");
|
|
|
-// }
|
|
|
-
|
|
|
- BuildSceneCallMessage mqMessage = getBuildSceneMqMessage(sceneNum, cameraType, algorithm, jsonObject, buildType,
|
|
|
- scenePlusVO.getDataSource());
|
|
|
+ BuildSceneCallMessage mqMessage = getBuildSceneMqMessage(sceneNum, cameraType, algorithm, jsonObject, buildType, scenePlusVO.getDataSource());
|
|
|
|
|
|
if (cameraDetail.getCompanyId() != null) {
|
|
|
Company company = companyService.getById(cameraDetail.getCompanyId());
|
|
@@ -1662,36 +1654,9 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
}
|
|
|
}
|
|
|
mqMessage.getExt().put("deleteExtras", true);
|
|
|
- mqMessage.getExt().put("customUserId", customUserId);
|
|
|
mqMessage.getExt().put("gps", jsonObject.getString("gps"));
|
|
|
mqMessage.getExt().put("threeCamType", scenePlusVO.getThreeCamType());
|
|
|
|
|
|
- if(uploadType.equals("single")){//场景上传模式(single-细小文件上传, zip-压缩包上传)
|
|
|
- OrigFileUploadBatch condition = new OrigFileUploadBatch();
|
|
|
- condition.setUuid(unicode);
|
|
|
- condition.setStatus(0);
|
|
|
- OrigFileUploadBatch origFileUploadBatch = origFileUploadBatchService.getByCondition(condition);
|
|
|
- origFileUploadBatch.setStatus(1);
|
|
|
- origFileUploadBatch.setMqContent(JSON.toJSONString(mqMessage));
|
|
|
- origFileUploadBatch.setNoticeTimes(origFileUploadBatch.getNoticeTimes() + 1);
|
|
|
- mqMessage.getExt().put("batchId", origFileUploadBatch.getBatchId());
|
|
|
- mqMessage.getExt().put("noticeTimes", origFileUploadBatch.getNoticeTimes());
|
|
|
- origFileUploadBatchService.updateById(origFileUploadBatch);
|
|
|
- redisUtil.del("single:upload:uuid:" + unicode);
|
|
|
- }
|
|
|
-
|
|
|
- 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 e){
|
|
|
- log.info("推送事件失败,param:{}", param);
|
|
|
- }
|
|
|
-
|
|
|
rabbitMqProducer.sendByWorkQueue(queueModelingPre, mqMessage);
|
|
|
|
|
|
return scenePlusVO;
|
|
@@ -2370,127 +2335,99 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ResultData noticeBuild(String uuid) throws Exception {
|
|
|
+ public ResultData noticeBuild(String uuid, String fileName, String dataSource) throws Exception {
|
|
|
log.info("通知计算,uuid:{} " + uuid);
|
|
|
|
|
|
- String[] uuidArr = uuid.split("_");
|
|
|
+ SceneOrigBd sceneOrigBd = sceneOrigBdService.getEnableOne(fileName);
|
|
|
|
|
|
- String snCode = uuidArr[0];
|
|
|
+ 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;//默认为看见相机
|
|
|
+ String homePath = SceneUtil.getHomePath(dataSource);
|
|
|
+ JSONObject fdageData = JSONObject.parseObject(fYunFileService.getFileContent(homePath + "data.fdage"));
|
|
|
+ int camType = fdageData.getJSONObject("cam").getIntValue("type");
|
|
|
|
|
|
- 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;//看看
|
|
|
- }
|
|
|
-
|
|
|
- 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 文件有误!");
|
|
|
- }
|
|
|
+ //相机入库
|
|
|
+ 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);
|
|
|
|
|
|
- //校验文件是否完整
|
|
|
- jmgaService.checkFileWhole(uuid, dataSource, fdageData);
|
|
|
+ Long cameraType = 13L;//默认为看见相机
|
|
|
|
|
|
- //推送开始上传状态
|
|
|
+ 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;//看看
|
|
|
+ }
|
|
|
|
|
|
- //调注册用户接口
|
|
|
- Map<String, Object> params = new HashMap<>();
|
|
|
- params.put("ryId", customUserId);
|
|
|
- params.put("ryNo", 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("注册用户失败");
|
|
|
- }
|
|
|
+ //校验文件是否完整
|
|
|
+// jmgaService.checkFileWhole(uuid, dataSource, fdageData);
|
|
|
+
|
|
|
+ //调注册用户接口
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ params.put("ryId", sceneOrigBd.getJyh());
|
|
|
+ params.put("ryNo", sceneOrigBd.getJyh());
|
|
|
+ params.put("nickName", sceneOrigBd.getUserXm());
|
|
|
+ params.put("password", AesUtil.encryptCBC("Aa123456", userPasswordKey, userPasswordIv, AesUtil.ALMODE_CBC_NOPADDING));
|
|
|
+ String url = fdServiceUrl.concat(URL_ADD_UCENTER_USER);
|
|
|
+ ResultData post1 = myClient.post(url, params);
|
|
|
+ log.info("---------registerUser result:{}-----------", post1);
|
|
|
+ JyUser jyUser = jyUserService.getByRyId(sceneOrigBd.getJyh());
|
|
|
+ User user = userService.getById(jyUser.getUserId());
|
|
|
+ if(Objects.isNull(jyUser)){
|
|
|
+ throw new RuntimeException("注册用户失败");
|
|
|
+ }
|
|
|
|
|
|
- String sceneNum = null;
|
|
|
+ String sceneNum = null;
|
|
|
|
|
|
- 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);
|
|
|
-// 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 + File.separator + fdageData.getString("icon"),imgViewPath + fdageData.getString("icon"));
|
|
|
-// icon = fYunFileConfig.getHost() + imgViewPath + fdageData.getString("icon");
|
|
|
-// log.info("上传icon成功....");
|
|
|
-// }
|
|
|
+ buildScenePost(dataSource, fdageData, "V3", cameraType, sceneNum, camera, cameraDetail, rebuild, "", user);
|
|
|
|
|
|
- buildScenePost(dataSource, fdageData, "V3", cameraType, sceneNum, camera, cameraDetail, rebuild, "", user, customUserId, "single");
|
|
|
+ scenePlus = scenePlusService.getScenePlusByNum(sceneNum);
|
|
|
|
|
|
- scenePlus = scenePlusService.getScenePlusByNum(sceneNum);
|
|
|
- fdkkLaserService.saveScene(scenePlus,fdageData,camera,user.getUserName(),rebuild == 1 ? true : false, scenePlus.getPayStatus());
|
|
|
+ if(cameraType == 14){
|
|
|
+ fdkkLaserService.saveScene(scenePlus,fdageData,camera,user.getUserName(),rebuild == 1 ? true : false, scenePlus.getPayStatus());
|
|
|
+ }
|
|
|
+ sceneOrigBd.setStatus(CommonSuccessStatus.SUCCESS.code());
|
|
|
+ }catch (Exception e){
|
|
|
+ sceneOrigBd.setStatus(CommonSuccessStatus.FAIL.code());
|
|
|
+ sceneOrigBd.setReason(ExceptionUtil.stacktraceToString(e,5000));
|
|
|
+ }
|
|
|
+ sceneOrigBd.setUpdateTime(null);
|
|
|
+ sceneOrigBdService.updateById(sceneOrigBd);
|
|
|
|
|
|
return ResultData.ok();
|
|
|
}
|
|
|
|
|
|
- public String getFileId(String snCode, String uuid) throws Exception {
|
|
|
-
|
|
|
- // 检测是否有生成
|
|
|
- String fileId = null;
|
|
|
- SceneFileBuild sceneFileBuild = this.findByUnicode(uuid);
|
|
|
- if(Objects.nonNull(sceneFileBuild)){
|
|
|
- fileId = sceneFileBuild.getFileId();
|
|
|
- return fileId;
|
|
|
- }
|
|
|
-
|
|
|
- fileId = new SnowflakeIdGenerator(0, 0).nextId() + "";
|
|
|
- log.info("新场景,fileid:{}", fileId);
|
|
|
-
|
|
|
- sceneFileBuild = new SceneFileBuild();
|
|
|
- sceneFileBuild.setChildName(snCode);
|
|
|
- sceneFileBuild.setFileId(fileId);
|
|
|
- sceneFileBuild.setRecStatus("A");
|
|
|
- sceneFileBuild.setUnicode(uuid);
|
|
|
- sceneFileBuild.setCreateTime(new Date());
|
|
|
- this.save(sceneFileBuild);
|
|
|
-
|
|
|
- return fileId;
|
|
|
+ public String getFileId(String unicode) throws Exception {
|
|
|
+ return this.getOne(new LambdaQueryWrapper<SceneFileBuild>().eq(SceneFileBuild::getUnicode, unicode)).getFileId();
|
|
|
}
|
|
|
|
|
|
|