liujie
2026-02-13 177e9446a26971f5215e58b11d52179424e09159
feat(order): 集成雪花算法生成唯一序列号并扩展任务订单功能

- 在OrderMissionController中引入SnowFlake工具类生成唯一序列号
- 修改cloudCreateOrder方法调用以传入生成的序列号参数
- 为RTTask实体类添加vin字段用于存储车辆识别码
- 更新XPUUtil工具类以支持序列号传递到消息头中
2个文件已修改
13 ■■■■■ 已修改文件
xp-robotaxi-automaticPilot-boot/src/main/java/com/xiaopeng/automaticPilot/controller/OrderMissionController.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-automaticPilot-boot/src/main/java/com/xiaopeng/automaticPilot/util/XPUUtil.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-automaticPilot-boot/src/main/java/com/xiaopeng/automaticPilot/controller/OrderMissionController.java
@@ -7,6 +7,7 @@
import com.xiaopeng.api.vo.automaticPilot.proto.down.cloudCreateOrder.TaskType;
import com.xiaopeng.automaticPilot.util.XPUUtil;
import com.xiaopeng.common.core.domain.R;
import com.xiaopeng.common.core.utils.SnowFlake;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
@@ -39,8 +40,10 @@
        task.setTask_id(System.currentTimeMillis()+ "");
        task.setTask_type(TaskType.ROBOTAXI);
        task.setStatus(TaskStatus.PENDING);
        ResponseMessage responseMessage = xpuUtil.cloudCreateOrder(task);
        SnowFlake snowFlake = new SnowFlake(0, 0);
        snowFlake.withStartTimestamp(1420041600000L);
        long sequence = snowFlake.nextId();
        ResponseMessage responseMessage = xpuUtil.cloudCreateOrder(task,sequence);
        if (responseMessage.getCode()== StatusCode.OK) {
            return R.ok(true);
        }
xp-robotaxi-automaticPilot-boot/src/main/java/com/xiaopeng/automaticPilot/util/XPUUtil.java
@@ -35,14 +35,16 @@
     * @param task
     * @return
     */
    public ResponseMessage cloudCreateOrder(RTTask task) {
    public ResponseMessage cloudCreateOrder(RTTask task,Long sequence) {
        MsgContent msgContent = new MsgContent();
        // 消息头
        RtMsgHeader header = new RtMsgHeader();
        header.setMsg_id(UUID.randomUUID().toString());
        header.setTimestamp(System.currentTimeMillis());
        header.setCmd(RTCmdType.CLOUD_CREATE_ORDER);
        header.setSequence(1L);
        header.setSequence(sequence);
        header.setType(MessageType.MESSAGE_TYPE_RESPONSE);
        msgContent.setHeader(header);
        // 消息内容