From a05b419384e148fc950c77553816a2d05144f4ae Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期四, 19 六月 2025 19:36:22 +0800 Subject: [PATCH] 修改生产环境配置 --- ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/DOWNPlaybackMsgStartup.java | 64 ++++++++++++++++++++++++++++++++ 1 files changed, 64 insertions(+), 0 deletions(-) diff --git a/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/DOWNPlaybackMsgStartup.java b/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/DOWNPlaybackMsgStartup.java index 914d5ce..fd3c127 100644 --- a/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/DOWNPlaybackMsgStartup.java +++ b/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/DOWNPlaybackMsgStartup.java @@ -1,6 +1,11 @@ package com.ruoyi.dataInterchange.model; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBufUtil; +import io.netty.buffer.Unpooled; import lombok.Data; + +import java.io.UnsupportedEncodingException; /** * 远程录像回放请求 @@ -67,4 +72,63 @@ * 车辆进入跨域地区后5min之内的任一位置 */ private String gnssData; + + + /** + * 编码回复报文 + */ + public byte[] encode() { + ByteBuf byteBuf = Unpooled.buffer(148); + byte[] bytes1 = new byte[0]; + try { + bytes1 = this.getVehicleNo().getBytes("GBK"); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + for (int i = 0; i < 21; i++) { + if (i < bytes1.length) { + byteBuf.writeByte(bytes1[i]); + } else { + byteBuf.writeByte(0x00); + } + } + byteBuf.writeByte(this.getVehicleColor()); + byteBuf.writeShort(this.getDataType()); + byteBuf.writeInt(this.getDataLength()); + byteBuf.writeChar(this.getChannelId()); + byteBuf.writeChar(this.getAvttemType()); + byteBuf.writeChar(this.getStreamType()); + byteBuf.writeChar(this.getMemType()); + byteBuf.writeLong(this.getPlaybackStartTime()); + byteBuf.writeLong(this.getPlaybackEndTime()); + byte[] bytes2 = new byte[0]; + try { + bytes2 = this.getAuthorizeCode().getBytes("GBK"); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + for (int i = 0; i < 64; i++) { + if (i < bytes2.length) { + byteBuf.writeByte(bytes2[i]); + } else { + byteBuf.writeByte(0x00); + } + } + byte[] bytes3 = new byte[0]; + try { + bytes3 = this.getGnssData().getBytes("GBK"); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + for (int i = 0; i < 36; i++) { + if (i < bytes3.length) { + byteBuf.writeByte(bytes3[i]); + } else { + byteBuf.writeByte(0x00); + } + } + byte[] bytes = ByteBufUtil.getBytes(byteBuf); + byteBuf.release(); + return bytes; + } } -- Gitblit v1.7.1