From 266584cece6c84a7a6a4e3773537dcc1f652191c Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Tue, 13 Jun 2023 18:46:49 +0800 Subject: [PATCH] =?UTF-8?q?feature(info-query):=20=E5=A2=9E=E5=8A=A0=20hiv?= =?UTF-8?q?e=20=E8=A1=A8=E7=BB=B4=E5=BA=A6=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/forest/service/InfoService.java | 9 ++++-- .../info/controller/InfoController.java | 10 +++++++ .../service/info/service/InfoService.java | 28 +++++++++++++++++-- 3 files changed, 43 insertions(+), 4 deletions(-) diff --git a/service-forest/src/main/java/com/lanyuanxiaoyao/service/forest/service/InfoService.java b/service-forest/src/main/java/com/lanyuanxiaoyao/service/forest/service/InfoService.java index 01b6c20..2574054 100644 --- a/service-forest/src/main/java/com/lanyuanxiaoyao/service/forest/service/InfoService.java +++ b/service-forest/src/main/java/com/lanyuanxiaoyao/service/forest/service/InfoService.java @@ -10,9 +10,8 @@ import com.lanyuanxiaoyao.service.configuration.entity.PageResponse; import com.lanyuanxiaoyao.service.configuration.entity.info.JobAndMetas; import com.lanyuanxiaoyao.service.configuration.entity.info.JobIdAndAlias; import com.lanyuanxiaoyao.service.configuration.entity.info.VersionUpdated; -import org.eclipse.collections.api.list.ImmutableList; - import java.util.Map; +import org.eclipse.collections.api.list.ImmutableList; /** * Info 接口 @@ -34,6 +33,12 @@ public interface InfoService { @Get("/hudi_focus_count") Long hudiFocusCount(); + @Get("/hive_count") + Long hiveCount(); + + @Get("/hive_focus_count") + Long hiveFocusCount(); + @Get("/un_receive_version_normal_table") ImmutableList unReceiveVersionNormalTable(@Query("version") String version); diff --git a/service-info-query/src/main/java/com/lanyuanxiaoyao/service/info/controller/InfoController.java b/service-info-query/src/main/java/com/lanyuanxiaoyao/service/info/controller/InfoController.java index 3444938..fa38125 100644 --- a/service-info-query/src/main/java/com/lanyuanxiaoyao/service/info/controller/InfoController.java +++ b/service-info-query/src/main/java/com/lanyuanxiaoyao/service/info/controller/InfoController.java @@ -184,4 +184,14 @@ public class InfoController { public Long hudiFocusCount() { return infoService.hudiFocusCount(); } + + @GetMapping("/hive_count") + public Long hiveCount() { + return infoService.hiveCount(); + } + + @GetMapping("/hive_focus_count") + public Long hiveFocusCount() { + return infoService.hiveFocusCount(); + } } diff --git a/service-info-query/src/main/java/com/lanyuanxiaoyao/service/info/service/InfoService.java b/service-info-query/src/main/java/com/lanyuanxiaoyao/service/info/service/InfoService.java index 59bc3ae..d8900eb 100644 --- a/service-info-query/src/main/java/com/lanyuanxiaoyao/service/info/service/InfoService.java +++ b/service-info-query/src/main/java/com/lanyuanxiaoyao/service/info/service/InfoService.java @@ -16,6 +16,7 @@ import com.lanyuanxiaoyao.service.configuration.entity.PageResponse; import com.lanyuanxiaoyao.service.configuration.entity.info.JobAndMetas; import com.lanyuanxiaoyao.service.configuration.entity.info.JobIdAndAlias; import com.lanyuanxiaoyao.service.configuration.entity.info.VersionUpdated; +import java.util.List; import org.eclipse.collections.api.factory.Lists; import org.eclipse.collections.api.list.ImmutableList; import org.eclipse.collections.api.map.ImmutableMap; @@ -28,8 +29,6 @@ import org.springframework.retry.annotation.Retryable; import org.springframework.stereotype.Service; import org.springframework.transaction.support.TransactionTemplate; -import java.util.List; - import static com.eshore.odcp.hudi.connector.Constants.DATABASE_NAME; /** @@ -530,4 +529,29 @@ public class InfoService { Long.class ); } + + @Cacheable(value = "hive-count", sync = true) + @Retryable(Throwable.class) + public Long hiveCount() { + return mysqlJdbcTemplate.queryForObject( + SqlBuilder.select("count(distinct concat(hive_db, hive_table)) as count") + .from(TABLE_INFO) + .whereEq(TABLE_INFO_STATUS, "y") + .build(), + Long.class + ); + } + + @Cacheable(value = "hive-focus-count", sync = true) + @Retryable(Throwable.class) + public Long hiveFocusCount() { + return mysqlJdbcTemplate.queryForObject( + SqlBuilder.select("count(distinct concat(hive_db, hive_table)) as count") + .from(TABLE_INFO) + .whereEq(TABLE_INFO_STATUS, "y") + .andGe(TABLE_INFO_PRIORITY, 10000) + .build(), + Long.class + ); + } }