From b8100f505a42a3622a865ee44d4b150cfc461bbb Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期三, 04 二月 2026 21:04:08 +0800
Subject: [PATCH] 小程序接口 冒泡页面部分
---
xp-service/xp-operation/src/main/java/com/xiaopeng/operation/service/impl/XpPricingServiceImpl.java | 47 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/xp-service/xp-operation/src/main/java/com/xiaopeng/operation/service/impl/XpPricingServiceImpl.java b/xp-service/xp-operation/src/main/java/com/xiaopeng/operation/service/impl/XpPricingServiceImpl.java
index 2501250..b29f4ea 100644
--- a/xp-service/xp-operation/src/main/java/com/xiaopeng/operation/service/impl/XpPricingServiceImpl.java
+++ b/xp-service/xp-operation/src/main/java/com/xiaopeng/operation/service/impl/XpPricingServiceImpl.java
@@ -1,11 +1,20 @@
package com.xiaopeng.operation.service.impl;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xiaopeng.api.dto.map.RouteAndFareDto;
+import com.xiaopeng.api.feignClient.map.XpMapClient;
+import com.xiaopeng.api.vo.map.XpDistanceAndDurationVo;
+import com.xiaopeng.common.core.domain.R;
import com.xiaopeng.operation.mapper.XpPricingMapper;
import com.xiaopeng.api.model.operation.XpPricing;
import com.xiaopeng.operation.service.XpPricingService;
+import com.xiaopeng.operation.utils.XpPricingUtil;
+import com.xiaopeng.api.vo.operation.RouteAndFareVo;
import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
/**
* <p>
@@ -18,4 +27,42 @@
@Service
public class XpPricingServiceImpl extends ServiceImpl<XpPricingMapper, XpPricing> implements XpPricingService {
+
+ @Resource
+ private XpPricingUtil xpPricingUtil;
+
+ @Resource
+ private XpMapClient xpMapClient;
+
+
+ @Override
+ public RouteAndFareVo getRouteAndFare(RouteAndFareDto routeAndFareDto) {
+ XpPricing xpPricing = this.baseMapper.selectOne(new LambdaQueryWrapper<XpPricing>().eq(XpPricing::getCityId, routeAndFareDto.getOpenCityId()));
+ if(xpPricing==null){
+ // 抛出异常
+ throw new RuntimeException("当前区域未开通服务");
+ }
+
+ // 判断2个点是否在同一个经营区域
+ R<Boolean> r = xpMapClient.diagnosisArea(routeAndFareDto);
+ if(r.getCode()!=R.SUCCESS){
+ // 抛出异常
+ throw new RuntimeException(r.getMsg());
+ }
+
+ if(!r.getData()){
+ // 抛出异常
+ throw new RuntimeException("当前区域未开通服务");
+ }
+
+
+ // 调用地图
+ R<XpDistanceAndDurationVo> distanceAndDuration = xpMapClient.getDistanceAndDuration(routeAndFareDto);
+
+
+ xpPricingUtil.calculationPrice(xpPricing.getBasicPricingJson(), xpPricing.getStartingFareJson(), routeAndFareDto.getDistance(), routeAndFareDto.getDuration(), routeAndFareDto.getWait(), routeAndFareDto.getWaitMoney())
+
+
+ return null;
+ }
}
--
Gitblit v1.7.1