From 3af1fcd2a5633d5045afb5109483d322fe4ee31b Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Wed, 1 Nov 2023 12:35:58 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20core=E6=A8=A1=E5=9D=97=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=94=A8=E6=88=B7=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataset/manage/DatasetGroupManage.java | 16 +++++++---- .../datasource/server/DatasourceServer.java | 28 ++++++++----------- .../system/manage/CoreUserManage.java | 14 ++++++++++ de-xpack | 2 +- 4 files changed, 37 insertions(+), 23 deletions(-) create mode 100644 core/core-backend/src/main/java/io/dataease/system/manage/CoreUserManage.java diff --git a/core/core-backend/src/main/java/io/dataease/dataset/manage/DatasetGroupManage.java b/core/core-backend/src/main/java/io/dataease/dataset/manage/DatasetGroupManage.java index 6be80e7fa5..85fb492f54 100644 --- a/core/core-backend/src/main/java/io/dataease/dataset/manage/DatasetGroupManage.java +++ b/core/core-backend/src/main/java/io/dataease/dataset/manage/DatasetGroupManage.java @@ -31,6 +31,7 @@ import io.dataease.license.config.XpackInteract; import io.dataease.model.BusiNodeRequest; import io.dataease.model.BusiNodeVO; import io.dataease.operation.manage.CoreOptRecentManage; +import io.dataease.system.manage.CoreUserManage; import io.dataease.utils.*; import jakarta.annotation.Resource; import org.apache.commons.lang3.ObjectUtils; @@ -71,6 +72,9 @@ public class DatasetGroupManage { @Autowired(required = false) private UserApi userApi; + @Resource + private CoreUserManage coreUserManage; + @Resource private CoreOptRecentManage coreOptRecentManage; @@ -232,13 +236,13 @@ public class DatasetGroupManage { DataSetBarVO dataSetBarVO = coreDataSetExtMapper.queryBarInfo(id); // get creator if (userApi != null) { - UserFormVO userFormVO = userApi.queryById(Long.valueOf(dataSetBarVO.getCreateBy())); - if (userFormVO != null) { - dataSetBarVO.setCreator(userFormVO.getName()); + String userName = coreUserManage.getUserName(Long.valueOf(dataSetBarVO.getCreateBy())); + if (StringUtils.isNotBlank(userName)) { + dataSetBarVO.setCreator(userName); } - UserFormVO userFormVOUpdateBy = userApi.queryById(Long.valueOf(dataSetBarVO.getUpdateBy())); - if (userFormVOUpdateBy != null) { - dataSetBarVO.setUpdater(userFormVOUpdateBy.getName()); + String updateUserName = coreUserManage.getUserName(Long.valueOf(dataSetBarVO.getUpdateBy())); + if (StringUtils.isNotBlank(updateUserName)) { + dataSetBarVO.setUpdater(updateUserName); } } dataSetBarVO.setDatasourceDTOList(getDatasource(id)); 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 91a8a00ab3..0419d7a4d1 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 @@ -14,8 +14,6 @@ import io.dataease.api.ds.DatasourceApi; import io.dataease.api.ds.vo.*; import io.dataease.api.permissions.auth.api.InteractiveAuthApi; import io.dataease.api.permissions.auth.dto.BusiResourceEditor; -import io.dataease.api.permissions.user.api.UserApi; -import io.dataease.api.permissions.user.vo.UserFormVO; import io.dataease.commons.constants.TaskStatus; import io.dataease.commons.utils.CommonThreadPool; import io.dataease.constant.DataSourceType; @@ -34,13 +32,13 @@ import io.dataease.datasource.provider.ApiUtils; import io.dataease.datasource.provider.CalciteProvider; import io.dataease.datasource.provider.ExcelUtils; import io.dataease.datasource.request.DatasourceRequest; -import io.dataease.datasource.type.Pg; import io.dataease.engine.constant.SQLConstants; import io.dataease.exception.DEException; import io.dataease.i18n.Translator; import io.dataease.license.config.XpackInteract; import io.dataease.model.BusiNodeRequest; import io.dataease.model.BusiNodeVO; +import io.dataease.system.manage.CoreUserManage; import io.dataease.utils.*; import jakarta.annotation.Resource; import org.apache.commons.lang3.ObjectUtils; @@ -89,11 +87,13 @@ public class DatasourceServer implements DatasourceApi { private CoreDsFinishPageMapper coreDsFinishPageMapper; @Resource private DatasetDataManage datasetDataManage; - @Autowired(required = false) - private UserApi userApi; + @Autowired(required = false) private InteractiveAuthApi interactiveAuthApi; + @Resource + private CoreUserManage coreUserManage; + @Override public List query(String keyWord) { return null; @@ -311,16 +311,16 @@ public class DatasourceServer implements DatasourceApi { private static void checkParams(String configurationStr) { DatasourceConfiguration configuration = JsonUtil.parseObject(configurationStr, DatasourceConfiguration.class); - if(configuration.getInitialPoolSize() < configuration.getMinPoolSize()){ + if (configuration.getInitialPoolSize() < configuration.getMinPoolSize()) { DEException.throwException("初始连接数不能小于最小连接数!"); } - if(configuration.getInitialPoolSize() > configuration.getMaxPoolSize()){ + if (configuration.getInitialPoolSize() > configuration.getMaxPoolSize()) { DEException.throwException("初始连接数不能大于最大连接数!"); } - if(configuration.getMaxPoolSize() < configuration.getMinPoolSize()){ + if (configuration.getMaxPoolSize() < configuration.getMinPoolSize()) { DEException.throwException("最大连接数不能小于最小连接数!"); } - if(configuration.getQueryTimeout() < 0){ + if (configuration.getQueryTimeout() < 0) { DEException.throwException("查询超时不能小于0!"); } } @@ -540,12 +540,8 @@ public class DatasourceServer implements DatasourceApi { } datasourceDTO.setConfiguration(new String(Base64.getEncoder().encode(datasourceDTO.getConfiguration().getBytes()))); - if (userApi != null) { - UserFormVO userFormVO = userApi.queryById(Long.valueOf(datasourceDTO.getCreateBy())); - if (userFormVO != null) { - datasourceDTO.setCreator(userFormVO.getName()); - } - } + datasourceDTO.setCreator(coreUserManage.getUserName(Long.valueOf(datasourceDTO.getCreateBy()))); + return datasourceDTO; } @@ -882,7 +878,7 @@ public class DatasourceServer implements DatasourceApi { List datasetTableDTOS = ApiUtils.getTables(datasourceRequest); for (int i = 0; i < pager.getRecords().size(); i++) { for (int i1 = 0; i1 < datasetTableDTOS.size(); i1++) { - if(pager.getRecords().get(i).getTableName().equalsIgnoreCase(datasetTableDTOS.get(i1).getTableName())){ + if (pager.getRecords().get(i).getTableName().equalsIgnoreCase(datasetTableDTOS.get(i1).getTableName())) { pager.getRecords().get(i).setName(datasetTableDTOS.get(i1).getName()); } } diff --git a/core/core-backend/src/main/java/io/dataease/system/manage/CoreUserManage.java b/core/core-backend/src/main/java/io/dataease/system/manage/CoreUserManage.java new file mode 100644 index 0000000000..1c4e7273d1 --- /dev/null +++ b/core/core-backend/src/main/java/io/dataease/system/manage/CoreUserManage.java @@ -0,0 +1,14 @@ +package io.dataease.system.manage; + +import io.dataease.license.config.XpackInteract; +import org.springframework.stereotype.Component; + +@Component +public class CoreUserManage { + + + @XpackInteract(value = "coreUserManage", replace = true) + public String getUserName(Long uid) { + return "管理员"; + } +} diff --git a/de-xpack b/de-xpack index c2c4436bac..7a4f9a2de6 160000 --- a/de-xpack +++ b/de-xpack @@ -1 +1 @@ -Subproject commit c2c4436bac4d300e5297ff1854fd6d45e01435ad +Subproject commit 7a4f9a2de62a8ff0b544f2660bef3838cc09d6de