“mitao”
2026-03-01 73427c7a74686bd2a16e00c2ac9c28cf1de40c4c
Merge remote-tracking branch 'origin/master'

# Conflicts:
# xp-robotaxi-vehicle-convoy-boot/src/main/java/com/xiaopeng/vehicleConvoy/service/impl/XpVehicleServiceImpl.java
14个文件已修改
201 ■■■■■ 已修改文件
xp-robotaxi-api/src/main/java/com/xiaopeng/api/vo/operation/RouteVo.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-automatic-pilot-boot/src/main/java/com/xiaopeng/automaticPilot/controller/OrderMissionController.java 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-automatic-pilot-boot/src/main/java/com/xiaopeng/automaticPilot/service/KafkaConsumerService.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-itinerary-boot/src/main/java/com/xiaopeng/itinerary/service/impl/XpPricingServiceImpl.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/schedule/InsuranceInspectionScheduleTask.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/schedule/RoutinePreparationScheduleTask.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/schedule/VehicleCleanScheduleTask.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/schedule/VehicleInspectionScheduleTask.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/schedule/VehicleMaintenanceScheduleTask.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpClockInServiceImpl.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/controller/XpMapController.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-order-boot/src/main/java/com/xiaopeng/order/controller/XpOrderController.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-order-boot/src/main/java/com/xiaopeng/order/service/impl/XpOrderServiceImpl.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-push-message-boot/src/main/java/com/xiaopeng/pushMessage/controller/PushOrderRouteController.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-api/src/main/java/com/xiaopeng/api/vo/operation/RouteVo.java
@@ -17,5 +17,8 @@
    private String routeID;
    @ApiModelProperty(value = "方向角度")
    private Double direction;
    private List<LonLatDto> polyline;
}
xp-robotaxi-automatic-pilot-boot/src/main/java/com/xiaopeng/automaticPilot/controller/OrderMissionController.java
@@ -32,6 +32,7 @@
import com.xiaopeng.common.redis.service.RedisService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.geo.Point;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.geo.GeoJsonPoint;
import org.springframework.data.mongodb.core.query.Criteria;
@@ -46,6 +47,7 @@
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@Slf4j
@RestController
@@ -170,7 +172,7 @@
        }
        RouteVo routeVo = routeVoR.getData();
        //缓存数据,用于后续推给乘客导航线路
        redisService.setCacheObject("ORDER_NAVIGATION_START_DATA:" + xpOrder.getAppUserId(), com.alibaba.fastjson.JSON.toJSONString(routeVo), 24L, TimeUnit.HOURS);
        redisService.setCacheObject("ORDER_NAVIGATION_START_DATA:" + xpOrder.getAppUserId(), JSON.toJSONString(routeVo), 24L, TimeUnit.HOURS);
        PopOrderDto dto1 = new PopOrderDto();
        dto1.setOrderId(Long.valueOf(orderId));
@@ -181,7 +183,7 @@
        //构建推送消息
        Map<String, Object> params = new HashMap<>();
        Map<String, Object> content = new HashMap<>();
        content.put("orderId", orderId);
        content.put("orderId", orderId.toString());
        content.put("status", 3);
        params.put("type", PushMessageTypeEnum.ORDER_STATUS.getDesc());
        params.put("content", JSONObject.toJSONString(content));
@@ -196,6 +198,17 @@
            log.error("推送消息失败:{}", stringR.getMsg());
        }
        xpOrderClient.updateOrderStatus(orderId, OrderStatusEnum.PICK_UP.getCode());
//        PushOrderRouteDTO dto3 = new PushOrderRouteDTO();
//        dto3.setOrderId(orderId);
//        dto3.setRouteType(1);
//        dto3.setLongitude(startLon);
//        dto3.setLatitude(startLat);
//        dto3.setDuration(10);
//        dto3.setDistance(2);
//        dto3.setDirection(60);
//        xpPushMessageClient.pushOrderRoute(dto3);
        return r;
    }
