From afd2fec8f33c5475c9a439f9dd5fc4b52a529425 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期二, 17 三月 2026 21:31:46 +0800
Subject: [PATCH] 修改订单bug

---
 xp-robotaxi-itinerary-boot/src/main/java/com/xiaopeng/itinerary/service/impl/XpPricingServiceImpl.java |   26 +++++++++++++-------------
 xp-robotaxi-order-boot/src/main/java/com/xiaopeng/order/service/impl/XpOrderServiceImpl.java           |   15 +++++----------
 xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpPricingServiceImpl.java |    1 +
 3 files changed, 19 insertions(+), 23 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 532ac71..4329ea3 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
@@ -183,16 +183,16 @@
 
     @Override
     public RouteAndFareVo getRouteAndFare(RouteAndFareDto routeAndFareDto, String userId) {
-        // 判断是否5分钟内进行了查询 相同站点的起始点  并且是同时段
-        String key = "xp-map-query-" + routeAndFareDto.getOpenCityId()
-                + "-" + routeAndFareDto.getOrigin().getLongitude() + "-" + routeAndFareDto.getOrigin().getLatitude()
-                + "-" + routeAndFareDto.getDestination().getLongitude() + "-" + routeAndFareDto.getDestination().getLatitude() + "-" + getCurrentTimeSlot() + "-" + userId+routeAndFareDto.getUserCouponId();
-
-        if (redisService.hasKey(key)) {
-            String jsonStr = Objects.requireNonNull(redisService.getCacheObject(key)).toString();
-            RouteAndFareVo RouteAndFareVo = JSONObject.parseObject(jsonStr, RouteAndFareVo.class);
-            return (RouteAndFareVo);
-        }
+//        // 判断是否5分钟内进行了查询 相同站点的起始点  并且是同时段
+//        String key = "xp-map-query-" + routeAndFareDto.getOpenCityId()
+//                + "-" + routeAndFareDto.getOrigin().getLongitude() + "-" + routeAndFareDto.getOrigin().getLatitude()
+//                + "-" + routeAndFareDto.getDestination().getLongitude() + "-" + routeAndFareDto.getDestination().getLatitude() + "-" + getCurrentTimeSlot() + "-" + userId+routeAndFareDto.getUserCouponId();
+//
+//        if (redisService.hasKey(key)) {
+//            String jsonStr = Objects.requireNonNull(redisService.getCacheObject(key)).toString();
+//            RouteAndFareVo RouteAndFareVo = JSONObject.parseObject(jsonStr, RouteAndFareVo.class);
+//            return (RouteAndFareVo);
+//        }
 
         // 1. 基础数据查询
         Map<String, String> geocode = gdMapGeocodingUtil.geocode(routeAndFareDto.getOrigin().getLongitude().toString(), routeAndFareDto.getOrigin().getLatitude().toString());
@@ -387,9 +387,9 @@
         routeAndFareVo.getXpPricingCard().setFinalFareStr(fareVo.getFinalFareStr());
 
 
-        String voJsonStr = JSONObject.toJSONString(routeAndFareVo);
-        // 进行缓存
-        redisService.setCacheObject(key, voJsonStr, 5l, TimeUnit.MINUTES);
+//        String voJsonStr = JSONObject.toJSONString(routeAndFareVo);
+//         进行缓存
+//        redisService.setCacheObject(key, voJsonStr, 5l, TimeUnit.MINUTES);
         //缓存导航数据,用于下单后推送导航给车端和乘客端
         redisService.setCacheObject("ORDER_NAVIGATION_END_DATA:" + userId, JSON.toJSONString(routeVo), 24L, TimeUnit.HOURS);
         return routeAndFareVo;
diff --git a/xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpPricingServiceImpl.java b/xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpPricingServiceImpl.java
index 18caae1..04db3a3 100644
--- a/xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpPricingServiceImpl.java
+++ b/xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpPricingServiceImpl.java
@@ -173,6 +173,7 @@
 
 
     @Override
+    @Deprecated
     public RouteAndFareVo getRouteAndFare(RouteAndFareDto routeAndFareDto, String userId) {
 
 
diff --git a/xp-robotaxi-order-boot/src/main/java/com/xiaopeng/order/service/impl/XpOrderServiceImpl.java b/xp-robotaxi-order-boot/src/main/java/com/xiaopeng/order/service/impl/XpOrderServiceImpl.java
index 0d2bc54..e707695 100644
--- a/xp-robotaxi-order-boot/src/main/java/com/xiaopeng/order/service/impl/XpOrderServiceImpl.java
+++ b/xp-robotaxi-order-boot/src/main/java/com/xiaopeng/order/service/impl/XpOrderServiceImpl.java
@@ -1487,7 +1487,6 @@
         List<FareBreakdownDetailVo> longDistance = new ArrayList<>();
         XpOrder order = this.getById(orderId);
 
-        Long orderAppUserId = order.getAppUserId();
         if (order == null) {
             throw new RuntimeException("订单不存在");
         }
@@ -1542,7 +1541,7 @@
 
             com.alibaba.fastjson.JSONObject basicPricingJson = com.alibaba.fastjson.JSONObject.parseObject(pricing.getBasicPricingJson());
 
-            XpPricingCardVo xpPricingCardVo = xpPricingUtil.calculationFixedPrice(orderAppUserId.toString(), basicPricingJson, null, mileageKilometers, duration1, 0, 0.0, pricing.getIsDynamicPrice(), order.getCityId(), pricing.getDynamicPricingJson());
+            XpPricingCardVo xpPricingCardVo = xpPricingUtil.calculationFixedPrice(uid, basicPricingJson, null, mileageKilometers, duration1, 0, 0.0, pricing.getIsDynamicPrice(), order.getCityId(), pricing.getDynamicPricingJson());
             XpOrderDetail xpOrderDetail = new XpOrderDetail();
             xpOrderDetail.setDetailType(1);
             xpOrderDetail.setOrderId(orderId);
@@ -2363,13 +2362,9 @@
             order.setTripEnd(tripEnd);
             this.updateById(order);
         }
-        // 计算行程时间 单位分钟
-        // 计算时间差
-        Duration durationBetween = Duration.between(createTime, tripEnd);
 
-        // 转换为秒并保留一位小数
-        BigDecimal minutes = BigDecimal.valueOf(durationBetween.getSeconds());
-        res.setTime(minutes);
+        double exactMinutes = Duration.between(order.getBoardingTime(), order.getTripEnd()).toMillis() / (1000.0 * 60);
+        res.setTime(new BigDecimal(exactMinutes).setScale(2, RoundingMode.HALF_UP));
         return R.ok(res);
     }
 
@@ -2517,8 +2512,8 @@
         } else {
             orderDetailVo.setOrderTime(0.0);
         }
-        orderDetailVo.setTotalMileage(order.getMileageKilometers() != null ? new BigDecimal(order.getMileageKilometers()).setScale(2, RoundingMode.HALF_UP).doubleValue() : 0D);
-
+        orderDetailVo.setTotalMileage(order.getMileageKilometers() != null ? new BigDecimal(order.getMileageKilometers() * 1000).setScale(2, RoundingMode.HALF_UP).doubleValue() : 0D);
+        orderDetailVo.setOrderTime(new BigDecimal(null == order.getDuration() ? 0 : order.getDuration()).multiply(new BigDecimal(60)).setScale(0, RoundingMode.HALF_EVEN).doubleValue());
         return orderDetailVo;
     }
 

--
Gitblit v1.7.1