ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/dao/UPWarnMsgOperationInfoDao.java
New file @@ -0,0 +1,11 @@ package com.ruoyi.dataInterchange.dao; import com.ruoyi.dataInterchange.model.UPWarnMsgOperationInfo; import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; /** * @author zhibing.pu * @Date 2025/6/3 17:25 */ public interface UPWarnMsgOperationInfoDao extends ElasticsearchRepository<UPWarnMsgOperationInfo, String> { } ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/UPWarnMsgOperationInfo.java
New file @@ -0,0 +1,113 @@ 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; /** * @author zhibing.pu * @Date 2025/6/3 17:16 */ @Data @Document(indexName = "up_warn_msg_operation_info") public class UPWarnMsgOperationInfo 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; /** * 报警处理结果 * 0x00:处理中 * 0x01:已处理完毕 */ @Field(type = FieldType.Integer) private int result; /** * 报警处理方式 * 0x00: 快速拍照 * 0x01: 语音下发 * 0x02: 不做处理 * 0x03: 其他 */ @Field(type = FieldType.Integer) private int method; /** * 报警处理人姓名长度 */ @Field(type = FieldType.Integer) private int operatorLength; /** * 报警处理人姓名 */ @Field(type = FieldType.Text) private String operator; /** * 报警处理人所属公司名称长度 */ @Field(type = FieldType.Integer) private int companyLength; /** * 报警处理人所属公司名称 */ @Field(type = FieldType.Text) private String company; /** * 解析报文 */ public UPWarnMsgOperationInfo 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.result = byteBuf.readByte(); //报警处理方式 this.method = byteBuf.readByte(); //报警处理人姓名长度 this.operatorLength = byteBuf.readByte(); //报警处理人姓名 this.operator = Jtt809Util.readGBKString(byteBuf,this.operatorLength); //报警处理人所属公司名称长度 this.companyLength = byteBuf.readByte(); //报警处理人所属公司名称 this.company = Jtt809Util.readGBKString(byteBuf,this.companyLength); }catch (Exception e){ e.printStackTrace(); } return this; } } ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/enu/DataType.java
@@ -71,6 +71,7 @@ UP_WARN_MSG(0x1400, "报警信息交互"), UP_WARN_MSG_URGE_TODO_ACK(0x1401, "报警督办应答消息"), UP_WARN_MSG_ADPT_INFO(0x1402, "上报报警信息"), UP_WARN_MSG_OPERATION_INFO(0x1402, "主动上报报警处理消息"), UP_WARN_MSG_ADPT_TODO_INFO(0x1412, "主动上报报警处理结果"), UP_WARN_MSG_URGE_TODO_ACK_INFO(0x1411, "上报报警督办应答消息"), DOWN_WARN_MSG(0x9400, "从链路报警信息"), ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/server/WarnMsgService.java
@@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSONObject; import com.ruoyi.dataInterchange.dao.UPExgMsgRealLocationDao; import com.ruoyi.dataInterchange.dao.UPWarnMsgAdptInfoDao; import com.ruoyi.dataInterchange.dao.UPWarnMsgOperationInfoDao; import com.ruoyi.dataInterchange.dao.UPWarnMsgUrgeTodoAckDao; import com.ruoyi.dataInterchange.model.*; import com.ruoyi.dataInterchange.model.enu.DataType; @@ -48,6 +49,9 @@ private UPWarnMsgAdptInfoDao upWarnMsgAdptInfoDao; @Resource private UPWarnMsgOperationInfoDao upWarnMsgOperationInfoDao; @Resource private RedisTemplate redisTemplate; @Resource @@ -74,6 +78,10 @@ case UP_WARN_MSG_ADPT_INFO: log.info("上报报警信息({}):{}", DataType.UP_WARN_MSG_ADPT_INFO.getCode(), out); up_warn_msg_adpt_info(ctx, out.getGnsscenterId(), warnMsg); break; case UP_WARN_MSG_OPERATION_INFO: log.info("上报报警处理信息({}):{}", DataType.UP_WARN_MSG_OPERATION_INFO.getCode(), out); up_warn_msg_operation_info(ctx, out.getGnsscenterId(), warnMsg); break; default: break; @@ -152,6 +160,24 @@ /** * 上报报警处理信息 * @param ctx * @param inferiorPlatformId * @param warnMsg */ public void up_warn_msg_operation_info(ChannelHandlerContext ctx, int inferiorPlatformId, WarnMsg warnMsg) { UPWarnMsgOperationInfo upWarnMsgOperationInfo = new UPWarnMsgOperationInfo().decode(warnMsg); upWarnMsgOperationInfo.setInferiorPlatformId(inferiorPlatformId); upWarnMsgOperationInfo.setCreateTime(LocalDateTime.now().toEpochSecond(ZoneOffset.ofHours(8))); upWarnMsgOperationInfoDao.save(upWarnMsgOperationInfo); //修改报警处理结果 UPWarnMsgAdptInfo upWarnMsgAdptInfo = upWarnMsgAdptInfoDao.findByInfoIdIs(upWarnMsgOperationInfo.getInfoId()); upWarnMsgAdptInfo.setResult(upWarnMsgOperationInfo.getResult()); upWarnMsgAdptInfoDao.save(upWarnMsgAdptInfo); } /** * 定时任务督办报警请求 */ public void taskUrgeTodo() {