mirror of
https://github.com/dataease/dataease.git
synced 2026-05-22 21:38:32 +08:00
fix: 修复系统变量显示问题
This commit is contained in:
@@ -117,9 +117,9 @@ public class CalciteProvider {
|
||||
tableDesc.setDatasourceId(datasourceRequest.getDatasource().getId());
|
||||
tableDesc.setType("db");
|
||||
tableDesc.setTableName(resultSet.getString(1));
|
||||
if(resultSet.getMetaData().getColumnCount() > 1){
|
||||
if (resultSet.getMetaData().getColumnCount() > 1) {
|
||||
tableDesc.setName(resultSet.getString(2));
|
||||
}else {
|
||||
} else {
|
||||
tableDesc.setName(resultSet.getString(1));
|
||||
}
|
||||
return tableDesc;
|
||||
@@ -316,10 +316,40 @@ public class CalciteProvider {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void hidePW(DatasourceDTO datasourceDTO) {
|
||||
DatasourceConfiguration configuration = null;
|
||||
DatasourceType datasourceType = DatasourceType.valueOf(datasourceDTO.getType());
|
||||
switch (datasourceType) {
|
||||
case mysql:
|
||||
case mongo:
|
||||
case mariadb:
|
||||
case TiDB:
|
||||
case StarRocks:
|
||||
case doris:
|
||||
configuration = JsonUtil.parseObject(datasourceDTO.getConfiguration(), Mysql.class);
|
||||
if (StringUtils.isNotEmpty(configuration.getUrlType()) && configuration.getUrlType().equalsIgnoreCase("jdbcUrl")) {
|
||||
if (configuration.getJdbcUrl().contains("password=")) {
|
||||
String[] params = configuration.getJdbcUrl().split("\\?")[1].split("&");
|
||||
String pd = "";
|
||||
for (int i = 0; i < params.length; i++) {
|
||||
if (params[i].contains("password=")) {
|
||||
pd = params[i];
|
||||
}
|
||||
}
|
||||
configuration.setJdbcUrl(configuration.getJdbcUrl().replace(pd, "password=******"));
|
||||
datasourceDTO.setConfiguration(JsonUtil.toJSONString(configuration).toString());
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private String getTableFiledSql(DatasourceRequest datasourceRequest) {
|
||||
String sql = "";
|
||||
DatasourceConfiguration configuration = null;
|
||||
String database="";
|
||||
String database = "";
|
||||
DatasourceType datasourceType = DatasourceType.valueOf(datasourceRequest.getDatasource().getType());
|
||||
switch (datasourceType) {
|
||||
case mysql:
|
||||
@@ -440,7 +470,8 @@ public class CalciteProvider {
|
||||
return sql;
|
||||
}
|
||||
|
||||
private TableField getTableFieldDesc(DatasourceRequest datasourceRequest, ResultSet resultSet) throws SQLException {
|
||||
private TableField getTableFieldDesc(DatasourceRequest datasourceRequest, ResultSet resultSet) throws
|
||||
SQLException {
|
||||
TableField tableField = new TableField();
|
||||
tableField.setOriginName(resultSet.getString(1));
|
||||
tableField.setType(resultSet.getString(2).toUpperCase());
|
||||
@@ -809,7 +840,7 @@ public class CalciteProvider {
|
||||
" AND ep.class = 1 \n" +
|
||||
" AND ep.name = 'MS_Description'\n" +
|
||||
"where sc.name ='DS_SCHEMA'"
|
||||
.replace("DS_SCHEMA", configuration.getSchema()));
|
||||
.replace("DS_SCHEMA", configuration.getSchema()));
|
||||
tableSqls.add("SELECT \n" +
|
||||
" t.name AS TableName, \n" +
|
||||
" ep.value AS TableDescription \n" +
|
||||
|
||||
@@ -488,12 +488,20 @@ public class DatasourceServer implements DatasourceApi {
|
||||
return calciteProvider.getSchema(datasourceRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatasourceDTO hidePw(Long datasourceId) throws DEException {
|
||||
return getDatasourceDTOById(datasourceId, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatasourceDTO get(Long datasourceId) throws DEException {
|
||||
return getDatasourceDTOById(datasourceId, false);
|
||||
}
|
||||
|
||||
private DatasourceDTO getDatasourceDTOById(Long datasourceId, boolean hidePw) throws DEException {
|
||||
DatasourceDTO datasourceDTO = new DatasourceDTO();
|
||||
CoreDatasource datasource = datasourceMapper.selectById(datasourceId);
|
||||
if(datasource == null){
|
||||
if (datasource == null) {
|
||||
DEException.throwException("不存在的数据源!");
|
||||
}
|
||||
BeanUtils.copyBean(datasourceDTO, datasource);
|
||||
@@ -547,15 +555,18 @@ public class DatasourceServer implements DatasourceApi {
|
||||
if (task != null) {
|
||||
datasourceDTO.setLastSyncTime(task.getStartTime());
|
||||
}
|
||||
} else {
|
||||
if (hidePw) {
|
||||
calciteProvider.hidePW(datasourceDTO);
|
||||
}
|
||||
|
||||
}
|
||||
if (datasourceDTO.getType().equalsIgnoreCase(DatasourceConfiguration.DatasourceType.Excel.toString())) {
|
||||
datasourceDTO.setFileName(ExcelUtils.getFileName(datasource));
|
||||
datasourceDTO.setSize(ExcelUtils.getSize(datasource));
|
||||
}
|
||||
datasourceDTO.setConfiguration(new String(Base64.getEncoder().encode(datasourceDTO.getConfiguration().getBytes())));
|
||||
|
||||
datasourceDTO.setCreator(coreUserManage.getUserName(Long.valueOf(datasourceDTO.getCreateBy())));
|
||||
|
||||
return datasourceDTO;
|
||||
}
|
||||
|
||||
@@ -750,7 +761,7 @@ public class DatasourceServer implements DatasourceApi {
|
||||
datasourceRequest.setDsList(Map.of(datasourceSchemaDTO.getId(), datasourceSchemaDTO));
|
||||
datasourceRequest.setQuery(TableUtils.tableName2Sql(datasourceSchemaDTO, tableName) + " LIMIT 0 OFFSET 0");
|
||||
datasourceRequest.setTable(tableName);
|
||||
List<TableField> tableFields = (List<TableField>) calciteProvider.fetchTableField(datasourceRequest) ;
|
||||
List<TableField> tableFields = (List<TableField>) calciteProvider.fetchTableField(datasourceRequest);
|
||||
return tableFields.stream().filter(tableField -> {
|
||||
return !tableField.getOriginName().equalsIgnoreCase("dataease_uuid");
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
@@ -183,12 +183,21 @@ public class ExportCenterManage {
|
||||
if (status.equalsIgnoreCase(exportTaskDTO.getExportStatus())) {
|
||||
setExportFromAbsName(exportTaskDTO);
|
||||
}
|
||||
if (status.equalsIgnoreCase(exportTaskDTO.getExportStatus())) {
|
||||
setOrgName(exportTaskDTO);
|
||||
}
|
||||
result.add(exportTaskDTO);
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void setOrgName(ExportTaskDTO exportTaskDTO) {
|
||||
if (exportTaskDTO.getExportFromType().equalsIgnoreCase("chart")) {
|
||||
exportTaskDTO.setOrgName(dataVisualizationServer.getAbsPath(exportTaskDTO.getExportFrom()));
|
||||
}
|
||||
}
|
||||
|
||||
private void setExportFromAbsName(ExportTaskDTO exportTaskDTO) {
|
||||
if (exportTaskDTO.getExportFromType().equalsIgnoreCase("chart")) {
|
||||
exportTaskDTO.setExportFromName(dataVisualizationServer.getAbsPath(exportTaskDTO.getExportFrom()));
|
||||
|
||||
@@ -10,9 +10,9 @@ import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
@Component
|
||||
public class CheckDsStatusJob implements Job {
|
||||
|
||||
@Resource
|
||||
private DatasourceServer datasourceServer;
|
||||
|
||||
|
||||
@@ -13,3 +13,24 @@ CREATE TABLE `core_sys_startup_job`
|
||||
BEGIN;
|
||||
INSERT INTO `core_sys_startup_job` VALUES ('chartFilterMerge', 'chartFilterMerge', 'ready');
|
||||
COMMIT;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS "core_export_task";
|
||||
CREATE TABLE "core_export_task"
|
||||
(
|
||||
"id" VARCHAR(255) NOT NULL,
|
||||
"user_id" BIGINT(20) NOT NULL,
|
||||
"file_name" VARCHAR(2048) DEFAULT NULL,
|
||||
"file_size" DOUBLE DEFAULT NULL,
|
||||
"file_size_unit" VARCHAR(255) DEFAULT NULL,
|
||||
"export_from" VARCHAR(255) DEFAULT NULL,
|
||||
"export_status" VARCHAR(255) DEFAULT NULL,
|
||||
"export_from_type" VARCHAR(255) DEFAULT NULL,
|
||||
"export_time" BIGINT(20) DEFAULT NULL,
|
||||
"export_progress" VARCHAR(255) DEFAULT NULL,
|
||||
"export_machine_name" VARCHAR(512) DEFAULT NULL,
|
||||
"params" CLOB NOT NULL COMMENT '过滤参数',
|
||||
PRIMARY KEY ("id")
|
||||
) COMMENT='导出任务表';
|
||||
|
||||
UPDATE `QRTZ_JOB_DETAILS` SET `JOB_CLASS_NAME` = 'io.dataease.job.schedule.CheckDsStatusJob' WHERE (`SCHED_NAME` = 'deSyncJob') and (`JOB_NAME` = 'Datasource') and (`JOB_GROUP` = 'check_status');
|
||||
|
||||
@@ -52,3 +52,6 @@ CREATE TABLE `xpack_platform_token`
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
|
||||
|
||||
UPDATE `QRTZ_JOB_DETAILS` SET `JOB_CLASS_NAME` = 'io.dataease.job.schedule.CheckDsStatusJob' WHERE (`SCHED_NAME` = 'deSyncJob') and (`JOB_NAME` = 'Datasource') and (`JOB_GROUP` = 'check_status');
|
||||
|
||||
Reference in New Issue
Block a user