From a6d543bcef73e2a78d8da9b065e241643c166aa8 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期五, 13 二月 2026 11:40:29 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
xp-robotaxi-automaticPilot-boot/src/main/java/com/xiaopeng/automaticPilot/util/XPUUtil.java | 41 +++++++++++++++++++++++++++++++++++++++--
1 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/xp-robotaxi-automaticPilot-boot/src/main/java/com/xiaopeng/automaticPilot/util/XPUUtil.java b/xp-robotaxi-automaticPilot-boot/src/main/java/com/xiaopeng/automaticPilot/util/XPUUtil.java
index 54dd228..f1d348c 100644
--- a/xp-robotaxi-automaticPilot-boot/src/main/java/com/xiaopeng/automaticPilot/util/XPUUtil.java
+++ b/xp-robotaxi-automaticPilot-boot/src/main/java/com/xiaopeng/automaticPilot/util/XPUUtil.java
@@ -1,5 +1,7 @@
package com.xiaopeng.automaticPilot.util;
+import cn.hutool.core.lang.Snowflake;
+import cn.hutool.core.util.IdUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
@@ -81,8 +83,9 @@
header.setMsg_id(UUID.randomUUID().toString());
header.setTimestamp(System.currentTimeMillis());
header.setCmd(RTCmdType.CLOUD_ORDER_OPERATION);
- header.setSequence(1L);
- header.setType(MessageType.MESSAGE_TYPE_RESPONSE);
+ Snowflake snowflake = IdUtil.getSnowflake(0, 0);
+ header.setSequence(snowflake.nextId());
+ header.setType(MessageType.MESSAGE_TYPE_REQUEST);
msgContent.setHeader(header);
// 消息内容
JSONObject jsonObject = new JSONObject();
@@ -108,4 +111,38 @@
}
+
+
+ /**
+ * 响应消息
+ *
+ * @param responseMessage
+ * @return
+ */
+ public ResponseMessage responseMessage(ResponseMessage responseMessage) {
+ MsgContent msgContent = new MsgContent();
+ // 消息头
+ RtMsgHeader header = new RtMsgHeader();
+ header.setMsg_id(UUID.randomUUID().toString());
+ header.setTimestamp(System.currentTimeMillis());
+ header.setCmd(RTCmdType.CLOUD_TASK_CONTROL);
+ Snowflake snowflake = IdUtil.getSnowflake(0, 0);
+ header.setSequence(snowflake.nextId());
+ header.setType(MessageType.MESSAGE_TYPE_RESPONSE);
+ msgContent.setHeader(header);
+ // 消息内容
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put("resposne", responseMessage);
+ msgContent.setContent_detail(jsonObject);
+ log.info("云端-->XPU 响应消息:{}", msgContent);
+ HttpRequest post = HttpUtil.createPost("");
+ post.body(JSON.toJSONString(msgContent));
+ HttpResponse execute = post.execute();
+ int status = execute.getStatus();
+ if (200 != status) {
+ throw new RuntimeException("XPU 接口异常:" + execute.getStatus());
+ }
+ return null;
+ }
+
}
--
Gitblit v1.7.1