From 319bab6c2d3a4a6d29849cafacf9faf1ddd3679a Mon Sep 17 00:00:00 2001 From: taojinlong Date: Tue, 2 Jul 2024 13:52:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20API=20=E6=95=B0=E6=8D=AE=E6=BA=90?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datasource/manage/DataSourceManage.java | 6 +- .../datasource/server/DatasourceServer.java | 4 +- .../manage/ExportCenterManage.java | 4 ++ .../data/datasource/form/EditorDetail.vue | 9 ++- .../visualized/data/datasource/index.vue | 56 +++++++++++++++++-- 5 files changed, 67 insertions(+), 12 deletions(-) diff --git a/core/core-backend/src/main/java/io/dataease/datasource/manage/DataSourceManage.java b/core/core-backend/src/main/java/io/dataease/datasource/manage/DataSourceManage.java index 305941e4d5..c78140fe6e 100644 --- a/core/core-backend/src/main/java/io/dataease/datasource/manage/DataSourceManage.java +++ b/core/core-backend/src/main/java/io/dataease/datasource/manage/DataSourceManage.java @@ -95,10 +95,10 @@ public class DataSourceManage { if (ObjectUtils.isNotEmpty(dto.getId())) { wrapper.ne("id", dto.getId()); } - if (ObjectUtils.isNotEmpty(dto.getNodeType()) ) { - if(dto.getNodeType().equalsIgnoreCase("folder")){ + if (ObjectUtils.isNotEmpty(dto.getNodeType())) { + if (dto.getNodeType().equalsIgnoreCase("folder")) { wrapper.eq("type", dto.getType()); - }else { + } else { wrapper.ne("type", "folder"); } diff --git a/core/core-backend/src/main/java/io/dataease/datasource/server/DatasourceServer.java b/core/core-backend/src/main/java/io/dataease/datasource/server/DatasourceServer.java index 865fdd7315..32c1d853b7 100644 --- a/core/core-backend/src/main/java/io/dataease/datasource/server/DatasourceServer.java +++ b/core/core-backend/src/main/java/io/dataease/datasource/server/DatasourceServer.java @@ -37,6 +37,7 @@ import io.dataease.i18n.Translator; import io.dataease.job.schedule.CheckDsStatusJob; import io.dataease.job.schedule.ScheduleManager; import io.dataease.license.config.XpackInteract; +import io.dataease.license.utils.LicenseUtil; import io.dataease.log.DeLog; import io.dataease.model.BusiNodeRequest; import io.dataease.model.BusiNodeVO; @@ -969,9 +970,10 @@ public class DatasourceServer implements DatasourceApi { datasources.forEach(datasource -> { commonThreadPool.addTask(() -> { try { + LicenseUtil.validate(); validate(datasource); } catch (Exception e) { - e.printStackTrace(); + } }); }); diff --git a/core/core-backend/src/main/java/io/dataease/exportCenter/manage/ExportCenterManage.java b/core/core-backend/src/main/java/io/dataease/exportCenter/manage/ExportCenterManage.java index 82ce2779fd..3b233c749b 100644 --- a/core/core-backend/src/main/java/io/dataease/exportCenter/manage/ExportCenterManage.java +++ b/core/core-backend/src/main/java/io/dataease/exportCenter/manage/ExportCenterManage.java @@ -70,6 +70,7 @@ public class ExportCenterManage { public void init() { scheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(corePoolSize); scheduledThreadPoolExecutor.setKeepAliveTime(keepAliveSeconds, TimeUnit.SECONDS); + scheduledThreadPoolExecutor.setMaximumPoolSize(10); } @Scheduled(fixedRate = 5000) @@ -154,6 +155,9 @@ public class ExportCenterManage { public void retry(String id) { CoreExportTask exportTask = exportTaskMapper.selectById(id); + if(!exportTask.getExportStatus().equalsIgnoreCase("FAILED")){ + DEException.throwException("正在导出中!"); + } exportTask.setExportStatus("PENDING"); exportTask.setExportProgress("0"); exportTask.setExportMachineName(hostName()); diff --git a/core/core-frontend/src/views/visualized/data/datasource/form/EditorDetail.vue b/core/core-frontend/src/views/visualized/data/datasource/form/EditorDetail.vue index b04fa6119f..0a8ea7ca6d 100644 --- a/core/core-frontend/src/views/visualized/data/datasource/form/EditorDetail.vue +++ b/core/core-frontend/src/views/visualized/data/datasource/form/EditorDetail.vue @@ -599,13 +599,18 @@ const handleApiParams = (cmd: string, data) => { autofocus: false, showClose: false }).then(() => { - form.value.paramsConfiguration.splice(0, 1) + let index = 0 + for (let i = 0; i < form.value.paramsConfiguration.length; i++) { + if (form.value.paramsConfiguration[i].serialNumber === data.serialNumber) { + index = i + } + } + form.value.paramsConfiguration.splice(index, 1) if (activeParamsName.value === data.name) { gridData.value = [] } }) } - if (cmd === 'edit') { addApiItem(data) } diff --git a/core/core-frontend/src/views/visualized/data/datasource/index.vue b/core/core-frontend/src/views/visualized/data/datasource/index.vue index 4569d14051..8c209135e3 100644 --- a/core/core-frontend/src/views/visualized/data/datasource/index.vue +++ b/core/core-frontend/src/views/visualized/data/datasource/index.vue @@ -630,15 +630,59 @@ const editDatasource = (editType?: number) => { } const handleEdit = async data => { - await handleNodeClick(data) - datasourceEditor.value.init(nodeInfo) + editDatasource() } const handleCopy = async data => { - await handleNodeClick(data) - nodeInfo.id = '' - nodeInfo.name = '复制数据源' - datasourceEditor.value.init(nodeInfo) + getById(nodeInfo.id).then(res => { + let { + name, + createBy, + id, + createTime, + creator, + type, + pid, + configuration, + syncSetting, + apiConfigurationStr, + paramsStr, + fileName, + size, + description, + lastSyncTime + } = res.data + if (configuration) { + configuration = JSON.parse(Base64.decode(configuration)) + } + if (paramsStr) { + paramsStr = JSON.parse(Base64.decode(paramsStr)) + } + if (apiConfigurationStr) { + apiConfigurationStr = JSON.parse(Base64.decode(apiConfigurationStr)) + } + let datasource = reactive(cloneDeep(defaultInfo)) + Object.assign(datasource, { + name, + pid, + description, + fileName, + size, + createTime, + creator, + createBy, + id, + type, + configuration, + syncSetting, + apiConfiguration: apiConfigurationStr, + paramsConfiguration: paramsStr, + lastSyncTime + }) + datasource.id = '' + datasource.name = '复制数据源' + datasourceEditor.value.init(datasource) + }) } const handleDatasourceTree = (cmd: string, data?: Tree) => {