From a46786fe889b0b9212f2c0eeb6659101af6d3785 Mon Sep 17 00:00:00 2001 From: awenes <1121353141@qq.com> Date: Sun, 4 Feb 2024 20:56:02 +0800 Subject: [PATCH] =?UTF-8?q?:zap:=20=E4=BC=98=E5=8C=96maxmind?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/geo/maxmind/MaxmindGeoLocationServiceImpl.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/geo/maxmind/MaxmindGeoLocationServiceImpl.java b/eiam-common/src/main/java/cn/topiam/employee/common/geo/maxmind/MaxmindGeoLocationServiceImpl.java index a75100d9..70f7482f 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/geo/maxmind/MaxmindGeoLocationServiceImpl.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/geo/maxmind/MaxmindGeoLocationServiceImpl.java @@ -34,7 +34,6 @@ import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream; import org.apache.commons.io.FileUtils; import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.StringUtils; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.web.client.ResourceAccessException; @@ -133,9 +132,9 @@ public class MaxmindGeoLocationServiceImpl implements GeoLocationService { .countryName(country.getName()) .countryCode(country.getGeoNameId().toString()) .cityName(city.getName()) - .cityCode(StringUtils.defaultString(CITY_DISTRICT.get(city.getName()), String.valueOf(city.getGeoNameId()))) + .cityCode(Objects.toString(CITY_DISTRICT.get(city.getName()), String.valueOf(city.getGeoNameId()))) .provinceName(subdivision.getName()) - .provinceCode(StringUtils.defaultString(PROVINCE_DISTRICT.get(subdivision.getName()), subdivision.getIsoCode())) + .provinceCode(Objects.toString(PROVINCE_DISTRICT.get(subdivision.getName()), subdivision.getIsoCode())) .longitude(location.getLongitude()) .latitude(location.getLatitude()) .provider(MAXMIND).build(); @@ -234,7 +233,7 @@ public class MaxmindGeoLocationServiceImpl implements GeoLocationService { File extractFolder = new File(extractPath); TarArchiveEntry entry; // 将 tar 文件解压到 extractPath 目录下 - while ((entry = fin.getNextTarEntry()) != null) { + while ((entry = fin.getNextEntry()) != null) { if (entry.isDirectory()) { continue; }