类 TaskServiceImpl
java.lang.Object
net.sohelp.boot.engine.workflow.impl.TaskServiceImpl
- 所有已实现的接口:
TaskService
任务执行业务类
- 从以下版本开始:
- 1.0
-
字段概要
字段修饰符和类型字段说明protected final FlwExtInstanceDaoprotected final FlowIdGeneratorprotected final FlwHisInstanceDaoprotected final FlwHisTaskActorDaoprotected final FlwHisTaskDaoprotected final FlwInstanceDaoprotected final TaskAccessStrategyprotected final FlwTaskActorDaoprotected final FlwTaskDaoprotected final TaskListenerprotected final TaskTrigger -
构造器概要
构造器构造器说明TaskServiceImpl(TaskAccessStrategy taskAccessStrategy, TaskListener taskListener, TaskTrigger taskTrigger, FlowIdGenerator flowLongIdGenerator, FlwInstanceDao instanceDao, FlwExtInstanceDao extInstanceDao, FlwHisInstanceDao hisInstanceDao, FlwTaskDao taskDao, FlwTaskActorDao taskActorDao, FlwHisTaskDao hisTaskDao, FlwHisTaskActorDao hisTaskActorDao) -
方法概要
修饰符和类型方法说明booleanaddTaskActor(Long taskId, PerformType performType, List<FlwTaskActor> taskActors, FlowCreator flowCreator) 向指定的任务ID添加参与者protected intassignActorType(int actorType, Integer dbActorType) 优先使用数据库参与者类型booleanassigneeTask(Long taskId, TaskType taskType, TaskEventType taskEventType, FlowCreator flowCreator, List<FlowCreator> assigneeFlowCreators, Map<String, Object> args, Function<FlwTask, Boolean> check) 根据 任务ID 分配任务给指定办理人、重置任务类型protected voidassignTask(Long instanceId, Long taskId, int actorType, FlwTaskActor taskActor) 对指定的任务分配参与者。booleancascadeRemoveByInstanceIds(List<Long> instanceIds) 级联删除表 flw_his_task_actor, flw_his_task, flw_task_actor, flw_taskbooleanchangeTaskActor(Long taskId, FlwTaskActor taskActor) 修改 taskId 任务办理人为指定 taskActor 参与者protected FlwTaskclaim(Long taskId, AgentType agentType, TaskEventType eventType, FlowCreator flowCreator) 根据 任务ID 认领任务,删除其它任务参与者claimDepartment(Long taskId, FlowCreator flowCreator) 部门根据 任务ID 认领任务,删除其它任务参与者claimRole(Long taskId, FlowCreator flowCreator) 角色根据 任务ID 认领任务,删除其它任务参与者booleancompleteActiveTasksByInstanceId(Long instanceId, FlowCreator flowCreator) 完成指定实例ID活动任务booleancreateCcTask(NodeModel taskModel, FlwTask flwTask, List<NodeAssignee> ccUserList, FlowCreator flowCreator) 创建抄送任务createNewTask(Long taskId, TaskType taskType, PerformType performType, List<FlwTaskActor> taskActors, FlowCreator flowCreator, Function<FlwTask, Execution> executionFunction) 根据已有任务、参与者创建新的任务创建 task 根据 model 决定是否分配参与者protected FlwTaskcreateTaskBase(NodeModel nodeModel, Execution execution) 根据模型、执行对象、任务类型构建基本的task对象voidendCallProcessTask(Long callProcessId, Long callInstanceId) 结束调用外部流程任务booleanexecuteFinishTrigger(NodeModel nodeModel, Execution execution, FlowCreator flowCreator) 执行完成触发器操作流程继续往下执行executeJumpTask(Long taskId, String nodeKey, FlowCreator flowCreator, Map<String, Object> args, Function<FlwTask, Execution> executionFunction, TaskType taskType) 执行节点跳转任务executeTask(Long taskId, FlowCreator flowCreator, Map<String, Object> args, TaskState taskState, TaskEventType eventType) 执行任务booleanexecuteTaskTrigger(Execution execution, FlwTask flwTask) 执行触发器任务protected voidexecuteTaskTrigger(NodeModel nodeModel, Execution execution, List<FlwTask> flwTasks, FlwTask flwTask, List<FlwTaskActor> taskActors) 执行任务触发器booleanforceCompleteAllTask(Long instanceId, FlwTask currentFlwTask, FlowCreator flowCreator, InstanceState instanceState, TaskEventType eventType) 强制完成所有任务booleanforceCompleteTask(FlwTask flwTask, FlowCreator flowCreator, TaskState taskState, TaskEventType eventType) 强制完成某个任务protected FlwTaskgetAllowedFlwTask(Long taskId, FlowCreator flowCreator, Map<String, Object> args, TaskState taskState) 获取执行任务并验证合法性protected FlwTaskActorgetAllowedFlwTaskActor(Long taskId, FlowCreator flowCreator) 获取指定 任务ID 合法参与者对象protected List<FlwTaskActor> getTaskActorsByTaskId(Long taskId) getTaskModel(Long taskId) 获取任务模型获取超时或者提醒的任务根据 taskId、createId 判断创建人是否允许执行任务protected booleanmoveToHisTask(FlwTask flwTask, TaskState taskState, FlowCreator flowCreator) 迁移任务至历史表protected voidmoveToHisTaskActor(List<FlwTaskActor> taskActors) 迁移任务参与者至历史表protected booleanmoveToHisTaskTrigger(FlwTask flwTask, FlowCreator flowCreator) 触发器任务归档reclaimTask(Long taskId, FlowCreator flowCreator, BiConsumer<FlwHisTask, Integer> assertConsumer) 拿回任务、根据历史任务ID撤回下一个节点的任务、恢复历史任务protected voidreclaimTaskAssert(BiConsumer<FlwHisTask, Integer> assertConsumer, FlwHisTask fht, Integer code, String errorMessage) 拿回任务异常断言rejectTask(FlwTask currentFlwTask, FlowCreator flowCreator, Map<String, Object> args, TaskState taskState, TaskEventType eventType) 根据当前任务对象驳回至上一步处理booleanremoveTaskActor(Long taskId, List<String> actorIds, FlowCreator flowCreator) 对指定的任务ID删除参与者【减签】booleanresolveTask(Long taskId, FlowCreator flowCreator) 根据 任务ID 解决委派任务booleanresume(Long instanceId, FlowCreator flowCreator, BiFunction<FlwInstance, String, Boolean> execFunc) 唤醒撤回或拒绝终止历史任务saveTask(FlwTask flwTask, PerformType performType, List<FlwTaskActor> taskActors, Execution execution, NodeModel nodeModel) 保存任务及参与者信息protected voidtaskNotify(TaskEventType eventType, Supplier<FlwTask> supplier, List<FlwTaskActor> taskActors, NodeModel nodeModel, FlowCreator flowCreator) booleantransferTask(FlowCreator flowCreator, FlowCreator assigneeFlowCreator) 参与者的所有任务【离职转办】给指定办理人undoHisTask(Long hisTaskId, FlowCreator flowCreator, TaskType taskType, Consumer<FlwHisTask> hisTaskConsumer) 撤回历史任务protected voidupdateCurrentNode(FlwTask flwTask, InstanceState instanceState) 更新当前执行节点信息voidupdateTaskById(FlwTask flwTask, FlowCreator flowCreator) 更新任务对象的 finishTime、createBy、expireTime、version、variablebooleanviewTask(Long taskId, FlowCreator flowCreator) 查看任务设置为已阅状态withdrawTask(Long taskId, FlowCreator flowCreator) 撤回指定的任务从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 net.sohelp.boot.engine.workflow.TaskService
addTaskActor, addTaskActor, addTaskActor, agentTask, agentTask, assigneeTask, complete, complete, createTask, delegateTask, delegateTask, executeJumpTask, executeJumpTask, reclaimTask, rejectTask, rejectTask, removeTaskActor, transferTask, transferTask
-
字段详细资料
-
taskAccessStrategy
-
taskTrigger
-
taskListener
-
flowLongIdGenerator
-
instanceDao
-
extInstanceDao
-
hisInstanceDao
-
taskDao
-
taskActorDao
-
hisTaskDao
-
hisTaskActorDao
-
-
构造器详细资料
-
TaskServiceImpl
public TaskServiceImpl(TaskAccessStrategy taskAccessStrategy, TaskListener taskListener, TaskTrigger taskTrigger, FlowIdGenerator flowLongIdGenerator, FlwInstanceDao instanceDao, FlwExtInstanceDao extInstanceDao, FlwHisInstanceDao hisInstanceDao, FlwTaskDao taskDao, FlwTaskActorDao taskActorDao, FlwHisTaskDao hisTaskDao, FlwHisTaskActorDao hisTaskActorDao)
-
-
方法详细资料
-
updateCurrentNode
更新当前执行节点信息- 参数:
flwTask- 当前所在执行任务
-
executeTask
public FlwTask executeTask(Long taskId, FlowCreator flowCreator, Map<String, Object> args, TaskState taskState, TaskEventType eventType) 执行任务- 指定者:
executeTask在接口中TaskService- 参数:
taskId- 任务IDflowCreator- 任务创建者args- 执行参数taskState- 任务状态eventType- 执行事件- 返回:
FlwTask
-
forceCompleteAllTask
public boolean forceCompleteAllTask(Long instanceId, FlwTask currentFlwTask, FlowCreator flowCreator, InstanceState instanceState, TaskEventType eventType) 强制完成所有任务- 指定者:
forceCompleteAllTask在接口中TaskService- 参数:
instanceId- 流程实例IDcurrentFlwTask- 当前任务flowCreator- 处理人员instanceState- 流程实例最终状态eventType- 监听事件类型- 返回:
- true 成功 false 失败
-
forceCompleteTask
public boolean forceCompleteTask(FlwTask flwTask, FlowCreator flowCreator, TaskState taskState, TaskEventType eventType) 从接口复制的说明:TaskService强制完成某个任务- 指定者:
forceCompleteTask在接口中TaskService- 参数:
flwTask- 审批任务flowCreator- 处理人员taskState- 流任务状态eventType- 监听事件类型- 返回:
- true 成功 false 失败
-
executeJumpTask
public Optional<List<FlwTask>> executeJumpTask(Long taskId, String nodeKey, FlowCreator flowCreator, Map<String, Object> args, Function<FlwTask, Execution> executionFunction, TaskType taskType) 执行节点跳转任务- 指定者:
executeJumpTask在接口中TaskService- 参数:
taskId- 任务IDnodeKey- 跳转至目标节点keyflowCreator- 任务创建者args- 任务参数executionFunction- 执行函数taskType- 任务类型,仅支持 jump rejectJump routeJump- 返回:
- 当前 flowCreator 所在的任务
-
getAllowedFlwTask
protected FlwTask getAllowedFlwTask(Long taskId, FlowCreator flowCreator, Map<String, Object> args, TaskState taskState) 获取执行任务并验证合法性- 参数:
taskId- 任务IDflowCreator- 任务创建者args- 执行参数taskState-TaskState- 返回:
- 流程任务
-
moveToHisTask
迁移任务至历史表- 参数:
flwTask- 执行任务taskState- 任务状态flowCreator- 任务创建者- 返回:
- true 成功 false 失败
-
moveToHisTaskActor
迁移任务参与者至历史表- 参数:
taskActors- 任务参与者列表
-
taskNotify
protected void taskNotify(TaskEventType eventType, Supplier<FlwTask> supplier, List<FlwTaskActor> taskActors, NodeModel nodeModel, FlowCreator flowCreator) -
executeTaskTrigger
从接口复制的说明:TaskService执行触发器任务- 指定者:
executeTaskTrigger在接口中TaskService- 参数:
execution-ExecutionflwTask- 触发器任务- 返回:
- true 成功 false 失败
-
completeActiveTasksByInstanceId
完成指定实例ID活动任务- 指定者:
completeActiveTasksByInstanceId在接口中TaskService- 参数:
instanceId- 实例IDflowCreator- 处理人员- 返回:
- true 成功 false 失败
-
updateTaskById
更新任务对象的 finishTime、createBy、expireTime、version、variable- 指定者:
updateTaskById在接口中TaskService- 参数:
flwTask- 任务对象flowCreator- 处理人员
-
viewTask
查看任务设置为已阅状态- 指定者:
viewTask在接口中TaskService- 参数:
taskId- 任务IDflowCreator- 处理人员- 返回:
- true 成功 false 失败
-
claimRole
从接口复制的说明:TaskService角色根据 任务ID 认领任务,删除其它任务参与者- 指定者:
claimRole在接口中TaskService- 参数:
taskId- 任务IDflowCreator- 任务认领者- 返回:
- Task 任务对象
-
claimDepartment
从接口复制的说明:TaskService部门根据 任务ID 认领任务,删除其它任务参与者- 指定者:
claimDepartment在接口中TaskService- 参数:
taskId- 任务IDflowCreator- 任务认领者- 返回:
- Task 任务对象
-
claim
protected FlwTask claim(Long taskId, AgentType agentType, TaskEventType eventType, FlowCreator flowCreator) 根据 任务ID 认领任务,删除其它任务参与者- 参数:
taskId- 任务IDagentType- 代理人类型eventType- 流程引擎监听类型flowCreator- 任务认领者- 返回:
- Task 任务对象
-
transferTask
从接口复制的说明:TaskService参与者的所有任务【离职转办】给指定办理人用于任务参与者离职
- 指定者:
transferTask在接口中TaskService- 参数:
flowCreator- 任务参与者assigneeFlowCreator- 指定办理人- 返回:
- true 成功 false 失败
-
assigneeTask
public boolean assigneeTask(Long taskId, TaskType taskType, TaskEventType taskEventType, FlowCreator flowCreator, List<FlowCreator> assigneeFlowCreators, Map<String, Object> args, Function<FlwTask, Boolean> check) 根据 任务ID 分配任务给指定办理人、重置任务类型- 指定者:
assigneeTask在接口中TaskService- 参数:
taskId- 任务IDtaskType- 任务类型taskEventType- 任务事件类型flowCreator- 任务参与者assigneeFlowCreators- 指定办理人列表args- 任务参数check- 校验函数,可以根据 dbFlwTask.getAssignorId() 是否存在判断为重发分配- 返回:
- true 成功 false 失败
-
getAllowedFlwTaskActor
获取指定 任务ID 合法参与者对象- 参数:
taskId- 任务IDflowCreator- 任务参与者- 返回:
- 任务参与者
-
resolveTask
根据 任务ID 解决委派任务- 指定者:
resolveTask在接口中TaskService- 参数:
taskId- 任务IDflowCreator- 任务参与者- 返回:
- true 成功 false 失败
-
reclaimTaskAssert
protected void reclaimTaskAssert(BiConsumer<FlwHisTask, Integer> assertConsumer, FlwHisTask fht, Integer code, String errorMessage) 拿回任务异常断言 -
reclaimTask
public Optional<List<FlwTask>> reclaimTask(Long taskId, FlowCreator flowCreator, BiConsumer<FlwHisTask, Integer> assertConsumer) 拿回任务、根据历史任务ID撤回下一个节点的任务、恢复历史任务- 指定者:
reclaimTask在接口中TaskService- 参数:
taskId- 任务ID(当前节点的父任务ID属于历史任务)flowCreator- 任务创建者assertConsumer- 断言处理函数- 返回:
- 拿回任务
-
resume
public boolean resume(Long instanceId, FlowCreator flowCreator, BiFunction<FlwInstance, String, Boolean> execFunc) 唤醒撤回或拒绝终止历史任务- 指定者:
resume在接口中TaskService- 参数:
instanceId- 历史实例IDflowCreator- 任务唤醒者execFunc- 执行函数- 返回:
- true 成功 false 失败
-
withdrawTask
撤回指定的任务- 指定者:
withdrawTask在接口中TaskService- 参数:
taskId- 待撤回历史任务IDflowCreator- 任务创建者- 返回:
- Task 任务对象
-
rejectTask
public Optional<List<FlwTask>> rejectTask(FlwTask currentFlwTask, FlowCreator flowCreator, Map<String, Object> args, TaskState taskState, TaskEventType eventType) 从接口复制的说明:TaskService根据当前任务对象驳回至上一步处理- 指定者:
rejectTask在接口中TaskService- 参数:
currentFlwTask- 当前任务对象flowCreator- 任务创建者args- 任务参数taskState- 任务状态eventType- 任务执行事件类型- 返回:
- Task 任务对象
-
undoHisTask
protected Optional<List<FlwTask>> undoHisTask(Long hisTaskId, FlowCreator flowCreator, TaskType taskType, Consumer<FlwHisTask> hisTaskConsumer) 撤回历史任务- 参数:
hisTaskId- 历史任务IDflowCreator- 任务创建者taskType- 任务类型hisTaskConsumer- 历史任务业务处理- 返回:
- 任务参与者
-
assignTask
对指定的任务分配参与者。参与者可以为用户、部门、角色- 参数:
instanceId- 实例IDtaskId- 任务IDactorType- 参与者类型 0,用户 1,角色 2,部门taskActor- 任务参与者
-
createNewTask
public List<FlwTask> createNewTask(Long taskId, TaskType taskType, PerformType performType, List<FlwTaskActor> taskActors, FlowCreator flowCreator, Function<FlwTask, Execution> executionFunction) 根据已有任务、参与者创建新的任务适用于动态转派,动态协办等处理且流程图中不体现节点情况
- 指定者:
createNewTask在接口中TaskService- 参数:
taskId- 主办任务IDtaskType- 任务类型performType- 参与类型taskActors- 参与者集合flowCreator- 任务创建者executionFunction- 执行函数- 返回:
- 创建任务集合
-
createCcTask
public boolean createCcTask(NodeModel taskModel, FlwTask flwTask, List<NodeAssignee> ccUserList, FlowCreator flowCreator) 创建抄送任务默认不校验是否重复抄送
- 指定者:
createCcTask在接口中TaskService- 参数:
taskModel- 任务模型flwTask- 当前任务ccUserList- 抄送任务分配到任务的人或角色列表flowCreator- 任务创建者
-
getTimeoutOrRemindTasks
获取超时或者提醒的任务- 指定者:
getTimeoutOrRemindTasks在接口中TaskService- 返回:
- 任务列表
-
getTaskModel
获取任务模型- 指定者:
getTaskModel在接口中TaskService- 参数:
taskId- 任务ID- 返回:
- 节点模型
-
createTask
public List<FlwTask> createTask(NodeModel nodeModel, Execution execution, Function<FlwTask, FlwTask> taskFunction) 创建 task 根据 model 决定是否分配参与者- 指定者:
createTask在接口中TaskService- 参数:
nodeModel- 节点模型execution- 执行对象taskFunction- 任务处理函数,如果自定义 CreateTaskHandler 可用于控制任务创建属性设置- 返回:
- 任务列表
-
executeTaskTrigger
protected void executeTaskTrigger(NodeModel nodeModel, Execution execution, List<FlwTask> flwTasks, FlwTask flwTask, List<FlwTaskActor> taskActors) 执行任务触发器 -
executeFinishTrigger
public boolean executeFinishTrigger(NodeModel nodeModel, Execution execution, FlowCreator flowCreator) 从接口复制的说明:TaskService执行完成触发器操作流程继续往下执行- 指定者:
executeFinishTrigger在接口中TaskService- 参数:
nodeModel- 节点模型NodeModelexecution- 执行对象ExecutionflowCreator- 任务创建者- 返回:
- true 成功 false 失败
-
moveToHisTaskTrigger
触发器任务归档 -
createTaskBase
根据模型、执行对象、任务类型构建基本的task对象- 参数:
nodeModel- 节点模型execution- 执行对象- 返回:
- Task任务对象
-
saveTask
protected List<FlwTask> saveTask(FlwTask flwTask, PerformType performType, List<FlwTaskActor> taskActors, Execution execution, NodeModel nodeModel) 保存任务及参与者信息- 参数:
flwTask- 流程任务对象performType- 参与类型PerformTypetaskActors- 参与者ID集合execution- 流程执行处理类ExecutionnodeModel- 流程节点模型对象NodeModel- 返回:
- 流程任务列表
-
assignActorType
优先使用数据库参与者类型 -
isAllowed
根据 taskId、createId 判断创建人是否允许执行任务- 指定者:
isAllowed在接口中TaskService- 参数:
flwTask- 流程任务userId- 用户ID- 返回:
- true 允许 false 不允许
-
addTaskActor
public boolean addTaskActor(Long taskId, PerformType performType, List<FlwTaskActor> taskActors, FlowCreator flowCreator) 向指定的任务ID添加参与者- 指定者:
addTaskActor在接口中TaskService- 参数:
taskId- 任务IDperformType- 参与类型PerformTypetaskActors- 参与者列表flowCreator- 执行操作人员- 返回:
- true 成功 false 失败
-
getTaskActorsByTaskId
-
removeTaskActor
从接口复制的说明:TaskService对指定的任务ID删除参与者【减签】- 指定者:
removeTaskActor在接口中TaskService- 参数:
taskId- 任务IDactorIds- 参与者ID列表flowCreator- 执行操作人员- 返回:
- true 成功 false 失败
-
changeTaskActor
从接口复制的说明:TaskService修改 taskId 任务办理人为指定 taskActor 参与者- 指定者:
changeTaskActor在接口中TaskService- 参数:
taskId- 任务IDtaskActor- 参与者- 返回:
- true 成功 false 失败
-
endCallProcessTask
从接口复制的说明:TaskService结束调用外部流程任务- 指定者:
endCallProcessTask在接口中TaskService- 参数:
callProcessId- 调用外部流程定义IDcallInstanceId- 调用外部流程实例ID
-
cascadeRemoveByInstanceIds
级联删除表 flw_his_task_actor, flw_his_task, flw_task_actor, flw_task- 指定者:
cascadeRemoveByInstanceIds在接口中TaskService- 参数:
instanceIds- 流程实例ID列表
-