From 312f26c49124f355e9f78c6ddd69f71895aa73fc Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期一, 26 五月 2025 13:47:43 +0800
Subject: [PATCH] 修改公交公司的事件订阅功能

---
 ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/server/WarnMsgService.java |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 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 2932e7e..128fd89 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
@@ -187,18 +187,21 @@
 	 * 存储mqtt协议报警信息
 	 */
 	public void saveWarnMsgService(JSONObject jsonObject) {
-		SubscriptionEvent subscriptionEvent = jsonObject.getObject("", SubscriptionEvent.class);
+		SubscriptionEvent subscriptionEvent = jsonObject.getObject("params", SubscriptionEvent.class);
 		List<Event> events = subscriptionEvent.getEvents();
 		events.forEach(event -> {
 			//车牌号
 			String srcName = event.getSrcName();
 			Alarm data = JSONObject.parseObject(event.getData(), Alarm.class);
+			if(!StringUtils.hasLength(data.getAlarmId())){
+				return;
+			}
 			UPWarnMsgAdptInfo upWarnMsgAdptInfo = upWarnMsgAdptInfoDao.findByInfoIdIs(data.getAlarmId());
 			if(null == upWarnMsgAdptInfo){
 				upWarnMsgAdptInfo = new UPWarnMsgAdptInfo();
 			}
 			upWarnMsgAdptInfo.setVehicleNo(srcName);
-			upWarnMsgAdptInfo.setVehicleColor(data.getVehicleLicenseColor());
+			upWarnMsgAdptInfo.setVehicleColor(null == data.getVehicleLicenseColor() ? 0 : data.getVehicleLicenseColor());
 			upWarnMsgAdptInfo.setWarnSrc(data.getSourceType() + 1);
 			upWarnMsgAdptInfo.setWarnType(getAlarmType(data.getEventType()));
 			upWarnMsgAdptInfo.setWarnTime(LocalDateTime.parse(data.getAlarmTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")).toEpochSecond(ZoneOffset.ofHours(8)));
@@ -207,11 +210,14 @@
 			upWarnMsgAdptInfo.setLongitude(data.getLongitude().intValue());
 			upWarnMsgAdptInfo.setLatitude(data.getLatitude().intValue());
 			upWarnMsgAdptInfo.setAltitude(data.getHeight().intValue() / 10);
-			upWarnMsgAdptInfo.setSpeed(data.getSpeed().intValue() / 10000);
-			upWarnMsgAdptInfo.setVec2(data.getSpeed().intValue());
+			upWarnMsgAdptInfo.setSpeed(data.getSpeed().intValue() / 100000);
+			upWarnMsgAdptInfo.setVec2(data.getSpeed().intValue() / 100000);
 			upWarnMsgAdptInfo.setStatus(data.getStatus());
 			upWarnMsgAdptInfo.setDirection(data.getDirection() / 100);
 			upWarnMsgAdptInfo.setInfoContent(data.getAlarmInfo());
+			if(2 == upWarnMsgAdptInfo.getLevel()){
+				return;
+			}
 			upWarnMsgAdptInfoDao.save(upWarnMsgAdptInfo);
 		});
 	}

--
Gitblit v1.7.1