map-api-usage.md 3.0 KB

地图功能使用现状

面向后端维护者的地图能力清单。2026-09-29 起,百度、Mapbox 的外部接口已标记停用:代码保留、行为未变,仅加注解与本文记录,禁止新增调用。

外部地图服务状态

服务 能力 封装位置 状态
Google Directions 路线 GetArea.getluxian → /utils/getluxianjvli 在用(key 硬编码,切换计划中作废)
Google Nearby/Geocoding 逆地理 GetArea.getgoogle / getgoogleadd → /utils/getLocationAddr(type=1)、/utils/getAddr 在用(key 硬编码)
Google Routes API v2 GoogleRoutesDistanceProvider(闪送报价距离) 在用(key 走字典 sys_googlemap_key)
Mapbox Directions cycling GetArea.getmpluxian → /utils/getluxianjvliMp 已停用(@Deprecated,端点保留)
Mapbox Directions driving 耗时 GetArea.getMotorbikeDuration 已停用(见下方存量调用点)
百度 逆地理 reverse_geocoding GetArea.getarearess → /utils/getLocationAddr(type=0) 已停用(分支保留兜底)
百度 坐标转换 geoconv GetArea.setlatlng → /utils/setLocat 已停用(端点保留)

不依赖外部地图的能力(纯数学 / 纯 DB)

能力 位置 实现
外卖运费估算 /utils/getyunfei GetJvli.getDistance Haversine 直线 + pos_freight 跳表
打车计价 TaxiPricesController /ganyunfei 直线距离 + taxi_prices 表
两点距离 UserOrderController /getDistance、GetArea.getDistance Haversine 纯数学
GCJ02→WGS84 /utils/GCJ2TOWGS 纯数学转换
地址簿最近地址 /system/address/getzuijinaddress DB 排序
骑手派单 / 附近订单 PosOrderMapper.getqisjvli / getstate MySQL st_distance DB 半径
闪送报价兜底 FlashDeliveryRouteService Google 路线失败时直线距离 + distanceSource=STRAIGHT_LINE 落库

存量调用点警示

  • PosOrderController.setYjsdTime(state=4 订单的预计送达时间,调用方为改单状态取餐分支与测试端点 /testYjsdTime)已停用(2026-09-29 标记):方法不再使用,保留调用不影响状态流转;其依赖的 getMotorbikeDuration(Mapbox driving ×1.5)因此实际无在用调用。切自部署路线源(032)时可一并清理。
  • /utils/getLocationAddr 的 type=0 百度分支保留兜底;App 端应使用 type=1 谷歌分支。
  • GetJvli.getOptimalRoute(Google Routes v2)全库无调用方,属死代码,不在本次标注范围。
  • GetArea/GetJvli 硬编码的 Google key 与 Mapbox token 已随 git 历史泄漏,切换自部署后应全部作废。

关联

  • 切换计划:specs/032-self-hosted-map-integration/spec.md(自部署 Foodie_HCM_Map:PostGIS 搜索 + OSRM 算路 + OpenFreeMap 底图;plan/tasks 未生成,未开工)
  • 自部署地图仓库:D:\QtwCode\foodie\Foodie_HCM_Map