From 1ee76c252f2dbba62e0ec34cccf9eaac51de9083 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期三, 23 七月 2025 16:25:23 +0800
Subject: [PATCH] 修改bug

---
 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/WarnController.java |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/WarnController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/WarnController.java
index 9ef5e24..0b85382 100644
--- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/WarnController.java
+++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/WarnController.java
@@ -110,17 +110,19 @@
 		CarWarnInfoResp carWarnInfoResp = new CarWarnInfoResp();
 		carWarnInfoResp.setVehicleNumber(vehicleNumber);
 		GnssDataVo gnssDataVo = upExgMsgRealLocationClient.getVehicleSpeed(vehicleNumber).getData();
-		carWarnInfoResp.setSpeed(new BigDecimal(gnssDataVo.getVec1()));
-		Map<String, String> geocode = null;
-		try {
-			String longitude = new BigDecimal(gnssDataVo.getLon()).divide(new BigDecimal(1000000)).toString();
-			String latitude = new BigDecimal(gnssDataVo.getLat()).divide(new BigDecimal(1000000)).toString();
-			geocode = GDMapGeocodingUtil.geocode(longitude, latitude);
-		} catch (Exception e) {
-			throw new RuntimeException(e);
+		if(null != gnssDataVo){
+			carWarnInfoResp.setSpeed(new BigDecimal(gnssDataVo.getVec1()));
+			Map<String, String> geocode = null;
+			try {
+				String longitude = new BigDecimal(gnssDataVo.getLon()).divide(new BigDecimal(1000000)).toString();
+				String latitude = new BigDecimal(gnssDataVo.getLat()).divide(new BigDecimal(1000000)).toString();
+				geocode = GDMapGeocodingUtil.geocode(longitude, latitude);
+			} catch (Exception e) {
+				throw new RuntimeException(e);
+			}
+			String address = geocode.get("address");
+			carWarnInfoResp.setNowAddress(address);
 		}
-		String address = geocode.get("address");
-		carWarnInfoResp.setNowAddress(address);
 		List<WarnResp> warnList = new ArrayList<>();
 		for (Warn warn : list) {
 			WarnResp warnResp = new WarnResp();

--
Gitblit v1.7.1