@@ -228,7 +241,7 @@
                Double longitude = lonLatDto.getLongitude();
                //保存车辆实时位置到redis
                redisTemplate.opsForGeo().add("vehiclePosition:" + vin, new GeoJsonPoint(longitude, latitude), vin);
                redisTemplate.opsForGeo().add("vehiclePosition:" + vin, new Point(longitude, latitude), vin);
                //保存车辆实时信息到mongodb
                VehiclePosition vehiclePosition = mongoTemplate.findOne(new Query(Criteria.where("vin").is(vin)), VehiclePosition.class);
@@ -254,10 +267,11 @@
                    dto.setLatitude(latitude);
                    dto.setDuration(10);
                    dto.setDistance(2);
                    dto.setDirection(60);
                    xpPushMessageClient.pushOrderRoute(dto);
                }
                //5秒钟循环一次
                //2秒钟循环一次
                try {
                    Thread.sleep(2000);
                } catch (InterruptedException e) {
@@ -268,7 +282,7 @@
            //构建推送消息
            Map<String, Object> params = new HashMap<>();
            Map<String, Object> content = new HashMap<>();
            content.put("orderId", orderId);
            content.put("orderId", orderId.toString());
            content.put("status", 4);
            params.put("type", PushMessageTypeEnum.ORDER_STATUS.getDesc());
            params.put("content", JSONObject.toJSONString(content));
@@ -299,7 +313,7 @@
        //构建推送消息
        Map<String, Object> params = new HashMap<>();
        Map<String, Object> content = new HashMap<>();
        content.put("orderId", orderId);
        content.put("orderId", orderId.toString());
        content.put("status", status);
        params.put("type", PushMessageTypeEnum.ORDER_STATUS.getDesc());
        params.put("content", JSONObject.toJSONString(content));
@@ -313,6 +327,36 @@
            log.error("推送消息失败:{}", stringR.getMsg());
        }
        xpOrderClient.updateOrderStatus(orderId, status);
        if(5 == status){
            //主动推一次全程轨迹
            Object cacheObject = redisService.getCacheObject("ORDER_NAVIGATION_END_DATA:" + xpOrder.getAppUserId());
            RouteVo routeVo = JSON.parseObject(cacheObject.toString(), RouteVo.class);
            com.alibaba.fastjson2.JSONObject jsonObject = new com.alibaba.fastjson2.JSONObject();
            jsonObject.put("type", "ORDER_ROUTE");
            jsonObject.put("timestamp", System.currentTimeMillis());
            com.alibaba.fastjson2.JSONObject content1 = new com.alibaba.fastjson2.JSONObject();
            content1.put("orderId", orderId.toString());
            content1.put("routeType", 1);
            com.alibaba.fastjson2.JSONObject route = new com.alibaba.fastjson2.JSONObject();
            route.put("distance", routeVo.getDistance());
            route.put("duration", routeVo.getDuration());
            route.put("routeID", routeVo.getRouteID());
            List<com.alibaba.fastjson2.JSONObject> collect = routeVo.getPolyline().stream().map(item -> {
                com.alibaba.fastjson2.JSONObject point = new com.alibaba.fastjson2.JSONObject();
                point.put("latitude", item.getLatitude());
                point.put("longitude", item.getLongitude());
                return point;
            }).collect(Collectors.toList());
            route.put("polyline", JSON.toJSONString(collect));
            content1.put("route", route.toJSONString());
            jsonObject.put("content", content1.toJSONString());
            SendMessageDTO messageDTO = new SendMessageDTO();
            messageDTO.setAppUserId(xpOrder.getAppUserId().toString());
            messageDTO.setMessage(jsonObject.toJSONString());
            xpPushMessageClient.sendRoute(messageDTO);
        }
        return R.ok();
    }
@@ -346,7 +390,7 @@
                Double longitude = lonLatDto.getLongitude();
                //保存车辆实时位置到redis
                redisTemplate.opsForGeo().add("vehiclePosition:" + vin, new GeoJsonPoint(longitude, latitude), vin);
                redisTemplate.opsForGeo().add("vehiclePosition:" + vin, new Point(longitude, latitude), vin);
                //保存车辆实时信息到mongodb
                VehiclePosition vehiclePosition = mongoTemplate.findOne(new Query(Criteria.where("vin").is(vin)), VehiclePosition.class);
