From fd74ab1958c336d1087037c516dfa3e8b8d3d61e Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期三, 06 八月 2025 11:13:26 +0800 Subject: [PATCH] 修改bug --- ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/UPExgMsgTakeEwayBillAck.java | 64 ++++++++++++++++++++----------- 1 files changed, 41 insertions(+), 23 deletions(-) diff --git a/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/UPExgMsgTakeEwayBillAck.java b/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/UPExgMsgTakeEwayBillAck.java index df7a1d0..6237dd5 100644 --- a/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/UPExgMsgTakeEwayBillAck.java +++ b/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/UPExgMsgTakeEwayBillAck.java @@ -1,53 +1,71 @@ package com.ruoyi.dataInterchange.model; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.ruoyi.dataInterchange.pojo.BaseModel; +import com.ruoyi.dataInterchange.util.jtt809.common.Jtt809Util; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; import lombok.Data; +import org.springframework.data.elasticsearch.annotations.Document; +import org.springframework.data.elasticsearch.annotations.Field; +import org.springframework.data.elasticsearch.annotations.FieldType; /** * 上报车辆电子运单应答消息 + * * @author zhibing.pu * @Date 2025/2/24 15:20 */ @Data -public class UPExgMsgTakeEwayBillAck { +@Document(indexName = "up_exg_msg_take_ewaybill_ack") +public class UPExgMsgTakeEwayBillAck extends BaseModel { /** * 车牌号 */ - @JsonProperty("VEHICLE_NO") + @Field(type = FieldType.Text) private String vehicleNo; /** * 车牌颜色 */ - @JsonProperty("VEHICLE_COLOR") - private String vehicleColor; + @Field(type = FieldType.Integer) + private int vehicleColor; /** * 子业务类型标识 */ - @JsonProperty("DATA_TYPE") - private String dataType; + @Field(type = FieldType.Integer) + private int dataType; /** * 后续数据长度 */ - @JsonProperty("DATA_LENGTH") - private Integer dataLength; - /** - * 对应上报车辆电子运单请求消息源子业务类型标识 - */ - @JsonProperty("SOURCE_DATA_TYPE") - private Integer sourceDataType; - /** - * 对应上报车辆电子运单请求消息源报文序列号 - */ - @JsonProperty("SOURCE_MSG_SN") - private Integer sourceMsgSn; + @Field(type = FieldType.Integer) + private int dataLength; /** * 电子运单数据体长度 */ - @JsonProperty("EWAYBILL_LENGTH") - private Integer ewaybillLength; + @Field(type = FieldType.Integer) + private int ewayBillLength; /** * 电子运单数据内容 */ - @JsonProperty("EWAYBILL_INFO") - private Object ewaybillInfo; + @Field(type = FieldType.Text) + private String ewayBillInfo; + + + /** + * 解析报文 + */ + public UPExgMsgTakeEwayBillAck decode(UPExgMsg exgMsg) { + try { + byte[] data = exgMsg.getData(); + ByteBuf byteBuf = Unpooled.wrappedBuffer(data); + this.vehicleNo = exgMsg.getVehicleNo(); + this.vehicleColor = exgMsg.getVehicleColor(); + this.dataType = exgMsg.getDataType(); + this.dataLength = exgMsg.getDataLength(); + this.ewayBillLength = byteBuf.readInt(); + this.ewayBillInfo = Jtt809Util.readGBKString(byteBuf, this.ewayBillLength); + }catch (Exception e){ + e.printStackTrace(); + } + return this; + } } -- Gitblit v1.7.1