mirror of
https://github.com/dataease/dataease.git
synced 2026-06-17 21:08:31 +08:00
fix: 支持达梦
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package io.dataease.config;
|
||||
|
||||
import org.hibernate.boot.Metadata;
|
||||
import org.hibernate.boot.model.relational.SqlStringGenerationContext;
|
||||
import org.hibernate.dialect.DmDialect;
|
||||
|
||||
import org.hibernate.tool.schema.internal.StandardTableExporter;
|
||||
import org.hibernate.tool.schema.spi.Exporter;
|
||||
|
||||
|
||||
public class CustomDMDialect extends DmDialect {
|
||||
|
||||
@Override
|
||||
public Exporter<org.hibernate.mapping.Table> getTableExporter() {
|
||||
return new StandardTableExporter(this) {
|
||||
@Override
|
||||
public String[] getSqlCreateStrings(org.hibernate.mapping.Table table, Metadata metadata, SqlStringGenerationContext context) {
|
||||
String[] createStrings = super.getSqlCreateStrings(table, metadata, context);
|
||||
return processBooleanDefaults(createStrings);
|
||||
}
|
||||
|
||||
private String[] processBooleanDefaults(String[] sqlStrings) {
|
||||
for (int i = 0; i < sqlStrings.length; i++) {
|
||||
sqlStrings[i] = sqlStrings[i]
|
||||
.replace(" default false", " DEFAULT 0")
|
||||
.replace(" default true", " DEFAULT 1")
|
||||
.replace(" varbinary(16777216)", " BLOB")
|
||||
.replace(" varchar(16777216)", " TEXT");
|
||||
}
|
||||
return sqlStrings;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toBooleanValueString(boolean bool) {
|
||||
return bool ? "1" : "0";
|
||||
}
|
||||
}
|
||||
@@ -594,8 +594,7 @@ public class DatasourceServer implements DatasourceApi {
|
||||
if (types.isEmpty()) {
|
||||
return list;
|
||||
} else {
|
||||
Specification<CoreDatasource> findInTypesSpec = (root, query, cb) ->
|
||||
root.get("type").in(types);
|
||||
Specification<CoreDatasource> findInTypesSpec = (root, query, cb) -> root.get("type").in(types);
|
||||
dsList = coreDatasourceRepository.findAll(findInTypesSpec);
|
||||
}
|
||||
}
|
||||
@@ -708,8 +707,7 @@ public class DatasourceServer implements DatasourceApi {
|
||||
}
|
||||
|
||||
if (coreDatasource.getType().equals(DatasourceConfiguration.DatasourceType.folder.name())) {
|
||||
Specification<CoreDatasource> findByPidSpec = (root, query, cb) ->
|
||||
cb.equal(root.get("pid"), datasourceId);
|
||||
Specification<CoreDatasource> findByPidSpec = (root, query, cb) -> cb.equal(root.get("pid"), datasourceId);
|
||||
List<CoreDatasource> coreDatasources = coreDatasourceRepository.findAll(findByPidSpec);
|
||||
if (ObjectUtils.isNotEmpty(coreDatasources)) {
|
||||
for (CoreDatasource record : coreDatasources) {
|
||||
@@ -746,10 +744,7 @@ public class DatasourceServer implements DatasourceApi {
|
||||
default:
|
||||
cron = "0 0/minute * * * ? *".replace("minute", interval.toString());
|
||||
}
|
||||
scheduleManager.addOrUpdateCronJob(new JobKey("Datasource", "check_status"),
|
||||
new TriggerKey("Datasource", "check_status"),
|
||||
CheckDsStatusJob.class,
|
||||
cron, new Date(System.currentTimeMillis()), null, new JobDataMap());
|
||||
scheduleManager.addOrUpdateCronJob(new JobKey("Datasource", "check_status"), new TriggerKey("Datasource", "check_status"), CheckDsStatusJob.class, cron, new Date(System.currentTimeMillis()), null, new JobDataMap());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1195,9 +1190,12 @@ public class DatasourceServer implements DatasourceApi {
|
||||
syncDsIds.add(datasource.getId());
|
||||
commonThreadPool.addTask(() -> {
|
||||
try {
|
||||
LogUtil.info("Begin to check ds status: " + datasource.getName());
|
||||
LicenseUtil.validate();
|
||||
validate(datasource);
|
||||
LogUtil.info("Finish to check ds status: " + datasource.getName());
|
||||
} catch (Exception e) {
|
||||
LogUtil.info("Error to check ds status: " + datasource.getName() + ", error message: " + e.getMessage());
|
||||
} finally {
|
||||
syncDsIds.removeIf(id -> id.equals(datasource.getId()));
|
||||
}
|
||||
@@ -1225,8 +1223,7 @@ public class DatasourceServer implements DatasourceApi {
|
||||
private void doUpdate() {
|
||||
List<QrtzSchedulerState> qrtzSchedulerStates = qrtzSchedulerStateRepository.findAll();
|
||||
Timestamp currentTimestamp = databaseTimeManage.getCurrentDatabaseTime();
|
||||
List<String> activeQrtzInstances = qrtzSchedulerStates.stream()
|
||||
.filter(qrtzSchedulerState -> qrtzSchedulerState.getLastCheckinTime() + qrtzSchedulerState.getCheckinInterval() + 1000 > currentTimestamp.getTime()).map(QrtzSchedulerState::getInstanceName).collect(Collectors.toList());
|
||||
List<String> activeQrtzInstances = qrtzSchedulerStates.stream().filter(qrtzSchedulerState -> qrtzSchedulerState.getLastCheckinTime() + qrtzSchedulerState.getCheckinInterval() + 1000 > currentTimestamp.getTime()).map(QrtzSchedulerState::getInstanceName).collect(Collectors.toList());
|
||||
|
||||
List<CoreDatasource> datasources = coreDatasourceRepository.findByTaskStatus(TaskStatus.UnderExecution.name());
|
||||
|
||||
@@ -1449,10 +1446,7 @@ public class DatasourceServer implements DatasourceApi {
|
||||
String configuration = coreDatasource.getConfiguration();
|
||||
DatasourceConfiguration config = null;
|
||||
String host = null;
|
||||
if (StringUtils.isBlank(configuration)
|
||||
|| StringUtils.equalsIgnoreCase("[]", configuration)
|
||||
|| ObjectUtils.isEmpty(config = JsonUtil.parseObject(configuration, DatasourceConfiguration.class))
|
||||
|| StringUtils.isBlank(host = config.getHost())) {
|
||||
if (StringUtils.isBlank(configuration) || StringUtils.equalsIgnoreCase("[]", configuration) || ObjectUtils.isEmpty(config = JsonUtil.parseObject(configuration, DatasourceConfiguration.class)) || StringUtils.isBlank(host = config.getHost())) {
|
||||
return vo;
|
||||
}
|
||||
vo.setHost(host);
|
||||
|
||||
Reference in New Issue
Block a user