From 4fe4a4616b3c762eafabe238acf40fac30fd25a3 Mon Sep 17 00:00:00 2001
From: zhouhn <zhouhn@xiaopeng.com>
Date: 星期六, 07 三月 2026 20:57:57 +0800
Subject: [PATCH] snowflake雪花算法的实现改为使用hutool工具库里面的实现
---
xp-robotaxi-automatic-pilot-boot/src/main/java/com/xiaopeng/automaticPilot/service/KafkaConsumerService.java | 13 +++++--------
1 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/xp-robotaxi-automatic-pilot-boot/src/main/java/com/xiaopeng/automaticPilot/service/KafkaConsumerService.java b/xp-robotaxi-automatic-pilot-boot/src/main/java/com/xiaopeng/automaticPilot/service/KafkaConsumerService.java
index 72cd1e9..fe309c5 100644
--- a/xp-robotaxi-automatic-pilot-boot/src/main/java/com/xiaopeng/automaticPilot/service/KafkaConsumerService.java
+++ b/xp-robotaxi-automatic-pilot-boot/src/main/java/com/xiaopeng/automaticPilot/service/KafkaConsumerService.java
@@ -1,7 +1,6 @@
package com.xiaopeng.automaticPilot.service;
import cn.hutool.core.lang.Snowflake;
-import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.xiaopeng.api.dto.map.OrderRouteAndFareDto;
@@ -41,10 +40,8 @@
import com.xiaopeng.common.core.domain.R;
import com.xiaopeng.common.core.enums.OrderStatusEnum;
import com.xiaopeng.common.core.enums.PushMessageTypeEnum;
-import com.xiaopeng.common.core.utils.SnowFlake;
import com.xiaopeng.common.core.utils.StringUtils;
import com.xiaopeng.common.core.utils.uuid.UUID;
-import com.xiaopeng.common.redis.service.RedisService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
@@ -89,6 +86,8 @@
private ReassignOrderClient reassignOrderClient;
@Resource
private UserVehicleClient userVehicleClient;
+ @Resource
+ private Snowflake snowflake;
@@ -182,9 +181,8 @@
default:
log.info("消息不在处理范围内,忽略:{}", message);
}
-
-
}
+ //TODO 有点看不懂
//消息应答
if(MessageType.MESSAGE_TYPE_RESPONSE == type){
com.xiaopeng.api.vo.automaticPilot.proto.up.ResponseMessage resposne = msgContent.getContent_detail().getObject("resposne", com.xiaopeng.api.vo.automaticPilot.proto.up.ResponseMessage.class);
@@ -506,6 +504,7 @@
}
XpVehicle xpVehicle = xpVehicleClient.queryById(xpOrder.getVehicleId()).getData();
RouteVo routeVo = routeVoR.getData();
+ //TODO 这里有问题,应该是下发导航信息,不是下发订单信息
//构建导航下发请求对象
cloudOrderOperation(orderType, orderId, taskId, routeVo, xpVehicle.getVehicleVin());
}
@@ -552,9 +551,7 @@
waypoints.add(waypoint);
}
orderOperation.setWaypoints(waypoints);
- SnowFlake snowFlake = new SnowFlake(0, 0);
- snowFlake.withStartTimestamp(1420041600000L);
- long sequence = snowFlake.nextId();
+ long sequence = snowflake.nextId();
// 处理数据
redisTemplate.opsForValue().set(sequence,"pushOrder_"+orderId+"_"+vin,30, TimeUnit.MINUTES);
//开发发送请求到XPU
--
Gitblit v1.7.1