Merge pull request #3245 from dataease/pr@dev@dataset

fix: 数据集任务展示下次执行时间
This commit is contained in:
xuwei-fit2cloud 2022-09-28 18:52:46 +08:00 committed by GitHub
commit e19e3ccc2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 11 deletions

View File

@ -58,14 +58,14 @@ public class DataSetTableTaskController {
@DePermission(type = DePermissionType.DATASET, value = "tableId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE) @DePermission(type = DePermissionType.DATASET, value = "tableId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
@ApiOperation("查询") @ApiOperation("查询")
@PostMapping("list") @PostMapping("list")
public List<DatasetTableTask> list(@RequestBody DatasetTableTask datasetTableTask) { public List<DataSetTaskDTO> list(@RequestBody DatasetTableTask datasetTableTask) {
return dataSetTableTaskService.list(datasetTableTask); return dataSetTableTaskService.list(datasetTableTask);
} }
@DePermission(type = DePermissionType.DATASET, value = "tableId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE) @DePermission(type = DePermissionType.DATASET, value = "tableId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
@ApiOperation("分页查询") @ApiOperation("分页查询")
@PostMapping("list/{goPage}/{pageSize}") @PostMapping("list/{goPage}/{pageSize}")
public Pager<List<DatasetTableTask>> list(@RequestBody DatasetTableTask datasetTableTask, @PathVariable int goPage, @PathVariable int pageSize) { public Pager<List<DataSetTaskDTO>> list(@RequestBody DatasetTableTask datasetTableTask, @PathVariable int goPage, @PathVariable int pageSize) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true); Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, dataSetTableTaskService.list(datasetTableTask)); return PageUtils.setPageInfo(page, dataSetTableTaskService.list(datasetTableTask));
} }

View File

@ -1,6 +1,7 @@
package io.dataease.listener; package io.dataease.listener;
import io.dataease.commons.utils.LogUtil; import io.dataease.commons.utils.LogUtil;
import io.dataease.dto.dataset.DataSetTaskDTO;
import io.dataease.plugins.common.base.domain.DatasetTableTask; import io.dataease.plugins.common.base.domain.DatasetTableTask;
import io.dataease.commons.constants.ScheduleType; import io.dataease.commons.constants.ScheduleType;
import io.dataease.service.ScheduleService; import io.dataease.service.ScheduleService;
@ -26,7 +27,7 @@ public class AppStartListener implements ApplicationListener<ApplicationReadyEve
public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) { public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) {
LogUtil.info("================= Application start ================="); LogUtil.info("================= Application start =================");
// 项目启动从数据库读取任务加入到Quartz // 项目启动从数据库读取任务加入到Quartz
List<DatasetTableTask> list = dataSetTableTaskService.list(new DatasetTableTask()); List<DataSetTaskDTO> list = dataSetTableTaskService.list(new DatasetTableTask());
for (DatasetTableTask task : list) { for (DatasetTableTask task : list) {
try { try {
if (!StringUtils.equalsIgnoreCase(task.getRate(), ScheduleType.SIMPLE.toString())) { if (!StringUtils.equalsIgnoreCase(task.getRate(), ScheduleType.SIMPLE.toString())) {

View File

@ -360,7 +360,7 @@ public class ApiProvider extends Provider {
private List<String[]> fetchResult(String result, ApiDefinition apiDefinition) { private List<String[]> fetchResult(String result, ApiDefinition apiDefinition) {
List<String[]> dataList = new LinkedList<>(); List<String[]> dataList = new LinkedList<>();
if (StringUtils.isNotEmpty(apiDefinition.getDataPath()) && CollectionUtils.isNotEmpty(apiDefinition.getJsonFields())) { if (StringUtils.isNotEmpty(apiDefinition.getDataPath()) && CollectionUtils.isEmpty(apiDefinition.getJsonFields())) {
List<LinkedHashMap> datas = new ArrayList<>(); List<LinkedHashMap> datas = new ArrayList<>();
Object object = JsonPath.read(result, apiDefinition.getDataPath()); Object object = JsonPath.read(result, apiDefinition.getDataPath());
if (object instanceof List) { if (object instanceof List) {

View File

@ -263,14 +263,19 @@ public class DataSetTableTaskService {
datasetTableTaskMapper.updateByExampleSelective(datasetTableTask, datasetTableTaskExample); datasetTableTaskMapper.updateByExampleSelective(datasetTableTask, datasetTableTaskExample);
} }
public List<DatasetTableTask> list(DatasetTableTask datasetTableTask) { public List<DataSetTaskDTO> list(DatasetTableTask datasetTableTask) {
DatasetTableTaskExample datasetTableTaskExample = new DatasetTableTaskExample(); BaseGridRequest request = new BaseGridRequest();
DatasetTableTaskExample.Criteria criteria = datasetTableTaskExample.createCriteria(); List<ConditionEntity> conditionEntities = new ArrayList<>();
if (datasetTableTask != null && StringUtils.isNotEmpty(datasetTableTask.getTableId())) { if(datasetTableTask != null && StringUtils.isNotEmpty(datasetTableTask.getTableId())){
criteria.andTableIdEqualTo(datasetTableTask.getTableId()); ConditionEntity entity = new ConditionEntity();
entity.setField("table_id");
entity.setOperator("eq");
entity.setValue(datasetTableTask.getTableId());
conditionEntities.add(entity);
} }
datasetTableTaskExample.setOrderByClause("create_time desc,name asc"); request.setConditions(conditionEntities);
return datasetTableTaskMapper.selectByExample(datasetTableTaskExample); GridExample gridExample = request.convertExample();
return extDataSetTaskMapper.taskList(gridExample);
} }
public List<DataSetTaskDTO> taskList4User(BaseGridRequest request) { public List<DataSetTaskDTO> taskList4User(BaseGridRequest request) {