@@ -367,17 +411,18 @@
                if (null != orderId) {
                    PushOrderRouteDTO dto = new PushOrderRouteDTO();
                    dto.setOrderId(orderId);
                    dto.setRouteType(2);
                    dto.setRouteType(1);
                    dto.setLongitude(longitude);
                    dto.setLatitude(latitude);
                    dto.setDuration(20);
                    dto.setDistance(10);
                    dto.setDirection(60);
                    xpPushMessageClient.pushOrderRoute(dto);
                }
                //5秒钟循环一次
                try {
                    Thread.sleep(2000);
                    Thread.sleep(500);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
@@ -386,8 +431,8 @@
            //构建推送消息
            Map<String, Object> params = new HashMap<>();
            Map<String, Object> content = new HashMap<>();
            content.put("orderId", orderId);
            content.put("status", 4);
            content.put("orderId", orderId.toString());
            content.put("status", 7);
            params.put("type", PushMessageTypeEnum.ORDER_STATUS.getDesc());
            params.put("content", JSONObject.toJSONString(content));
            params.put("timestamp", System.currentTimeMillis() + "");
@@ -399,7 +444,7 @@
            if (R.isError(stringR)) {
                log.error("推送消息失败:{}", stringR.getMsg());
            }
            xpOrderClient.updateOrderStatus(orderId, OrderStatusEnum.PICK_UP_GUESTS.getCode());
            xpOrderClient.updateOrderStatus(orderId, OrderStatusEnum.SEE_OFF_GUESTS.getCode());
        });
    }
xp-robotaxi-automatic-pilot-boot/src/main/java/com/xiaopeng/automaticPilot/service/KafkaConsumerService.java
@@ -51,6 +51,7 @@
import com.xiaopeng.common.core.utils.uuid.UUID;
import com.xiaopeng.common.redis.service.RedisService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.geo.Point;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.geo.GeoJsonPoint;
import org.springframework.data.mongodb.core.query.Criteria;
@@ -277,7 +278,7 @@
        long sequence = msgContent.getHeader().getSequence();
        responseMessage(sequence, vin);
        //保存车辆实时位置到redis
        redisTemplate.opsForGeo().add("vehiclePosition:" + vin, new GeoJsonPoint(longitude, latitude), vin);
        redisTemplate.opsForGeo().add("vehiclePosition:" + vin, new Point(longitude, latitude), vin);
        //保存车辆实时信息到mongodb
        VehiclePosition vehiclePosition = mongoTemplate.findOne(new Query(Criteria.where("vin").is(vin)), VehiclePosition.class);
