forked from github/dataease
feat(fix):自定义数据集错误提示优化
This commit is contained in:
parent
dce12e6057
commit
137ddafd7e
@ -483,7 +483,14 @@ public class DataSetTableService {
|
||||
Map<String, String[]> customInfo = new TreeMap<>();
|
||||
dataTableInfoDTO.getList().forEach(ele -> {
|
||||
String table = DorisTableUtils.dorisName(ele.getTableId());
|
||||
DatasetTable datasetTable = datasetTableMapper.selectByPrimaryKey(ele.getTableId());
|
||||
if (ObjectUtils.isEmpty(datasetTable)) {
|
||||
throw new RuntimeException(Translator.get("i18n_custom_ds_delete"));
|
||||
}
|
||||
List<DatasetTableField> fields = dataSetTableFieldsService.getListByIdsEach(ele.getCheckedFields());
|
||||
if (CollectionUtils.isEmpty(fields)) {
|
||||
throw new RuntimeException(Translator.get("i18n_cst_ds_tb_or_field_deleted"));
|
||||
}
|
||||
String[] array = fields.stream().map(f -> table + "." + f.getDataeaseName() + " AS " + DorisTableUtils.dorisFieldName(ele.getTableId() + "_" + f.getDataeaseName())).toArray(String[]::new);
|
||||
customInfo.put(table, array);
|
||||
});
|
||||
@ -665,7 +672,7 @@ public class DataSetTableService {
|
||||
}
|
||||
|
||||
|
||||
public void saveIncrementalConfig(DatasetTableIncrementalConfig datasetTableIncrementalConfig) throws Exception{
|
||||
public void saveIncrementalConfig(DatasetTableIncrementalConfig datasetTableIncrementalConfig) throws Exception {
|
||||
if (datasetTableIncrementalConfig == null || StringUtils.isEmpty(datasetTableIncrementalConfig.getTableId())) {
|
||||
return;
|
||||
}
|
||||
@ -700,11 +707,11 @@ public class DataSetTableService {
|
||||
.replace(currentUpdateTime, Long.valueOf(System.currentTimeMillis()).toString());
|
||||
datasourceRequest.setQuery(sql);
|
||||
List<String> sqlFileds = new ArrayList<>();
|
||||
datasourceProvider.fetchResultField(datasourceRequest).stream().map(TableFiled::getFieldName).forEach(filed ->{
|
||||
datasourceProvider.fetchResultField(datasourceRequest).stream().map(TableFiled::getFieldName).forEach(filed -> {
|
||||
sqlFileds.add(filed);
|
||||
});
|
||||
sort(sqlFileds);
|
||||
if(!originNameFileds.equals(sqlFileds)){
|
||||
if (!originNameFileds.equals(sqlFileds)) {
|
||||
throw new Exception(Translator.get("i18n_sql_add_not_matching") + sqlFileds.toString());
|
||||
}
|
||||
}
|
||||
@ -713,17 +720,17 @@ public class DataSetTableService {
|
||||
.replace(currentUpdateTime, Long.valueOf(System.currentTimeMillis()).toString());
|
||||
datasourceRequest.setQuery(sql);
|
||||
List<String> sqlFileds = new ArrayList<>();
|
||||
datasourceProvider.fetchResultField(datasourceRequest).stream().map(TableFiled::getFieldName).forEach(filed ->{
|
||||
datasourceProvider.fetchResultField(datasourceRequest).stream().map(TableFiled::getFieldName).forEach(filed -> {
|
||||
sqlFileds.add(filed);
|
||||
});
|
||||
sort(sqlFileds);
|
||||
if(!originNameFileds.equals(sqlFileds)){
|
||||
if (!originNameFileds.equals(sqlFileds)) {
|
||||
throw new Exception(Translator.get("i18n_sql_delete_not_matching") + sqlFileds.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void sort(List<String> sqlFileds){
|
||||
private void sort(List<String> sqlFileds) {
|
||||
sqlFileds.sort((o1, o2) -> {
|
||||
if (o1 == null) {
|
||||
return -1;
|
||||
@ -734,6 +741,7 @@ public class DataSetTableService {
|
||||
return o1.compareTo(o2);
|
||||
});
|
||||
}
|
||||
|
||||
private void checkName(DatasetTable datasetTable) {
|
||||
// if (StringUtils.isEmpty(datasetTable.getId()) && StringUtils.equalsIgnoreCase("db", datasetTable.getType())) {
|
||||
// return;
|
||||
|
@ -256,4 +256,5 @@ i18n_not_exec_add_sync=There is no completed synchronization task. Incremental s
|
||||
i18n_excel_header_empty=Excel first row can not empty
|
||||
i18n_custom_ds_delete=Custom dataset union data is deleted,can not display
|
||||
i18n_sql_add_not_matching=The data column of incremental SQL does not match the dataset,
|
||||
i18n_sql_delete_not_matching=The data column of incremental delete SQL does not match the dataset,
|
||||
i18n_sql_delete_not_matching=The data column of incremental delete SQL does not match the dataset,
|
||||
i18n_cst_ds_tb_or_field_deleted=Custom dataset union data is deleted or field changed,can not display
|
@ -257,4 +257,5 @@ i18n_excel_header_empty=Excel第一行为空
|
||||
i18n_custom_ds_delete=自定义数据集所关联数据被删除,无法正常显示
|
||||
i18n_sql_add_not_matching=增量添加 sql 的数据列与数据集不匹配,
|
||||
i18n_sql_delete_not_matching=增量删除 sql 的数据列与数据集不匹配,
|
||||
i18n_cst_ds_tb_or_field_deleted=自定义数据集所关联数据被删除或字段发生变化,无法正常显示
|
||||
|
||||
|
@ -258,4 +258,5 @@ i18n_not_exec_add_sync=沒有已經完成的同步任務,無法進行增量同
|
||||
i18n_excel_header_empty=Excel第一行為空
|
||||
i18n_custom_ds_delete=自定義數據集所關聯數據被刪除,無法正常顯示
|
||||
i18n_sql_add_not_matching=增量添加 sql 的數據列與數據集不匹配,
|
||||
i18n_sql_delete_not_matching=增量刪除 sql 的數據列與數據集不匹配,
|
||||
i18n_sql_delete_not_matching=增量刪除 sql 的數據列與數據集不匹配,
|
||||
i18n_cst_ds_tb_or_field_deleted=自定義數據集所關聯數據被刪除或字段發生變化,無法正常顯示
|
Loading…
Reference in New Issue
Block a user