xp-robotaxi-automatic-pilot-boot/src/main/java/com/xiaopeng/automaticPilot/controller/KafkaTestController.java
@@ -1,64 +1,64 @@ //package com.xiaopeng.automaticPilot.controller; // //import com.alibaba.fastjson2.JSONObject; //import com.xiaopeng.api.vo.automaticPilot.MqttPublishVo; //import com.xiaopeng.automaticPilot.service.KafkaConsumerService; //import com.xiaopeng.common.core.domain.R; //import lombok.extern.slf4j.Slf4j; //import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.kafka.annotation.KafkaListener; //import org.springframework.web.bind.annotation.PostMapping; //import org.springframework.web.bind.annotation.PostMapping; //import org.springframework.web.bind.annotation.RequestBody; //import org.springframework.web.bind.annotation.RestController; // //@Slf4j //@RestController //public class KafkaTestController { // // @Autowired // private KafkaConsumerService kafkaConsumerService; // // //TODO 少了factory属性声明 // // /** // * 消费消息 - XPU上报Robotaxi云端的消息topic(高优先级) // * // * @param message 消息内容 // */ // @PostMapping("/test/kafka/xpu-high") // @KafkaListener(topics = "topic-prod-robotaxi-xpu-high", groupId = "group-robotaxi-xpu") // public void topicProdRobotaxiXpuHigh(@RequestBody String message) { // log.info("收到XPU上报高优先级主题消息: {}", message); // kafkaConsumerService.topicProdRobotaxiXpuHigh(message); // } // // //TODO 少了factory属性声明 // // /** // * 消费消息 - XPU上报Robotaxi云端的消息topic(低优先级) // * // * @param message 消息内容 // */ // @PostMapping("/test/kafka/xpu-normal") // @KafkaListener(topics = "topic-prod-robotaxi-xpu-normal", groupId = "group-robotaxi-xpu") // public void topicProdRobotaxiXpuNormal(String message) { // log.info("收到XPU上报低优先级主题消息: {}", message); // kafkaConsumerService.topicProdRobotaxiXpuNormal(message); // } // // /** // * 模拟推送XPU消息 // * @param message // * @return // */ // @PostMapping("/base/v1/pushXPUMessage") // public R pushXPUMessage(@RequestBody String message) { // log.info("收到XPU推送消息: {}", message); // JSONObject json = new JSONObject(); // json.put("ts", System.currentTimeMillis()); // json.put("payload", message); // kafkaConsumerService.topicProdRobotaxiXpuHigh(json.toJSONString()); // return R.ok(); // } //} package com.xiaopeng.automaticPilot.controller; import com.alibaba.fastjson2.JSONObject; import com.xiaopeng.api.vo.automaticPilot.MqttPublishVo; import com.xiaopeng.automaticPilot.service.KafkaConsumerService; import com.xiaopeng.common.core.domain.R; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.annotation.KafkaListener; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; @Slf4j @RestController public class KafkaTestController { @Autowired private KafkaConsumerService kafkaConsumerService; //TODO 少了factory属性声明 /** * 消费消息 - XPU上报Robotaxi云端的消息topic(高优先级) * * @param message 消息内容 */ @PostMapping("/test/kafka/xpu-high") @KafkaListener(topics = "topic-prod-robotaxi-xpu-high", groupId = "group-robotaxi-xpu") public void topicProdRobotaxiXpuHigh(@RequestBody String message) { log.info("收到XPU上报高优先级主题消息: {}", message); kafkaConsumerService.topicProdRobotaxiXpuHigh(message); } //TODO 少了factory属性声明 /** * 消费消息 - XPU上报Robotaxi云端的消息topic(低优先级) * * @param message 消息内容 */ @PostMapping("/test/kafka/xpu-normal") @KafkaListener(topics = "topic-prod-robotaxi-xpu-normal", groupId = "group-robotaxi-xpu") public void topicProdRobotaxiXpuNormal(String message) { log.info("收到XPU上报低优先级主题消息: {}", message); kafkaConsumerService.topicProdRobotaxiXpuNormal(message); } /** * 模拟推送XPU消息 * @param message * @return */ @PostMapping("/base/v1/pushXPUMessage") public R pushXPUMessage(@RequestBody String message) { log.info("收到XPU推送消息: {}", message); JSONObject json = new JSONObject(); json.put("ts", System.currentTimeMillis()); json.put("payload", message); kafkaConsumerService.topicProdRobotaxiXpuHigh(json.toJSONString()); return R.ok(); } } xp-robotaxi-itinerary-boot/src/main/java/com/xiaopeng/itinerary/service/impl/ActiveOrderServiceImpl.java
@@ -156,11 +156,8 @@ //将修改信息存入到redis, // 获取起点经纬度 XpPoint xpPoint = xpPointService.getById(order.getStartPointId()); XpRoutePlan xpRoutePlan = xpRoutePlanMapper.selectOne(new LambdaQueryWrapper<XpRoutePlan>().eq(XpRoutePlan::getAuditStatus, 2).eq(XpRoutePlan::getCityCode, order.getCityCode())); final Integer planRuleForQueue = dto.getSelectedRoutePlanRule() != null ? dto.getSelectedRoutePlanRule() : (xpRoutePlan != null ? xpRoutePlan.getRoutePlanRule() : null); final Integer planRuleForQueue = dto.getSelectedRoutePlanRule(); // order.getId() + "_" + xpPoint.getPointLon() + "," + xpPoint.getPointLat() + "_0" + "_" + uid + "_" + order.getOrderNumber() + "_" + dto.getDistance() + "_" + dto.getDuration() + "_" + null StringJoiner points = new StringJoiner("_"); points.add(order.getId().toString()); points.add(xpPoint.getPointLon() + "," + xpPoint.getPointLat()); xp-robotaxi-order-boot/src/main/java/com/xiaopeng/order/config/MiniprogramConfigurer.java
@@ -10,7 +10,7 @@ import javax.annotation.Resource; @Slf4j @Configuration //@Configuration public class MiniprogramConfigurer extends WebMvcConfigurerAdapter { @Resource xp-robotaxi-order-boot/src/main/java/com/xiaopeng/order/controller/ActiveOrderController.java
@@ -1,13 +1,16 @@ package com.xiaopeng.order.controller; import com.alibaba.fastjson2.JSON; import com.xiaopeng.api.dto.QueryOrderRouteDTO; import com.xiaopeng.api.feignClient.operation.XpPointClient; import com.xiaopeng.api.feignClient.vehicleConvoy.XpVehicleClient; import com.xiaopeng.api.model.operation.XpPoint; 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.common.core.domain.R; import com.xiaopeng.common.redis.service.RedisService; import com.xiaopeng.order.model.vo.XpOrderDetailVO; import com.xiaopeng.order.service.IXpOrderService; import com.xiaopeng.unifiedverification.interceptor.XpClientCheck; @@ -20,7 +23,10 @@ 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.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @@ -46,6 +52,8 @@ private final XpPointClient xpPointClient; @Resource private final XpVehicleClient xpVehicleClient; @Resource private RedisService redisService; @Nullable private R<XpOrder> getOrderTripEnd(String orderId) { @@ -67,9 +75,9 @@ * 分享行程接口1-订单查询实时轨迹路线 */ @ApiOperation(value = "分享行程接口1 订单查询实时轨迹路线") @GetMapping("/base/v1/mini-program/orderActive/share/queryOrderRoute") @GetMapping("/base/v1/mini-program/orderActive/share/queryOrderRoute/{orderId}") @XpClientCheck(checkToken = false, checkOtpToken = false) public R<RouteVo> queryOrderRoute(@RequestParam String orderId, HttpServletRequest request) { public R<RouteVo> queryOrderRoute(@PathVariable("orderId") String orderId, HttpServletRequest request) { // 查询订单信息 if(StringUtils.isBlank(orderId) ){ return R.fail("参数不能为空"); @@ -78,8 +86,25 @@ if (r != null && r.getCode() != 200) { return r; } QueryOrderRouteDTO dto = new QueryOrderRouteDTO(); return xpOrderController.queryOrderRoute(dto,request); // 查询订单信息 XpOrder xpOrder = xpOrderService.getById(orderId); 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); } /**