From f3eb0cde171d53badcebdf6448903f33d0202e83 Mon Sep 17 00:00:00 2001 From: smallbun <2689170096@qq.com> Date: Mon, 16 Dec 2024 01:05:20 +0800 Subject: [PATCH] =?UTF-8?q?:building=5Fconstruction:=20=E5=9C=B0=E7=90=86?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ionServiceImpl.java => NoneGeoLocationParserImpl.java} | 6 +++--- ...rviceImpl.java => Ip2regionGeoLocationParserImpl.java} | 6 +++--- ...ServiceImpl.java => MaxmindGeoLocationParserImpl.java} | 8 ++++---- .../geo/maxmind/UpdateMaxmindTaskConfiguration.java | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) rename eiam-common/src/main/java/cn/topiam/employee/common/geo/{NoneGeoLocationServiceImpl.java => NoneGeoLocationParserImpl.java} (88%) rename eiam-common/src/main/java/cn/topiam/employee/common/geo/ip2region/{Ip2regionGeoLocationServiceImpl.java => Ip2regionGeoLocationParserImpl.java} (94%) rename eiam-common/src/main/java/cn/topiam/employee/common/geo/maxmind/{MaxmindGeoLocationServiceImpl.java => MaxmindGeoLocationParserImpl.java} (97%) diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/geo/NoneGeoLocationServiceImpl.java b/eiam-common/src/main/java/cn/topiam/employee/common/geo/NoneGeoLocationParserImpl.java similarity index 88% rename from eiam-common/src/main/java/cn/topiam/employee/common/geo/NoneGeoLocationServiceImpl.java rename to eiam-common/src/main/java/cn/topiam/employee/common/geo/NoneGeoLocationParserImpl.java index a90a7673..ab1c2678 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/geo/NoneGeoLocationServiceImpl.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/geo/NoneGeoLocationParserImpl.java @@ -18,8 +18,8 @@ package cn.topiam.employee.common.geo; import cn.topiam.employee.support.geo.GeoLocation; +import cn.topiam.employee.support.geo.GeoLocationParser; import cn.topiam.employee.support.geo.GeoLocationProvider; -import cn.topiam.employee.support.geo.GeoLocationService; /** * None @@ -27,13 +27,13 @@ import cn.topiam.employee.support.geo.GeoLocationService; * @author TopIAM * Created by support@topiam.cn on 2021/11/27 21:20 */ -public class NoneGeoLocationServiceImpl implements GeoLocationService { +public class NoneGeoLocationParserImpl implements GeoLocationParser { /** * 获取地理位置 * * @param remote {@link String} - * @return {@link GeoLocationService} + * @return {@link GeoLocation} */ @Override public GeoLocation getGeoLocation(String remote) { diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/geo/ip2region/Ip2regionGeoLocationServiceImpl.java b/eiam-common/src/main/java/cn/topiam/employee/common/geo/ip2region/Ip2regionGeoLocationParserImpl.java similarity index 94% rename from eiam-common/src/main/java/cn/topiam/employee/common/geo/ip2region/Ip2regionGeoLocationServiceImpl.java rename to eiam-common/src/main/java/cn/topiam/employee/common/geo/ip2region/Ip2regionGeoLocationParserImpl.java index d8cf431c..38409f44 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/geo/ip2region/Ip2regionGeoLocationServiceImpl.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/geo/ip2region/Ip2regionGeoLocationParserImpl.java @@ -27,8 +27,8 @@ import org.springframework.util.Assert; import cn.topiam.employee.common.enums.Country; import cn.topiam.employee.support.geo.GeoLocation; +import cn.topiam.employee.support.geo.GeoLocationParser; import cn.topiam.employee.support.geo.GeoLocationProvider; -import cn.topiam.employee.support.geo.GeoLocationService; import lombok.extern.slf4j.Slf4j; import static cn.topiam.employee.common.geo.District.CITY_DISTRICT; @@ -41,7 +41,7 @@ import static cn.topiam.employee.common.geo.District.PROVINCE_DISTRICT; * Created by support@topiam.cn on 2023/10/30 19:11 */ @Slf4j -public class Ip2regionGeoLocationServiceImpl implements GeoLocationService, DisposableBean { +public class Ip2regionGeoLocationParserImpl implements GeoLocationParser, DisposableBean { public static GeoLocationProvider IP2REGION = new GeoLocationProvider("default", "ip2region"); @@ -50,7 +50,7 @@ public class Ip2regionGeoLocationServiceImpl implements GeoLocationService, Disp private final Searcher searcher; - public Ip2regionGeoLocationServiceImpl() throws IOException { + public Ip2regionGeoLocationParserImpl() throws IOException { // 加载整个xdb到内存。 try (InputStream in = this.getClass().getResourceAsStream(DEFAULT_XDB_PATH)) { Assert.notNull(in, "XDB must not be null"); 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/MaxmindGeoLocationParserImpl.java similarity index 97% rename from eiam-common/src/main/java/cn/topiam/employee/common/geo/maxmind/MaxmindGeoLocationServiceImpl.java rename to eiam-common/src/main/java/cn/topiam/employee/common/geo/maxmind/MaxmindGeoLocationParserImpl.java index 7845573a..a71d7023 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/MaxmindGeoLocationParserImpl.java @@ -46,8 +46,8 @@ import com.maxmind.geoip2.record.*; import cn.topiam.employee.support.constant.EiamConstants; import cn.topiam.employee.support.geo.GeoLocation; +import cn.topiam.employee.support.geo.GeoLocationParser; import cn.topiam.employee.support.geo.GeoLocationProvider; -import cn.topiam.employee.support.geo.GeoLocationService; import cn.topiam.employee.support.util.IpUtils; import lombok.Getter; @@ -66,7 +66,7 @@ import static cn.topiam.employee.common.geo.District.PROVINCE_DISTRICT; */ @Slf4j @Getter -public class MaxmindGeoLocationServiceImpl implements GeoLocationService { +public class MaxmindGeoLocationParserImpl implements GeoLocationParser { private final DatabaseReader reader; private final MaxmindProviderConfig maxmindProviderConfig; @@ -86,8 +86,8 @@ public class MaxmindGeoLocationServiceImpl implements GeoLocationService { */ public static final String SHA256_URL = "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=%s&suffix=tar.gz.sha256"; - public MaxmindGeoLocationServiceImpl(MaxmindProviderConfig maxmindProviderConfig, - RestTemplate restTemplate) throws IOException { + public MaxmindGeoLocationParserImpl(MaxmindProviderConfig maxmindProviderConfig, + RestTemplate restTemplate) throws IOException { this.maxmindProviderConfig = maxmindProviderConfig; this.restTemplate = restTemplate; download(); diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/geo/maxmind/UpdateMaxmindTaskConfiguration.java b/eiam-common/src/main/java/cn/topiam/employee/common/geo/maxmind/UpdateMaxmindTaskConfiguration.java index a666fb5b..918728ea 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/geo/maxmind/UpdateMaxmindTaskConfiguration.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/geo/maxmind/UpdateMaxmindTaskConfiguration.java @@ -22,7 +22,7 @@ import org.slf4j.LoggerFactory; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; -import cn.topiam.employee.support.geo.GeoLocationService; +import cn.topiam.employee.support.geo.GeoLocationParser; import lombok.RequiredArgsConstructor; @@ -43,7 +43,7 @@ public class UpdateMaxmindTaskConfiguration { @Scheduled(cron = "0 0 1 * * ?") public void update() { try { - if (geoLocationService instanceof MaxmindGeoLocationServiceImpl maxmindGeoLocation) { + if (geoLocationParser instanceof MaxmindGeoLocationParserImpl maxmindGeoLocation) { logger.info("执行IP库文件更新定时任务开始"); if (maxmindGeoLocation.checkDbFileIsUpdate()) { maxmindGeoLocation.download(); @@ -55,6 +55,6 @@ public class UpdateMaxmindTaskConfiguration { } } - private final GeoLocationService geoLocationService; + private final GeoLocationParser geoLocationParser; }