package com.ruoyi.dataInterchange.model;
|
|
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;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
|
/**
|
* 报警附件目录请求应答
|
* @author zhibing.pu
|
* @Date 2025/6/4 15:05
|
*/
|
@Data
|
@Document(indexName = "up_warn_msg_filelist_ack")
|
public class UpWarnMsgFileListAck extends BaseModel {
|
/**
|
* 车牌号
|
*/
|
@Field(type = FieldType.Text)
|
private String vehicleNo;
|
/**
|
* 车牌颜色
|
*/
|
@Field(type = FieldType.Integer)
|
private int vehicleColor;
|
/**
|
* 子业务类型标识
|
*/
|
@Field(type = FieldType.Integer)
|
private int dataType;
|
/**
|
* 后续数据长度
|
*/
|
@Field(type = FieldType.Integer)
|
private int dataLength;
|
/**
|
* 报警信息ID
|
*/
|
@Field(type = FieldType.Text)
|
private String infoId;
|
/**
|
* 附件服务器地址长度
|
*/
|
@Field(type = FieldType.Integer)
|
private int serverLength;
|
/**
|
* 附件服务器IP或域名
|
*/
|
@Field(type = FieldType.Text)
|
private String server;
|
/**
|
* 附件服务器FTP协议端口号
|
*/
|
@Field(type = FieldType.Integer)
|
private int port;
|
/**
|
* 用户名长度
|
*/
|
@Field(type = FieldType.Integer)
|
private int userNameLength;
|
/**
|
* 附件服务器用户名
|
*/
|
@Field(type = FieldType.Text)
|
private String userName;
|
/**
|
* 密码长度
|
*/
|
@Field(type = FieldType.Integer)
|
private int passwordLength;
|
/**
|
* 附件服务器密码
|
*/
|
@Field(type = FieldType.Text)
|
private String password;
|
/**
|
* 附件数量
|
*/
|
@Field(type = FieldType.Integer)
|
private int fileCount;
|
/**
|
* 附件列表数据
|
*/
|
@Field(type = FieldType.Object)
|
private List<File> fileList;
|
|
|
/**
|
* 解析报文
|
*/
|
public UpWarnMsgFileListAck decode(WarnMsg warnMsg) {
|
try {
|
byte[] data = warnMsg.getData();
|
ByteBuf byteBuf = Unpooled.wrappedBuffer(data);
|
this.vehicleNo = warnMsg.getVehicleNo();
|
this.vehicleColor = warnMsg.getVehicleColor();
|
this.dataType = warnMsg.getDataType();
|
this.dataLength = warnMsg.getDataLength();
|
|
//信息ID
|
this.infoId = Jtt809Util.readGBKString(byteBuf,32);
|
//附件服务器地址长度
|
this.serverLength = byteBuf.readByte();
|
//附件服务器IP或域名
|
this.server = Jtt809Util.readGBKString(byteBuf,serverLength);
|
//附件服务器FTP协议端口号
|
this.port = byteBuf.readShort();
|
//用户名长度
|
this.userNameLength = byteBuf.readByte();
|
//附件服务器用户名
|
this.userName = Jtt809Util.readGBKString(byteBuf,userNameLength);
|
//密码长度
|
this.passwordLength = byteBuf.readByte();
|
//附件服务器密码
|
this.password = Jtt809Util.readGBKString(byteBuf,passwordLength);
|
//附件数量
|
this.fileCount = byteBuf.readByte();
|
List<File> list = new ArrayList<>();
|
for (int i = 0; i < this.fileCount; i++) {
|
list.add(new File().decode(byteBuf));
|
}
|
this.fileList = list;
|
}catch (Exception e){
|
e.printStackTrace();
|
}
|
return this;
|
}
|
}
|