public class TaskServiceImpl extends Object implements TaskService
构造器和说明 |
---|
TaskServiceImpl(TaskAccessStrategy taskAccessStrategy,
TaskListener taskListener,
TaskTrigger taskTrigger,
FlwInstanceDao instanceDao,
FlwExtInstanceDao extInstanceDao,
FlwHisInstanceDao hisInstanceDao,
FlwTaskDao taskDao,
FlwTaskActorDao taskActorDao,
FlwHisTaskDao hisTaskDao,
FlwHisTaskActorDao hisTaskActorDao) |
限定符和类型 | 方法和说明 |
---|---|
boolean |
addTaskActor(Long taskId,
PerformType performType,
List<FlwTaskActor> flwTaskActors,
FlowCreator flowCreator)
向指定的任务ID添加参与者
|
protected int |
assignActorType(int actorType,
Integer dbActorType)
优先使用数据库参与者类型
|
boolean |
assigneeTask(Long taskId,
TaskType taskType,
FlowCreator flowCreator,
List<FlowCreator> assigneeFlowCreators,
Function<FlwTask,Boolean> check)
根据 任务ID 分配任务给指定办理人、重置任务类型
|
protected void |
assignTask(Long instanceId,
Long taskId,
int actorType,
FlwTaskActor taskActor)
对指定的任务分配参与者。
|
boolean |
cascadeRemoveByInstanceIds(List<Long> instanceIds)
级联删除表 flw_his_task_actor, flw_his_task, flw_task_actor, flw_task
|
protected FlwTask |
claim(Long taskId,
AgentType agentType,
TaskEventType eventType,
FlowCreator flowCreator)
根据 任务ID 认领任务,删除其它任务参与者
|
FlwTask |
claimDepartment(Long taskId,
FlowCreator flowCreator)
部门根据 任务ID 认领任务,删除其它任务参与者
|
FlwTask |
claimRole(Long taskId,
FlowCreator flowCreator)
角色根据 任务ID 认领任务,删除其它任务参与者
|
boolean |
completeActiveTasksByInstanceId(Long instanceId,
FlowCreator flowCreator)
完成指定实例ID活动任务
|
List<FlwTask> |
createNewTask(Long taskId,
TaskType taskType,
PerformType performType,
List<FlwTaskActor> taskActors,
FlowCreator flowCreator,
Function<FlwTask,Execution> executionFunction)
根据已有任务、参与者创建新的任务
适用于动态转派,动态协办等处理且流程图中不体现节点情况
|
List<FlwTask> |
createTask(NodeModel nodeModel,
Execution execution,
Function<FlwTask,FlwTask> taskFunction)
创建 task 根据 model 决定是否分配参与者
|
void |
endCallProcessTask(Long callProcessId,
Long callInstanceId)
结束调用外部流程任务
|
Optional<FlwTask> |
executeJumpTask(Long taskId,
String nodeKey,
FlowCreator flowCreator,
Map<String,Object> args,
Function<FlwTask,Execution> executionFunction,
TaskType taskTye)
执行节点跳转任务
|
FlwTask |
executeTask(Long taskId,
FlowCreator flowCreator,
Map<String,Object> args,
TaskState taskState,
TaskEventType eventType)
执行任务
|
boolean |
executeTaskTrigger(Execution execution,
FlwTask flwTask)
执行触发器任务
|
boolean |
forceCompleteAllTask(Long instanceId,
FlowCreator flowCreator,
InstanceState instanceState,
TaskEventType eventType)
强制完成所有任务
|
protected FlwTask |
getAllowedFlwTask(Long taskId,
FlowCreator flowCreator,
Map<String,Object> args,
TaskState taskState)
获取执行任务并验证合法性
|
protected FlwTaskActor |
getAllowedFlwTaskActor(Long taskId,
FlowCreator flowCreator)
获取指定 任务ID 合法参与者对象
|
protected List<FlwTaskActor> |
getTaskActorsByTaskId(Long taskId) |
NodeModel |
getTaskModel(Long taskId)
获取任务模型
|
List<FlwTask> |
getTimeoutOrRemindTasks()
获取超时或者提醒的任务
|
FlwTaskActor |
isAllowed(FlwTask flwTask,
String userId)
根据 taskId、createId 判断创建人是否允许执行任务
|
protected boolean |
moveToHisTask(FlwTask flwTask,
TaskState taskState,
FlowCreator flowCreator)
迁移任务至历史表
|
protected void |
moveToHisTaskActor(List<FlwTaskActor> taskActors)
迁移任务参与者至历史表
|
Optional<FlwTask> |
reclaimTask(Long taskId,
FlowCreator flowCreator)
拿回任务、根据历史任务ID撤回下一个节点的任务、恢复历史任务
|
Optional<FlwTask> |
rejectTask(FlwTask currentFlwTask,
FlowCreator flowCreator,
Map<String,Object> args)
根据当前任务对象驳回至上一步处理
|
boolean |
removeTaskActor(Long taskId,
List<String> actorIds,
FlowCreator flowCreator)
对指定的任务ID删除参与者【减签】
|
boolean |
resolveTask(Long taskId,
FlowCreator flowCreator)
根据 任务ID 解决委派任务
|
FlwTask |
resume(Long taskId,
FlowCreator flowCreator)
唤醒指定的历史任务
|
protected List<FlwTask> |
saveTask(FlwTask flwTask,
PerformType performType,
List<FlwTaskActor> taskActors,
Execution execution,
NodeModel nodeModel)
保存任务及参与者信息
|
void |
saveTaskCc(NodeModel nodeModel,
FlwTask flwTask,
FlowCreator flowCreator)
保存抄送任务
|
protected void |
taskNotify(TaskEventType eventType,
Supplier<FlwTask> supplier,
NodeModel nodeModel,
FlowCreator flowCreator) |
boolean |
transferTask(FlowCreator flowCreator,
FlowCreator assigneeFlowCreator)
参与者的所有任务【离职转办】给指定办理人
用于任务参与者离职
|
protected Optional<FlwTask> |
undoHisTask(Long hisTaskId,
FlowCreator flowCreator,
TaskType taskType,
Consumer<FlwHisTask> hisTaskConsumer)
撤回历史任务
|
protected void |
updateCurrentNode(FlwTask flwTask)
更新当前执行节点信息
|
void |
updateTaskById(FlwTask flwTask,
FlowCreator flowCreator)
更新任务对象的 finishTime、createBy、expireTime、version、variable
|
boolean |
viewTask(Long taskId,
FlwTaskActor taskActor)
查看任务设置为已阅状态
|
Optional<FlwTask> |
withdrawTask(Long taskId,
FlowCreator flowCreator)
撤回指定的任务
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addTaskActor, agentTask, assigneeTask, complete, complete, createTask, delegateTask, executeJumpTask, executeJumpTask, rejectTask, removeTaskActor, transferTask
public TaskServiceImpl(TaskAccessStrategy taskAccessStrategy, TaskListener taskListener, TaskTrigger taskTrigger, FlwInstanceDao instanceDao, FlwExtInstanceDao extInstanceDao, FlwHisInstanceDao hisInstanceDao, FlwTaskDao taskDao, FlwTaskActorDao taskActorDao, FlwHisTaskDao hisTaskDao, FlwHisTaskActorDao hisTaskActorDao)
protected void updateCurrentNode(FlwTask flwTask)
flwTask
- 当前所在执行任务public FlwTask executeTask(Long taskId, FlowCreator flowCreator, Map<String,Object> args, TaskState taskState, TaskEventType eventType)
executeTask
在接口中 TaskService
taskId
- 任务IDflowCreator
- 任务创建者args
- 执行参数taskState
- 任务状态eventType
- 执行事件FlwTask
public boolean forceCompleteAllTask(Long instanceId, FlowCreator flowCreator, InstanceState instanceState, TaskEventType eventType)
forceCompleteAllTask
在接口中 TaskService
instanceId
- 流程实例IDflowCreator
- 处理人员instanceState
- 流程实例最终状态eventType
- 监听事件类型public Optional<FlwTask> executeJumpTask(Long taskId, String nodeKey, FlowCreator flowCreator, Map<String,Object> args, Function<FlwTask,Execution> executionFunction, TaskType taskTye)
executeJumpTask
在接口中 TaskService
taskId
- 任务IDnodeKey
- 跳转至目标节点keyflowCreator
- 任务创建者args
- 任务参数executionFunction
- 执行函数taskTye
- 任务类型,仅支持 jump rejectJump routeJumpprotected FlwTask getAllowedFlwTask(Long taskId, FlowCreator flowCreator, Map<String,Object> args, TaskState taskState)
taskId
- 任务IDflowCreator
- 任务创建者args
- 执行参数taskState
- TaskState
protected boolean moveToHisTask(FlwTask flwTask, TaskState taskState, FlowCreator flowCreator)
flwTask
- 执行任务taskState
- 任务状态flowCreator
- 任务创建者protected void moveToHisTaskActor(List<FlwTaskActor> taskActors)
taskActors
- 任务参与者列表protected void taskNotify(TaskEventType eventType, Supplier<FlwTask> supplier, NodeModel nodeModel, FlowCreator flowCreator)
public boolean executeTaskTrigger(Execution execution, FlwTask flwTask)
TaskService
executeTaskTrigger
在接口中 TaskService
execution
- Execution
flwTask
- 触发器任务public boolean completeActiveTasksByInstanceId(Long instanceId, FlowCreator flowCreator)
completeActiveTasksByInstanceId
在接口中 TaskService
instanceId
- 实例IDflowCreator
- 处理人员public void updateTaskById(FlwTask flwTask, FlowCreator flowCreator)
updateTaskById
在接口中 TaskService
flwTask
- 任务对象flowCreator
- 处理人员public boolean viewTask(Long taskId, FlwTaskActor taskActor)
viewTask
在接口中 TaskService
taskId
- 任务IDtaskActor
- 任务参与者public FlwTask claimRole(Long taskId, FlowCreator flowCreator)
TaskService
claimRole
在接口中 TaskService
taskId
- 任务IDflowCreator
- 任务认领者public FlwTask claimDepartment(Long taskId, FlowCreator flowCreator)
TaskService
claimDepartment
在接口中 TaskService
taskId
- 任务IDflowCreator
- 任务认领者protected FlwTask claim(Long taskId, AgentType agentType, TaskEventType eventType, FlowCreator flowCreator)
taskId
- 任务IDagentType
- 代理人类型eventType
- 流程引擎监听类型flowCreator
- 任务认领者public boolean transferTask(FlowCreator flowCreator, FlowCreator assigneeFlowCreator)
TaskService
用于任务参与者离职
transferTask
在接口中 TaskService
flowCreator
- 任务参与者assigneeFlowCreator
- 指定办理人public boolean assigneeTask(Long taskId, TaskType taskType, FlowCreator flowCreator, List<FlowCreator> assigneeFlowCreators, Function<FlwTask,Boolean> check)
assigneeTask
在接口中 TaskService
taskId
- 任务IDtaskType
- 任务类型flowCreator
- 任务参与者assigneeFlowCreators
- 指定办理人列表check
- 校验函数,可以根据 dbFlwTask.getAssignorId() 是否存在判断为重发分配protected FlwTaskActor getAllowedFlwTaskActor(Long taskId, FlowCreator flowCreator)
taskId
- 任务IDflowCreator
- 任务参与者public boolean resolveTask(Long taskId, FlowCreator flowCreator)
resolveTask
在接口中 TaskService
taskId
- 任务IDflowCreator
- 任务参与者public Optional<FlwTask> reclaimTask(Long taskId, FlowCreator flowCreator)
reclaimTask
在接口中 TaskService
taskId
- 任务ID(当前节点的父任务ID属于历史任务)flowCreator
- 任务创建者public FlwTask resume(Long taskId, FlowCreator flowCreator)
resume
在接口中 TaskService
taskId
- 历史任务IDflowCreator
- 任务唤醒者FlwTask
唤醒后的任务对象public Optional<FlwTask> withdrawTask(Long taskId, FlowCreator flowCreator)
withdrawTask
在接口中 TaskService
taskId
- 待撤回历史任务IDflowCreator
- 任务创建者public Optional<FlwTask> rejectTask(FlwTask currentFlwTask, FlowCreator flowCreator, Map<String,Object> args)
TaskService
rejectTask
在接口中 TaskService
currentFlwTask
- 当前任务对象flowCreator
- 任务创建者args
- 任务参数protected Optional<FlwTask> undoHisTask(Long hisTaskId, FlowCreator flowCreator, TaskType taskType, Consumer<FlwHisTask> hisTaskConsumer)
hisTaskId
- 历史任务IDflowCreator
- 任务创建者taskType
- 任务类型hisTaskConsumer
- 历史任务业务处理protected void assignTask(Long instanceId, Long taskId, int actorType, FlwTaskActor taskActor)
instanceId
- 实例IDtaskId
- 任务IDactorType
- 参与者类型 0,用户 1,角色 2,部门taskActor
- 任务参与者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
- 执行函数public List<FlwTask> getTimeoutOrRemindTasks()
getTimeoutOrRemindTasks
在接口中 TaskService
public NodeModel getTaskModel(Long taskId)
getTaskModel
在接口中 TaskService
taskId
- 任务IDpublic List<FlwTask> createTask(NodeModel nodeModel, Execution execution, Function<FlwTask,FlwTask> taskFunction)
createTask
在接口中 TaskService
nodeModel
- 节点模型execution
- 执行对象taskFunction
- 任务处理函数,如果自定义 CreateTaskHandler 可用于控制任务创建属性设置public void saveTaskCc(NodeModel nodeModel, FlwTask flwTask, FlowCreator flowCreator)
nodeModel
- 节点模型flwTask
- 流程任务对象flowCreator
- 处理人protected List<FlwTask> saveTask(FlwTask flwTask, PerformType performType, List<FlwTaskActor> taskActors, Execution execution, NodeModel nodeModel)
flwTask
- 流程任务对象performType
- 参与类型 PerformType
taskActors
- 参与者ID集合execution
- 流程执行处理类 Execution
nodeModel
- 流程节点模型对象 NodeModel
protected int assignActorType(int actorType, Integer dbActorType)
public FlwTaskActor isAllowed(FlwTask flwTask, String userId)
isAllowed
在接口中 TaskService
flwTask
- 流程任务userId
- 用户IDpublic boolean addTaskActor(Long taskId, PerformType performType, List<FlwTaskActor> flwTaskActors, FlowCreator flowCreator)
addTaskActor
在接口中 TaskService
taskId
- 任务IDflwTaskActors
- 参与者列表performType
- 参与类型 PerformType
flowCreator
- 执行操作人员protected List<FlwTaskActor> getTaskActorsByTaskId(Long taskId)
public boolean removeTaskActor(Long taskId, List<String> actorIds, FlowCreator flowCreator)
TaskService
removeTaskActor
在接口中 TaskService
taskId
- 任务IDactorIds
- 参与者ID列表flowCreator
- 执行操作人员public void endCallProcessTask(Long callProcessId, Long callInstanceId)
TaskService
endCallProcessTask
在接口中 TaskService
callProcessId
- 调用外部流程定义IDcallInstanceId
- 调用外部流程实例IDpublic boolean cascadeRemoveByInstanceIds(List<Long> instanceIds)
cascadeRemoveByInstanceIds
在接口中 TaskService
instanceIds
- 流程实例ID列表Copyright © 2025. All rights reserved.