diff --git a/leopard-server/src/main/java/com/lanyuanxiaoyao/leopard/server/service/QuartzService.java b/leopard-server/src/main/java/com/lanyuanxiaoyao/leopard/server/service/QuartzService.java index f537560..c60658c 100644 --- a/leopard-server/src/main/java/com/lanyuanxiaoyao/leopard/server/service/QuartzService.java +++ b/leopard-server/src/main/java/com/lanyuanxiaoyao/leopard/server/service/QuartzService.java @@ -2,6 +2,7 @@ package com.lanyuanxiaoyao.leopard.server.service; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; +import com.yomahub.liteflow.core.FlowExecutor; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.ArrayList; @@ -79,18 +80,23 @@ public class QuartzService { @Slf4j public static class TaskExecutionJob extends QuartzJobBean { - private final TaskService taskService; + private final TaskTemplateService taskTemplateService; + private final FlowExecutor flowExecutor; - public TaskExecutionJob(TaskService taskService) { - this.taskService = taskService; + public TaskExecutionJob(TaskTemplateService taskTemplateService, FlowExecutor flowExecutor) { + this.taskTemplateService = taskTemplateService; + this.flowExecutor = flowExecutor; } @Override protected void executeInternal(JobExecutionContext context) { var dataMap = context.getMergedJobDataMap(); var templateId = dataMap.getLong("template_id"); - var parms = (Map) dataMap.getOrDefault("params", Map.of()); - taskService.execute(templateId, parms); + if (ObjectUtil.isNotNull(templateId)) { + var template = taskTemplateService.detail(templateId); + var params = (Map) dataMap.getOrDefault("params", Map.of()); + flowExecutor.execute2Resp(template.getChain(), params, context); + } } } diff --git a/leopard-web/src/index.tsx b/leopard-web/src/index.tsx index 395c81e..a134d85 100644 --- a/leopard-web/src/index.tsx +++ b/leopard-web/src/index.tsx @@ -8,7 +8,6 @@ import Test from './pages/Test.tsx' import StockList from './pages/stock/StockList.tsx' import StockDetail from './pages/stock/StockDetail.tsx' import TaskList from './pages/task/TaskList.tsx' -import TaskAdd from './pages/task/TaskAdd.tsx' import TaskTemplateList from './pages/task/TaskTemplateList.tsx' import TaskTemplateSave from './pages/task/TaskTemplateSave.tsx' import TaskScheduleList from './pages/task/TaskScheduleList.tsx' @@ -51,10 +50,6 @@ const routes: RouteObject[] = [ path: 'list', Component: TaskList, }, - { - path: 'add', - Component: TaskAdd, - }, { path: 'template', children: [ diff --git a/leopard-web/src/pages/task/TaskAdd.tsx b/leopard-web/src/pages/task/TaskAdd.tsx deleted file mode 100644 index 1cd0b77..0000000 --- a/leopard-web/src/pages/task/TaskAdd.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import React from 'react' -import {amisRender, commonInfo} from '../../util/amis.tsx' - -function TaskAdd() { - return ( -
- {amisRender( - { - type: 'page', - title: '任务添加', - body: [ - { - debug: commonInfo.debug, - type: 'form', - wrapWithPanel: false, - mode: 'horizontal', - labelAlign: 'left', - body: [], - }, - ], - }, - )} -
- ) -} - -export default React.memo(TaskAdd) \ No newline at end of file diff --git a/leopard-web/src/pages/task/TaskList.tsx b/leopard-web/src/pages/task/TaskList.tsx index 1ced1e5..90e6301 100644 --- a/leopard-web/src/pages/task/TaskList.tsx +++ b/leopard-web/src/pages/task/TaskList.tsx @@ -24,32 +24,7 @@ function TaskList() { }, }, ...crudCommonOptions(), - ...paginationTemplate( - 15, - undefined, - [ - { - type: 'action', - label: '', - icon: 'fa fa-plus', - tooltip: '添加任务', - tooltipPlacement: 'top', - onEvent: { - click: { - actions: [ - { - actionType: 'custom', - // @ts-ignore - script: (context, action, event) => { - navigate('/task/add') - }, - }, - ], - }, - }, - }, - ], - ), + ...paginationTemplate(15), columns: [ { name: 'name', diff --git a/leopard-web/src/pages/task/TaskScheduleSave.tsx b/leopard-web/src/pages/task/TaskScheduleSave.tsx index d7bf8aa..17d9426 100644 --- a/leopard-web/src/pages/task/TaskScheduleSave.tsx +++ b/leopard-web/src/pages/task/TaskScheduleSave.tsx @@ -60,6 +60,23 @@ function TaskScheduleSave() { label: '重置', actionType: 'reset', }, + { + type: 'action', + label: '返回', + onEvent: { + click: { + actions: [ + { + actionType: 'custom', + // @ts-ignore + script: (context, action, event) => { + navigate(-1) + }, + }, + ], + }, + }, + } ], }, ],