@@ -491,7 +492,7 @@
                    RouteVo routeVo = routeVoR.getData();
                    routeID = routeVo.getRouteID();
                    //缓存数据,用于后续推给乘客导航线路
                    redisService.setCacheObject("ORDER_NAVIGATION_START_DATA:" + xpOrder.getAppUserId(), com.alibaba.fastjson.JSON.toJSONString(routeVo), 24L, TimeUnit.HOURS);
                    redisService.setCacheObject("ORDER_NAVIGATION_START_DATA:" + xpOrder.getAppUserId(), JSON.toJSONString(routeVo), 24L, TimeUnit.HOURS);
                }
                //驶往下车点的行程
                if (Arrays.asList(6).contains(xpOrder.getStatus())) {
@@ -608,12 +609,12 @@
                RouteVo routeVo = routeVoR.getData();
                routeID = routeVo.getRouteID();
                //缓存数据,用于后续推给乘客导航线路
                redisService.setCacheObject("ORDER_NAVIGATION_START_DATA:" + xpOrder.getAppUserId(), com.alibaba.fastjson.JSON.toJSONString(routeVo), 24L, TimeUnit.HOURS);
                redisService.setCacheObject("ORDER_NAVIGATION_START_DATA:" + xpOrder.getAppUserId(), JSON.toJSONString(routeVo), 24L, TimeUnit.HOURS);
            }
            //驶往下车点的行程
            if (orderPhase.equals(OrderPhase.ROUTE_TO_DESTINATION)) {
                //直接取缓存中的导航数据推送给车端和乘客
                Object cacheObject = redisService.getCacheObject("ORDER_NAVIGATION_DATA:" + xpOrder.getAppUserId());
                Object cacheObject = redisService.getCacheObject("ORDER_NAVIGATION_END_DATA:" + xpOrder.getAppUserId());
                if(null == cacheObject){
                    //没有缓存数据,重新规划线路
                    //查询起点到终点的线路
@@ -927,7 +928,7 @@
            //构建推送消息
            Map<String, Object> params = new HashMap<>();
            Map<String, Object> content = new HashMap<>();
            content.put("orderId", orderId);
            content.put("orderId", orderId.toString());
            content.put("status", status.getCode());
            params.put("type", PushMessageTypeEnum.ORDER_STATUS.getDesc());
            params.put("content", JSONObject.toJSONString(content));
xp-robotaxi-itinerary-boot/src/main/java/com/xiaopeng/itinerary/service/impl/XpPricingServiceImpl.java
@@ -731,7 +731,7 @@
            jsonObject.put("type", "ORDER_ROUTE");
            jsonObject.put("timestamp", System.currentTimeMillis());
            com.alibaba.fastjson2.JSONObject content = new com.alibaba.fastjson2.JSONObject();
            content.put("orderId", orderId);
            content.put("orderId", orderId.toString());
            content.put("routeType", 1);
            com.alibaba.fastjson2.JSONObject route = new com.alibaba.fastjson2.JSONObject();
            route.put("distance", routeVo.getDistance());
@@ -745,7 +745,7 @@
                return point;
            }).collect(Collectors.toList());
            route.put("polyline", collect);
            route.put("polyline", JSON.toJSONString(collect));
            content.put("route", route.toJSONString());
            jsonObject.put("content", content.toJSONString());
            SendMessageDTO messageDTO = new SendMessageDTO();
@@ -799,7 +799,7 @@
            jsonObject.put("type", "ORDER_ROUTE");
            jsonObject.put("timestamp", System.currentTimeMillis());
            com.alibaba.fastjson2.JSONObject content = new com.alibaba.fastjson2.JSONObject();
            content.put("orderId", orderId);
            content.put("orderId", orderId.toString());
            content.put("routeType", 2);
            com.alibaba.fastjson2.JSONObject route = new com.alibaba.fastjson2.JSONObject();
            route.put("distance", routeVo.getDistance());
@@ -811,7 +811,7 @@
                point.put("longitude", item.getLongitude());
                return point;
            }).collect(Collectors.toList());
            route.put("polyline", collect);
            route.put("polyline", JSON.toJSONString(collect));
            content.put("route", route.toJSONString());
            jsonObject.put("content", content.toJSONString());
            SendMessageDTO messageDTO = new SendMessageDTO();
xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/schedule/InsuranceInspectionScheduleTask.java
@@ -350,7 +350,7 @@
            }
            // 设置任务状态为待到达
            task.setStatus(TaskScheduleConstants.TASK_STATUS_PENDING_ARRIVE);
            task.setStatus(TaskScheduleConstants.TASK_STATUS_PENDING);
            // 设置任务接收人(配置角色下的所有运维人员都可以看到)
            task.setHandleUserId(belongUserIds);
xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/schedule/RoutinePreparationScheduleTask.java
@@ -370,7 +370,7 @@
            }
            // 设置任务状态为待到达
            task.setStatus(TaskScheduleConstants.TASK_STATUS_PENDING_ARRIVE);
            task.setStatus(TaskScheduleConstants.TASK_STATUS_PENDING);
            // 设置任务接收人(配置角色下的所有运维人员都可以看到)
            task.setHandleUserId(belongUserIds);
xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/schedule/VehicleCleanScheduleTask.java
@@ -370,7 +370,7 @@
            }
            // 设置任务状态为待到达
            task.setStatus(TaskScheduleConstants.TASK_STATUS_PENDING_ARRIVE);
            task.setStatus(TaskScheduleConstants.TASK_STATUS_PENDING);
            // 设置任务接收人(配置角色下的所有运维人员都可以看到)
            task.setHandleUserId(belongUserIds);
xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/schedule/VehicleInspectionScheduleTask.java
@@ -330,7 +330,7 @@
            }
            // 设置任务状态为待到达
            task.setStatus(TaskScheduleConstants.TASK_STATUS_PENDING_ARRIVE);
            task.setStatus(TaskScheduleConstants.TASK_STATUS_PENDING);
            // 设置任务接收人(配置角色下的所有运维人员都可以看到)
            task.setHandleUserId(belongUserIds);
xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/schedule/VehicleMaintenanceScheduleTask.java
@@ -356,7 +356,7 @@
            }
            // 设置任务状态为待到达
            task.setStatus(TaskScheduleConstants.TASK_STATUS_PENDING_ARRIVE);
            task.setStatus(TaskScheduleConstants.TASK_STATUS_PENDING);
            // 设置任务接收人(配置角色下的所有运维人员都可以看到)
            task.setHandleUserId(belongUserIds);
xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpClockInServiceImpl.java
@@ -249,8 +249,8 @@
        String endTime = "";
        if(StringUtils.isNotEmpty(query.getStatisticDate())){
            String statisticDate = query.getStatisticDate();
            startTime = statisticDate.split(" - ")[0];
            endTime = statisticDate.split(" - ")[1];
            startTime = statisticDate.split(" - ")[0].split(" ")[0];
            endTime = statisticDate.split(" - ")[1].split(" ")[0];
        }
        //查询数据
        List<ClockInStatisticsDto> clockInStatistics = this.baseMapper.getClockInStatistics(pageInfo, appUserIds, startTime, endTime);
@@ -309,8 +309,8 @@
        String endTime = "";
        if(StringUtils.isNotEmpty(query.getStatisticDate())){
            String statisticDate = query.getStatisticDate();
            startTime = statisticDate.split(" - ")[0];
            endTime = statisticDate.split(" - ")[1];
            startTime = statisticDate.split(" - ")[0].split(" ")[0];
            endTime = statisticDate.split(" - ")[1].split(" ")[0];
        }
        //查询数据
        List<ClockInStatisticsDto> clockInStatistics = this.baseMapper.getClockInStatistics(pageInfo, appUserIds, startTime, endTime);
@@ -355,8 +355,8 @@
        String endTime = "";
        if(StringUtils.isNotEmpty(query.getStatisticDate())){
            String statisticDate = query.getStatisticDate();
            startTime = statisticDate.split(" - ")[0];
            endTime = statisticDate.split(" - ")[1];
            startTime = statisticDate.split(" - ")[0].split(" ")[0];
            endTime = statisticDate.split(" - ")[1].split(" ")[0];
        }
        List<ClockInStatisticsDetailsDto> clockInStatisticsDetails = this.baseMapper.getClockInStatisticsDetails(pageInfo, query.getAppUserId(), startTime, endTime);
        List<XpOperationsUserWithRoleVO> data = xpOperationUserClient.listByIdsWithRole(Arrays.asList(query.getAppUserId())).getData();
@@ -384,8 +384,8 @@
        String endTime = "";
        if(StringUtils.isNotEmpty(query.getStatisticDate())){
            String statisticDate = query.getStatisticDate();
            startTime = statisticDate.split(" - ")[0];
            endTime = statisticDate.split(" - ")[1];
            startTime = statisticDate.split(" - ")[0].split(" ")[0];
            endTime = statisticDate.split(" - ")[1].split(" ")[0];
        }
        List<ClockInStatisticsDetailsDto> clockInStatisticsDetails = this.baseMapper.getClockInStatisticsDetails(pageInfo, query.getAppUserId(), startTime, endTime);
        List<XpOperationsUserWithRoleVO> data = xpOperationUserClient.listByIdsWithRole(Arrays.asList(query.getAppUserId())).getData();
xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/controller/XpMapController.java
@@ -122,7 +122,7 @@
        // 存储redis
        redisService.setCacheObject(CacheConstants.ORDER_ROUTE + "_" + dto.getOrderId() + "_" +dto.getRouteType(), routeVo);
        // 存储路线偏离缓存,后续进行轨迹截取
        redisService.setCacheObject(CacheConstants.ORDER_ROUTE_CAPTURE + "_" + dto.getOrderId() + "_" +dto.getRouteType(), routeVo);
//        redisService.setCacheObject(CacheConstants.ORDER_ROUTE_CAPTURE + "_" + dto.getOrderId() + "_" +dto.getRouteType(), routeVo);
        return R.ok(routeVo);
    }
xp-robotaxi-order-boot/src/main/java/com/xiaopeng/order/controller/XpOrderController.java
@@ -3,14 +3,17 @@
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.xiaopeng.api.dto.QueryOrderRouteDTO;
import com.xiaopeng.api.dto.order.GetOrderNumDto;
import com.xiaopeng.api.dto.order.PopOrderDto;
import com.xiaopeng.api.dto.statistics.OrderStatisticsDTO;
import com.xiaopeng.api.dto.statistics.StatisticsQueryDTO;
import com.xiaopeng.api.feignClient.vehicleConvoy.XpVehicleClient;
import com.xiaopeng.api.model.order.XpOrder;
import com.xiaopeng.api.model.vehicleConvoy.XpVehicle;
import com.xiaopeng.api.vo.automaticPilot.VehiclePosition;
import com.xiaopeng.api.vo.operation.RouteVo;
import com.xiaopeng.api.vo.order.FareBreakdownVo;
import com.xiaopeng.api.vo.order.XpHistoryEndPointsVo;
@@ -40,7 +43,11 @@
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -67,6 +74,10 @@
    private final IXpOrderService xpOrderService;
    private final RedisService redisService;
    @Autowired
    private MongoTemplate mongoTemplate;
    @Autowired
    private XpVehicleClient xpVehicleClient;
    /**
     * 获取订单统计数据(内部接口)
@@ -476,9 +487,24 @@
    public R<RouteVo> queryOrderRoute(@Validated @RequestBody QueryOrderRouteDTO dto, HttpServletRequest request) {
        String uid = request.getHeader("XP-Uid");
        // 查询订单信息
//        XpOrder xpOrder = xpOrderService.getById(dto.getOrderId());
        XpOrder xpOrder = xpOrderService.getById(dto.getOrderId());
        // 获取路线规划
        RouteVo routeVo = redisService.getCacheObject(CacheConstants.ORDER_ROUTE_CAPTURE + "_" + dto.getOrderId() + "_" +dto.getRouteType());
//        RouteVo routeVo = redisService.getCacheObject(CacheConstants.ORDER_ROUTE_CAPTURE + "_" + dto.getOrderId() + "_" +dto.getRouteType());
        String key = "";
        //接驾情况,获取车辆位置到起点的导航
        if(xpOrder.getStatus() < 5){
            key = "ORDER_NAVIGATION_START_DATA:" + xpOrder.getAppUserId();
        }
        //服务中,获取起点到终点的导航数据
        if(xpOrder.getStatus() >= 5){
            key = "ORDER_NAVIGATION_END_DATA:" + xpOrder.getAppUserId();
        }
        Object cacheObject = redisService.getCacheObject(key);
        RouteVo routeVo = JSON.parseObject(cacheObject.toString(), RouteVo.class);
        XpVehicle xpVehicle = xpVehicleClient.queryById(xpOrder.getVehicleId()).getData();
        VehiclePosition vehiclePosition = mongoTemplate.findOne(new Query(Criteria.where("vin").is(xpVehicle.getVehicleVin())), VehiclePosition.class);
        routeVo.setDirection(null != vehiclePosition ? vehiclePosition.getCourse() : 90);
        return R.ok(routeVo);
    }
xp-robotaxi-order-boot/src/main/java/com/xiaopeng/order/service/impl/XpOrderServiceImpl.java
@@ -51,6 +51,7 @@
import com.xiaopeng.api.vo.OrderType;
import com.xiaopeng.api.vo.account.GetUserListByUidsVo;
import com.xiaopeng.api.vo.account.UserCouponVo;
import com.xiaopeng.api.vo.automaticPilot.VehiclePosition;
import com.xiaopeng.api.vo.automaticPilot.proto.down.cloudOrderOperation.OrderOperationType;
import com.xiaopeng.api.vo.operation.RouteVo;
import com.xiaopeng.api.vo.order.*;
@@ -1051,7 +1052,7 @@
        // 消息推送
        Map<String, Object> params = new HashMap<>();
        Map<String, Object> content = new HashMap<>();
        content.put("orderId", order.getId());
        content.put("orderId", order.getId().toString());
        content.put("status", OrderStatusEnum.CANCELED.getCode());
        params.put("type", PushMessageTypeEnum.ORDER_STATUS.getDesc());
        params.put("content", com.alibaba.fastjson2.JSONObject.toJSONString(content));
@@ -1987,8 +1988,9 @@
        //乘客单处理逻辑
        if(OrderType.USER_ORDER.equals(orderType)){
            XpOrder order = this.getById(orderId);
            Long appUserId = order.getAppUserId();
            //订单为待接单状态
            if(order.getStatus() == 1){
            if(order.getStatus() < 4){
                AddTaxiPassengerVo addTaxiPassengerVo = new AddTaxiPassengerVo();
                order.setAcceptanceTime(LocalDateTime.now());
                R<XpVehicle> byVehicleVin = xpVehicleClient.findByVehicleVin(dto.getXpVehicleVin());
@@ -2008,8 +2010,7 @@
                String[] split = popFirstElement.split("_");
                xpGeoQueryEntity.setOrderId(split[0]);
                // 存mongo数据
                xpPricingClient.updateXpGeoQueryEntity(split[0]);
                order.setAppUserId(null);
                xpPricingClient.updateXpGeoQueryEntity(order.getId().toString());
                // 修改车辆信息
@@ -2017,18 +2018,19 @@
                xpVehicleClient.updateVehicleById(vehicle);
                //绑定用户和车辆关系
                addTaxiPassengerVo.setUid(order.getAppUserId().toString());
                addTaxiPassengerVo.setUid(appUserId.toString());
                order.setAppUserId(null);
                this.updateById(order);
                addTaxiPassengerVo.setOrderNo(order.getOrderNumber());
                // TODO appid
                addTaxiPassengerVo.setAppId("");
                userVehicleClient.addTaxiPassenger(addTaxiPassengerVo);
                //推送乘客车辆到达预约点的导航数据
                sendRoute(order.getAppUserId().toString(), orderId, "ORDER_NAVIGATION_START_DATA");
                sendRoute(addTaxiPassengerVo.getUid(), orderId, "ORDER_NAVIGATION_START_DATA", dto.getXpVehicleVin());
            }else{
                //推送行起点到终点的驶轨迹给乘客端
                sendRoute(order.getAppUserId().toString(), orderId, "ORDER_NAVIGATION_END_DATA");
                sendRoute(appUserId.toString(), orderId, "ORDER_NAVIGATION_END_DATA", dto.getXpVehicleVin());
            }
        }
    }
@@ -2039,7 +2041,8 @@
     * @param appUserId
     * @param keyStr
     */
    public void sendRoute(String appUserId, Long orderId, String keyStr){
    public void sendRoute(String appUserId, Long orderId, String keyStr, String vin){
        VehiclePosition vehiclePosition = mongoTemplate.findOne(new Query(Criteria.where("vin").is(vin)), VehiclePosition.class);
        Object cacheObject = redisService.getCacheObject(keyStr + ":" + appUserId);
        if(null != cacheObject){
            RouteVo routeVo = JSON.parseObject(cacheObject.toString(), RouteVo.class);
@@ -2047,8 +2050,9 @@
            jsonObject.put("type", "ORDER_ROUTE");
            jsonObject.put("timestamp", System.currentTimeMillis());
            JSONObject content = new JSONObject();
            content.put("orderId", orderId);
            content.put("orderId", orderId.toString());
            content.put("routeType", "ORDER_NAVIGATION_START_DATA".equals(keyStr) ? 1 : 2);
            content.put("direction", null != vehiclePosition ? vehiclePosition.getCourse() : 90);
            JSONObject route = new JSONObject();
            route.put("distance", routeVo.getDistance());
            route.put("duration", routeVo.getDuration());
@@ -2061,12 +2065,13 @@
                return point;
            }).collect(Collectors.toList());
            route.put("polyline", collect);
            route.put("polyline", JSON.toJSONString(collect));
            content.put("route", route.toJSONString());
            jsonObject.put("content", content.toJSONString());
            SendMessageDTO messageDTO = new SendMessageDTO();
            messageDTO.setAppUserId(appUserId);
            messageDTO.setMessage(jsonObject.toJSONString());
            System.err.println(messageDTO);
            xpPushMessageClient.sendRoute(messageDTO);
        }
    }
