From 759c5b1cad51c74c590135ebadbfb410731dcd10 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期六, 14 二月 2026 16:55:57 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpPricingServiceImpl.java |   57 ++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 50 insertions(+), 7 deletions(-)

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 a3964c5..85c8f7d 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
@@ -36,6 +36,7 @@
 import com.xiaopeng.operation.mapper.*;
 import com.xiaopeng.operation.query.PricingPageListQuery;
 import com.xiaopeng.operation.service.IXpGeoQueryEntityService;
+import com.xiaopeng.operation.service.XpPointService;
 import com.xiaopeng.operation.service.XpPricingService;
 import com.xiaopeng.operation.utils.XpPricingUtil;
 import com.xiaopeng.operation.utils.holiday.HolidayUtil;
@@ -48,6 +49,7 @@
 import javax.annotation.PreDestroy;
 import javax.annotation.Resource;
 import java.time.LocalDateTime;
+import java.time.LocalTime;
 import java.util.*;
 import java.util.concurrent.*;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -97,9 +99,6 @@
 
 
     @Resource
-    private XpPointMapper xpPointMapper;
-
-    @Resource
     private XpWhitelistMapper xpWhitelistMapper;
 
     @Resource
@@ -113,6 +112,9 @@
 
     @Autowired
     private XpElectronicFenceMapper xpElectronicFenceMapper;
+
+    @Autowired
+    private XpPointService xpPointService;
 
 
     // 自定义线程池用于并行执行任务
@@ -202,7 +204,7 @@
 //            throw new ServiceException("当前区域未开通服务", I18nKeyConstant.NO_CURRENT_REGION);
 //        }
 
-        // 2. 计算价格(需要在并行任务前完成,因为优惠券查询需要价格)
+        // 2. 计算价格(需要在并行任务前完成,因为优惠券查询需要价格) TODO 判断是动态还是一口价
 //        XpPricingCardVo xpPricingCardVo = xpPricingUtil.calculationPrice(
 //                JSON.parseObject(xpPricing.getBasicPricingJson()),
 //                JSON.parseArray(xpPricing.getStartingFareJson()),
@@ -278,7 +280,33 @@
 
         // 8. 构建响应对象
         RouteAndFareVo routeAndFareVo = new RouteAndFareVo();
-//        routeAndFareVo.setRoute(routeVo);
+
+        // 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);
@@ -370,6 +398,9 @@
 
     @Override
     public Long saveOrder(XpOrderDto dto, String uid) {
+
+
+
         // 是否在运营区域时间内
         XpElectronicFenceArea xpElectronicFenceArea = xpElectronicFenceAreaMapper.selectById(dto.getXpElectronicFenceAreaId());
         XpElectronicFence xpElectronicFence = xpElectronicFenceMapper.selectById(xpElectronicFenceArea.getElectronicId());
@@ -388,10 +419,21 @@
         }
 
         // 获取起点经纬度
-        XpPoint xpPoint = xpPointMapper.selectById(dto.getStartPointId());
+        XpPoint xpPoint = xpPointService.getById(dto.getStartPointId());
 
         // 终点
-        XpPoint endXpPoint = xpPointMapper.selectById(dto.getStartPointId());
+        XpPoint endXpPoint = xpPointService.getById(dto.getStartPointId());
+
+        // 判断点位是否在运营区域内
+        LocalTime now = LocalTime.now();
+        boolean inTime = xpPointService.getInTime(now, xpPoint.getEffectivePeriod(), xpPoint.getEffectiveTimePeriod());
+        if(!inTime){
+            throw new ServiceException("当前点位未开通服务", I18nKeyConstant.NO_CURRENT_REGION);
+        }
+        inTime = xpPointService.getInTime(now, endXpPoint.getEffectivePeriod(), endXpPoint.getEffectiveTimePeriod());
+        if(!inTime){
+            throw new ServiceException("当前点位未开通服务", I18nKeyConstant.NO_CURRENT_REGION);
+        }
 
         // 判断当天取消的次数 后台配置 redis 查询
         Object cancelOrder = redisService.getCacheObject("CANCEL_ORDER_" + uid);
@@ -575,6 +617,7 @@
     }
 
 
+
     private Boolean isInOperationTime(String operationStrategy) {
         JSONArray jsonArray = JSONArray.parseArray(operationStrategy);
         Integer holidayToday = holidayUtil.isHolidayToday();

--
Gitblit v1.7.1