From 4e6453cc91184f149530a22c3015085a04c74b30 Mon Sep 17 00:00:00 2001
From: “mitao” <“2763622819@qq.com”>
Date: 星期六, 14 三月 2026 23:27:11 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 xp-robotaxi-itinerary-boot/src/main/java/com/xiaopeng/itinerary/service/impl/XpPricingServiceImpl.java |   74 ++++--------------------------------
 1 files changed, 9 insertions(+), 65 deletions(-)

diff --git a/xp-robotaxi-itinerary-boot/src/main/java/com/xiaopeng/itinerary/service/impl/XpPricingServiceImpl.java b/xp-robotaxi-itinerary-boot/src/main/java/com/xiaopeng/itinerary/service/impl/XpPricingServiceImpl.java
index 87a4b3a..db69b44 100644
--- a/xp-robotaxi-itinerary-boot/src/main/java/com/xiaopeng/itinerary/service/impl/XpPricingServiceImpl.java
+++ b/xp-robotaxi-itinerary-boot/src/main/java/com/xiaopeng/itinerary/service/impl/XpPricingServiceImpl.java
@@ -217,7 +217,7 @@
         }
 
 
-//        // 算距离
+        // 算距离
         R<RouteVo> distanceAndDuration = xpMapClient.getDistanceAndDuration(routeAndFareDto);
         if (distanceAndDuration.getCode() != 200) {
             throw new ServiceException("获取导肮信息失败", I18nKeyConstant.PATH_NOT_FOUND);
@@ -310,35 +310,7 @@
 
         // 8. 构建响应对象
         RouteAndFareVo routeAndFareVo = new RouteAndFareVo();
-
-        // MOCK数据
-//        RouteVo routeVo = new RouteVo();
-//        routeVo.setDistance(3000);
-//        routeVo.setDuration(5);
-//        routeVo.setRouteID("1");
-//        List<LonLatDto> routePolyline = Arrays.asList(
-//                // 起点:天府新谷
-//                new LonLatDto(104.05363, 30.58937),
-//
-//                // 途经点1:府城大道与交子北二路交叉口附近
-//                new LonLatDto(104.05821, 30.58745),
-//
-//                // 途经点2:交子大道与成汉南路交叉口
-//                new LonLatDto(104.06418, 30.58492),
-//
-//                // 途经点3:交子大道与万象南路交叉口
-//                new LonLatDto(104.06975, 30.58321),
-//
-//                // 途经点4:交子大道与益州大道交叉口
-//                new LonLatDto(104.07366, 30.58198),
-//
-//                // 终点:金融城(地铁站附近)
-//                new LonLatDto(104.076544, 30.581039)
-//        );
-//        routeVo.setPolyline(routePolyline);
         routeAndFareVo.setRoute(routeVo);
-
-
         routeAndFareVo.setXpPricingCard(xpPricingCardVo);
 
         FareVo fareVo = new FareVo();
@@ -393,8 +365,6 @@
         redisService.setCacheObject(key, voJsonStr, 5l, TimeUnit.MINUTES);
         //缓存导航数据,用于下单后推送导航给车端和乘客端
         redisService.setCacheObject("ORDER_NAVIGATION_END_DATA:" + userId, JSON.toJSONString(routeVo), 24L, TimeUnit.HOURS);
-
-
         return routeAndFareVo;
     }
 
@@ -562,18 +532,6 @@
         xpOrder.setCreateTime(LocalDateTime.now());
 
 
