|
@@ -28,6 +28,7 @@ import com.fdkankan.model.utils.CreateHouseJsonUtil;
|
|
import com.fdkankan.model.utils.CreateObjUtil;
|
|
import com.fdkankan.model.utils.CreateObjUtil;
|
|
import com.fdkankan.push.config.PushMessageConfig;
|
|
import com.fdkankan.push.config.PushMessageConfig;
|
|
import com.fdkankan.push.utils.PushMsgUtil;
|
|
import com.fdkankan.push.utils.PushMsgUtil;
|
|
|
|
+import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
|
|
import com.fdkankan.rabbitmq.bean.BuildSceneResultMqMessage;
|
|
import com.fdkankan.rabbitmq.bean.BuildSceneResultMqMessage;
|
|
import com.fdkankan.redis.constant.RedisKey;
|
|
import com.fdkankan.redis.constant.RedisKey;
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
@@ -61,6 +62,10 @@ public class BuildScenePostServiceImpl implements IBuildScenePostService {
|
|
private String mainUrl;
|
|
private String mainUrl;
|
|
@Value("${scene.pro.new.url}")
|
|
@Value("${scene.pro.new.url}")
|
|
private String sceneProNewUrl;
|
|
private String sceneProNewUrl;
|
|
|
|
+
|
|
|
|
+ @Value("${4dkk.laserService.host}")
|
|
|
|
+ private String laserHost;
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private ISceneFileBuildService sceneFileBuildService;
|
|
private ISceneFileBuildService sceneFileBuildService;
|
|
@Autowired
|
|
@Autowired
|
|
@@ -86,6 +91,9 @@ public class BuildScenePostServiceImpl implements IBuildScenePostService {
|
|
@Autowired
|
|
@Autowired
|
|
private IUserIncrementService userIncrementService;
|
|
private IUserIncrementService userIncrementService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private IFdkkLaserService fdkkLaserService;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void buildScenePost(BuildSceneResultMqMessage message) throws Exception {
|
|
public void buildScenePost(BuildSceneResultMqMessage message) throws Exception {
|
|
Integer cameraType = Integer.parseInt(message.getCameraType());
|
|
Integer cameraType = Integer.parseInt(message.getCameraType());
|
|
@@ -99,26 +107,28 @@ public class BuildScenePostServiceImpl implements IBuildScenePostService {
|
|
Boolean buildSuccess = message.getBuildSuccess();
|
|
Boolean buildSuccess = message.getBuildSuccess();
|
|
Integer videoVersion = getVideoVersion(path + File.separator + "capture" +File.separator+"data.fdage");
|
|
Integer videoVersion = getVideoVersion(path + File.separator + "capture" +File.separator+"data.fdage");
|
|
|
|
|
|
- Map<String, String> uploadFiles = getUploadFiles(path);
|
|
|
|
|
|
+
|
|
|
|
|
|
Integer pushChannel = message.getPushChannel();
|
|
Integer pushChannel = message.getPushChannel();
|
|
String pushToken = message.getPushToken();
|
|
String pushToken = message.getPushToken();
|
|
String prefix = message.getPrefix();
|
|
String prefix = message.getPrefix();
|
|
try {
|
|
try {
|
|
- if(!buildSuccess){//建模失败,修改状态为失败状态
|
|
|
|
- log.info("建模失败,修改状态为失败状态");
|
|
|
|
|
|
+ if (!buildSuccess) {
|
|
|
|
+ log.error("建模失败,修改状态为失败状态");
|
|
scenePlusService.update(new LambdaUpdateWrapper<ScenePlus>()
|
|
scenePlusService.update(new LambdaUpdateWrapper<ScenePlus>()
|
|
.set(ScenePlus::getSceneStatus, SceneStatus.FAILD.code())
|
|
.set(ScenePlus::getSceneStatus, SceneStatus.FAILD.code())
|
|
.eq(ScenePlus::getNum, sceneCode));
|
|
.eq(ScenePlus::getNum, sceneCode));
|
|
|
|
|
|
SceneFileBuild sceneFileBuild = sceneFileBuildService.findByFileId(fileId);
|
|
SceneFileBuild sceneFileBuild = sceneFileBuildService.findByFileId(fileId);
|
|
- if(Objects.nonNull(sceneFileBuild)){
|
|
|
|
|
|
+ if (Objects.nonNull(sceneFileBuild)) {
|
|
sceneFileBuild.setBuildStatus(BuildStatus.fail.code());
|
|
sceneFileBuild.setBuildStatus(BuildStatus.fail.code());
|
|
sceneFileBuildService.updateById(sceneFileBuild);
|
|
sceneFileBuildService.updateById(sceneFileBuild);
|
|
}
|
|
}
|
|
- return;
|
|
|
|
|
|
+ throw new RuntimeException("建模失败!");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ Map<String, String> uploadFiles = getUploadFiles(path);
|
|
|
|
+
|
|
//建模成功走以下逻辑
|
|
//建模成功走以下逻辑
|
|
log.info("cameraType:{}",cameraType);
|
|
log.info("cameraType:{}",cameraType);
|
|
|
|
|
|
@@ -160,14 +170,12 @@ public class BuildScenePostServiceImpl implements IBuildScenePostService {
|
|
fYunFileService.uploadFile(outPathZh, String.format(UploadFilePath.DOWNLOADS_QRCODE, sceneCode) + sceneCode + ".png");
|
|
fYunFileService.uploadFile(outPathZh, String.format(UploadFilePath.DOWNLOADS_QRCODE, sceneCode) + sceneCode + ".png");
|
|
fYunFileService.uploadFile(outPathEn, String.format(UploadFilePath.DOWNLOADS_QRCODE, sceneCode) + sceneCode + "_en.png");
|
|
fYunFileService.uploadFile(outPathEn, String.format(UploadFilePath.DOWNLOADS_QRCODE, sceneCode) + sceneCode + "_en.png");
|
|
|
|
|
|
- Map<String, String> newUploadFiles = this.uploadFileMapHandler(sceneCode, cameraType, uploadFiles);
|
|
|
|
-
|
|
|
|
//上传全景图俯视图
|
|
//上传全景图俯视图
|
|
- this.uploadFloorCad(path, sceneCode, newUploadFiles);
|
|
|
|
|
|
+ this.uploadFloorCad(path, sceneCode, uploadFiles);
|
|
|
|
|
|
//上传文件
|
|
//上传文件
|
|
log.info("开始上传场景计算结果数据,num:{}", sceneCode);
|
|
log.info("开始上传场景计算结果数据,num:{}", sceneCode);
|
|
- fYunFileService.uploadMulFiles(newUploadFiles);
|
|
|
|
|
|
+ fYunFileService.uploadMulFiles(uploadFiles);
|
|
|
|
|
|
Map<String,String> damFileHeaders = new HashMap<>();
|
|
Map<String,String> damFileHeaders = new HashMap<>();
|
|
damFileHeaders.put("Content-Encoding","gzip");
|
|
damFileHeaders.put("Content-Encoding","gzip");
|
|
@@ -199,13 +207,22 @@ public class BuildScenePostServiceImpl implements IBuildScenePostService {
|
|
//计算成功,发短信
|
|
//计算成功,发短信
|
|
this.pushMsgToApp(pushChannel,pushToken, cameraType, scenePlus.getTitle(), scenePlusExt.getWebSite());
|
|
this.pushMsgToApp(pushChannel,pushToken, cameraType, scenePlus.getTitle(), scenePlusExt.getWebSite());
|
|
|
|
|
|
|
|
+ if (cameraType == 14) {
|
|
|
|
+ //计算成功 激光转台相机 同步 请求
|
|
|
|
+ fdkkLaserService.syncBuildResult(scenePlus, scenePlusExt);
|
|
|
|
+ }
|
|
log.info("场景计算结果处理结束,场景码:{}", message.getSceneCode());
|
|
log.info("场景计算结果处理结束,场景码:{}", message.getSceneCode());
|
|
|
|
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
- log.error("场景计算结果处理出错", e);
|
|
|
|
|
|
+ String errorMsg = "场景计算结果处理出错!";
|
|
|
|
+ log.error(errorMsg);
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ if(!buildSuccess){
|
|
|
|
+ errorMsg = "场景构建失败!";
|
|
|
|
+ }
|
|
//发送钉钉
|
|
//发送钉钉
|
|
String serverPath = message.getPath().substring(0,message.getPath().lastIndexOf("/")+1).concat(prefix);
|
|
String serverPath = message.getPath().substring(0,message.getPath().lastIndexOf("/")+1).concat(prefix);
|
|
-// buildSceneDTService.handFail("场景计算结果处理出错", serverPath, sceneCode, BuildScenePreServiceImpl.hostName, BuildScenePreServiceImpl.contentExt);
|
|
|
|
|
|
+// buildSceneDTService.handFail(errorMsg, serverPath, sceneCode, BuildScenePreServiceImpl.hostName, BuildScenePreServiceImpl.contentExt);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -217,9 +234,9 @@ public class BuildScenePostServiceImpl implements IBuildScenePostService {
|
|
|
|
|
|
String projectNum = scenePlus.getNum();
|
|
String projectNum = scenePlus.getNum();
|
|
|
|
|
|
- String dataPath = String.format(ConstantFilePath.DATA_PATH_FORMAT, projectNum);
|
|
|
|
- String imagesPath = String.format(ConstantFilePath.IMAGE_PATH_FORMAT, projectNum);
|
|
|
|
- String videoPath = String.format(ConstantFilePath.VIDEO_PATH_FORMAT, projectNum);
|
|
|
|
|
|
+ String dataPath = String.format(UploadFilePath.DATA_VIEW_PATH, projectNum);
|
|
|
|
+ String imagesPath = String.format(UploadFilePath.IMG_VIEW_PATH, projectNum);
|
|
|
|
+ String videoPath = String.format(UploadFilePath.VIDEOS_VIEW_PATH, projectNum);
|
|
String resultsPath = path + File.separator + "results" + File.separator;
|
|
String resultsPath = path + File.separator + "results" + File.separator;
|
|
|
|
|
|
String uploadJsonPath = resultsPath + "upload.json";
|
|
String uploadJsonPath = resultsPath + "upload.json";
|
|
@@ -447,36 +464,6 @@ public class BuildScenePostServiceImpl implements IBuildScenePostService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
- private Map<String, String> uploadFileMapHandler(String num, int cameraType, Map<String, String> map) {
|
|
|
|
- if(CollUtil.isEmpty(map)){
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- String dataPath = String.format("data/data%s/", num);
|
|
|
|
- String imagePath = String.format("images/images%s/", num);
|
|
|
|
- String videoPath = String.format("video/video%s/", num);
|
|
|
|
-
|
|
|
|
- String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, num);
|
|
|
|
- String imgViewPath = String.format(UploadFilePath.IMG_VIEW_PATH, num);
|
|
|
|
- String videosViewPath = String.format(UploadFilePath.VIDEOS_VIEW_PATH, num);
|
|
|
|
-
|
|
|
|
- Map<String, String> newMap = new HashMap<>();
|
|
|
|
- for (String key : map.keySet()) {
|
|
|
|
- String value = map.get(key);
|
|
|
|
- if(value.contains(dataPath)){
|
|
|
|
- newMap.put(key, value.replace(dataPath, dataViewPath));
|
|
|
|
- }
|
|
|
|
- if(value.contains(imagePath)){
|
|
|
|
- newMap.put(key, value.replace(imagePath, imgViewPath));
|
|
|
|
- }
|
|
|
|
- if(value.contains(videoPath)){
|
|
|
|
- newMap.put(key, value.replace(videoPath, videosViewPath));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return newMap;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
private JSONObject getVideosJson(String path, Integer videoVersion, String projectNum, int cameraType) throws Exception {
|
|
private JSONObject getVideosJson(String path, Integer videoVersion, String projectNum, int cameraType) throws Exception {
|
|
//读取videos_hdr_param.json, 保存点位视频的value
|
|
//读取videos_hdr_param.json, 保存点位视频的value
|
|
Map<String, Object> videoMap = new HashMap<>();
|
|
Map<String, Object> videoMap = new HashMap<>();
|
|
@@ -712,82 +699,4 @@ public class BuildScenePostServiceImpl implements IBuildScenePostService {
|
|
hourseTypeJsonPath = String.format(UploadFilePath.DATA_EDIT_PATH, num) + "houseType.json";
|
|
hourseTypeJsonPath = String.format(UploadFilePath.DATA_EDIT_PATH, num) + "houseType.json";
|
|
fYunFileService.uploadFile(json.toJSONString().getBytes(), hourseTypeJsonPath);
|
|
fYunFileService.uploadFile(json.toJSONString().getBytes(), hourseTypeJsonPath);
|
|
}
|
|
}
|
|
-
|
|
|
|
- private JSONArray[] createHouseTypeJsonHandler(JSONObject floor){
|
|
|
|
-
|
|
|
|
- JSONArray[] result = new JSONArray[2];
|
|
|
|
-
|
|
|
|
- //处理点
|
|
|
|
- Map<Integer, VertexBean> vertexMap = new HashMap<>();
|
|
|
|
- Map<String, PointBean> pointMap = new HashMap<>();
|
|
|
|
- Map<Integer, String> vpMap = new HashMap<>();
|
|
|
|
- JSONArray vertexArr = floor.getJSONArray("vertex-xy");
|
|
|
|
- for(int i = 0; i < vertexArr.size(); i++){
|
|
|
|
- Object o = vertexArr.get(i);
|
|
|
|
-
|
|
|
|
- VertexBean vertexBean = JSON.parseObject(JSON.toJSONString(o), VertexBean.class);
|
|
|
|
- Integer vertexId = vertexBean.getId();
|
|
|
|
- vertexMap.put(vertexId, vertexBean);
|
|
|
|
-
|
|
|
|
- String pointId = "Point" + i;
|
|
|
|
- pointMap.put(pointId, PointBean.builder().vectorId(pointId).x(vertexBean.getX()).y(vertexBean.getY()).build());
|
|
|
|
-
|
|
|
|
- vpMap.put(vertexId, pointId);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //处理墙
|
|
|
|
- Map<Integer, SegmentBean> segmentMap = new HashMap<>();
|
|
|
|
- Map<String, WallBean> wallMap = new HashMap<>();
|
|
|
|
- Map<Integer, String> swMap = new HashMap<>();
|
|
|
|
- JSONArray segmentArr = floor.getJSONArray("segment");
|
|
|
|
- Map<String, String> startMap = new HashMap<>();
|
|
|
|
- Map<String, String> endMap = new HashMap<>();
|
|
|
|
- for(int i = 0; i < segmentArr.size(); i++){
|
|
|
|
- Object o = segmentArr.get(i);
|
|
|
|
-
|
|
|
|
- SegmentBean segmentBean = JSON.parseObject(JSON.toJSONString(o), SegmentBean.class);
|
|
|
|
- String startPointId = vpMap.get(segmentBean.getA());
|
|
|
|
- String endPointId = vpMap.get(segmentBean.getB());
|
|
|
|
- segmentBean.setStartPointId(startPointId);
|
|
|
|
- segmentBean.setEndPointId(endPointId);
|
|
|
|
-
|
|
|
|
- Integer segmentId = segmentBean.getId();
|
|
|
|
- segmentMap.put(segmentId, segmentBean);
|
|
|
|
-
|
|
|
|
- String wallId = "Wall" + i;
|
|
|
|
- WallBean wallBean = WallBean.builder()
|
|
|
|
- .vectorId(wallId)
|
|
|
|
- .start(segmentBean.getStartPointId())
|
|
|
|
- .end(segmentBean.getEndPointId())
|
|
|
|
- .children(new String[]{})
|
|
|
|
- .width(0.2d)
|
|
|
|
- .build();
|
|
|
|
- wallMap.put(wallId, wallBean);
|
|
|
|
-
|
|
|
|
- startMap.put(wallBean.getStart(), wallBean.getVectorId());
|
|
|
|
- endMap.put(wallBean.getEnd(), wallBean.getVectorId());
|
|
|
|
-
|
|
|
|
- swMap.put(segmentId, wallId);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- Collection<PointBean> pointBeans = pointMap.values();
|
|
|
|
- for (PointBean pointBean : pointBeans) {
|
|
|
|
- Map<String, String> parent = new HashMap<>();
|
|
|
|
- String startParent = startMap.get(pointBean.getVectorId());
|
|
|
|
- String endParent = endMap.get(pointBean.getVectorId());
|
|
|
|
- parent.put(startParent, "start");
|
|
|
|
- parent.put(endParent, "end");
|
|
|
|
- pointBean.setParent(parent);
|
|
|
|
- }
|
|
|
|
- JSONArray pointArr = JSON.parseArray(JSON.toJSONString(pointBeans));
|
|
|
|
- result[0] = pointArr;
|
|
|
|
-
|
|
|
|
- Collection<WallBean> wallBeans = wallMap.values();
|
|
|
|
- JSONArray wallArr = JSON.parseArray(JSON.toJSONString(wallBeans));
|
|
|
|
- result[1] = wallArr;
|
|
|
|
-
|
|
|
|
- return result;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
}
|
|
}
|