From b8a3a680f3e6720a8329bfaae571b09659aace52 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期三, 09 四月 2025 19:47:55 +0800 Subject: [PATCH] 开发推流拉流工具类 --- ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/server/WarnMsgService.java | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/server/WarnMsgService.java b/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/server/WarnMsgService.java index c76dc69..43f6387 100644 --- a/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/server/WarnMsgService.java +++ b/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/server/WarnMsgService.java @@ -1,12 +1,10 @@ package com.ruoyi.dataInterchange.server; import com.alibaba.fastjson.JSON; +import com.ruoyi.dataInterchange.dao.UPExgMsgRealLocationDao; import com.ruoyi.dataInterchange.dao.UPWarnMsgAdptInfoDao; import com.ruoyi.dataInterchange.dao.UPWarnMsgUrgeTodoAckDao; -import com.ruoyi.dataInterchange.model.DOWNWarnMsgUrgeTodoReq; -import com.ruoyi.dataInterchange.model.UPWarnMsgAdptInfo; -import com.ruoyi.dataInterchange.model.UPWarnMsgUrgeTodoAck; -import com.ruoyi.dataInterchange.model.WarnMsg; +import com.ruoyi.dataInterchange.model.*; import com.ruoyi.dataInterchange.model.enu.DataType; import com.ruoyi.dataInterchange.netty.client.ChannelMap; import com.ruoyi.dataInterchange.util.jtt809.common.Jtt809Util; @@ -43,6 +41,9 @@ @Resource private RedisTemplate redisTemplate; + + @Resource + private UPExgMsgRealLocationDao upExgMsgRealLocationDao; public void up_warn_msg(ChannelHandlerContext ctx, OuterPacket out) { @@ -124,6 +125,13 @@ upWarnMsgAdptInfo.setResult(0x00); upWarnMsgAdptInfo.setInferiorPlatformId(inferiorPlatformId); upWarnMsgAdptInfo.setCreateTime(LocalDateTime.now().toEpochSecond(ZoneOffset.ofHours(8))); + UPExgMsgRealLocation upExgMsgRealLocation = upExgMsgRealLocationDao.findByVehicleNoOrderByCreateTimeDesc(upWarnMsgAdptInfo.getVehicleNo()); + if (null != upExgMsgRealLocation) { + GnssData gnssData = upExgMsgRealLocation.getGnssData(); + upWarnMsgAdptInfo.setSpeed(gnssData.getVec1()); + upWarnMsgAdptInfo.setLongitude(gnssData.getLon()); + upWarnMsgAdptInfo.setLatitude(gnssData.getLat()); + } upWarnMsgAdptInfoDao.save(upWarnMsgAdptInfo); } @@ -152,7 +160,7 @@ downWarnMsgUrgeTodoReq.setDataType(DataType.DOWN_WARN_MSG_URGE_TODO_REQ.getCode()); downWarnMsgUrgeTodoReq.setDataLength(92); byte[] body = downWarnMsgUrgeTodoReq.encode(); - OuterPacket out = new OuterPacket(DataType.DOWN_WARN_MSG_URGE_TODO_REQ.getCode(), body); + OuterPacket out = new OuterPacket(DataType.DOWN_WARN_MSG.getCode(), body); //获取从链路通道 Channel channel = ChannelMap.getClientChannel(inferiorPlatformId); if (null != channel && channel.isActive()) { -- Gitblit v1.7.1