From 41c64a5680521bf1d41fa6b9caadc55feac68ca3 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期四, 05 六月 2025 16:12:59 +0800 Subject: [PATCH] 优化报警 --- ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/DOWNExgMsgTakeEwaybillReq.java | 20 ++++++++++++++++---- 1 files changed, 16 insertions(+), 4 deletions(-) diff --git a/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/DOWNExgMsgTakeEwaybillReq.java b/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/DOWNExgMsgTakeEwaybillReq.java index 12622b7..963c612 100644 --- a/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/DOWNExgMsgTakeEwaybillReq.java +++ b/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/DOWNExgMsgTakeEwaybillReq.java @@ -5,8 +5,11 @@ import io.netty.buffer.Unpooled; import lombok.Data; +import java.io.UnsupportedEncodingException; + /** * 上报车辆电子运单请求 + * * @author zhibing.pu * @Date 2025/3/3 11:06 */ @@ -35,12 +38,21 @@ */ public byte[] encode() { ByteBuf byteBuf = Unpooled.buffer(28); - byte[] bytes1 = this.getVehicleNo().getBytes(); - for (byte b : bytes1) { - byteBuf.writeByte(b); + 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.writeByte(this.getDataType()); + byteBuf.writeShort(this.getDataType()); byteBuf.writeInt(this.getDataLength()); byte[] bytes = ByteBufUtil.getBytes(byteBuf); byteBuf.release(); -- Gitblit v1.7.1