From 85c7bf4c62b4863ac187f496119282337491e3da Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期二, 10 三月 2026 09:14:46 +0800
Subject: [PATCH] 合并代码
---
xp-robotaxi-automatic-pilot-boot/src/main/java/com/xiaopeng/automaticPilot/service/KafkaConsumerService.java | 38 ++++++++++++++++++++------------------
1 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/xp-robotaxi-automatic-pilot-boot/src/main/java/com/xiaopeng/automaticPilot/service/KafkaConsumerService.java b/xp-robotaxi-automatic-pilot-boot/src/main/java/com/xiaopeng/automaticPilot/service/KafkaConsumerService.java
index b274609..0139579 100644
--- a/xp-robotaxi-automatic-pilot-boot/src/main/java/com/xiaopeng/automaticPilot/service/KafkaConsumerService.java
+++ b/xp-robotaxi-automatic-pilot-boot/src/main/java/com/xiaopeng/automaticPilot/service/KafkaConsumerService.java
@@ -422,15 +422,15 @@
log.info("订单的任务未开始执行");
break;
case ROUTE_TO_PICKUP:
- log.info("驶往上车点的行程");
+ log.info("驶往上车点的行程 {}", orderId);
buildNaviRequest(requestId, orderId, orderPhase, msgContent.getHeader().getSequence());
break;
case ROUTE_TO_DESTINATION:
- log.info("驶往下车点的行程");
+ log.info("驶往下车点的行程 {}", orderId);
buildNaviRequest(requestId, orderId, orderPhase, msgContent.getHeader().getSequence());
break;
case ROUTE_TO_CRUISE:
- log.info("巡游阶段路线");
+ log.info("巡游阶段路线 {}", orderId);
buildNaviRequest(requestId, orderId, orderPhase, msgContent.getHeader().getSequence());
break;
}
@@ -467,7 +467,7 @@
LonLatDto origin = new LonLatDto();
if (orderId.contains("XU")) {
- orderType = OrderType.CRUISE_ORDER;
+// orderType = OrderType.CRUISE_ORDER;
R<XpCruiseOrder> cruiseOrder = xpCruiseOrderClient.getCruiseOrder(orderId);
XpCruiseOrder xpCruiseOrder = cruiseOrder.getData();
@@ -484,17 +484,18 @@
dto.setOrderId(Long.parseLong(orderId));
dto.setOrigin(origin);
dto.setDestination(destination);
+ dto.setRouteType(3);
R<RouteVo> routeVoR = xpMapClient.getOrderDistanceAndDuration(dto);
if (200 != routeVoR.getCode()) {
throw new RuntimeException("获取订单线路和运费失败");
}
RouteVo routeVo = routeVoR.getData();
- routeID = routeVo.getRouteID();
+// routeID = routeVo.getRouteID();
- vehicleId = xpCruiseOrder.getVehicleId();
+// vehicleId = xpCruiseOrder.getVehicleId();
} else {
- orderType = OrderType.USER_ORDER;
+// orderType = OrderType.USER_ORDER;
//正常单
R<XpOrder> xpOrderR = xpOrderClient.queryOrderById(Long.parseLong(orderId));
if (200 != xpOrderR.getCode()) {
@@ -516,12 +517,13 @@
dto.setOrderId(Long.parseLong(orderId));
dto.setOrigin(origin);
dto.setDestination(destination);
+ dto.setRouteType(1);
R<RouteVo> routeVoR = xpMapClient.getOrderDistanceAndDuration(dto);
if (200 != routeVoR.getCode()) {
throw new RuntimeException("获取订单线路和运费失败");
}
RouteVo routeVo = routeVoR.getData();
- routeID = routeVo.getRouteID();
+// routeID = routeVo.getRouteID();
//缓存数据,用于后续推给乘客导航线路
redisService.setCacheObject("ORDER_NAVIGATION_START_DATA:" + xpOrder.getAppUserId(), JSON.toJSONString(routeVo), 24L, TimeUnit.HOURS);
}
@@ -536,16 +538,17 @@
dto.setOrderId(Long.parseLong(orderId));
dto.setOrigin(origin);
dto.setDestination(destination);
+ dto.setRouteType(2);
R<RouteVo> routeVoR = xpMapClient.getOrderDistanceAndDuration(dto);
if (200 != routeVoR.getCode()) {
throw new RuntimeException("获取订单线路和运费失败");
}
RouteVo routeVo = routeVoR.getData();
- routeID = routeVo.getRouteID();
+// routeID = routeVo.getRouteID();
//缓存导航数据,用于后面的逻辑中给乘客端推送导航数据
redisService.setCacheObject("ORDER_NAVIGATION_END_DATA:" + xpOrder.getAppUserId(), com.alibaba.fastjson.JSON.toJSONString(routeVo), 24L, TimeUnit.HOURS);
}
- vehicleId = xpOrder.getVehicleId();
+// vehicleId = xpOrder.getVehicleId();
}
// TODO 在请求导航哪里返回导航数据
@@ -594,6 +597,7 @@
dto.setOrderId(Long.parseLong(orderId));
dto.setOrigin(origin);
dto.setDestination(destination);
+ dto.setRouteType(3);
R<RouteVo> routeVoR = xpMapClient.getOrderDistanceAndDuration(dto);
if (200 != routeVoR.getCode()) {
throw new RuntimeException("获取订单线路和运费失败");
@@ -609,7 +613,7 @@
//正常单
R<XpOrder> xpOrderR = xpOrderClient.queryOrderById(Long.parseLong(orderId));
if (200 != xpOrderR.getCode()) {
- throw new RuntimeException("订单不存在");
+ throw new RuntimeException("订单不存在 " + orderId);
}
XpOrder xpOrder = xpOrderR.getData();
XpVehicle xpVehicle = xpVehicleClient.queryById(xpOrder.getVehicleId()).getData();
@@ -630,6 +634,7 @@
dto.setOrderId(Long.parseLong(orderId));
dto.setOrigin(origin);
dto.setDestination(destination);
+ dto.setRouteType(1);
R<RouteVo> routeVoR = xpMapClient.getOrderDistanceAndDuration(dto);
if (200 != routeVoR.getCode()) {
throw new RuntimeException("获取订单线路和运费失败");
@@ -654,6 +659,7 @@
dto.setOrderId(Long.parseLong(orderId));
dto.setOrigin(origin);
dto.setDestination(destination);
+ dto.setRouteType(2);
R<RouteVo> routeVoR = xpMapClient.getOrderDistanceAndDuration(dto);
if (200 != routeVoR.getCode()) {
throw new RuntimeException("获取订单线路和运费失败");
@@ -671,11 +677,13 @@
}
if(StringUtils.isNotEmpty(routeID)){
+ log.info("开始推送导航信息 {}", orderId);
XpVehicle xpVehicle = xpVehicleClient.queryById(vehicleId).getData();
R<String> stringR = xpMapClient.queryRouted(routeID);
if (200 != stringR.getCode()) {
throw new RuntimeException("根据导航ID获取车端需要的导航数据失败");
}
+ log.info("根据导航ID获取车端需要的导航数据 订单 {} 导航数据 {}", orderId, stringR.getData());
//构建导航下发请求对象
cloudPushNavigationInfo(requestId, routeID, stringR.getData(), orderType, orderId, xpVehicle.getVehicleVin(), xpVehicle.getXpuId());
}
@@ -1027,13 +1035,7 @@
SnowFlake snowFlake = new SnowFlake(0, 0);
snowFlake.withStartTimestamp(1420041600000L);
long sequence = snowFlake.nextId();
- // 处理数据
- JSONObject jsonObject = new JSONObject();
- jsonObject.put("event", SystemEventType.PUSH_NAVIGATION);
- jsonObject.put("orderType", orderType);
- jsonObject.put("orderId", orderId);
- jsonObject.put("vin", vin);
- redisTemplate.opsForValue().set(sequence, jsonObject.toJSONString(),30, TimeUnit.MINUTES);
+ log.info("开始推送导航数据 {}", orderId);
MqttPublishDto mqttPublishDto = xpuUtil.cloudPushNavigation(navigationDataBuilder.build(), xpuId, sequence);
log.info("推送导航的响应消息,{}", JSON.toJSONString(mqttPublishDto));
}
--
Gitblit v1.7.1