From f4756827a78bab2a4e88067b4bbbd9ceff7892bf Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Tue, 18 Mar 2025 10:50:53 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E4=BB=AA=E8=A1=A8=E6=9D=BF=E3=80=81?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F):=20=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E5=A2=9E=E5=8A=A0=E7=A6=81=E7=94=A8api?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=BA=90=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../visualization/server/DataVisualizationServer.java | 9 +++++++-- .../src/main/resources/i18n/core_en_US.properties | 1 + .../src/main/resources/i18n/core_zh_CN.properties | 1 + .../src/main/resources/i18n/core_zh_TW.properties | 1 + 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/core/core-backend/src/main/java/io/dataease/visualization/server/DataVisualizationServer.java b/core/core-backend/src/main/java/io/dataease/visualization/server/DataVisualizationServer.java index df00c3159b..dc7be91689 100644 --- a/core/core-backend/src/main/java/io/dataease/visualization/server/DataVisualizationServer.java +++ b/core/core-backend/src/main/java/io/dataease/visualization/server/DataVisualizationServer.java @@ -232,7 +232,9 @@ public class DataVisualizationServer implements DataVisualizationApi { newDatasourceId.add(datasourceOld.getSystemDatasourceId()); // Excel 数据表明映射 if (StringUtils.isNotEmpty(datasourceOld.getConfiguration())) { - if (datasourceOld.getType().equals(DatasourceConfiguration.DatasourceType.Excel.name())) { + if (datasourceOld.getType().equals(DatasourceConfiguration.DatasourceType.API.name())) { + DEException.throwException(Translator.get("i18n_app_error_no_api")); + } else if (datasourceOld.getType().equals(DatasourceConfiguration.DatasourceType.Excel.name())) { dsTableNamesMap.put(datasourceOld.getId(), ExcelUtils.getTableNamesMap(datasourceOld.getType(), datasourceOld.getConfiguration())); } else if (datasourceOld.getType().contains(DatasourceConfiguration.DatasourceType.API.name())) { dsTableNamesMap.put(datasourceOld.getId(), (Map) datasourceServer.invokeMethod(datasourceOld.getType(), "getTableNamesMap", String.class, datasourceOld.getConfiguration())); @@ -338,7 +340,7 @@ public class DataVisualizationServer implements DataVisualizationApi { appDsTableNamesMap.forEach((keyName, valueName) -> { if (!CollectionUtils.isEmpty(systemDsTableNamesMap) && StringUtils.isNotEmpty(systemDsTableNamesMap.get(keyName))) { dsGroup.setInfo(dsGroup.getInfo().replaceAll(valueName, systemDsTableNamesMap.get(keyName))); - }else{ + } else { dsGroup.setInfo(dsGroup.getInfo().replaceAll(valueName, "excel_can_not_find")); } }); @@ -813,6 +815,9 @@ public class DataVisualizationServer implements DataVisualizationApi { if (CollectionUtils.isEmpty(datasourceVOInfo)) { DEException.throwException("当前不存在数据源无法导出"); + } else if(datasourceVOInfo.stream() + .anyMatch(datasource -> DatasourceConfiguration.DatasourceType.API.name().equals(datasource.getType()))){ + DEException.throwException(Translator.get("i18n_app_error_no_api")); } List linkageVOInfo = appTemplateMapper.findAppLinkageInfo(dvId); diff --git a/core/core-backend/src/main/resources/i18n/core_en_US.properties b/core/core-backend/src/main/resources/i18n/core_en_US.properties index 63187cca0f..e08cc922df 100644 --- a/core/core-backend/src/main/resources/i18n/core_en_US.properties +++ b/core/core-backend/src/main/resources/i18n/core_en_US.properties @@ -209,3 +209,4 @@ i18n_unsupported_file_format=Unsupported file format! i18n_invalid_address=Invalid address! i18n_unsupported_protocol=Unsupported protocol! i18n_excel_error_first_row=Empty cells are not allowed in the middle of the first row! +i18n_app_error_no_api=Current API data source is not supported. diff --git a/core/core-backend/src/main/resources/i18n/core_zh_CN.properties b/core/core-backend/src/main/resources/i18n/core_zh_CN.properties index 776d6dc6ea..b085550da5 100644 --- a/core/core-backend/src/main/resources/i18n/core_zh_CN.properties +++ b/core/core-backend/src/main/resources/i18n/core_zh_CN.properties @@ -208,3 +208,4 @@ i18n_unsupported_file_format=\u4e0d\u652f\u6301\u7684\u6587\u4ef6\u683c\u5f0f\uf i18n_invalid_address=\u65e0\u6548\u7684\u5730\u5740\uff01 i18n_unsupported_protocol=\u4e0d\u652f\u6301\u7684\u534f\u8bae\uff01 i18n_excel_error_first_row=\u9996\u884c\u884c\u4e2d\u4e0d\u5141\u8bb8\u6709\u7a7a\u5355\u5143\u683c\uff01 +i18n_app_error_no_api=\u5f53\u524d\u4e0d\u652f\u6301API\u6570\u636e\u6e90\u3002 diff --git a/core/core-backend/src/main/resources/i18n/core_zh_TW.properties b/core/core-backend/src/main/resources/i18n/core_zh_TW.properties index 99b2a297d1..dbb3ef8058 100644 --- a/core/core-backend/src/main/resources/i18n/core_zh_TW.properties +++ b/core/core-backend/src/main/resources/i18n/core_zh_TW.properties @@ -208,3 +208,4 @@ i18n_unsupported_file_format=\u4e0d\u652f\u63f4\u7684\u6587\u4ef6\u683c\u5f0f\uf i18n_invalid_address=\u7121\u6548\u7684\u5730\u5740\uff01 i18n_unsupported_protocol=\u4e0d\u652f\u63f4\u7684\u5354\u8b70\uff01 i18n_excel_error_first_row=\u9996\u884c\u884c\u4e2d\u4e0d\u5141\u8a31\u6709\u7a7a\u5132\u5b58\u683c\uff01 +i18n_app_error_no_api=\u7576\u524d\u4e0d\u652f\u63f4API\u6578\u64da\u6e90\u3002