xp-robotaxi-push-message-boot/src/main/java/com/xiaopeng/pushMessage/controller/PushOrderRouteController.java
@@ -1,5 +1,6 @@
package com.xiaopeng.pushMessage.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.xiaopeng.api.dto.operation.LonLatDto;
import com.xiaopeng.api.dto.pushMessage.PushOrderRouteDTO;
@@ -14,6 +15,7 @@
import com.xiaopeng.common.redis.service.RedisService;
import com.xiaopeng.pushMessage.utils.MapMatchingUtil;
import io.swagger.annotations.Api;
import org.powermock.core.ListMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
@@ -22,6 +24,7 @@
import org.springframework.web.bind.annotation.RestController;
import java.util.*;
import java.util.concurrent.TimeUnit;
@Api(tags = "订单推送轨迹接口")
@RestController
@@ -51,7 +54,15 @@
            routeType = xpOrder.getStatus() == 3 ? 1 : 2;
        }
        // 获取路线规划
        RouteVo routeVo = redisService.getCacheObject(CacheConstants.ORDER_ROUTE_CAPTURE + "_" + dto.getOrderId() + "_" +routeType);
        String key = "";
        //接驾情况,获取车辆位置到起点的导航
        if(1 == routeType){
            key = "ORDER_NAVIGATION_START_DATA:" + xpOrder.getAppUserId();
        }else{
            key = "ORDER_NAVIGATION_END_DATA:" + xpOrder.getAppUserId();
        }
        Object cacheObject = redisService.getCacheObject(key);
        RouteVo routeVo = JSON.parseObject(cacheObject.toString(), RouteVo.class);
        if(Objects.nonNull(routeVo)){
@@ -63,13 +74,17 @@
            routeVo.setPolyline(lonLatDtos);
            // 存储最新路线偏离缓存,后续进行轨迹截取
            redisService.setCacheObject(CacheConstants.ORDER_ROUTE_CAPTURE + "_" + dto.getOrderId() + "_" +routeType, routeVo);
//            redisService.setCacheObject(CacheConstants.ORDER_ROUTE_CAPTURE + "_" + dto.getOrderId() + "_" +routeType, routeVo);
            redisService.setCacheObject(key, JSON.toJSONString(routeVo), 24L, TimeUnit.HOURS);
            // 封装轨迹点位集合
            Map<String, Object> polyline = new HashMap<>();
            List<Map<String, Object>> polyline = new ArrayList<>();
            for (LonLatDto lonLatDto : lonLatDtos) {
                polyline.put("longitude",lonLatDto.getLongitude());
                polyline.put("latitude",lonLatDto.getLatitude());
                Map<String, Object> polylineMap = new HashMap<>();
                polylineMap.put("longitude",lonLatDto.getLongitude());
                polylineMap.put("latitude",lonLatDto.getLatitude());
                polyline.add(polylineMap);
            }
            // 封装路由详情
            Map<String, Object> route = new HashMap<>();
@@ -78,7 +93,7 @@
            route.put("polyline",JSONObject.toJSONString(polyline));
            Map<String, Object> content = new HashMap<>();
            content.put("orderId",dto.getOrderId());
            content.put("orderId",dto.getOrderId().toString());
            content.put("routeType",routeType);
            content.put("direction",dto.getDirection());
            content.put("route",JSONObject.toJSONString(route));