Interface TaskService
- All Known Implementing Classes:
DefaultTaskService
public interface TaskService
Task-centric facade exposing the seven approval operations + todo / lookup.
任务侧门面 —— 暴露 7 个审批操作 + 待办 / 查询接口。
All (taskId, userId, ...) methods MUST perform the v4 §8.0.1
ownership pre-check before any business logic; implementations route through
a single requireOwnedPendingTask helper. Reject reasons:
- task not found →
BASE-FLOW-TASK-001(TASK_NOT_FOUND) - task not assigned to caller →
BASE-FLOW-TASK-002 - task already done / canceled →
BASE-FLOW-TASK-003
所有 (taskId, userId, ...) 方法必须先做 v4 §8.0.1 的所有权前置校验。
- Since:
- JDK 25, opencode-base-flow V1.0.5
- Author:
- Leon Soo
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdd-sign action.voidApprove action.voidCirculate (read-only notification) to additional users.Convenience: equivalent tofindTodo(userId, 0, 50).Paginated todo query (status = PENDING) for a user.Returns the task by id (or throws TASK_NOT_FOUND).voidReject action.voidTransfer the current task to another user.voidvote(String taskId, String userId, VoteOpinion opinion, String comment) Vote action (records vote and marks task DONE).voidWithdraw the running instance (initiator only).
-
Method Details
-
findTodo
Paginated todo query (status = PENDING) for a user.sizeis capped at 200 (v4 D18). 分页查询用户待办(仅 PENDING)。size硬上限 200。- Parameters:
userId- assignee user id — 承接人page- zero-based page — 页码(0 起)size- page size (≤ 200) — 每页大小(≤ 200)- Returns:
- tasks on the requested page — 该页任务
- Since:
- JDK 25, opencode-base-flow V1.0.5
-
findTodo
-
get
-
approve
-
vote
Vote action (records vote and marks task DONE). 投票(记录投票并把 task 置为 DONE)。- Parameters:
taskId- task id — 任务 IDuserId- caller user id — 调用者opinion- vote opinion — 投票意见comment- comment (nullable) — 文本意见(可空)- Since:
- JDK 25, opencode-base-flow V1.0.5
-
reject
Reject action. 驳回。- Parameters:
taskId- task id — 任务 IDuserId- caller user id — 调用者targetStepId-null= previous;"_INITIATOR_"= to-initiator; otherwise a visited step id —null上一级;"_INITIATOR_"起草点; 否则指定步骤 idcomment- comment (nullable) — 文本意见- Since:
- JDK 25, opencode-base-flow V1.0.5
-
addSign
Add-sign action. Only USER ids accepted (no role / dept). 后加签。仅接受 userId 列表。- Parameters:
taskId- task id — 任务 IDuserId- caller user id — 调用者additionalUserIds- extra user ids — 新增加签人comment- comment (nullable) — 文本意见- Since:
- JDK 25, opencode-base-flow V1.0.5
-
withdraw
-
transfer
Transfer the current task to another user. 转办给他人。- Parameters:
taskId- task id — 任务 IDfromUserId- caller user id — 调用者toUserId- target user id — 目标 userIdreason- reason (nullable) — 理由- Since:
- JDK 25, opencode-base-flow V1.0.5
-
circulate
Circulate (read-only notification) to additional users. 抄送(仅通知)。- Parameters:
taskId- task id — 任务 IDfromUserId- caller user id — 调用者toUserIds- notify these users — 被抄送 userId 列表comment- comment (nullable) — 文本意见- Since:
- JDK 25, opencode-base-flow V1.0.5
-