-        // 计算距离 和 时间
-        RouteAndFareDto routeAndFareDto = new RouteAndFareDto();
-        LonLatDto lonLatDto = new LonLatDto();
-        lonLatDto.setLongitude(xpPoint.getPointLon());
-        lonLatDto.setLatitude(xpPoint.getPointLat());
-        routeAndFareDto.setOrigin(lonLatDto);
-
-        LonLatDto lonLatDto1 = new LonLatDto();
-        lonLatDto1.setLongitude(endXpPoint.getPointLon());
-        lonLatDto1.setLatitude(endXpPoint.getPointLat());
-        routeAndFareDto.setDestination(lonLatDto1);
-
         XpOpenCity openCities = xpOpenCityMapper.selectById(dto.getOpenCityId());
         if (openCities == null) {
             throw new ServiceException("获取城市信息失败", I18nKeyConstant.CITY_NOT_FOUND);
@@ -582,18 +540,15 @@
         dto.setOpenCityId(xpOpenCity.getId());
         xpOrder.setCityCode(xpOpenCity.getCityCode());
         XpRoutePlan xpRoutePlan = xpRoutePlanMapper.selectOne(new LambdaQueryWrapper<XpRoutePlan>().eq(XpRoutePlan::getAuditStatus, 2).eq(XpRoutePlan::getCityCode, xpOpenCity.getCityCode()));
-        if (xpRoutePlan != null) {
-            routeAndFareDto.setRoutePlanRule(xpRoutePlan.getRoutePlanRule());
-        }
-        R<RouteVo> distanceAndDuration = xpMapClient.getDistanceAndDuration(routeAndFareDto);
+
         Integer distance = 0;
         Integer duration = 0;
-        if (distanceAndDuration.getCode() != 200) {
-//            throw new ServiceException("订单生成失败", I18nKeyConstant.ORDER_CREATE_FAIL);
+        Object cacheObject = redisService.getCacheObject("ORDER_NAVIGATION_END_DATA:" + uid);
+        if (cacheObject != null) {
+            RouteVo routeVo = JSON.parseObject(cacheObject.toString(), RouteVo.class);
+            distance = routeVo.getDistance();
+            duration = routeVo.getDuration();
         }
-//        distance = distanceAndDuration.getData().getDistance();
-//        duration = distanceAndDuration.getData().getDuration();
-
 
         // 产生订单
         R<Long> addOrderR = xpOrderClient.addOrder(xpOrder);
@@ -626,7 +581,7 @@
             // 和上车点进行判断是否<maxPushDistance
             double v = FastDistanceCalculator.distanceFast(Double.parseDouble(lonLat.split(",")[1]), Double.parseDouble(lonLat.split(",")[0]), xpPoint.getPointLat(), xpPoint.getPointLon());
             if (v < maxPushDistance) {
-                String value = orderId + "_" + xpPoint.getPointLon() + "," + xpPoint.getPointLat() + "_0" + "_" + uid + "_" + xpOrder.getOrderNumber() + "_" + distance + "_" + duration + "_" + routeAndFareDto.getRoutePlanRule();
+                String value = orderId + "_" + xpPoint.getPointLon() + "," + xpPoint.getPointLat() + "_0" + "_" + uid + "_" + xpOrder.getOrderNumber() + "_" + distance + "_" + duration + "_" + xpRoutePlan.getRoutePlanRule();
                 if (isPriorityDispatch) {
                     // 头部  value 订单_经纬度_状态_用户id_订单编号_距离_时间
                     redisService.addToHead(s, value);
@@ -654,7 +609,7 @@
         }
 
         String key = CacheConstants.QUEUE_POINT_ID + "-" + xpPoint.getId() + "-" + xpPoint.getPointLon() + "," + xpPoint.getPointLat();
-        redisService.setCacheList(key, Arrays.asList(orderId + "_" + xpPoint.getPointLon() + "," + xpPoint.getPointLat() + "_0" + "_" + uid + "_" + xpOrder.getOrderNumber() + "_" + distance + "_" + duration + "_" + routeAndFareDto.getRoutePlanRule()));
+        redisService.setCacheList(key, Arrays.asList(orderId + "_" + xpPoint.getPointLon() + "," + xpPoint.getPointLat() + "_0" + "_" + uid + "_" + xpOrder.getOrderNumber() + "_" + distance + "_" + duration + "_" + xpRoutePlan.getRoutePlanRule()));
         log.info("订单推单:{}   {}", key, redisService.getCacheList(key));
         xpOrder.setQueueName(key);
         xpOrderClient.updateOrder(xpOrder);
@@ -670,17 +625,6 @@
         xpGeoQueryEntity.setTimestamp(System.currentTimeMillis());
         geoQueryEntityService.save(xpGeoQueryEntity);
         return orderId.toString();
-
-//
-//        XpElectronicFenceArea xpElectronicFenceArea = xpElectronicFenceAreaMapper.selectById(dto.getXpElectronicFenceAreaId());
-//        // 获取电子围栏的车辆
-//        R<List<XpVehicle>> vehicles = xpVehicleClient.listByFenceId(xpElectronicFenceArea.getElectronicId());
-//
-
-
-        // 产生订单  存订单数据  // 下发指令  消息推送用户端
-//        return null;
-
     }
 
 

--
Gitblit v1.7.1