feat:功能优化

This commit is contained in:
junjie
2021-03-08 11:35:28 +08:00
parent 708208d6d1
commit 9d3a5bc39e
7 changed files with 144 additions and 18 deletions

View File

@@ -5,6 +5,7 @@ import io.dataease.base.domain.DatasetTableTaskExample;
import io.dataease.base.mapper.DatasetTableTaskMapper;
import io.dataease.service.ScheduleService;
import org.apache.commons.lang3.StringUtils;
import org.quartz.CronExpression;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -24,6 +25,12 @@ public class DataSetTableTaskService {
private ScheduleService scheduleService;
public DatasetTableTask save(DatasetTableTask datasetTableTask) throws Exception {
// check
if (StringUtils.isNotEmpty(datasetTableTask.getCron())) {
if (!CronExpression.isValidExpression(datasetTableTask.getCron())) {
throw new RuntimeException("cron expression error.");
}
}
if (StringUtils.isEmpty(datasetTableTask.getId())) {
datasetTableTask.setId(UUID.randomUUID().toString());
datasetTableTask.setCreateTime(System.currentTimeMillis());