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.time.LocalDateTime;
|
import java.time.ZoneOffset;
|
|
/**
|
* 报警督办请求
|
*
|
* @author zhibing.pu
|
* @Date 2025/3/3 15:14
|
*/
|
@Data
|
public class DOWNWarnMsgUrgeTodoReq {
|
/**
|
* 车牌号
|
*/
|
private String vehicleNo;
|
/**
|
* 车牌颜色
|
*/
|
private int vehicleColor;
|
/**
|
* 子业务类型标识
|
*/
|
private int dataType;
|
/**
|
* 后续数据长度
|
*/
|
private int dataLength;
|
/**
|
* 报警信息来源
|
* 0x01: 车载终端
|
* 0x02: 企业监控平台
|
* 0x03: 政府监管平台
|
* 0x09: 其他
|
*/
|
private int warnSrc;
|
/**
|
* 报警类型
|
*/
|
private int warnType;
|
/**
|
* 报警时间
|
*/
|
private long warnTime;
|
/**
|
* 报警督办ID
|
*/
|
private int supervisionId;
|
/**
|
* 督办截止时间
|
*/
|
private long supervisionEndTime;
|
/**
|
* 督办级别
|
* 0x00: 紧急
|
* 0x01: 一般
|
*/
|
private int supervisionLevel;
|
/**
|
* 督办人
|
*/
|
private String supervisor;
|
/**
|
* 督办联系电话
|
*/
|
private String supervisorTel;
|
/**
|
* 督办联系电子邮件
|
*/
|
private String supervisorEmail;
|
|
|
public DOWNWarnMsgUrgeTodoReq build(UPWarnMsgAdptInfo upWarnMsgAdptInfo) {
|
this.vehicleNo = upWarnMsgAdptInfo.getVehicleNo();
|
this.vehicleColor = upWarnMsgAdptInfo.getVehicleColor();
|
this.dataType = upWarnMsgAdptInfo.getDataType();
|
this.dataLength = upWarnMsgAdptInfo.getDataLength();
|
this.warnSrc = upWarnMsgAdptInfo.getWarnSrc();
|
this.warnType = upWarnMsgAdptInfo.getWarnType();
|
this.warnTime = upWarnMsgAdptInfo.getWarnTime();
|
this.supervisionId = upWarnMsgAdptInfo.getInfoId();
|
this.supervisionEndTime = LocalDateTime.now().plusDays(7).toEpochSecond(ZoneOffset.UTC);
|
this.supervisionLevel = 0x01;
|
this.supervisor = "admin";
|
this.supervisorTel = "";
|
this.supervisorEmail = "";
|
return this;
|
}
|
|
|
/**
|
* 编码报文
|
*/
|
public byte[] encode() {
|
ByteBuf byteBuf = Unpooled.buffer(120);
|
byte[] bytes1 = this.getVehicleNo().getBytes();
|
for (byte b : bytes1) {
|
byteBuf.writeByte(b);
|
}
|
byteBuf.writeByte(this.getVehicleColor());
|
byteBuf.writeShort(this.getDataType());
|
byteBuf.writeInt(this.getDataLength());
|
byteBuf.writeByte(this.getWarnSrc());
|
byteBuf.writeShort(this.getWarnType());
|
byteBuf.writeLong(this.getWarnTime());
|
byteBuf.writeInt(this.getSupervisionId());
|
byteBuf.writeLong(this.getSupervisionEndTime());
|
byteBuf.writeByte(this.getSupervisionLevel());
|
byte[] bytes2 = this.getSupervisor().getBytes();
|
for (byte b : bytes2) {
|
byteBuf.writeByte(b);
|
}
|
byte[] bytes3 = this.getSupervisorTel().getBytes();
|
for (byte b : bytes3) {
|
byteBuf.writeByte(b);
|
}
|
byte[] bytes4 = this.getSupervisorEmail().getBytes();
|
for (byte b : bytes4) {
|
byteBuf.writeByte(b);
|
}
|
byte[] bytes = ByteBufUtil.getBytes(byteBuf);
|
byteBuf.release();
|
return bytes;
|
}
|
}
|