From 847a7773ef1a8ad418c6934d35b5f205a97c04d0 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期六, 06 十二月 2025 17:03:24 +0800
Subject: [PATCH] fix:在任务状态更新时,需要更新日志到旧系统
---
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaiduMapServiceImpl.java | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaiduMapServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaiduMapServiceImpl.java
index f44748a..e6c330e 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaiduMapServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaiduMapServiceImpl.java
@@ -82,4 +82,24 @@
return null;
}
}
+
+ @Override
+ public String reverseGeocoding(double lng, double lat) {
+ //璋冪敤鐧惧害鍦板潃鍙嶅悜瑙f瀽鎺ュ彛
+ String url = "https://api.map.baidu.com/reverse_geocoding/v3/";
+ String params = "location=" + lat + "," + lng +
+ "&output=json" +
+ "&ak=" + baiduMapConfig.getAk();
+ String response = HttpUtils.sendGet(url, params);
+ //"{\"status\":0,\"result\":{\"location\":{\"lng\":113.25330399999999,\"lat\":23.04668300960378},\"formatted_address\":\"骞夸笢鐪佷經灞卞競鍗楁捣鍖烘鍩庤閬揬",\"edz\":{\"name\":\"\"},\"business\":\"\",\"business_info\":[],\"addressComponent\":{\"country\":\"涓浗\",\"country_code\":0,\"region_code_iso\":\"CHN\",\"country_code_iso\":\"CHN\",\"country_code_iso2\":\"CN\",\"province\":\"骞夸笢鐪乗",\"city\":\"浣涘北甯俓",\"city_level\":2,\"district\":\"鍗楁捣鍖篭",\"town\":\"妗傚煄琛楅亾\",\"town_code\":\"440605011\",\"distance\":\"\",\"direction\":\"\",\"adcode\":\"440605\",\"street\":\"\",\"street_number\":\"\"},\"pois\":[],\"roads\":[],\"poiRegions\":[],\"sematic_description\":\"\",\"formatted_address_poi\":\"\",\"cityCode\":138}}"
+ JSONObject jsonObject = JSONObject.parseObject(response);
+ if (jsonObject.getInteger("status") != 0) {
+ logger.warn("鐧惧害鍦板浘鍦板潃鍙嶅悜瑙f瀽澶辫触: lng={}, lat={}, status={}, message={}",
+ lng, lat, jsonObject.getInteger("status"), jsonObject.getString("message"));
+ return null;
+ }
+ String address = jsonObject.getJSONObject("result").getString("formatted_address");
+ logger.info("鐧惧害鍦板浘鍦板潃鍙嶅悜瑙f瀽鎴愬姛: lng={}, lat={}, address={}", lng, lat, address);
+ return address;
+ }
}
--
Gitblit v1.9.1