forked from github/dataease
feat(cron):cron time fix
This commit is contained in:
parent
83a243e193
commit
8e6d5436bc
@ -2,7 +2,6 @@ package io.dataease.controller.dataset;
|
||||
|
||||
import io.dataease.base.domain.DatasetTableTask;
|
||||
import io.dataease.controller.request.dataset.DataSetTaskRequest;
|
||||
import io.dataease.service.dataset.DataSetTableService;
|
||||
import io.dataease.service.dataset.DataSetTableTaskService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -18,13 +17,10 @@ import java.util.List;
|
||||
public class DataSetTableTaskController {
|
||||
@Resource
|
||||
private DataSetTableTaskService dataSetTableTaskService;
|
||||
@Resource
|
||||
private DataSetTableService dataSetTableService;
|
||||
|
||||
@PostMapping("save")
|
||||
public DatasetTableTask save(@RequestBody DataSetTaskRequest dataSetTaskRequest) throws Exception {
|
||||
dataSetTableService.saveIncrementalConfig(dataSetTaskRequest.getDatasetTableIncrementalConfig());
|
||||
return dataSetTableTaskService.save(dataSetTaskRequest.getDatasetTableTask());
|
||||
return dataSetTableTaskService.save(dataSetTaskRequest);
|
||||
}
|
||||
|
||||
@PostMapping("delete/{id}")
|
||||
|
@ -3,10 +3,13 @@ package io.dataease.service.dataset;
|
||||
import io.dataease.base.domain.DatasetTableTask;
|
||||
import io.dataease.base.domain.DatasetTableTaskExample;
|
||||
import io.dataease.base.mapper.DatasetTableTaskMapper;
|
||||
import io.dataease.controller.request.dataset.DataSetTaskRequest;
|
||||
import io.dataease.i18n.Translator;
|
||||
import io.dataease.service.ScheduleService;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.quartz.CronExpression;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -27,14 +30,25 @@ public class DataSetTableTaskService {
|
||||
private DataSetTableTaskLogService dataSetTableTaskLogService;
|
||||
@Resource
|
||||
private ScheduleService scheduleService;
|
||||
@Resource
|
||||
@Lazy
|
||||
private DataSetTableService dataSetTableService;
|
||||
|
||||
public DatasetTableTask save(DatasetTableTask datasetTableTask) throws Exception {
|
||||
public DatasetTableTask save(DataSetTaskRequest dataSetTaskRequest) throws Exception {
|
||||
dataSetTableService.saveIncrementalConfig(dataSetTaskRequest.getDatasetTableIncrementalConfig());
|
||||
DatasetTableTask datasetTableTask = dataSetTaskRequest.getDatasetTableTask();
|
||||
// check
|
||||
if (StringUtils.isNotEmpty(datasetTableTask.getCron())) {
|
||||
if (!CronExpression.isValidExpression(datasetTableTask.getCron())) {
|
||||
throw new RuntimeException(Translator.get("i18n_cron_expression_error"));
|
||||
}
|
||||
}
|
||||
// check start time and end time
|
||||
if (ObjectUtils.isNotEmpty(datasetTableTask.getStartTime())
|
||||
&& ObjectUtils.isNotEmpty(datasetTableTask.getEndTime())
|
||||
&& datasetTableTask.getStartTime() > datasetTableTask.getEndTime()) {
|
||||
throw new RuntimeException(Translator.get("i18n_cron_time_error"));
|
||||
}
|
||||
if (StringUtils.isEmpty(datasetTableTask.getId())) {
|
||||
datasetTableTask.setId(UUID.randomUUID().toString());
|
||||
datasetTableTask.setCreateTime(System.currentTimeMillis());
|
||||
|
@ -184,7 +184,6 @@ automation_exec_info=There are no test steps to execute
|
||||
authsource_name_already_exists=Authentication source name already exists
|
||||
authsource_name_is_null=Authentication source name cannot be empty
|
||||
authsource_configuration_is_null=Authentication source configuration cannot be empty
|
||||
|
||||
个人信息=Personal Information
|
||||
仪表盘=Panel
|
||||
修改密码=Change Password
|
||||
@ -238,3 +237,4 @@ i18n_panel_list=Panel
|
||||
i18n_processing_data=Processing data now, Refresh later
|
||||
i18n_union_already_exists=Union relation already exists
|
||||
i18n_union_field_exists=The same field can't in two dataset
|
||||
i18n_cron_time_error=Start time can't greater then end time
|
||||
|
@ -239,3 +239,4 @@ i18n_panel_list=仪表盘
|
||||
i18n_processing_data=正在处理数据,稍后刷新
|
||||
i18n_union_already_exists=关联关系已存在
|
||||
i18n_union_field_exists=两个数据集之间关联不能出现多次相同字段
|
||||
i18n_cron_time_error=开始时间不能大于结束时间
|
||||
|
@ -239,3 +239,4 @@ i18n_panel_list=仪表盘
|
||||
i18n_processing_data=正在處理數據,稍後刷新
|
||||
i18n_union_already_exists=關聯關系已存在
|
||||
i18n_union_field_exists=兩個數據集之間關聯不能出現多次相同字段
|
||||
i18n_cron_time_error=開始時間不能大於結束時間
|
Loading…
Reference in New Issue
Block a user