puzhibing
2026-04-08 57b2a831bb61ac6008a0e350f00efb7e8b723fd5
修改获取轨迹的参数
1个文件已添加
5个文件已修改
66 ■■■■■ 已修改文件
xp-robotaxi-api/src/main/java/com/xiaopeng/api/dto/map/HistoryPointDto.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-api/src/main/java/com/xiaopeng/api/dto/map/OrderRouteAndFareDto.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-api/src/main/java/com/xiaopeng/api/dto/map/RouteAndFareDto.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-api/src/main/java/com/xiaopeng/api/model/operation/XpTestPlanPoint.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/controller/XpMapController.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/utils/GDMapGeocodingUtil.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-api/src/main/java/com/xiaopeng/api/dto/map/HistoryPointDto.java
New file
@@ -0,0 +1,28 @@
package com.xiaopeng.api.dto.map;
import lombok.Data;
@Data
public class HistoryPointDto {
    /**
     * 经纬度116.473195,39.993253
     */
    private String location;
    /**
     * 定位时间戳
     */
    private String locateTime;
    /**
     * 定位精度
     */
    private Double accuracy;
    /**
     * 定位方向
     */
    private Double direction;
    /**
     * 速度
     */
    private Double speed;
}
xp-robotaxi-api/src/main/java/com/xiaopeng/api/dto/map/OrderRouteAndFareDto.java
@@ -28,4 +28,7 @@
    private Integer routeType;
    @ApiModelProperty(value = "前端不处理")
    private Integer routePlanRule;
    @ApiModelProperty("车辆VIN码")
    private String vin;
}
xp-robotaxi-api/src/main/java/com/xiaopeng/api/dto/map/RouteAndFareDto.java
@@ -30,6 +30,9 @@
    @ApiModelProperty(value = "优惠券id(是否指定使用某个优惠券)")
    private Long userCouponId;
    @ApiModelProperty("车辆VIN码")
    private String vin;
xp-robotaxi-api/src/main/java/com/xiaopeng/api/model/operation/XpTestPlanPoint.java
@@ -29,7 +29,7 @@
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "自增id")
    @TableId(value = "id", type = IdType.AUTO)
    @TableId(value = "id", type = IdType.NONE)
    private Long id;
    @ApiModelProperty(value = "测试计划ID")
xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/controller/XpMapController.java
@@ -1,6 +1,8 @@
package com.xiaopeng.map.controller;
import com.alibaba.fastjson2.JSON;
import com.xiaopeng.api.dto.map.HistoryPointDto;
import com.xiaopeng.api.dto.map.OrderRouteAndFareDto;
import com.xiaopeng.api.dto.map.RouteAndFareDto;
import com.xiaopeng.api.dto.operation.LonLatDto;
@@ -91,7 +93,16 @@
                    }
                }
            }
            RouteVo routeVo = gdMapGeocodingUtil.getDistanceAndTime(dto.getOrigin(), dto.getDestination(), String.join("|", pointStrParam), fenceId,dto.getRoutePlanRule());
            List<Object> cacheList = redisService.getCacheList("VEHICLE_HISTORY_POINT_LIST:" + dto.getVin());
            List<HistoryPointDto> history = new ArrayList<>();
            if(cacheList!=null && !cacheList.isEmpty()){
                for (Object cache : cacheList) {
                    HistoryPointDto historyPointDto = JSON.parseObject(cache.toString(), HistoryPointDto.class);
                    history.add(historyPointDto);
                }
            }
            RouteVo routeVo = gdMapGeocodingUtil.getDistanceAndTime(dto.getOrigin(), dto.getDestination(), String.join("|", pointStrParam), fenceId,dto.getRoutePlanRule(), history);
            if(routeVo==null){
                return R.fail("没有找到路线");
            }
@@ -134,8 +145,15 @@
                }
            }
        }
        RouteVo routeVo = gdMapGeocodingUtil.getDistanceAndTime(dto.getOrigin(), dto.getDestination(), String.join("|", pointStrParam), fenceId,dto.getRoutePlanRule());
        List<Object> cacheList = redisService.getCacheList("VEHICLE_HISTORY_POINT_LIST:" + dto.getVin());
        List<HistoryPointDto> history = new ArrayList<>();
        if(cacheList!=null && !cacheList.isEmpty()){
            for (Object cache : cacheList) {
                HistoryPointDto historyPointDto = JSON.parseObject(cache.toString(), HistoryPointDto.class);
                history.add(historyPointDto);
            }
        }
        RouteVo routeVo = gdMapGeocodingUtil.getDistanceAndTime(dto.getOrigin(), dto.getDestination(), String.join("|", pointStrParam), fenceId,dto.getRoutePlanRule(), history);
        if(routeVo==null){
            return R.fail("没有找到路线");
        }
xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/utils/GDMapGeocodingUtil.java
@@ -3,6 +3,7 @@
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.xiaopeng.api.dto.map.HistoryPointDto;
import com.xiaopeng.api.dto.operation.LonLatDto;
import com.xiaopeng.api.vo.operation.RouteVo;
import com.xiaopeng.common.core.utils.HttpUtils;
@@ -47,7 +48,7 @@
     * @return
     * @throws Exception
     */
    public RouteVo getDistanceAndTime(LonLatDto start, LonLatDto end,String avoidRoads,String fenceId,Integer routePlanRule)  {
    public RouteVo getDistanceAndTime(LonLatDto start, LonLatDto end,String avoidRoads,String fenceId,Integer routePlanRule, List<HistoryPointDto> history)  {
        RouteVo routeVo = new RouteVo();
        String url = "https://tsapi.amap.com/v1/route/price?key=" + key + "&extensions=all&start=" + start.getLongitude() + "," + start.getLatitude();
@@ -62,6 +63,9 @@
        if(routePlanRule!=null){
            params.put("strategy", routePlanRule);
        }
        if(null != history && !history.isEmpty()){
            params.put("history", history);
        }
        log.info("高德地图接口:{}", url);
        log.info("高德地图参数:{}", params);
        String post = HttpUtils.post(url, JSON.toJSONString(params));