forked from github/dataease
feat(fix):数据源、数据集、视图以及分组场景等,同一级下名称全局唯一,修改提示文案;同一数据集下相同定时任务同名校验
This commit is contained in:
parent
071cafcd26
commit
2d6c22190f
@ -1,8 +1,6 @@
|
|||||||
package io.dataease.service.dataset;
|
package io.dataease.service.dataset;
|
||||||
|
|
||||||
import io.dataease.base.domain.DatasetTableTask;
|
import io.dataease.base.domain.*;
|
||||||
import io.dataease.base.domain.DatasetTableTaskExample;
|
|
||||||
import io.dataease.base.domain.DatasetTableTaskLog;
|
|
||||||
import io.dataease.base.mapper.DatasetTableTaskMapper;
|
import io.dataease.base.mapper.DatasetTableTaskMapper;
|
||||||
import io.dataease.commons.constants.JobStatus;
|
import io.dataease.commons.constants.JobStatus;
|
||||||
import io.dataease.commons.constants.ScheduleType;
|
import io.dataease.commons.constants.ScheduleType;
|
||||||
@ -38,7 +36,9 @@ public class DataSetTableTaskService {
|
|||||||
private DataSetTableService dataSetTableService;
|
private DataSetTableService dataSetTableService;
|
||||||
@Resource
|
@Resource
|
||||||
private ExtractDataService extractDataService;
|
private ExtractDataService extractDataService;
|
||||||
|
|
||||||
public DatasetTableTask save(DataSetTaskRequest dataSetTaskRequest) throws Exception {
|
public DatasetTableTask save(DataSetTaskRequest dataSetTaskRequest) throws Exception {
|
||||||
|
checkName(dataSetTaskRequest);
|
||||||
DatasetTableTask datasetTableTask = dataSetTaskRequest.getDatasetTableTask();
|
DatasetTableTask datasetTableTask = dataSetTaskRequest.getDatasetTableTask();
|
||||||
dataSetTableService.saveIncrementalConfig(dataSetTaskRequest.getDatasetTableIncrementalConfig());
|
dataSetTableService.saveIncrementalConfig(dataSetTaskRequest.getDatasetTableIncrementalConfig());
|
||||||
|
|
||||||
@ -60,10 +60,10 @@ public class DataSetTableTaskService {
|
|||||||
datasetTableTask.setId(UUID.randomUUID().toString());
|
datasetTableTask.setId(UUID.randomUUID().toString());
|
||||||
datasetTableTask.setCreateTime(System.currentTimeMillis());
|
datasetTableTask.setCreateTime(System.currentTimeMillis());
|
||||||
// SIMPLE 类型,提前占位
|
// SIMPLE 类型,提前占位
|
||||||
if(datasetTableTask.getRate().equalsIgnoreCase(ScheduleType.SIMPLE.toString())){
|
if (datasetTableTask.getRate().equalsIgnoreCase(ScheduleType.SIMPLE.toString())) {
|
||||||
if(extractDataService.updateSyncStatus(dataSetTableService.get(datasetTableTask.getTableId()))){
|
if (extractDataService.updateSyncStatus(dataSetTableService.get(datasetTableTask.getTableId()))) {
|
||||||
throw new Exception(Translator.get("i18n_sync_job_exists"));
|
throw new Exception(Translator.get("i18n_sync_job_exists"));
|
||||||
}else {
|
} else {
|
||||||
//write log
|
//write log
|
||||||
DatasetTableTaskLog datasetTableTaskLog = new DatasetTableTaskLog();
|
DatasetTableTaskLog datasetTableTaskLog = new DatasetTableTaskLog();
|
||||||
datasetTableTaskLog.setTableId(datasetTableTask.getTableId());
|
datasetTableTaskLog.setTableId(datasetTableTask.getTableId());
|
||||||
@ -119,4 +119,22 @@ public class DataSetTableTaskService {
|
|||||||
datasetTableTaskExample.setOrderByClause("create_time desc,name asc");
|
datasetTableTaskExample.setOrderByClause("create_time desc,name asc");
|
||||||
return datasetTableTaskMapper.selectByExample(datasetTableTaskExample);
|
return datasetTableTaskMapper.selectByExample(datasetTableTaskExample);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkName(DataSetTaskRequest dataSetTaskRequest) {
|
||||||
|
DatasetTableTaskExample datasetTableTaskExample = new DatasetTableTaskExample();
|
||||||
|
DatasetTableTaskExample.Criteria criteria = datasetTableTaskExample.createCriteria();
|
||||||
|
if (StringUtils.isNotEmpty(dataSetTaskRequest.getDatasetTableTask().getId())) {
|
||||||
|
criteria.andIdNotEqualTo(dataSetTaskRequest.getDatasetTableTask().getId());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(dataSetTaskRequest.getDatasetTableTask().getTableId())) {
|
||||||
|
criteria.andTableIdEqualTo(dataSetTaskRequest.getDatasetTableTask().getTableId());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(dataSetTaskRequest.getDatasetTableTask().getName())) {
|
||||||
|
criteria.andNameEqualTo(dataSetTaskRequest.getDatasetTableTask().getName());
|
||||||
|
}
|
||||||
|
List<DatasetTableTask> list = datasetTableTaskMapper.selectByExample(datasetTableTaskExample);
|
||||||
|
if (list.size() > 0) {
|
||||||
|
throw new RuntimeException(Translator.get("i18n_task_name_repeat"));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -241,8 +241,9 @@ i18n_union_field_exists=The same field can't in two dataset
|
|||||||
i18n_cron_time_error=Start time can't greater then end time
|
i18n_cron_time_error=Start time can't greater then end time
|
||||||
i18n_auth_source_be_canceled=This Auth Resource Already Be Canceled
|
i18n_auth_source_be_canceled=This Auth Resource Already Be Canceled
|
||||||
i18n_username_exists=ID is already exists
|
i18n_username_exists=ID is already exists
|
||||||
i18n_ds_name_exists=Datasource name exists
|
i18n_ds_name_exists=Datasource name used
|
||||||
i18n_sync_job_exists=There is already a synchronization task running, please try again later
|
i18n_sync_job_exists=There is already a synchronization task running, please try again later
|
||||||
i18n_datasource_check_fail=Invalid,please check config
|
i18n_datasource_check_fail=Invalid,please check config
|
||||||
i18n_not_find_user=Can not find user.
|
i18n_not_find_user=Can not find user.
|
||||||
i18n_sql_not_empty=SQL can not be empty.
|
i18n_sql_not_empty=SQL can not be empty.
|
||||||
|
i18n_task_name_repeat=Name is used in same data set
|
@ -243,8 +243,9 @@ i18n_union_field_exists=两个数据集之间关联不能出现多次相同字
|
|||||||
i18n_cron_time_error=开始时间不能大于结束时间
|
i18n_cron_time_error=开始时间不能大于结束时间
|
||||||
i18n_auth_source_be_canceled=当前资源授权权限已经被取消
|
i18n_auth_source_be_canceled=当前资源授权权限已经被取消
|
||||||
i18n_username_exists=用户 ID 已存在
|
i18n_username_exists=用户 ID 已存在
|
||||||
i18n_ds_name_exists=数据源名称已存在
|
i18n_ds_name_exists=数据源名称已被使用
|
||||||
i18n_sync_job_exists=已经有同步任务在运行,稍后重试
|
i18n_sync_job_exists=已经有同步任务在运行,稍后重试
|
||||||
i18n_datasource_check_fail=校验失败,请检查配置信息
|
i18n_datasource_check_fail=校验失败,请检查配置信息
|
||||||
i18n_not_find_user=未找到用户
|
i18n_not_find_user=未找到用户
|
||||||
i18n_sql_not_empty=SQL 不能为空
|
i18n_sql_not_empty=SQL 不能为空
|
||||||
|
i18n_task_name_repeat=同一数据集下任务名称已被使用
|
@ -243,8 +243,9 @@ i18n_union_field_exists=兩個數據集之間關聯不能出現多次相同字
|
|||||||
i18n_cron_time_error=開始時間不能大於結束時間
|
i18n_cron_time_error=開始時間不能大於結束時間
|
||||||
i18n_auth_source_be_canceled=當前資源授權權限已經被取消
|
i18n_auth_source_be_canceled=當前資源授權權限已經被取消
|
||||||
i18n_username_exists=用戶ID已存在
|
i18n_username_exists=用戶ID已存在
|
||||||
i18n_ds_name_exists=數據源名稱已存在
|
i18n_ds_name_exists=數據源名稱已被使用
|
||||||
i18n_sync_job_exists=已經有同步任務在運行,稍後重試
|
i18n_sync_job_exists=已經有同步任務在運行,稍後重試
|
||||||
i18n_datasource_check_fail=校驗失敗,請檢查配置信息
|
i18n_datasource_check_fail=校驗失敗,請檢查配置信息
|
||||||
i18n_not_find_user=未找到用戶
|
i18n_not_find_user=未找到用戶
|
||||||
i18n_sql_not_empty=SQL 不能為空
|
i18n_sql_not_empty=SQL 不能為空
|
||||||
|
i18n_task_name_repeat=同一數據集下任務名稱已被使用
|
Loading…
Reference in New Issue
Block a user