Documentation
¶
Overview ¶
business.go 提供业务系统注册管理(P1.1,对位 Java auth 模块 BusinessSystemService): workflow_business_system 表的端口(Store)+ 内存实现 + SQL 适配器 + 注册服务。 系统代号 system_symbol 即流程租户 tenantId,是业务系统与流程绑定的查询键。
callback.go 提供业务回调 client(P6.2 核心提前交付): 报文协议与 Java BusinessCallTaskListener / BusinessCallExecutionListener 逐字兼容, 按租户查业务系统注册表取回调地址,地址为空或注册表查无时静默跳过(与 Java 一致), 失败按 D5 指数退避重试 3 次,重试仍失败记录日志并可插拔异常记录器(P4 接 workflow_task_exception)。
delegate.go 提供规则型委托(代理人)域服务(P4.1-P4.2,对位 Java WorkflowTaskDelegateServiceImpl 与 ProcessesUtil#doTaskOwnerAdjustment:5856): 三表模型(主表 workflow_task_delegate + 被委托人 workflow_task_consigners + 委托对象 workflow_task_consign_obj)、 时间重叠三段式校验、禁止委托传递、命中优先级(单项目 > 单流程分类 > 全部)、 待办生成改派钩子与待办调整(多 owner 复制 next_activity + 委托镜像 + WP 操作记录)。 注意:按任务委派/转办/归还(delegateTask/transferTask/resolveTask)已在 complete.go 实现,本文件不重复。
dict.go 提供工作流静态字典服务(D9): 码表内置 Go map(数据见 dict_data.go),对位 Java 前端 $store.getters.dictionary 后端字典, 管理台经 /workflow/dict/{code} 读取;未知名返回错误。
dict_data.go 是工作流静态字典的条目数据(D9): 键 = 字典码(dict.go 常量),值 = 条目列表。条目值与 Java 协议逐字对齐处已注明来源, 其余按调研 007/005 语义自拟合理中文项,P6 契约测试如与线上字典冲突再逐条修正。
exception.go 提供任务异常记录域服务(P4.6,对位 Java ProcessesExceptionAspect 与 workflow_task_exception 表): 四类异常判定(BusinessException / FlowableException / RuntimeException / NotTaskMessageException, 按 Java ProcessesExceptionAspect:109-125 分类语义)、消息截断 1000、处理/忽略流转、 进程内原子计数(对位 Java Redis incr)与回调失败记录适配器(P1-C CallbackClient 的 ExceptionRecorder 端口实现)。
executor_rewrite.go 实现执行人重写全局钩子(P1-D 核心闭环后半触发端)。 对位 Java 全局监听器 TaskExecutorConfigListener:任务创建时若实例变量 operationType 命中门控(agreeComplete/completeToTarget),读取"下一步预生成-消耗"台账(used=0 记录) 回填当前任务的办理人/候选人/候选组,并置 used=1、回写 task_id。 与 Java 的差异(规格决策):
- 非会签节点未找到未消耗记录时保留模型默认执行人(兜底),不像 Java 直接抛错;
- 多条记录语义为整体重写候选用户并清空默认办理人(Java candidateUsers 分支 "删默认候选重建"的等价形态,SetCandidateUsers 为整体重写);
- 会签节点每次实例创建消费"恰好一条"未消耗记录(见 rewriteCountersign 注释)。
identity.go 提供身份门面(D10):基于引擎 api.IdentityService 封装管理台左树/人员/角色数据源, 对位 Java auth 服务(AccountIdentityService/OrgGroupService/RoleService 等)经 /workflow/identity/** 暴露的形态。 引擎身份库(ACT_ID_*)无组层级、无资源模型:缺数据处按 D10 决策降级(平铺/空树), 并预留 IdentityAdapter 接口供外部 auth 适配器接管(P6+)。
remind.go 提供催办(提醒)域服务(P4.3,对位 Java ReminderSchedule 与 workflow_remind / workflow_remind_target 两表): 催办配置维护(pid + 步骤白名单 + 预警/延时目标)、对象展开(-1111 当前待办人 / ${initiator} 发起人 / 静态角色组成员 / 字面用户;动态角色 PATH 留接口位)、到期扫描判定(预警 dueTime-duration<=now、 延时 dueTime+duration<=now 或按任务接收时间)、步骤白名单过滤与重试计数。
reset.go 实现流程重置门面服务(P2 波2-B)。 对位 Java ProcessesUtil#doResetProcess:3766: 校验(实例运行中/存在活动任务)→ 引擎 WorkflowExtService().ResetProcess (全部活动执行软回首:迁至开始事件首个出线目标)→ 收尾:LCCZ 意见 + 操作记录 → 删 next_activity 双表 + 待办 + 已办(Java 明确删除已办)→ saveFirstTaskUser 重建首步执行人(在本包实现解析辅助,不可改 start.go)→ 首任务待办/已办镜像重建 → document 刷新。
rollback.go 实现撤回门面服务(P2 波2-B)。 对位 Java ProcessesUtil#doRollbackTask:4373: 校验(历史任务已办结、实例运行中)→ 引擎 WorkflowExtService().RollbackTask (引擎内含撤回工厂判定与 ROLLBACK_* 变量写入,下游执行人重写钩子消费该变量回填办理人)→ 收尾:CH 意见 + 操作记录(type=CH) + DeleteForRollback(清下一步预存, 对位 Java deleteRollbackWorkflowNextActivity)+ 待办遗留清理 + 表单状态刷新。
schedulers.go 提供 workflow 调度器(P4.4-P4.5,平铺于 internal/workflow 包以贴合现包风格; 对位 Java FlowableScheduleTask / ReminderSchedule / ExceptionMonitorSchedule): 1) 自动办结 AutoCompleteTick(noHandleAutoComplete 开关,5 分钟,逾期待办按预存下一步自动完成/退回); 2) 超时提醒 TimeoutRemindTick(task-timeout-remind 开关,每日 8 点); 3) 催办扫描 RemindScanTick(send-workflow-remind 开关,30 秒,RemindService.ScanDue → 送达); 4) 僵尸监控 ZombieScanTick(5 分钟,运行中实例与有待办实例差集 → NotTaskMessageException)。 全部 tick 可注入 trigger 函数并支持测试直调(不真 sleep)。
start.go 实现流程发起域服务(P1-D 核心闭环前半)。 对位 Java ProcessesUtil#publishAndGetFirstTaskByKey:987 与 saveFirstTaskUserNextActivity:1142: 五参校验 → 部署校验 → 协议变量注入 → 引擎发起 → 首任务执行者解析 → 首步预生成(used=1 + taskId)→ 提交意见(TJ)/操作记录/待办/已办镜像/表单状态落位。
terminate.go 实现终止/删除/挂起/激活/重激活门面服务(P2 波2-B)。 对位 Java ProcessesUtil:
doStopProcessByTaskId:675 / doStopProcessByProcessInstanceId:726(软终止收尾)、 deleteProcessInstanceById:5216(实例删除收尾)、deleteProcessByBusinessId:5970(业务键批量删除)、 suspendProcessInstanceByProcessInstanceId:1300 / activateProcessInstanceByProcessInstanceId:1316 (LCZT/LCJH 意见 + 操作记录,next_activity 不动)。
引擎级软终止(迁至结束事件)与历史实例复活由 api.WorkflowExtService 承载。
Package workflow 提供复杂流程的业务封装能力: 发起/办结/退回/撤回/直送/加签/会签/委托/催办/调度/推演等门面服务。
依赖方向:本包仅依赖 api.Engine(七服务)+ api hooks + internal/persistence/workflow, 不 import internal/engine(引擎数据操作一律走引擎状态 API)。
Index ¶
- Constants
- Variables
- func ClassifyException(err error) string
- func DefaultIDGen() func() string
- func FormatParams(params map[string]string) string
- func GetEnumMsgByType(commentType string) string
- func GetExtendColumns() []string
- func IsDraftStep(stepCode string) bool
- func IsEndStep(stepCode string) bool
- func IsSignStep(stepCode string) bool
- func ParseParams(params string) map[string]string
- func SimulateViewString(view NextUserTaskView) string
- func ValidateCountersignConfigWith(ctx context.Context, meta *ModelMetaService, definitionID string) error
- func ValidateProcessIDMatch(process *model.Process, expectedKey string) error
- type ActExtend
- type ActExtendStore
- type AddSignRequest
- type AddSignResult
- type AddSignService
- func (s *AddSignService) AddMultiInstanceMember(ctx context.Context, processInstanceID, activityID, assignee string) error
- func (s *AddSignService) AddSign(ctx context.Context, req AddSignRequest) (AddSignResult, error)
- func (s *AddSignService) DelSign(ctx context.Context, req DelSignRequest) (DelSignResult, error)
- func (s *AddSignService) RemoveMultiInstanceMember(ctx context.Context, ...) error
- func (s *AddSignService) WithAddSignUsers(users UserQuery) *AddSignService
- func (s *AddSignService) WithMultiInstancePort(port MultiInstanceMemberPort) *AddSignService
- type AdjustOwnerRequest
- type AutoCompleteBackExecutor
- type AutoCompleteRule
- type BackNodeView
- type BackOption
- type BackService
- type BackTaskVo
- type BaseColumns
- type BaseProcessVo
- type BusinessCallbackHook
- func (h *BusinessCallbackHook) Hook(ctx context.Context, task *api.Task, ctl api.HookControl) error
- func (h *BusinessCallbackHook) Register(eng api.Engine)
- func (h *BusinessCallbackHook) Warmup(ctx context.Context, definitionID string) error
- func (h *BusinessCallbackHook) WarmupAll(ctx context.Context, engine api.Engine) error
- type BusinessSystem
- type BusinessSystemOption
- type BusinessSystemOptions
- type BusinessSystemService
- func (s *BusinessSystemService) Get(ctx context.Context, symbol string) (*BusinessSystem, error)
- func (s *BusinessSystemService) List(ctx context.Context) ([]BusinessSystem, error)
- func (s *BusinessSystemService) Register(ctx context.Context, input *BusinessSystem) (*BusinessSystem, error)
- func (s *BusinessSystemService) Remove(ctx context.Context, symbol string) error
- func (s *BusinessSystemService) Update(ctx context.Context, input *BusinessSystem) (*BusinessSystem, error)
- type BusinessSystemStore
- type CallbackClient
- type CallbackException
- type CallbackExceptionRecorder
- type CallbackKind
- type CallbackOption
- func WithCallbackBackoff(intervals []time.Duration) CallbackOption
- func WithCallbackHTTP(client *http.Client) CallbackOption
- func WithCallbackLogger(logger *log.Logger) CallbackOption
- func WithCallbackRecorder(recorder ExceptionRecorder) CallbackOption
- func WithCallbackSleeper(sleeper func(time.Duration)) CallbackOption
- type CallbackOptions
- type CategoryLookup
- type ChannelProvider
- type CommentRequest
- type CommentService
- type CommentView
- type CompleteResult
- type CompleteService
- func (s *CompleteService) Complete(ctx context.Context, vo *api.CompleteTaskVo) (CompleteResult, error)
- func (s *CompleteService) DelegateTask(ctx context.Context, req *DelegateTaskRequest) error
- func (s *CompleteService) ResolveTask(ctx context.Context, req *ResolveTaskRequest) error
- func (s *CompleteService) TransferTask(ctx context.Context, req *TransferTaskRequest) error
- type CompleteTaskVo
- type CompleteToActivity
- type CompleteToActivityStore
- type CountersignOption
- type CountersignService
- func (s *CountersignService) CountersignPercentResult(ctx context.Context, taskID string, countersignResult int) (bool, error)
- func (s *CountersignService) ListNodeWeights(ctx context.Context, definitionID string, key CountersignWeightKey) ([]CountersignWeight, error)
- func (s *CountersignService) RegisterCountersignListeners(eng api.Engine) error
- func (s *CountersignService) SaveNodeWeights(ctx context.Context, key CountersignWeightKey, configs []CountersignWeight) error
- func (s *CountersignService) ValidateCountersignConfig(ctx context.Context, definitionID string) error
- func (s *CountersignService) Warmup(ctx context.Context, definitionID string) error
- func (s *CountersignService) WarmupAll(ctx context.Context) error
- type CountersignWeight
- type CountersignWeightKey
- type CountersignWeightStore
- type CreatedProcessModel
- type DefinitionQuery
- type DelSignRequest
- type DelSignResult
- type DelegateConsignObj
- type DelegateConsigner
- type DelegateRule
- type DelegateRuleService
- func (s *DelegateRuleService) Add(ctx context.Context, rule *DelegateRule) error
- func (s *DelegateRuleService) AdjustTaskOwner(ctx context.Context, req AdjustOwnerRequest) error
- func (s *DelegateRuleService) ApplyOnTodoCreate(ctx context.Context, msg *MessageExtend) (*MessageExtend, error)
- func (s *DelegateRuleService) Disable(ctx context.Context, id string) error
- func (s *DelegateRuleService) Enable(ctx context.Context, id string) error
- func (s *DelegateRuleService) HitConsigner(ctx context.Context, ownerID, tenantID, projectID, flowCategory string) (string, error)
- func (s *DelegateRuleService) List(ctx context.Context, ownerID, tenantID string) ([]*DelegateRule, error)
- func (s *DelegateRuleService) Remove(ctx context.Context, id string) error
- func (s *DelegateRuleService) Retire(ctx context.Context, id string) error
- func (s *DelegateRuleService) TriggerScan(ctx context.Context) (*DelegateScanResult, error)
- func (s *DelegateRuleService) Update(ctx context.Context, rule *DelegateRule) error
- type DelegateScanResult
- type DelegateTaskMirror
- type DelegateTaskMirrorStore
- type DelegateTaskRequest
- type DeploySnapshotService
- type Dict
- type DictItem
- type DictService
- type DirectOption
- type DirectService
- type Document
- type DocumentSaveRequest
- type DocumentService
- func (s *DocumentService) CleanByProcessInstance(ctx context.Context, processInstanceID string) error
- func (s *DocumentService) Finish(ctx context.Context, processInstanceID string) error
- func (s *DocumentService) GetByBusinessID(ctx context.Context, businessID, tenantID string) (*Document, bool, error)
- func (s *DocumentService) GetByInstance(ctx context.Context, processInstanceID string) (*Document, bool, error)
- func (s *DocumentService) MarkFinishTime(ctx context.Context, processInstanceID string, finishTime time.Time) error
- func (s *DocumentService) Save(ctx context.Context, req DocumentSaveRequest) (*Document, error)
- func (s *DocumentService) Terminate(ctx context.Context, processInstanceID string) error
- func (s *DocumentService) UpdateByProcessInstanceOrTask(ctx context.Context, processInstanceID, taskID string) error
- type DocumentStore
- type DomainClock
- type DoneTaskView
- type ExceptionRecorder
- type ExceptionRequest
- type ExceptionService
- func (s *ExceptionService) Count() int64
- func (s *ExceptionService) Handle(ctx context.Context, ids []string, handled bool) error
- func (s *ExceptionService) ListByInstance(ctx context.Context, processInstanceID string) ([]*TaskException, error)
- func (s *ExceptionService) ListByTask(ctx context.Context, taskID string) ([]*TaskException, error)
- func (s *ExceptionService) ListUnhandled(ctx context.Context) ([]*TaskException, error)
- func (s *ExceptionService) Record(ctx context.Context, req *ExceptionRequest) (*TaskException, error)
- func (s *ExceptionService) RecordCallbackFailure(ctx context.Context, exception *CallbackException) error
- func (s *ExceptionService) RecordZombieInstance(ctx context.Context, instance api.ProcessInstance) (*TaskException, error)
- type ExecutionCallback
- type ExecutorConfig
- type ExecutorRewriteHook
- func (h *ExecutorRewriteHook) Hook(ctx context.Context, task *api.Task, ctl api.HookControl) error
- func (h *ExecutorRewriteHook) Register(eng api.Engine)
- func (h *ExecutorRewriteHook) Warmup(ctx context.Context, definitionID string) error
- func (h *ExecutorRewriteHook) WarmupAll(ctx context.Context) error
- type ExtendFields
- type FirstStepRequest
- type GroupMemberQuery
- type HighlightData
- type HighlightService
- type HisStepStore
- type HistoryExtend
- type HistoryExtendService
- func (s *HistoryExtendService) CreateForTask(ctx context.Context, req *HistoryExtend) (*HistoryExtend, error)
- func (s *HistoryExtendService) DeleteByBusinessID(ctx context.Context, businessID, tenantID string) error
- func (s *HistoryExtendService) DeleteByInstance(ctx context.Context, processInstanceID string) error
- func (s *HistoryExtendService) DeleteByProcessInstanceAndActivityIDs(ctx context.Context, processInstanceID string, stepCodes []string) error
- func (s *HistoryExtendService) DeleteByTaskID(ctx context.Context, taskID string) error
- func (s *HistoryExtendService) GetByTaskID(ctx context.Context, taskID string) (*HistoryExtend, bool, error)
- func (s *HistoryExtendService) ListByBusinessID(ctx context.Context, businessID, tenantID string) ([]*HistoryExtend, error)
- func (s *HistoryExtendService) ListByInstance(ctx context.Context, processInstanceID string) ([]*HistoryExtend, error)
- func (s *HistoryExtendService) ListByOwner(ctx context.Context, ownerID, tenantID string, page PageQuery) (PageResult[*HistoryExtend], error)
- func (s *HistoryExtendService) UpdateFinishTime(ctx context.Context, taskID, ownerID string, finishTime time.Time) error
- type HistoryExtendStore
- type IdentityAccount
- type IdentityAdapter
- type IdentityFacade
- func (f *IdentityFacade) AccountSearch(ctx context.Context, keyword string) ([]IdentityAccount, error)
- func (f *IdentityFacade) GroupList(ctx context.Context) ([]api.Group, error)
- func (f *IdentityFacade) OrgTree(ctx context.Context) ([]IdentityNode, error)
- func (f *IdentityFacade) ResourceTree(ctx context.Context) ([]IdentityNode, error)
- func (f *IdentityFacade) RoleList(ctx context.Context) ([]api.Role, error)
- func (f *IdentityFacade) UserTree(ctx context.Context) ([]IdentityNode, error)
- type IdentityFacadeOptions
- type IdentityNode
- type IdentityOption
- type InstanceQuery
- type InstanceVariableSource
- type LogNotifier
- type MemActExtendStore
- func (m *MemActExtendStore) Delete(ctx context.Context, id string) error
- func (m *MemActExtendStore) GetByDefinitionKeyAndActivity(ctx context.Context, definitionKey, activityID string) ([]*ActExtend, error)
- func (m *MemActExtendStore) ListByDefinitionKey(ctx context.Context, definitionKey string) ([]*ActExtend, error)
- func (m *MemActExtendStore) Save(ctx context.Context, ext *ActExtend) error
- type MemCompleteToActivityStore
- func (m *MemCompleteToActivityStore) ListByProcessInstance(ctx context.Context, processInstanceID string) ([]*CompleteToActivity, error)
- func (m *MemCompleteToActivityStore) ListByTask(ctx context.Context, taskID string) ([]*CompleteToActivity, error)
- func (m *MemCompleteToActivityStore) Save(ctx context.Context, record *CompleteToActivity) error
- type MemCountersignWeightStore
- type MemDelegateTaskMirrorStore
- func (m *MemDelegateTaskMirrorStore) DeleteByProcessInstance(ctx context.Context, processInstanceID string) error
- func (m *MemDelegateTaskMirrorStore) ListByEntrust(ctx context.Context, entrustID string) ([]*DelegateTaskMirror, error)
- func (m *MemDelegateTaskMirrorStore) ListByTaskID(ctx context.Context, taskID string) ([]*DelegateTaskMirror, error)
- func (m *MemDelegateTaskMirrorStore) Save(ctx context.Context, mirror *DelegateTaskMirror) error
- type MemDocumentStore
- func (m *MemDocumentStore) GetByBusinessID(ctx context.Context, businessID, tenantID string) (*Document, bool, error)
- func (m *MemDocumentStore) GetByInstance(ctx context.Context, processInstanceID string) (*Document, bool, error)
- func (m *MemDocumentStore) MarkDeletedByBusinessID(ctx context.Context, businessID, tenantID string) error
- func (m *MemDocumentStore) Now() time.Time
- func (m *MemDocumentStore) Save(ctx context.Context, d *Document) error
- func (m *MemDocumentStore) UpdateByInstance(ctx context.Context, processInstanceID string, changes map[string]any) error
- type MemHisStepStore
- func (m *MemHisStepStore) DeleteByDeployment(_ context.Context, deploymentID string) error
- func (m *MemHisStepStore) GetByDeploymentAndActivity(_ context.Context, deploymentID, activityID string) (*StepRule, bool, error)
- func (m *MemHisStepStore) ListByDeployment(_ context.Context, deploymentID string) ([]*StepRule, error)
- func (m *MemHisStepStore) Put(_ context.Context, deploymentID string, rules []*StepRule) error
- type MemHistoryStore
- func (m *MemHistoryStore) DeleteByBusinessID(ctx context.Context, businessID, tenantID string) error
- func (m *MemHistoryStore) DeleteByInstance(ctx context.Context, processInstanceID string) error
- func (m *MemHistoryStore) DeleteByProcessInstanceAndActivityIDs(ctx context.Context, processInstanceID string, stepCodes []string) error
- func (m *MemHistoryStore) DeleteByTaskID(ctx context.Context, taskID string) error
- func (m *MemHistoryStore) GetByTaskID(ctx context.Context, taskID string) (*HistoryExtend, bool, error)
- func (m *MemHistoryStore) ListByBusinessID(ctx context.Context, businessID, tenantID string) ([]*HistoryExtend, error)
- func (m *MemHistoryStore) ListByInstance(ctx context.Context, processInstanceID string) ([]*HistoryExtend, error)
- func (m *MemHistoryStore) ListByOwner(ctx context.Context, ownerID, tenantID string, page PageQuery) ([]*HistoryExtend, int64, error)
- func (m *MemHistoryStore) Now() time.Time
- func (m *MemHistoryStore) Save(ctx context.Context, h *HistoryExtend) error
- func (m *MemHistoryStore) UpdateFinishTime(ctx context.Context, taskID, ownerID string, finishTime time.Time) error
- type MemMessageStore
- func (m *MemMessageStore) DeleteByBusinessID(ctx context.Context, businessID, tenantID string) error
- func (m *MemMessageStore) DeleteByInstance(ctx context.Context, processInstanceID string) error
- func (m *MemMessageStore) DeleteByProcessInstanceAndActivityIDs(ctx context.Context, processInstanceID string, stepCodes []string) error
- func (m *MemMessageStore) DeleteByTaskID(ctx context.Context, taskID string) error
- func (m *MemMessageStore) DeleteByTaskIDAndOwner(ctx context.Context, taskID, ownerID string) error
- func (m *MemMessageStore) GetByTaskID(ctx context.Context, taskID string) (*MessageExtend, bool, error)
- func (m *MemMessageStore) ListByBusinessID(ctx context.Context, businessID, tenantID string) ([]*MessageExtend, error)
- func (m *MemMessageStore) ListByInstance(ctx context.Context, processInstanceID string) ([]*MessageExtend, error)
- func (m *MemMessageStore) ListByOwner(ctx context.Context, ownerID, tenantID string, page PageQuery) ([]*MessageExtend, int64, error)
- func (m *MemMessageStore) Now() time.Time
- func (m *MemMessageStore) Save(ctx context.Context, msg *MessageExtend) error
- func (m *MemMessageStore) SetPlanFinishTime(ctx context.Context, taskID string, planFinishTime *time.Time) error
- func (m *MemMessageStore) UpdateDelay(ctx context.Context, taskID string, delayTime time.Time) error
- func (m *MemMessageStore) UpdateRead(ctx context.Context, taskID, ownerID string, readTime time.Time) error
- type MemModelMgmtStore
- func (m *MemModelMgmtStore) DeleteByIDs(_ context.Context, ids []string) error
- func (m *MemModelMgmtStore) GetByCode(_ context.Context, tenantID, modelCode string) (*ModelCategory, bool, error)
- func (m *MemModelMgmtStore) GetByPK(_ context.Context, id string) (*ModelCategory, bool, error)
- func (m *MemModelMgmtStore) Insert(_ context.Context, row *ModelCategory) error
- func (m *MemModelMgmtStore) ListByTenant(_ context.Context, tenantID string) ([]*ModelCategory, error)
- func (m *MemModelMgmtStore) Update(_ context.Context, row *ModelCategory) error
- func (m *MemModelMgmtStore) UpdateLastDeployTime(_ context.Context, id string, deployTime time.Time) error
- type MemModelStore
- type MemNextStore
- func (m *MemNextStore) DeleteByProcessInstance(ctx context.Context, processInstanceID string) error
- func (m *MemNextStore) DeleteByProcessInstanceAndActivityIDs(ctx context.Context, processInstanceID string, nextActivityIDs []string) error
- func (m *MemNextStore) DeleteForBackToStep(ctx context.Context, processInstanceID, nextActivityID string) error
- func (m *MemNextStore) DeleteForResolve(ctx context.Context, ...) error
- func (m *MemNextStore) DeleteForRollback(ctx context.Context, processInstanceID, preTaskID, keepActivityID string) error
- func (m *MemNextStore) FindAssignSource(ctx context.Context, ...) (*NextActivity, bool, error)
- func (m *MemNextStore) GetFirstUnusedByActivity(ctx context.Context, processInstanceID, nextActivityID string) (*NextActivity, bool, error)
- func (m *MemNextStore) InsertDual(ctx context.Context, act *NextActivity) error
- func (m *MemNextStore) LatestVersion(ctx context.Context, processInstanceID, nextActivityID string) (int, error)
- func (m *MemNextStore) ListByPreTask(ctx context.Context, preTaskID string) ([]*NextActivity, error)
- func (m *MemNextStore) ListByTaskID(ctx context.Context, taskID string) ([]*NextActivity, error)
- func (m *MemNextStore) ListHisByInstance(ctx context.Context, processInstanceID string) ([]*NextActivity, error)
- func (m *MemNextStore) ListHisByTaskID(ctx context.Context, taskID string) ([]*NextActivity, error)
- func (m *MemNextStore) ListUnusedByInstance(ctx context.Context, processInstanceID string) ([]*NextActivity, error)
- func (m *MemNextStore) ListUnusedByInstanceAndActivity(ctx context.Context, processInstanceID, nextActivityID string) ([]*NextActivity, error)
- func (m *MemNextStore) ListUsedByInstance(ctx context.Context, processInstanceID string) ([]*NextActivity, error)
- func (m *MemNextStore) MarkUsedAndWriteBack(ctx context.Context, ids []string, taskID string) error
- func (m *MemNextStore) Now() time.Time
- type MemOperationStore
- func (m *MemOperationStore) CountByInstance(ctx context.Context, processInstanceID string) (int, error)
- func (m *MemOperationStore) LastTypeByInstance(ctx context.Context, processInstanceID string) (string, error)
- func (m *MemOperationStore) ListByBusinessID(ctx context.Context, businessID string) ([]*OperationRecord, error)
- func (m *MemOperationStore) ListByBusinessIDs(ctx context.Context, businessIDs []string) ([]*OperationRecord, error)
- func (m *MemOperationStore) ListByInstance(ctx context.Context, processInstanceID string) ([]*OperationRecord, error)
- func (m *MemOperationStore) ListByTask(ctx context.Context, taskID string) ([]*OperationRecord, error)
- func (m *MemOperationStore) ListSignable(ctx context.Context, businessIDs []string) ([]*OperationRecord, error)
- func (m *MemOperationStore) Now() time.Time
- func (m *MemOperationStore) Save(ctx context.Context, r *OperationRecord) error
- type MemRemindStore
- func (m *MemRemindStore) Get(ctx context.Context, id string) (*Remind, bool, error)
- func (m *MemRemindStore) ListActive(ctx context.Context) ([]*Remind, error)
- func (m *MemRemindStore) ListByModel(ctx context.Context, modelID string) ([]*Remind, error)
- func (m *MemRemindStore) ListNotSent(ctx context.Context) ([]*Remind, error)
- func (m *MemRemindStore) MarkDeleted(ctx context.Context, id string) error
- func (m *MemRemindStore) MarkDeletedByIDs(ctx context.Context, ids []string) error
- func (m *MemRemindStore) MarkSent(ctx context.Context, id string) error
- func (m *MemRemindStore) Save(ctx context.Context, remind *Remind) error
- type MemRemindTargetStore
- func (m *MemRemindTargetStore) DeleteByRemind(ctx context.Context, remindID string) error
- func (m *MemRemindTargetStore) ListByRemind(ctx context.Context, remindID string) ([]*RemindTarget, error)
- func (m *MemRemindTargetStore) MarkSent(ctx context.Context, id string) error
- func (m *MemRemindTargetStore) Save(ctx context.Context, target *RemindTarget) error
- func (m *MemRemindTargetStore) UpdateRetryCount(ctx context.Context, id string, count int) error
- type MemReviewTaskStore
- func (m *MemReviewTaskStore) CountUnread(ctx context.Context, reviewer, tenantID string) (int64, error)
- func (m *MemReviewTaskStore) DeleteByInstance(ctx context.Context, processInstanceID string) error
- func (m *MemReviewTaskStore) Get(ctx context.Context, id string) (*ReviewTask, bool, error)
- func (m *MemReviewTaskStore) Insert(ctx context.Context, rt *ReviewTask) error
- func (m *MemReviewTaskStore) ListByInstance(ctx context.Context, processInstanceID string) ([]*ReviewTask, error)
- func (m *MemReviewTaskStore) ListByReviewer(ctx context.Context, reviewer, tenantID string, page PageQuery) ([]*ReviewTask, int64, error)
- func (m *MemReviewTaskStore) Now() time.Time
- func (m *MemReviewTaskStore) Update(ctx context.Context, rt *ReviewTask) error
- type MemStepDesignStore
- func (m *MemStepDesignStore) DeleteByIDs(_ context.Context, ids []string) error
- func (m *MemStepDesignStore) GetByModelAndCode(_ context.Context, modelID, stepCode string) (*StepDesign, bool, error)
- func (m *MemStepDesignStore) GetByPK(_ context.Context, id string) (*StepDesign, bool, error)
- func (m *MemStepDesignStore) Insert(_ context.Context, s *StepDesign) error
- func (m *MemStepDesignStore) ListByModel(_ context.Context, modelID string) ([]*StepDesign, error)
- func (m *MemStepDesignStore) Update(_ context.Context, s *StepDesign) error
- type MemStepStore
- type MemStores
- type MemTaskDelegateStore
- func (m *MemTaskDelegateStore) Delete(ctx context.Context, id string) error
- func (m *MemTaskDelegateStore) Get(ctx context.Context, id string) (*DelegateRule, bool, error)
- func (m *MemTaskDelegateStore) ListByConsigner(ctx context.Context, consignerID, tenantID string) ([]*DelegateRule, error)
- func (m *MemTaskDelegateStore) ListByOwner(ctx context.Context, ownerID, tenantID string) ([]*DelegateRule, error)
- func (m *MemTaskDelegateStore) Save(ctx context.Context, rule *DelegateRule) error
- func (m *MemTaskDelegateStore) UpdateState(ctx context.Context, id string, enable, retire int) error
- type MemTaskExceptionStore
- func (m *MemTaskExceptionStore) Get(ctx context.Context, id string) (*TaskException, bool, error)
- func (m *MemTaskExceptionStore) ListByInstance(ctx context.Context, processInstanceID string) ([]*TaskException, error)
- func (m *MemTaskExceptionStore) ListByTask(ctx context.Context, taskID string) ([]*TaskException, error)
- func (m *MemTaskExceptionStore) ListByTypeAndInstances(ctx context.Context, exceptionType string, instanceIDs []string) ([]*TaskException, error)
- func (m *MemTaskExceptionStore) ListUnhandled(ctx context.Context) ([]*TaskException, error)
- func (m *MemTaskExceptionStore) MarkHandled(ctx context.Context, ids []string, status int) error
- func (m *MemTaskExceptionStore) Save(ctx context.Context, e *TaskException) error
- type MemTemplateStore
- func (m *MemTemplateStore) DeleteByIDs(_ context.Context, ids []string) error
- func (m *MemTemplateStore) GetByPK(_ context.Context, id string) (*TemplateDef, bool, error)
- func (m *MemTemplateStore) Insert(_ context.Context, t *TemplateDef) error
- func (m *MemTemplateStore) ListByCategory(_ context.Context, categoryID string) ([]*TemplateDef, error)
- func (m *MemTemplateStore) ListByTenant(_ context.Context, tenantID string) ([]*TemplateDef, error)
- func (m *MemTemplateStore) Update(_ context.Context, t *TemplateDef) error
- type MemTodoSource
- type MemoryBusinessSystemStore
- func (m *MemoryBusinessSystemStore) Delete(ctx context.Context, symbol string) error
- func (m *MemoryBusinessSystemStore) GetBySymbol(ctx context.Context, symbol string) (*BusinessSystem, bool, error)
- func (m *MemoryBusinessSystemStore) GetByTenant(ctx context.Context, tenantID string) (*BusinessSystem, bool, error)
- func (m *MemoryBusinessSystemStore) List(ctx context.Context) ([]BusinessSystem, error)
- func (m *MemoryBusinessSystemStore) Save(ctx context.Context, system *BusinessSystem) error
- type MessageCreateRequest
- type MessageExtend
- type MessageExtendService
- func (s *MessageExtendService) CopyAsDelegate(ctx context.Context, taskID, entrustID, entrustName string) (*MessageExtend, error)
- func (s *MessageExtendService) CreateForTask(ctx context.Context, req *MessageCreateRequest) (*MessageExtend, error)
- func (s *MessageExtendService) DeleteByBusinessID(ctx context.Context, businessID, tenantID string) error
- func (s *MessageExtendService) DeleteByInstance(ctx context.Context, processInstanceID string) error
- func (s *MessageExtendService) DeleteByProcessInstanceAndActivityIDs(ctx context.Context, processInstanceID string, stepCodes []string) error
- func (s *MessageExtendService) DeleteByTaskID(ctx context.Context, taskID string) error
- func (s *MessageExtendService) DeleteByTaskIDAndOwner(ctx context.Context, taskID, ownerID string) error
- func (s *MessageExtendService) GetByTaskID(ctx context.Context, taskID string) (*MessageExtend, bool, error)
- func (s *MessageExtendService) InstallDelegateHook(hook func(ctx context.Context, msg *MessageExtend) (*MessageExtend, error))
- func (s *MessageExtendService) ListByBusinessID(ctx context.Context, businessID, tenantID string) ([]*MessageExtend, error)
- func (s *MessageExtendService) ListByInstance(ctx context.Context, processInstanceID string) ([]*MessageExtend, error)
- func (s *MessageExtendService) ListByOwner(ctx context.Context, ownerID, tenantID string, page PageQuery) (PageResult[*MessageExtend], error)
- func (s *MessageExtendService) SetPlanFinishTime(ctx context.Context, taskID string, planFinishTime *time.Time) error
- func (s *MessageExtendService) UpdateDelay(ctx context.Context, taskID string, delayTime time.Time) error
- func (s *MessageExtendService) UpdateRead(ctx context.Context, taskID, ownerID string, readTime time.Time) error
- type MessageExtendStore
- type ModelCategory
- type ModelMetaService
- func (s *ModelMetaService) FirstUserTask(ctx context.Context, definitionID string) (*UserTaskMeta, error)
- func (s *ModelMetaService) ListUserTaskMetas(ctx context.Context, definitionID string) ([]*UserTaskMeta, error)
- func (s *ModelMetaService) NodeExtensions(ctx context.Context, definitionID, elementID string) (*model.ElementExtensions, error)
- func (s *ModelMetaService) UserTaskMeta(ctx context.Context, definitionID, activityID string) (*UserTaskMeta, error)
- type ModelMgmtStore
- type ModelService
- func (s *ModelService) Add(ctx context.Context, m *ModelCategory) (*ModelCategory, error)
- func (s *ModelService) Delete(ctx context.Context, ids ...string) error
- func (s *ModelService) Edit(ctx context.Context, m *ModelCategory) (*ModelCategory, error)
- func (s *ModelService) GetByCode(ctx context.Context, tenantID, modelCode string) (*ModelCategory, bool, error)
- func (s *ModelService) GetByID(ctx context.Context, id string) (*ModelCategory, bool, error)
- func (s *ModelService) List(ctx context.Context, tenantID string) ([]*ModelCategory, error)
- func (s *ModelService) Tree(ctx context.Context, tenantID string) ([]*ModelTreeNode, error)
- type ModelStore
- type ModelTreeNode
- type MultiInstanceMemberPort
- type MultiInstanceMeta
- type NextActivity
- type NextActivityRequest
- type NextActivitySaveRequest
- type NextActivityService
- func (s *NextActivityService) DeleteByProcessInstance(ctx context.Context, processInstanceID string) error
- func (s *NextActivityService) DeleteByProcessInstanceAndActivityIDs(ctx context.Context, processInstanceID string, activityIDs []string) error
- func (s *NextActivityService) DeleteForBackToStep(ctx context.Context, processInstanceID, activityID string) error
- func (s *NextActivityService) DeleteForResolve(ctx context.Context, processInstanceID, activityID, taskID, identityID string) error
- func (s *NextActivityService) DeleteForRollback(ctx context.Context, processInstanceID, preTaskID, keepActivityID string) error
- func (s *NextActivityService) GetFirstUnusedByActivity(ctx context.Context, processInstanceID, activityID string) (*NextActivity, bool, error)
- func (s *NextActivityService) InsertDual(ctx context.Context, act *NextActivity, operator string) error
- func (s *NextActivityService) LatestVersion(ctx context.Context, processInstanceID, taskKey string) (int, error)
- func (s *NextActivityService) ListByPreTask(ctx context.Context, preTaskID string) ([]*NextActivity, error)
- func (s *NextActivityService) ListByTaskID(ctx context.Context, taskID string) ([]*NextActivity, error)
- func (s *NextActivityService) ListHisByInstance(ctx context.Context, processInstanceID string) ([]*NextActivity, error)
- func (s *NextActivityService) ListHisByTaskID(ctx context.Context, taskID string) ([]*NextActivity, error)
- func (s *NextActivityService) ListUnusedByInstance(ctx context.Context, processInstanceID string) ([]*NextActivity, error)
- func (s *NextActivityService) ListUnusedByInstanceAndActivity(ctx context.Context, processInstanceID, activityID string) ([]*NextActivity, error)
- func (s *NextActivityService) MarkUsedAndWriteBack(ctx context.Context, ids []string, taskID string) error
- func (s *NextActivityService) SaveAgreeNext(ctx context.Context, req NextActivitySaveRequest) error
- func (s *NextActivityService) SaveBackToStepNext(ctx context.Context, req NextActivitySaveRequest) error
- func (s *NextActivityService) SaveFirstTaskUser(ctx context.Context, req FirstStepRequest) error
- func (s *NextActivityService) SaveResolveNext(ctx context.Context, req ResolveNextSaveRequest) error
- type NextActivityStore
- type NextActivityVo
- type NextUserTaskView
- type NopChannelProvider
- type NopExceptionRecorder
- type NopScheduleRuleProvider
- type Notifier
- type OperationRecord
- type OperationRecordService
- func (s *OperationRecordService) ListByBusinessIDs(ctx context.Context, businessIDs []string) ([]*OperationRecord, error)
- func (s *OperationRecordService) ListByInstance(ctx context.Context, processInstanceID string) ([]*OperationRecord, error)
- func (s *OperationRecordService) ListSignable(ctx context.Context, businessIDs []string) ([]*OperationRecord, error)
- func (s *OperationRecordService) Save(ctx context.Context, req OperationRequest) (*OperationRecord, error)
- type OperationRecordStore
- type OperationRequest
- type Option
- func WithAdjacentActivitySameOwnerAutoComplete(enabled bool) Option
- func WithClock(c clock.Clock) Option
- func WithNoHandleAutoComplete(enabled bool) Option
- func WithSQLStores(store *pwf.Store, db *sql.DB) Option
- func WithSendTodoRemind(enabled bool) Option
- func WithSendWorkflowRemind(enabled bool) Option
- func WithTaskTimeoutRemind(enabled bool) Option
- type Options
- type PageQuery
- type PageResult
- type PercentReturnRule
- type ProcessInstanceView
- type QueryService
- func (s *QueryService) AllInstanceList(ctx context.Context, query PageQuery) (PageResult[*ProcessInstanceView], error)
- func (s *QueryService) DoneListByIdentityID(ctx context.Context, identityID string, query PageQuery) (PageResult[*DoneTaskView], error)
- func (s *QueryService) InstanceListByUser(ctx context.Context, userID string, query PageQuery) (PageResult[*ProcessInstanceView], error)
- func (s *QueryService) SignableOperationRecords(ctx context.Context, businessIDs []string) ([]*OperationRecord, error)
- func (s *QueryService) TaskHistoryListByBusinessID(ctx context.Context, tenantID, businessID string) ([]*HistoryExtend, error)
- func (s *QueryService) TaskHistoryListByInstance(ctx context.Context, processInstanceID string) ([]*HistoryExtend, error)
- func (s *QueryService) TaskHistoryListByTaskID(ctx context.Context, taskID string) (*HistoryExtend, error)
- func (s *QueryService) TaskInfoByTaskID(ctx context.Context, taskID string) (*TaskInfoView, error)
- func (s *QueryService) TaskMessageListByBusinessID(ctx context.Context, tenantID, businessID string) ([]*MessageExtend, error)
- func (s *QueryService) TodoListByIdentityID(ctx context.Context, identityID string, query PageQuery) (PageResult[*TodoTaskView], error)
- type R
- type Remind
- type RemindHit
- type RemindInstanceContext
- type RemindNotification
- type RemindSaveRequest
- type RemindService
- func (s *RemindService) Add(ctx context.Context, req RemindSaveRequest) (*Remind, error)
- func (s *RemindService) Deliver(ctx context.Context, hit *RemindHit, notifier Notifier) (int, error)
- func (s *RemindService) ExpandTargets(ctx context.Context, target *RemindTarget, instance *RemindInstanceContext) []string
- func (s *RemindService) Get(ctx context.Context, id string) (*Remind, bool, error)
- func (s *RemindService) List(ctx context.Context, modelID string, page PageQuery) (PageResult[*Remind], error)
- func (s *RemindService) Remove(ctx context.Context, id string) error
- func (s *RemindService) RemoveBatch(ctx context.Context, ids []string) error
- func (s *RemindService) ScanDue(ctx context.Context, now time.Time) ([]*RemindHit, error)
- func (s *RemindService) SendNow(ctx context.Context, taskID string) ([]*RemindHit, error)
- func (s *RemindService) Update(ctx context.Context, req RemindSaveRequest) (*Remind, error)
- type RemindStore
- type RemindTarget
- type RemindTargetStore
- type ResetService
- type ResolveNextSaveRequest
- type ResolveTaskRequest
- type ReviewTask
- type ReviewTaskService
- func (s *ReviewTaskService) Complete(ctx context.Context, reviewTaskID, opinion, operator string) (*ReviewTask, error)
- func (s *ReviewTaskService) CountUnreadByReviewer(ctx context.Context, reviewer, tenantID string) (int64, error)
- func (s *ReviewTaskService) Get(ctx context.Context, reviewTaskID string) (*ReviewTask, bool, error)
- func (s *ReviewTaskService) ListByInstance(ctx context.Context, processInstanceID string) ([]*ReviewTask, error)
- func (s *ReviewTaskService) ListByReviewer(ctx context.Context, reviewer, tenantID string, page PageQuery) (PageResult[*ReviewTask], error)
- func (s *ReviewTaskService) SyncForTask(ctx context.Context, task *api.Task, senderID, senderName string) ([]*ReviewTask, error)
- type ReviewTaskStore
- type RoleMemberLookup
- type RollbackService
- type SQLActExtendStore
- func (s *SQLActExtendStore) Delete(ctx context.Context, id string) error
- func (s *SQLActExtendStore) GetByDefinitionKeyAndActivity(ctx context.Context, definitionKey, activityID string) ([]*ActExtend, error)
- func (s *SQLActExtendStore) ListByDefinitionKey(ctx context.Context, definitionKey string) ([]*ActExtend, error)
- func (s *SQLActExtendStore) Save(ctx context.Context, ext *ActExtend) error
- type SQLBusinessSystemStore
- func (s *SQLBusinessSystemStore) Delete(ctx context.Context, symbol string) error
- func (s *SQLBusinessSystemStore) GetBySymbol(ctx context.Context, symbol string) (*BusinessSystem, bool, error)
- func (s *SQLBusinessSystemStore) GetByTenant(ctx context.Context, tenantID string) (*BusinessSystem, bool, error)
- func (s *SQLBusinessSystemStore) List(ctx context.Context) ([]BusinessSystem, error)
- func (s *SQLBusinessSystemStore) Save(ctx context.Context, system *BusinessSystem) error
- type SQLCompleteToActivityStore
- func (s *SQLCompleteToActivityStore) ListByProcessInstance(ctx context.Context, processInstanceID string) ([]*CompleteToActivity, error)
- func (s *SQLCompleteToActivityStore) ListByTask(ctx context.Context, taskID string) ([]*CompleteToActivity, error)
- func (s *SQLCompleteToActivityStore) Save(ctx context.Context, record *CompleteToActivity) error
- type SQLCountersignWeightStore
- type SQLDelegateTaskMirrorStore
- func (s *SQLDelegateTaskMirrorStore) DeleteByProcessInstance(ctx context.Context, processInstanceID string) error
- func (s *SQLDelegateTaskMirrorStore) ListByEntrust(ctx context.Context, entrustID string) ([]*DelegateTaskMirror, error)
- func (s *SQLDelegateTaskMirrorStore) ListByTaskID(ctx context.Context, taskID string) ([]*DelegateTaskMirror, error)
- func (s *SQLDelegateTaskMirrorStore) Save(ctx context.Context, mirror *DelegateTaskMirror) error
- type SQLDocumentStore
- func (s *SQLDocumentStore) GetByBusinessID(ctx context.Context, businessID, tenantID string) (*Document, bool, error)
- func (s *SQLDocumentStore) GetByInstance(ctx context.Context, processInstanceID string) (*Document, bool, error)
- func (s *SQLDocumentStore) MarkDeletedByBusinessID(ctx context.Context, businessID, tenantID string) error
- func (s *SQLDocumentStore) Save(ctx context.Context, d *Document) error
- func (s *SQLDocumentStore) UpdateByInstance(ctx context.Context, processInstanceID string, changes map[string]any) error
- type SQLHisStepStore
- func (s *SQLHisStepStore) DeleteByDeployment(ctx context.Context, deploymentID string) error
- func (s *SQLHisStepStore) GetByDeploymentAndActivity(ctx context.Context, deploymentID, activityID string) (*StepRule, bool, error)
- func (s *SQLHisStepStore) ListByDeployment(ctx context.Context, deploymentID string) ([]*StepRule, error)
- func (s *SQLHisStepStore) Put(ctx context.Context, deploymentID string, rules []*StepRule) error
- type SQLHistoryStore
- func (s *SQLHistoryStore) DeleteByBusinessID(ctx context.Context, businessID, tenantID string) error
- func (s *SQLHistoryStore) DeleteByInstance(ctx context.Context, processInstanceID string) error
- func (s *SQLHistoryStore) DeleteByProcessInstanceAndActivityIDs(ctx context.Context, processInstanceID string, stepCodes []string) error
- func (s *SQLHistoryStore) DeleteByTaskID(ctx context.Context, taskID string) error
- func (s *SQLHistoryStore) GetByTaskID(ctx context.Context, taskID string) (*HistoryExtend, bool, error)
- func (s *SQLHistoryStore) ListByBusinessID(ctx context.Context, businessID, tenantID string) ([]*HistoryExtend, error)
- func (s *SQLHistoryStore) ListByInstance(ctx context.Context, processInstanceID string) ([]*HistoryExtend, error)
- func (s *SQLHistoryStore) ListByOwner(ctx context.Context, ownerID, tenantID string, page PageQuery) ([]*HistoryExtend, int64, error)
- func (s *SQLHistoryStore) Save(ctx context.Context, h *HistoryExtend) error
- func (s *SQLHistoryStore) UpdateFinishTime(ctx context.Context, taskID, ownerID string, finishTime time.Time) error
- type SQLMessageStore
- func (s *SQLMessageStore) DeleteByBusinessID(ctx context.Context, businessID, tenantID string) error
- func (s *SQLMessageStore) DeleteByInstance(ctx context.Context, processInstanceID string) error
- func (s *SQLMessageStore) DeleteByProcessInstanceAndActivityIDs(ctx context.Context, processInstanceID string, stepCodes []string) error
- func (s *SQLMessageStore) DeleteByTaskID(ctx context.Context, taskID string) error
- func (s *SQLMessageStore) DeleteByTaskIDAndOwner(ctx context.Context, taskID, ownerID string) error
- func (s *SQLMessageStore) GetByTaskID(ctx context.Context, taskID string) (*MessageExtend, bool, error)
- func (s *SQLMessageStore) ListByBusinessID(ctx context.Context, businessID, tenantID string) ([]*MessageExtend, error)
- func (s *SQLMessageStore) ListByInstance(ctx context.Context, processInstanceID string) ([]*MessageExtend, error)
- func (s *SQLMessageStore) ListByOwner(ctx context.Context, ownerID, tenantID string, page PageQuery) ([]*MessageExtend, int64, error)
- func (s *SQLMessageStore) Save(ctx context.Context, msg *MessageExtend) error
- func (s *SQLMessageStore) SetPlanFinishTime(ctx context.Context, taskID string, planFinishTime *time.Time) error
- func (s *SQLMessageStore) UpdateDelay(ctx context.Context, taskID string, delayTime time.Time) error
- func (s *SQLMessageStore) UpdateRead(ctx context.Context, taskID, ownerID string, readTime time.Time) error
- type SQLModelMgmtStore
- func (s *SQLModelMgmtStore) DeleteByIDs(ctx context.Context, ids []string) error
- func (s *SQLModelMgmtStore) GetByCode(ctx context.Context, tenantID, modelCode string) (*ModelCategory, bool, error)
- func (s *SQLModelMgmtStore) GetByPK(ctx context.Context, id string) (*ModelCategory, bool, error)
- func (s *SQLModelMgmtStore) Insert(ctx context.Context, m *ModelCategory) error
- func (s *SQLModelMgmtStore) ListByTenant(ctx context.Context, tenantID string) ([]*ModelCategory, error)
- func (s *SQLModelMgmtStore) Update(ctx context.Context, m *ModelCategory) error
- func (s *SQLModelMgmtStore) UpdateLastDeployTime(ctx context.Context, id string, deployTime time.Time) error
- type SQLModelMgmtStoreSet
- type SQLNextStore
- func (s *SQLNextStore) DeleteByProcessInstance(ctx context.Context, processInstanceID string) error
- func (s *SQLNextStore) DeleteByProcessInstanceAndActivityIDs(ctx context.Context, processInstanceID string, nextActivityIDs []string) error
- func (s *SQLNextStore) DeleteForBackToStep(ctx context.Context, processInstanceID, nextActivityID string) error
- func (s *SQLNextStore) DeleteForResolve(ctx context.Context, ...) error
- func (s *SQLNextStore) DeleteForRollback(ctx context.Context, processInstanceID, preTaskID, keepActivityID string) error
- func (s *SQLNextStore) FindAssignSource(ctx context.Context, ...) (*NextActivity, bool, error)
- func (s *SQLNextStore) GetFirstUnusedByActivity(ctx context.Context, processInstanceID, nextActivityID string) (*NextActivity, bool, error)
- func (s *SQLNextStore) InsertDual(ctx context.Context, act *NextActivity) error
- func (s *SQLNextStore) LatestVersion(ctx context.Context, processInstanceID, nextActivityID string) (int, error)
- func (s *SQLNextStore) ListByPreTask(ctx context.Context, preTaskID string) ([]*NextActivity, error)
- func (s *SQLNextStore) ListByTaskID(ctx context.Context, taskID string) ([]*NextActivity, error)
- func (s *SQLNextStore) ListHisByInstance(ctx context.Context, processInstanceID string) ([]*NextActivity, error)
- func (s *SQLNextStore) ListHisByTaskID(ctx context.Context, taskID string) ([]*NextActivity, error)
- func (s *SQLNextStore) ListUnusedByInstance(ctx context.Context, processInstanceID string) ([]*NextActivity, error)
- func (s *SQLNextStore) ListUnusedByInstanceAndActivity(ctx context.Context, processInstanceID, nextActivityID string) ([]*NextActivity, error)
- func (s *SQLNextStore) ListUsedByInstance(ctx context.Context, processInstanceID string) ([]*NextActivity, error)
- func (s *SQLNextStore) MarkUsedAndWriteBack(ctx context.Context, ids []string, taskID string) error
- type SQLOperationStore
- func (s *SQLOperationStore) CountByInstance(ctx context.Context, processInstanceID string) (int, error)
- func (s *SQLOperationStore) LastTypeByInstance(ctx context.Context, processInstanceID string) (string, error)
- func (s *SQLOperationStore) ListByBusinessID(ctx context.Context, businessID string) ([]*OperationRecord, error)
- func (s *SQLOperationStore) ListByBusinessIDs(ctx context.Context, businessIDs []string) ([]*OperationRecord, error)
- func (s *SQLOperationStore) ListByInstance(ctx context.Context, processInstanceID string) ([]*OperationRecord, error)
- func (s *SQLOperationStore) ListByTask(ctx context.Context, taskID string) ([]*OperationRecord, error)
- func (s *SQLOperationStore) ListSignable(ctx context.Context, businessIDs []string) ([]*OperationRecord, error)
- func (s *SQLOperationStore) Save(ctx context.Context, r *OperationRecord) error
- type SQLRemindStore
- func (s *SQLRemindStore) Get(ctx context.Context, id string) (*Remind, bool, error)
- func (s *SQLRemindStore) ListActive(ctx context.Context) ([]*Remind, error)
- func (s *SQLRemindStore) ListByModel(ctx context.Context, modelID string) ([]*Remind, error)
- func (s *SQLRemindStore) ListNotSent(ctx context.Context) ([]*Remind, error)
- func (s *SQLRemindStore) MarkDeleted(ctx context.Context, id string) error
- func (s *SQLRemindStore) MarkDeletedByIDs(ctx context.Context, ids []string) error
- func (s *SQLRemindStore) MarkSent(ctx context.Context, id string) error
- func (s *SQLRemindStore) Save(ctx context.Context, remind *Remind) error
- type SQLRemindTargetStore
- func (s *SQLRemindTargetStore) DeleteByRemind(ctx context.Context, remindID string) error
- func (s *SQLRemindTargetStore) ListByRemind(ctx context.Context, remindID string) ([]*RemindTarget, error)
- func (s *SQLRemindTargetStore) MarkSent(ctx context.Context, id string) error
- func (s *SQLRemindTargetStore) Save(ctx context.Context, target *RemindTarget) error
- func (s *SQLRemindTargetStore) UpdateRetryCount(ctx context.Context, id string, count int) error
- type SQLReviewStores
- type SQLReviewTaskStore
- func (s *SQLReviewTaskStore) CountUnread(ctx context.Context, reviewer, tenantID string) (int64, error)
- func (s *SQLReviewTaskStore) DeleteByInstance(ctx context.Context, processInstanceID string) error
- func (s *SQLReviewTaskStore) Get(ctx context.Context, id string) (*ReviewTask, bool, error)
- func (s *SQLReviewTaskStore) Insert(ctx context.Context, rt *ReviewTask) error
- func (s *SQLReviewTaskStore) ListByInstance(ctx context.Context, processInstanceID string) ([]*ReviewTask, error)
- func (s *SQLReviewTaskStore) ListByReviewer(ctx context.Context, reviewer, tenantID string, page PageQuery) ([]*ReviewTask, int64, error)
- func (s *SQLReviewTaskStore) Update(ctx context.Context, rt *ReviewTask) error
- type SQLStepDesignStore
- func (s *SQLStepDesignStore) DeleteByIDs(ctx context.Context, ids []string) error
- func (s *SQLStepDesignStore) GetByModelAndCode(ctx context.Context, modelID, stepCode string) (*StepDesign, bool, error)
- func (s *SQLStepDesignStore) GetByPK(ctx context.Context, id string) (*StepDesign, bool, error)
- func (s *SQLStepDesignStore) Insert(ctx context.Context, d *StepDesign) error
- func (s *SQLStepDesignStore) ListByModel(ctx context.Context, modelID string) ([]*StepDesign, error)
- func (s *SQLStepDesignStore) Update(ctx context.Context, d *StepDesign) error
- type SQLStepStore
- type SQLStoreSet
- type SQLTaskDelegateStore
- func (s *SQLTaskDelegateStore) Delete(ctx context.Context, id string) error
- func (s *SQLTaskDelegateStore) Get(ctx context.Context, id string) (*DelegateRule, bool, error)
- func (s *SQLTaskDelegateStore) ListByConsigner(ctx context.Context, consignerID, tenantID string) ([]*DelegateRule, error)
- func (s *SQLTaskDelegateStore) ListByOwner(ctx context.Context, ownerID, tenantID string) ([]*DelegateRule, error)
- func (s *SQLTaskDelegateStore) Save(ctx context.Context, rule *DelegateRule) error
- func (s *SQLTaskDelegateStore) UpdateState(ctx context.Context, id string, enable, retire int) error
- type SQLTaskExceptionStore
- func (s *SQLTaskExceptionStore) Get(ctx context.Context, id string) (*TaskException, bool, error)
- func (s *SQLTaskExceptionStore) ListByInstance(ctx context.Context, processInstanceID string) ([]*TaskException, error)
- func (s *SQLTaskExceptionStore) ListByTask(ctx context.Context, taskID string) ([]*TaskException, error)
- func (s *SQLTaskExceptionStore) ListByTypeAndInstances(ctx context.Context, exceptionType string, instanceIDs []string) ([]*TaskException, error)
- func (s *SQLTaskExceptionStore) ListUnhandled(ctx context.Context) ([]*TaskException, error)
- func (s *SQLTaskExceptionStore) MarkHandled(ctx context.Context, ids []string, status int) error
- func (s *SQLTaskExceptionStore) Save(ctx context.Context, e *TaskException) error
- type SQLTemplateStore
- func (s *SQLTemplateStore) DeleteByIDs(ctx context.Context, ids []string) error
- func (s *SQLTemplateStore) GetByPK(ctx context.Context, id string) (*TemplateDef, bool, error)
- func (s *SQLTemplateStore) Insert(ctx context.Context, t *TemplateDef) error
- func (s *SQLTemplateStore) ListByCategory(ctx context.Context, categoryID string) ([]*TemplateDef, error)
- func (s *SQLTemplateStore) ListByTenant(ctx context.Context, tenantID string) ([]*TemplateDef, error)
- func (s *SQLTemplateStore) Update(ctx context.Context, t *TemplateDef) error
- type ScheduleRuleProvider
- type Scheduler
- func (s *Scheduler) AutoCompleteTick(ctx context.Context) error
- func (s *Scheduler) RemindScanTick(ctx context.Context) error
- func (s *Scheduler) Start(ctx context.Context)
- func (s *Scheduler) Stop()
- func (s *Scheduler) TimeoutRemindTick(ctx context.Context) error
- func (s *Scheduler) ZombieScanTick(ctx context.Context) error
- type SchedulerConfig
- type SecretGenerator
- type Service
- func (s *Service) ActivateProcessInstances(ctx context.Context, processInstanceIDs []string, operator string) (R, error)
- func (s *Service) AddDelegateTask(ctx context.Context, rule *DelegateRule) (R, error)
- func (s *Service) AddExecution(ctx context.Context, req AddSignRequest) (R, error)
- func (s *Service) AddModelCategory(ctx context.Context, m *ModelCategory) (R, error)
- func (s *Service) AddMultiInstanceMember(ctx context.Context, processInstanceID, activityID, assignee string) (R, error)
- func (s *Service) AddRemind(ctx context.Context, req RemindSaveRequest) (R, error)
- func (s *Service) AddStepDesign(ctx context.Context, d *StepDesign) (R, error)
- func (s *Service) AddTemplateDef(ctx context.Context, t *TemplateDef) (R, error)
- func (s *Service) BackTask(ctx context.Context, vo *BackTaskVo) (R, error)
- func (s *Service) BackToStepTask(ctx context.Context, vo *BackTaskVo) (R, error)
- func (s *Service) ClaimTask(ctx context.Context, taskID, userID string) (R, error)
- func (s *Service) Complete(ctx context.Context, vo *CompleteTaskVo) (R, error)
- func (s *Service) CompleteReviewTask(ctx context.Context, reviewTaskID, opinion, operator string) (R, error)
- func (s *Service) CompleteSign(ctx context.Context, taskID string, countersignResult int) (R, error)
- func (s *Service) CompleteToTargetActivity(ctx context.Context, vo *CompleteTaskVo) (R, error)
- func (s *Service) CopyProcess(ctx context.Context, sourceModelID string, targetModelIDs []string) (R, error)
- func (s *Service) CountUnreadReviews(ctx context.Context, reviewer, tenantID string) (R, error)
- func (s *Service) CreateProcessModel(ctx context.Context, tenantID, name, modelCode, xml string) (R, error)
- func (s *Service) DelExecution(ctx context.Context, req DelSignRequest) (R, error)
- func (s *Service) DelegateTask(ctx context.Context, taskID, userID string) (R, error)
- func (s *Service) DeleteCountersignWeights(ctx context.Context, processDefinitionKey, activityID, tenantID string) (R, error)
- func (s *Service) DeleteDelegateTask(ctx context.Context, id string) (R, error)
- func (s *Service) DeleteModelCategory(ctx context.Context, ids []string) (R, error)
- func (s *Service) DeleteRemind(ctx context.Context, id string) (R, error)
- func (s *Service) DeleteStepDesign(ctx context.Context, ids []string) (R, error)
- func (s *Service) DeleteTemplateDef(ctx context.Context, ids []string) (R, error)
- func (s *Service) DeployModel(ctx context.Context, tenantID, modelID string) (R, error)
- func (s *Service) DisableDelegateTask(ctx context.Context, id string) (R, error)
- func (s *Service) DoActivateProcessInstance(ctx context.Context, processInstanceID, operator string) (R, error)
- func (s *Service) DoAddComment(ctx context.Context, taskID, userID, processInstanceID, typ, msg string) (R, error)
- func (s *Service) DoDeleteProcessByBusinessID(ctx context.Context, tenantID, businessKey, operator string) (R, error)
- func (s *Service) DoDeleteProcessInstance(ctx context.Context, processInstanceID, operator, reason string) (R, error)
- func (s *Service) DoMoveActivity(ctx context.Context, processInstanceID, fromActivityID, toActivityID string) (R, error)
- func (s *Service) DoMoveExecution(ctx context.Context, processInstanceID, toActivityID string) (R, error)
- func (s *Service) DoReactivateProcess(ctx context.Context, ...) (R, error)
- func (s *Service) DoResetProcess(ctx context.Context, processInstanceID, operator string) (R, error)
- func (s *Service) DoRollbackTask(ctx context.Context, processInstanceID, taskID, operator string) (R, error)
- func (s *Service) DoStopProcessInstance(ctx context.Context, processInstanceID, operator, message string) (R, error)
- func (s *Service) DoStopTaskByTaskID(ctx context.Context, taskID, operator string) (R, error)
- func (s *Service) DoSuspendProcessInstance(ctx context.Context, processInstanceID, operator string) (R, error)
- func (s *Service) DoTaskOwnerAdjustment(ctx context.Context, ...) (R, error)
- func (s *Service) DoTaskOwnerAdjustmentByID(ctx context.Context, taskID, toOwner, operator string) (R, error)
- func (s *Service) EditDelegateTask(ctx context.Context, rule *DelegateRule) (R, error)
- func (s *Service) EditModelCategory(ctx context.Context, m *ModelCategory) (R, error)
- func (s *Service) EditRemind(ctx context.Context, req RemindSaveRequest) (R, error)
- func (s *Service) EditStepDesign(ctx context.Context, d *StepDesign) (R, error)
- func (s *Service) EditTemplateDef(ctx context.Context, t *TemplateDef) (R, error)
- func (s *Service) EnableDelegateTask(ctx context.Context, id string) (R, error)
- func (s *Service) Engine() api.Engine
- func (s *Service) GetBackNodes(ctx context.Context, taskID string) (R, error)
- func (s *Service) GetDefinitionXML(ctx context.Context, definitionID string) (R, error)
- func (s *Service) GetDoneTaskListByIdentityID(ctx context.Context, identityID string, query PageQuery) (R, error)
- func (s *Service) GetFlowHighlight(ctx context.Context, processInstanceID string) (R, error)
- func (s *Service) GetFlowHighlightByTask(ctx context.Context, taskID string) (R, error)
- func (s *Service) GetIdentityTree(ctx context.Context) (R, error)
- func (s *Service) GetModelAndStepPage(ctx context.Context, tenantID string) (R, error)
- func (s *Service) GetModelCategoryByCode(ctx context.Context, tenantID, modelCode string) (R, error)
- func (s *Service) GetModelCategoryByID(ctx context.Context, id string) (R, error)
- func (s *Service) GetModelCategoryTree(ctx context.Context, tenantID string) (R, error)
- func (s *Service) GetModelXML(ctx context.Context, modelID string) (R, error)
- func (s *Service) GetNextUserTaskAndUserList(ctx context.Context, taskID string) (R, error)
- func (s *Service) GetNextUserTaskAndUserListByKey(ctx context.Context, tenantID, processDefinitionKey, businessKey string, ...) (R, error)
- func (s *Service) GetOperationButtons(ctx context.Context, processInstanceID string) (R, error)
- func (s *Service) GetProcessGlobalVariableByBusinessID(ctx context.Context, tenantID, businessKey string, names []string) (R, error)
- func (s *Service) GetProcessGlobalVariableByProcessInstanceID(ctx context.Context, processInstanceID string, names []string) (R, error)
- func (s *Service) GetProcessInstancePageList(ctx context.Context, query PageQuery) (R, error)
- func (s *Service) GetRemind(ctx context.Context, id string) (R, error)
- func (s *Service) GetRemindPageList(ctx context.Context, modelID string, query PageQuery) (R, error)
- func (s *Service) GetReviewTask(ctx context.Context, reviewTaskID string) (R, error)
- func (s *Service) GetStepDesign(ctx context.Context, id string) (R, error)
- func (s *Service) GetTaskHistoryListByBusinessID(ctx context.Context, tenantID, businessKey string) (R, error)
- func (s *Service) GetTaskHistoryListByProcessInstanceID(ctx context.Context, processInstanceID string) (R, error)
- func (s *Service) GetTaskHistoryListByTaskID(ctx context.Context, taskID string) (R, error)
- func (s *Service) GetTaskInfoByTaskID(ctx context.Context, taskID string) (R, error)
- func (s *Service) GetTaskMessageListByBusinessID(ctx context.Context, tenantID, businessKey string) (R, error)
- func (s *Service) GetTodoTaskListByIdentityID(ctx context.Context, identityID string, query PageQuery) (R, error)
- func (s *Service) GetUserTaskMetas(ctx context.Context, definitionID string) (R, error)
- func (s *Service) GetWorkflowStatusByBusinessID(ctx context.Context, tenantID, processDefinitionKey, businessKey string) (R, error)
- func (s *Service) HandleTaskExceptions(ctx context.Context, ids []string, handled bool) (R, error)
- func (s *Service) IsExistRunningProcess(ctx context.Context, tenantID, processDefinitionKey, businessKey string) (R, error)
- func (s *Service) IsMultiInstanceLastPerson(ctx context.Context, taskID string) (R, error)
- func (s *Service) IsProcessDeployed(ctx context.Context, tenantID, processDefinitionKey string) (R, error)
- func (s *Service) ListActExtends(ctx context.Context, definitionKey, activityID string) (R, error)
- func (s *Service) ListCountersignWeights(ctx context.Context, processDefinitionKey, activityID, tenantID string) (R, error)
- func (s *Service) ListDelegateTask(ctx context.Context, ownerID, tenantID string) (R, error)
- func (s *Service) ListHisSteps(ctx context.Context, deploymentID string) (R, error)
- func (s *Service) ListModelCategory(ctx context.Context, tenantID string) (R, error)
- func (s *Service) ListReviewTasksByInstance(ctx context.Context, processInstanceID string) (R, error)
- func (s *Service) ListReviewTasksByReviewer(ctx context.Context, reviewer, tenantID string, query PageQuery) (R, error)
- func (s *Service) ListStepDesignByModel(ctx context.Context, modelID string) (R, error)
- func (s *Service) ListTaskExceptions(ctx context.Context, processInstanceID string) (R, error)
- func (s *Service) ListTemplateDefs(ctx context.Context, tenantID string) (R, error)
- func (s *Service) Options() Options
- func (s *Service) RegisterBusinessCallbackHook(ctx context.Context) error
- func (s *Service) RegisterCountersignRuntime(ctx context.Context) error
- func (s *Service) RegisterExecutorRewriteHook(ctx context.Context) error
- func (s *Service) RemoveMultiInstanceMember(ctx context.Context, ...) (R, error)
- func (s *Service) ResolveTask(ctx context.Context, taskID, userID string) (R, error)
- func (s *Service) ResolveTaskWithVariables(ctx context.Context, taskID, userID string, variables map[string]any) (R, error)
- func (s *Service) RetireDelegateTask(ctx context.Context, id string) (R, error)
- func (s *Service) RewarmBusinessCallbackDefinition(ctx context.Context, definitionID string) error
- func (s *Service) RewarmCountersignDefinition(ctx context.Context, definitionID string) error
- func (s *Service) RewarmExecutorRewriteDefinition(ctx context.Context, definitionID string) error
- func (s *Service) SaveActExtend(ctx context.Context, ext *ActExtend) (R, error)
- func (s *Service) SaveAgreeNextActivity(ctx context.Context, req *NextActivityRequest) (R, error)
- func (s *Service) SaveCountersignWeights(ctx context.Context, processDefinitionKey, activityID, tenantID string, ...) (R, error)
- func (s *Service) SaveModelXML(ctx context.Context, modelID, xml string) (R, error)
- func (s *Service) StartProcess(ctx context.Context, vo *StartProcessInstanceVo) (R, error)
- func (s *Service) StartProcessAndFirstStep(ctx context.Context, vo *StartProcessInstanceVo) (R, error)
- func (s *Service) StartSchedulers(ctx context.Context)
- func (s *Service) StopSchedulers()
- func (s *Service) SuspendProcessInstances(ctx context.Context, processInstanceIDs []string, operator string) (R, error)
- func (s *Service) SyncReviewForTask(ctx context.Context, task *api.Task, senderID, senderName string) (R, error)
- func (s *Service) TriggerDelegateScan(ctx context.Context) (R, error)
- func (s *Service) UpdateModelFromDefinition(ctx context.Context, tenantID, definitionID string) (R, error)
- func (s *Service) UpdateProcessGlobalVariable(ctx context.Context, processInstanceID string, variables map[string]any) (R, error)
- func (s *Service) UpdateWorkflowDocumentByProcessInstanceIDOrTaskID(ctx context.Context, processInstanceID, taskID string, document map[string]any) (R, error)
- type SimulateOption
- type SimulateService
- type StartProcessInstanceVo
- type StartResult
- type StartService
- type StepDesign
- type StepDesignService
- func (s *StepDesignService) Add(ctx context.Context, d *StepDesign) (*StepDesign, error)
- func (s *StepDesignService) Delete(ctx context.Context, ids ...string) error
- func (s *StepDesignService) Edit(ctx context.Context, d *StepDesign) (*StepDesign, error)
- func (s *StepDesignService) GetByID(ctx context.Context, id string) (*StepDesign, bool, error)
- func (s *StepDesignService) ListByModel(ctx context.Context, modelID string) ([]*StepDesign, error)
- type StepDesignStore
- type StepResolver
- type StepRule
- type StepRuleProvider
- type StepRuleService
- func (s *StepRuleService) AllowReturn(ctx context.Context, deploymentID, activityID string) (bool, error)
- func (s *StepRuleService) BackStepCodes(ctx context.Context, deploymentID, activityID string) ([]string, error)
- func (s *StepRuleService) PercentReturnRule(ctx context.Context, taskID string) (*PercentReturnRule, bool, error)
- func (s *StepRuleService) ReturnPercentOf(ctx context.Context, deploymentID, activityID string) (*float64, bool, error)
- func (s *StepRuleService) SortOf(ctx context.Context, deploymentID, activityID string) (int, error)
- func (s *StepRuleService) StepNameOf(ctx context.Context, deploymentID, activityID string) (string, error)
- type StepStore
- type TaskCallback
- type TaskCommentEngine
- type TaskDelegateStore
- type TaskException
- type TaskExceptionStore
- type TaskHistoryQuery
- type TaskInfoView
- type TemplateDef
- type TemplateService
- func (s *TemplateService) Add(ctx context.Context, t *TemplateDef) (*TemplateDef, error)
- func (s *TemplateService) Delete(ctx context.Context, ids ...string) error
- func (s *TemplateService) Edit(ctx context.Context, t *TemplateDef) (*TemplateDef, error)
- func (s *TemplateService) List(ctx context.Context, tenantID string) ([]*TemplateDef, error)
- func (s *TemplateService) ListByCategory(ctx context.Context, categoryID string) ([]*TemplateDef, error)
- type TemplateStore
- type TerminateOption
- type TerminateService
- func (s *TerminateService) Activate(ctx context.Context, processInstanceID, operator string) error
- func (s *TerminateService) DeleteByBusinessID(ctx context.Context, tenantID, businessKey, operator string) error
- func (s *TerminateService) DeleteInstance(ctx context.Context, processInstanceID, operator, reason string) error
- func (s *TerminateService) Reactivate(ctx context.Context, ...) error
- func (s *TerminateService) StopByInstance(ctx context.Context, processInstanceID, operator, message string) error
- func (s *TerminateService) StopByTask(ctx context.Context, taskID, operator string) error
- func (s *TerminateService) Suspend(ctx context.Context, processInstanceID, operator string) error
- type TodoSource
- type TodoTaskView
- type TransferTaskRequest
- type UserQuery
- type UserTaskMeta
Constants ¶
const ( // AttrBusinessCallback 节点级业务回调开关属性(值为 "true" 时触发回调)。 AttrBusinessCallback = "businessCallback" // AttrBusinessCallbackParams 回调报文 params 字段的原始扩展属性串("k:v;k:v")。 AttrBusinessCallbackParams = "businessCallbackParams" )
业务回调在 BPMN 节点上的扩展属性键(对位调研 006 §3 报文约定)。
const ( // CallbackKindTask 任务级回调(BusinessCallTaskListener 语义)。 CallbackKindTask = "task" // CallbackKindExecution 执行级回调(BusinessCallExecutionListener 语义)。 CallbackKindExecution = "execution" )
回调类别常量(异常记录与日志区分任务级/执行级)。
const ( // ListenerCountersignCollectionConfig 普通会签集合配置监听器(weightType=average 节点)。 ListenerCountersignCollectionConfig = "countersignCollectionConfig" // ListenerCountersignByWeight 权重会签配置监听器(weightType=custom 节点)。 ListenerCountersignByWeight = "countersignByWeight" )
会签执行监听器注册名(BPMN flowable:executionListener class 值, 对位 Java CountersignCollectionConfigExecutionListener/CountersignByWeightExecutionListener 的注册约定)。
const ( // ConsignTypeAll 全部委托(不限定项目/流程分类)。 ConsignTypeAll = "All" // ConsignTypeSingleProject 单项目委托。 ConsignTypeSingleProject = "SingleProject" // ConsignTypeMultiProject 多项目委托。 ConsignTypeMultiProject = "MultiProject" // ConsignTypeAllProject 全部项目委托(协议保留值,命中不参与)。 ConsignTypeAllProject = "AllProject" // ConsignTypeSingleFlowCategory 单流程分类委托。 ConsignTypeSingleFlowCategory = "SingleFlowCategory" // ConsignTypeMultiFlowCategory 多流程分类委托。 ConsignTypeMultiFlowCategory = "MultiFlowCategory" // ConsignTypeAllFlowCategory 全部流程分类委托(协议保留值,命中不参与)。 ConsignTypeAllFlowCategory = "AllFlowCategory" )
委托范围类型常量(对位 Java WorkflowTaskDelegateEntity.CONSIGNTYPE_*)。
const ( // ConditionProjectPrefix 项目条件前缀(condition 列取值如 "@ProjId='p1,p2'")。 ConditionProjectPrefix = "@ProjId" // ConditionFlowCategoryPrefix 流程分类条件前缀(condition 列取值如 "@FlowCategory='m1'")。 ConditionFlowCategoryPrefix = "@FlowCategory" )
委托条件串前缀(对位 Java CONDITION_PROJECT_PREFIX / CONDITION_FLOWCATEGORY_PREFIX)。
const ( // DelegateEnabled 启用。 DelegateEnabled = 1 // DelegateDisabled 停用。 DelegateDisabled = 0 // DelegateRetired 退休( retirement=1 时同时停用,Java Retire 语义)。 DelegateRetired = 1 )
委托规则启用/退休标记取值。
const ( // DictCodeMessageType 消息渠道(催办/提醒发送渠道)。 DictCodeMessageType = "messageType" // DictCodeEnable 启用状态。 DictCodeEnable = "enable" // DictCodeVisible 可见性。 DictCodeVisible = "visible" // DictCodeConsignType 委托类型(值与 Java WorkflowTaskDelegateEntity.CONSIGNTYPE_* 一致)。 DictCodeConsignType = "consignType" // DictCodeEntrustCondition 委托条件(值即条件串前缀,见 006 §5 硬约定)。 DictCodeEntrustCondition = "entrustCondition" // DictCodeExceptionType 异常类型(值与 Java WorkflowTaskExceptionEntity.EXCEPTION_TYPE_* 一致)。 DictCodeExceptionType = "exceptionType" // DictCodeTargetType 提醒目标类型。 DictCodeTargetType = "targetType" // DictCodeRemindType 提醒类型。 DictCodeRemindType = "remindType" // DictCodeTaskType 任务类型(BPMN 任务形态)。 DictCodeTaskType = "taskType" // DictCodeFlowStatus 流程状态。 DictCodeFlowStatus = "flowStatus" // DictCodeHandleStatus 异常处理状态(workflow_task_exception.handle_status)。 DictCodeHandleStatus = "handleStatus" )
字典码常量(管理台所需码表名,与 dict_data.go 的 staticDicts 键一一对应)。
const ( // FlowStatusNotSubmitted 未提交:发起后尚未产生第一条办结记录(操作记录数 <=1)。 FlowStatusNotSubmitted = "未提交" // FlowStatusRunning 流转中:存在待办且未命中结束/终止/签收条件。 FlowStatusRunning = "流转中" // FlowStatusFinished 已完成:实例结束或待办步骤代号命中签收类保留代号。 FlowStatusFinished = "已完成" // FlowStatusTerminated 已终止:最后一条操作记录类型为 LCZZ(流程终止)。 FlowStatusTerminated = "已终止" // FlowStatusUnknown 未知状态:业务键下找不到任何实例(防御分支,Java 同名语义)。 FlowStatusUnknown = "未知状态" )
document flow_status 状态值常量(对齐 Java WorkflowDocumentServiceImpl 的硬编码中文状态, 线上协议即中文字符串,勿改为英文代号)。
const ( // ExceptionTypeBusiness 业务异常(Java BusinessException 等价)。 ExceptionTypeBusiness = "BusinessException" // ExceptionTypeFlowable 工作流异常(Java FlowableException 等价)。 ExceptionTypeFlowable = "FlowableException" // ExceptionTypeRuntime 其他运行时异常(Java RuntimeException 等价兜底)。 ExceptionTypeRuntime = "RuntimeException" // ExceptionTypeNotTaskMessage 未生成待办异常(僵尸流程监控专用)。 ExceptionTypeNotTaskMessage = "NotTaskMessageException" )
异常类型常量(对位 Java WorkflowTaskExceptionEntity.EXCEPTION_TYPE_*,docs 002 §3.12)。
const ( // ExceptionUnhandled 未处理。 ExceptionUnhandled = 0 // ExceptionHandled 已处理(处理与忽略共用已处理终态)。 ExceptionHandled = 1 )
异常处理状态常量(Go 侧新增 handle_status 列,docs 003 §1 索引)。
const ( // IdentityNodeRoot 虚拟根节点。 IdentityNodeRoot = "root" // IdentityNodeGroup 组节点。 IdentityNodeGroup = "group" // IdentityNodeRole 角色节点。 IdentityNodeRole = "role" // IdentityNodeUser 用户节点。 IdentityNodeUser = "user" // IdentityNodeResource 资源节点。 IdentityNodeResource = "resource" )
身份树节点类型常量。
const ( // InstanceStatusRunning 运行中(含未提交/流转中)。 InstanceStatusRunning = 0 // InstanceStatusFinished 已完成(实例已结束且最后操作非终止)。 InstanceStatusFinished = 1 // InstanceStatusTerminated 已终止(最后一条操作记录为 LCZZ)。 InstanceStatusTerminated = 2 )
实例列表状态代号(对位调研 005 §1.1 instance/list 的状态字段约定)。
const ( // RemindExecutorCurrentHandler 当前待办人占位(-1111)。 RemindExecutorCurrentHandler = "-1111" // RemindExecutorInitiator 发起人占位(${initiator},展开取流程变量 initiator)。 RemindExecutorInitiator = "${initiator}" )
催办对象执行者特殊取值(docs 003 §3.18:executor_id 支持 ${initiator} 占位与 -1111=当前待办人)。
const ( // RemindTypeAhead 预警型(提前量 ahead)。 RemindTypeAhead = 1 // RemindTypeDelay 延时型(延迟量 delay)。 RemindTypeDelay = 2 // RemindTargetTypeUser 用户对象。 RemindTargetTypeUser = 1 // RemindTargetTypeRole 角色对象(静态展开组成员)。 RemindTargetTypeRole = 2 )
催办类型与对象类型常量(对位 Java WorkflowRemindTargetEntity.TYPE_AHEAD/TYPE_DELAY)。
const ( // RemindKindAhead 预警提醒。 RemindKindAhead = "预警提醒" // RemindKindDelay 延迟提醒。 RemindKindDelay = "延迟提醒" // RemindKindManual 手动催办。 RemindKindManual = "手动催办" // RemindKindTimeout 任务超时提醒(调度器超时提醒共用文案)。 RemindKindTimeout = "任务超时提醒" )
催办命中类别文案(对位 Java ReminderSchedule 的 messageType 参数)。
const ( // ActOwnerTypePerson 人员绑定:owner_value 即审阅人身份 Id,直接使用。 ActOwnerTypePerson = "person" // ActOwnerTypeOrg 组织绑定:owner_value 为组织/组 Id,经身份服务展开成员。 ActOwnerTypeOrg = "org" // ActOwnerTypeRole 角色绑定:owner_value 为角色 Id,经身份服务展开成员。 ActOwnerTypeRole = "role" )
审阅人绑定的 owner_type 常量(003 文档 §workflow_act_extend:person/org/role)。
const ( // ReviewStatusPending 待审阅:影子任务已生成,审阅人尚未办结。 ReviewStatusPending = 0 // ReviewStatusDone 已办结:审阅人已完成审阅并回写意见。 ReviewStatusDone = 1 // ReviewStatusUnresolved 待解析:org/role 展开失败,reviewer 保留原组/角色值,需业务系统二次解析。 ReviewStatusUnresolved = 2 )
审阅影子任务状态常量(status 列;0/1 对齐 Java 线上语义,2 为 Go 侧扩展)。
const ( // AutoCompleteInterval 自动办结扫描周期:5 分钟(Java cron "0 */5 * * * ?")。 AutoCompleteInterval = 5 * time.Minute // RemindScanInterval 催办扫描周期:30 秒(Java fixedDelay=30000)。 RemindScanInterval = 30 * time.Second // ZombieScanInterval 僵尸监控周期:5 分钟(Java fixedDelay=1000*60*5)。 ZombieScanInterval = 5 * time.Minute // TimeoutRemindHour 超时提醒每日触发时刻:8 点(Java cron "0 0 8 * * ?")。 TimeoutRemindHour = 8 )
调度周期常量(对位 Java @Scheduled 注解取值)。
const ( CommentTypeSP = "SP" // 审批 CommentTypeSQ = "SQ" // 授权 CommentTypeTH = "TH" // 退回 CommentTypeCFTG = "CFTG" // 重复跳过 CommentTypeCH = "CH" // 撤回 CommentTypeXT = "XT" // 协同 CommentTypeZC = "ZC" // 暂存 CommentTypeLCZZ = "LCZZ" // 流程终止 CommentTypeQS = "QS" // 签收 CommentTypeLCCZ = "LCCZ" // 流程重置 CommentTypeWP = "WP" // 委派 CommentTypeLCZT = "LCZT" // 流程暂停 CommentTypeZH = "ZH" // 知会 CommentTypeLCJH = "LCJH" // 流程激活 CommentTypeZY = "ZY" // 转阅 CommentTypeLCSC = "LCSC" // 流程删除 CommentTypeYY = "YY" // 已阅 CommentTypeBZJH = "BZJH" // 步骤激活 CommentTypeZB = "ZB" // 转办 CommentTypePS = "PS" // 评审 CommentTypeQJQ = "QJQ" // 前加签 CommentTypeTZ = "TZ" // 跳转 CommentTypeHJQ = "HJQ" // 后加签 CommentTypeTJ = "TJ" // 提交 CommentTypeXTZX = "XTZX" // 系统执行 CommentTypeCXTJ = "CXTJ" // 重新提交 CommentTypeSPJS = "SPJS" // 审批结束 )
意见类型 CommentTypeEnum 代码常量(对位 Java enm/CommentTypeEnum.java)。 注:006 规格标题写"26 种",但其 §2 表格逐行列出 27 个代码;为不破坏线上协议, 这里按表格全集收录,多余的代码不影响既有调用方。P1 需对照 Java 枚举源码复核。
const ( // StepCodeEnd 流程结束代号,用户不可见不可选;直送目标为 end 时跳过预存。 StepCodeEnd = "end" // StepCodeSign 签收步骤代号:出现在待办时 document 置"已完成"。 StepCodeSign = "Sign" // StepCodeSign1 签收步骤代号变体 1。 StepCodeSign1 = "Sign1" // StepCodeSign2 签收步骤代号变体 2。 StepCodeSign2 = "Sign2" // StepCodeEngineerSign 工程师签收步骤代号。 StepCodeEngineerSign = "EngineerSign" // StepCodeDraft 草稿节点代号:taskKey 为 Draft 时 document 记流程开始时间。 StepCodeDraft = "Draft" )
保留步骤代号常量(006 §5 内置保留值与硬约定)。
const ( // VarInitiator 发起人身份 Id;发起时注入 =operator,BPMN 中 ${initiator} 即发起人节点。 VarInitiator = "initiator" // VarBusinessKey 业务单据 ID;发起时注入(与引擎 businessKey 冗余存储)。 VarBusinessKey = "businessKey" // VarTitle 实例标题;发起时注入并同步 setProcessInstanceName。 VarTitle = "title" // VarProcessDefinitionKey 流程定义 Key;发起时注入。 VarProcessDefinitionKey = "processDefinitionKey" // VarRemark 备注;发起时注入。 VarRemark = "remark" // VarEntity 业务表单数据(Map 型),驱动条件连线求值与动态角色。 VarEntity = "entity" // VarTableName 业务表名(document.document_table)。 VarTableName = "tableName" // VarOperationType 运行时操作类型;执行人重写门控(只有两种合法值触发回填)。 VarOperationType = "operationType" // VarExecutorList 会签集合变量(countersignCollectionConfig 写入)。 VarExecutorList = "executorList" // VarExecutor 单人执行表达式变量(子流程/会签、撤回策略用)。 VarExecutor = "executor" // VarNrOfInstances 多实例循环总次数(countersignCollectionConfig 强制写入)。 VarNrOfInstances = "nrOfInstances" // VarCountersignPass 会签通过计数(初始化 0,比例退回时累计)。 VarCountersignPass = "countersignPass" // VarCountersignReturn 会签退回计数(初始化 0,比例退回时累计)。 VarCountersignReturn = "countersignReturn" // VarTotalWeight 权重会签累计权重(办结时按 Arith 累计)。 VarTotalWeight = "totalWeight" // VarWeightThreshold 权重会签通过阈值。 VarWeightThreshold = "weightThreshold" // VarCountersignByWeight 权重会签开关标记。 VarCountersignByWeight = "countersignByWeight" // VarCustomExecutorList 业务方指定会签人集合(优先级最高)。 VarCustomExecutorList = "customExecutorList" // VarRandomSort 会签人随机排序开关。 VarRandomSort = "randomSort" // VarSkipExpressionEnabled Flowable 官方跳过表达式开关(配合 skipExpression 自动跳过节点)。 VarSkipExpressionEnabled = "_FLOWABLE_SKIP_EXPRESSION_ENABLED" // VarRollbackAssigneePrefix 撤回后目标执行人变量前缀: // 完整变量名 = 前缀 + {procInstId}{taskKey}(RollbackEventListener 读取)。 VarRollbackAssigneePrefix = "ROLLBACK_ASSIGNEE_PREFIX_" // VarRollbackTaskTypePrefix 撤回策略类名变量前缀: // 完整变量名 = 前缀 + {procInstId}{taskKey}。 VarRollbackTaskTypePrefix = "ROLLBACK_TASK_TYPE_PREFIX_" // VarNrOfActiveInstances 多实例当前活跃数(Flowable 内置,撤回策略手工修正)。 VarNrOfActiveInstances = "nrOfActiveInstances" // VarNrOfCompletedInstances 多实例已完成数(Flowable 内置,撤回策略手工修正)。 VarNrOfCompletedInstances = "nrOfCompletedInstances" // VarLoopCounter 多实例循环下标(Flowable 内置,撤回策略手工修正)。 VarLoopCounter = "loopCounter" // VarPass 会签演示模板通过标记(仅演示语料 countersign.xml)。 VarPass = "pass" // VarResult 会签演示模板结论标记(仅演示语料 countersign.xml)。 VarResult = "result" // VarSignList 会签演示模板集合变量(仅演示语料 countersign.xml)。 VarSignList = "signList" // VarSigner 会签演示模板元素变量(仅演示语料 countersign.xml)。 VarSigner = "signer" )
流程变量 key 常量(006 §1 变量 key 全集,线上协议逐字兼容)。
const ( // OperationTypeAgreeComplete 办结写入的合法操作类型:同意办结(执行人重写门控)。 OperationTypeAgreeComplete = "agreeComplete" // OperationTypeCompleteToTarget 办结写入的合法操作类型:直送目标节点(执行人重写门控)。 OperationTypeCompleteToTarget = "completeToTarget" // FlowSubmitterName 发起人节点显示名(FLOW_SUBMITTER)。 FlowSubmitterName = "提交人" // AddSignScopeAfter 后加签 scopeType(AFTER_ADDSIGN)。 AddSignScopeAfter = "after" // AddSignScopeBefore 前加签 scopeType(BEFORE_ADDSIGN)。 AddSignScopeBefore = "before" // SpecialGatewayBeginSuffix 并行网关成对虚拟节点开始后缀。 SpecialGatewayBeginSuffix = "_begin" // SpecialGatewayEndSuffix 并行网关成对虚拟节点结束后缀。 SpecialGatewayEndSuffix = "_end" // SuspensionStateValue 挂起状态值(SUSPENSION_STATE)。 SuspensionStateValue = 2 // ActivateStateValue 激活状态值(ACTIVATE_STATE)。 ActivateStateValue = 1 )
操作类型与其他协议常量(对位 Java constants/FlowConstant.java 与 ProcessesUtil)。
const ( // AutoCompleteAgreeMessage 自动办结同意文案。 AutoCompleteAgreeMessage = "同意(自动办结)" // AutoCompleteReturnMessage 自动办结退回文案。 AutoCompleteReturnMessage = "退回(自动办结)" )
自动办结固定审批文案(006 §2,意见类型 SP/TH)。
const SimEndActivityID = "end"
SimEndActivityID 是"办结"伪节点的保留代号(对位 Java next() 的 end 内置节点: his_step 添加步骤时禁止用户使用该代号)。
const SimEndActivityName = "办结"
SimEndActivityName 是"办结"伪节点的展示名。
Variables ¶
var CommentTypeEnumMsgs = map[string]string{ CommentTypeSP: "审批", CommentTypeSQ: "授权", CommentTypeTH: "退回", CommentTypeCFTG: "重复跳过", CommentTypeCH: "撤回", CommentTypeXT: "协同", CommentTypeZC: "暂存", CommentTypeLCZZ: "流程终止", CommentTypeQS: "签收", CommentTypeLCCZ: "流程重置", CommentTypeWP: "委派", CommentTypeLCZT: "流程暂停", CommentTypeZH: "知会", CommentTypeLCJH: "流程激活", CommentTypeZY: "转阅", CommentTypeLCSC: "流程删除", CommentTypeYY: "已阅", CommentTypeBZJH: "步骤激活", CommentTypeZB: "转办", CommentTypePS: "评审", CommentTypeQJQ: "前加签", CommentTypeTZ: "跳转", CommentTypeHJQ: "后加签", CommentTypeTJ: "提交", CommentTypeXTZX: "系统执行", CommentTypeCXTJ: "重新提交", CommentTypeSPJS: "审批结束", }
CommentTypeEnumMsgs 是意见类型代码到中文名称的映射(协议字典,调用方只读勿改)。
Functions ¶
func ClassifyException ¶
ClassifyException 按错误值判定异常类型(对位 Java ProcessesExceptionAspect:109-125 的 instanceof 链):api.Error 的请求参数类错误视作业务异常;错误链含 flowable 标记或引擎 内部错误码视作工作流异常;其余为运行时异常。 @param err 原始错误 @return 异常类型常量
func DefaultIDGen ¶
func DefaultIDGen() func() string
DefaultIDGen 返回默认 ID 生成函数(UUIDv7,时间有序)。 @return ID 生成函数
func FormatParams ¶
FormatParams 将键值映射序列化为 "k:v;k:v" 格式(按键名升序保证确定性)。 @param params 键值映射 @return 序列化串(空映射返回空串)
func GetEnumMsgByType ¶
GetEnumMsgByType 返回意见类型的中文名称。 @param commentType 意见类型代码(如 SP/TH/CH) @return 中文名称,未知代码返回空串
func GetExtendColumns ¶
func GetExtendColumns() []string
GetExtendColumns 返回扩展列的列名全集(与 DDL 顺序一致,供行转换使用)。 @return 扩展列名列表
func IsDraftStep ¶
IsDraftStep 判断步骤代号是否为草稿节点代号(Draft)。 @param stepCode 步骤代号 @return 是否草稿代号
func IsSignStep ¶
IsSignStep 判断步骤代号是否为签收类保留代号(Sign/Sign1/Sign2/EngineerSign)。 @param stepCode 步骤代号 @return 是否签收步骤
func ParseParams ¶
ParseParams 解析 "k:v;k:v" 格式的 BPMN 扩展属性串。 无冒号的分段跳过(Java 版会数组越界,此处容错);值中再含冒号时保留全部剩余内容(比 Java split[1] 更忠实)。 @param params 原始串(如 "name:张三;age:1;sex:男") @return 键值映射(空串返回空映射)
func SimulateViewString ¶
func SimulateViewString(view NextUserTaskView) string
SimulateViewString 推演视图的调试摘要(节点[执行人])。 @param view 推演视图 @return 摘要文本
func ValidateCountersignConfigWith ¶
func ValidateCountersignConfigWith(ctx context.Context, meta *ModelMetaService, definitionID string) error
ValidateCountersignConfigWith 部署强校验(显式注入模型元数据服务,供复用既有服务实例)。 @param ctx 操作上下文 @param meta 模型元数据服务 @param definitionID 流程定义 ID @return 错误(首个不合规节点)
func ValidateProcessIDMatch ¶
ValidateProcessIDMatch 校验流程 id 与预期流程 Key 一致(对位 Java checkCountersignListenerConfig 的导入校验段:id 为空报"流程定义key为空",不一致报"导入流程与当前流程不匹配,请检查后重试。")。 @param process 流程模型 @param expectedKey 预期流程定义 Key @return 错误
Types ¶
type ActExtend ¶
type ActExtend struct {
BaseColumns // 公共审计列
ActivityID string // BPMN 节点 ID(userTask id)
ActivityName string // 节点名称(设计器展示名)
ProcessDefinitionKey string // 流程定义 Key
OwnerType string // 审阅人类型:person/org/role(ActOwnerType* 常量)
OwnerValue string // 审阅人值:身份 Id / 组织 Id / 角色 Id
StepID string // 关联设计步骤 Id(→workflow_step.id,可空)
}
ActExtend 是 workflow_act_extend(活动扩展,审阅人绑定)的领域实体: 按(流程定义 Key + BPMN 节点 ID)配置审阅人,运行期任务到达节点时据此生成审阅影子任务。
type ActExtendStore ¶
type ActExtendStore interface {
// GetByDefinitionKeyAndActivity 按流程定义 Key 与 BPMN 节点 ID 查询绑定(运行期审阅人读取入口)。
GetByDefinitionKeyAndActivity(ctx context.Context, definitionKey, activityID string) ([]*ActExtend, error)
// ListByDefinitionKey 查询流程定义 Key 下全部绑定(设计器配置读取入口)。
ListByDefinitionKey(ctx context.Context, definitionKey string) ([]*ActExtend, error)
// Save 保存一条绑定(id 由调用方生成)。
Save(ctx context.Context, ext *ActExtend) error
// Delete 按主键删除绑定。
Delete(ctx context.Context, id string) error
}
ActExtendStore 是审阅人绑定(活动扩展)的存储端口。
type AddSignRequest ¶
type AddSignRequest = api.AddSignRequest // 前后加签请求(对位 Java AddSignTaskVo)
协议 DTO 归属 api 包(门面契约引用),此处保留包内别名以维持既有引用不变。
type AddSignResult ¶
type AddSignResult struct {
ParentTaskID string // 父任务 Id(首层加签 = 当前任务 Id)
SubTaskIDs []string // 新建被加签人子任务 Id 列表
PlaceholderTaskID string // 首层加签时为加签人创建并立即办结的占位子任务 Id
CommentType string // 意见类型代码(QJQ 前加签 / HJQ 后加签)
}
AddSignResult 是加签结果。
type AddSignService ¶
type AddSignService struct {
// contains filtered or unexported fields
}
AddSignService 是加签/减签域服务(P3-A)。 对位 Java ProcessesServiceImpl#addSignTask:311 / #createSignSubTasks:352 / ProcessesUtil#createSubTask:4351。 子任务全部完成后的父任务联动(resolve/后加签办结)由 complete.go handleParentTaskAfterComplete 在办结链路实现,本服务只负责加签侧改造(父任务须保持 PENDING 委派态以匹配该联动的 Resolve 语义)。
func NewAddSignService ¶
func NewAddSignService(engine api.Engine, comments *CommentService, operations *OperationRecordService, messages *MessageExtendService, histories *HistoryExtendService, c clock.Clock) *AddSignService
NewAddSignService 构造加签/减签域服务。 @param engine 引擎门面(七服务) @param comments 审批意见域服务 @param operations 操作记录域服务 @param messages 待办扩展域服务 @param histories 已办扩展域服务 @param c 时间源,nil 时回退真实时钟 @return 加签/减签域服务
func (*AddSignService) AddMultiInstanceMember ¶
func (s *AddSignService) AddMultiInstanceMember(ctx context.Context, processInstanceID, activityID, assignee string) error
AddMultiInstanceMember 多实例动态加签成员(workflow 侧): 维护 executorList 变量(追加成员)并同步 nrOfInstances;引擎端口注入时同时驱动 引擎侧实例创建(Go 引擎暂无原生 API,未注入仅变量维护)。 @param ctx 操作上下文 @param processInstanceID 流程实例 ID @param activityID 多实例活动 ID @param assignee 新成员身份 Id @return 错误
func (*AddSignService) AddSign ¶
func (s *AddSignService) AddSign(ctx context.Context, req AddSignRequest) (AddSignResult, error)
AddSign 前后加签(对位 Java addSignTask:311)。 首层加签(当前任务无父任务):当前任务改造为父任务(owner=操作人、assignee 置空、 扩展变量 countEnabled=true/scopeType,引擎侧再置 PENDING 委派态),为每个被加签人建子任务, 并为加签人自己建占位子任务立即办结(对位 Java 占位跑通链); 二层加签(当前任务已是子任务):新子任务挂到顶层父任务(与既有子任务平级),当前子任务立即办结。 收尾:候选人清理(加签人是父任务候选时移除)→ QJQ/HJQ 意见 → 操作记录 → 待办(新子任务生成, 父任务待办标记 consigner)。 @param ctx 操作上下文 @param req 加签请求 @return 加签结果 @return 错误
func (*AddSignService) DelSign ¶
func (s *AddSignService) DelSign(ctx context.Context, req DelSignRequest) (DelSignResult, error)
DelSign 减签(删除指定加签子任务;Java 无任务级减签对位源码,按加签逆操作定义)。 删除子任务 + QJQ/HJQ 意见 + 删待办/已办;剩余子任务为空时恢复父任务 (resolve 还原 assignee=owner),后加签作用域下父任务随之办结。 @param ctx 操作上下文 @param req 减签请求 @return 减签结果 @return 错误
func (*AddSignService) RemoveMultiInstanceMember ¶
func (s *AddSignService) RemoveMultiInstanceMember(ctx context.Context, processInstanceID, activityID, assignee, executionID string, completed bool) error
RemoveMultiInstanceMember 多实例动态减签成员(workflow 侧): 维护 executorList 变量(移除成员)并同步 nrOfInstances;引擎端口注入时同时驱动 引擎侧实例销毁(executionID 为被移除实例的执行 ID)。 @param ctx 操作上下文 @param processInstanceID 流程实例 ID @param activityID 多实例活动 ID @param assignee 待移除成员身份 Id @param executionID 被移除实例的执行 ID(引擎端口用,可空) @param completed 移除时是否视作已完成 @return 错误
func (*AddSignService) WithAddSignUsers ¶
func (s *AddSignService) WithAddSignUsers(users UserQuery) *AddSignService
WithAddSignUsers 注入身份查询(补待办姓名展示)。 @param users 身份查询 @return 加签/减签域服务(链式)
func (*AddSignService) WithMultiInstancePort ¶
func (s *AddSignService) WithMultiInstancePort(port MultiInstanceMemberPort) *AddSignService
WithMultiInstancePort 注入多实例动态成员引擎端口。 @param port 引擎端口 @return 加签/减签域服务(链式)
type AdjustOwnerRequest ¶
type AdjustOwnerRequest struct {
TaskID string // 任务 Id(必填)
CurrentOwnerID string // 当前处理人身份 Id(必填)
UserCode string // 操作人身份 Id(必填,留痕用)
OwnerIDs []string // 新处理人身份 Id 列表(必填,可多人)
KeepCurrentTask *bool // 是否保留原处理人的预存与待办(必填,nil 视为不保留)
}
AdjustOwnerRequest 是待办调整请求(对位 Java ProcessesUtil#doTaskOwnerAdjustment:5856 入参)。
type AutoCompleteBackExecutor ¶
type AutoCompleteBackExecutor interface {
// BackToStepTask 退回任务到指定步骤(对位 Java processesService.backToStepTask)。
// @param ctx 操作上下文
// @param vo 退回请求(TargetActivityID 必填)
// @return 错误
BackToStepTask(ctx context.Context, vo *api.BackTaskVo) error
}
AutoCompleteBackExecutor 是自动办结退回执行器端口(P2-B BackService 完成后由主控经适配器接线; nil 时退回型自动办结跳过并保持待办不变)。
type AutoCompleteRule ¶
type AutoCompleteRule struct {
AutoComplete int // 自动办结类型:0 无、1 同意、2 退回
TimeLimit *float64 // 时限数值(nil 未配置)
TimeUnit string // 时限单位(天/小时/分钟)
AllowReturn int // 允许退回:0/1(autoComplete=2 时需为 1)
BackStepCode string // 退回目标步骤代号(back_step_codes 首个,退回型自动办结用)
}
AutoCompleteRule 是自动办结步骤规则(his_step 规则字典投影)。
type BackNodeView ¶
type BackNodeView struct {
ActivityID string // 节点 ID(BPMN userTask id)
ActivityName string // 节点名称
TaskIDs []string // 该节点历史任务 ID 列表(多实例节点为全部实例任务)
AssigneeNames []string // 办理人列表(多实例节点收集全部历史办理人)
Sort int // 步骤排序号(his_step.sort,未配置为 0,仅作展示排序)
}
BackNodeView 是可退回节点视图(对位 Java FlowNodeVo 的退回场景字段子集)。
type BackOption ¶
type BackOption func(*BackService)
BackOption 是退回服务选项函数。
func WithBackModels ¶
func WithBackModels(models ModelStore) BackOption
WithBackModels 注入模型主数据端口(workflow_model.returnSort 读取)。 @param models 模型主数据端口 @return 选项
func WithBackUsers ¶
func WithBackUsers(users UserQuery) BackOption
WithBackUsers 注入身份查询(办理人姓名展示)。 @param users 身份查询 @return 选项
type BackService ¶
type BackService struct {
// contains filtered or unexported fields
}
BackService 是任意退回域服务(P2-B)。 行为规格对位 Java ProcessesUtil#generalBack:2557 / getBackNodesByTaskId:2673 / backTask:4502:五道过滤链计算可退节点 → 预存目标执行人 → allowReturn/暂停校验 → 引擎级任意退回(BackUserTaskCmd 对位)→ TH 意见/操作记录/预存清理/待办账本收尾。
func NewBackService ¶
func NewBackService(engine api.Engine, meta *ModelMetaService, next *NextActivityService, comments *CommentService, operations *OperationRecordService, messages *MessageExtendService, histories *HistoryExtendService, documents *DocumentService, steps *StepRuleService, instances InstanceQuery, c clock.Clock, options ...BackOption) *BackService
NewBackService 构造任意退回域服务。 @param engine 引擎门面(七服务) @param meta 模型元数据服务 @param next 下一步预生成域服务 @param comments 审批意见域服务 @param operations 操作记录域服务 @param messages 待办扩展域服务 @param histories 已办扩展域服务 @param documents 业务表单状态域服务 @param steps 步骤规则服务(his_step 端口) @param instances 实例查询(挂起校验) @param c 时间源,nil 时回退真实时钟 @param options 可选配置(模型主数据端口、身份查询) @return 退回域服务
func (*BackService) BackNodes ¶
func (s *BackService) BackNodes(ctx context.Context, taskID string) ([]BackNodeView, error)
BackNodes 计算当前任务的可退回节点列表(五道过滤链): ①hisStep allowReturn=="0" → 空列表;②数据源=引擎已完成历史活动实例; ③过滤 userTask/非当前节点/按节点聚合;④祖先链(his_next_activity preTaskId 链, ModelStore 未注入时跳过);⑤backStepCodes 白名单;⑥可达性(经引擎 BPMN 模型)。 多实例节点收集全部历史办理人;结果按步骤排序号升序。 @param ctx 操作上下文 @param taskID 当前任务 ID @return 可退回节点列表(任务不存在或步骤禁止退回时为空列表) @return 错误
func (*BackService) BackToPrevious ¶
func (s *BackService) BackToPrevious(ctx context.Context, req BackTaskVo) error
BackToPrevious 退回任务到上一节点(对位 Java backTask:4502 的简化退回,Go 按入线自动定位): 取当前节点唯一入线的 sourceRef 直迁;多入线(网关/汇聚后)报错,仅支持串行流程。 收尾做最小账本闭合:TH 意见 + 当前任务待办清理 + 已办完成时间 + 重生成待办 (Java backTask 仅写意见后直接执行命令,Go 补齐待办账本一致性,避免死待办)。 @param ctx 操作上下文 @param req 退回请求(TaskID/UserCode 必填) @return 错误
func (*BackService) BackToStep ¶
func (s *BackService) BackToStep(ctx context.Context, req BackTaskVo, targetActivityID string) error
BackToStep 退回任务到指定步骤(对位 Java generalBack): 目标执行人预存(saveBackToStepNext 对位)→ allowReturn 校验 → 暂停拒绝 → 引擎级任意退回 → TH 意见 + 操作记录(isAgree=0) → 预存清理(目标之后节点)→ 待办清理(目标及之后节点 + 当前任务)→ 已办完成时间 → 按实例重新生成待办。 Go 协议适配:BackTaskVo 无 request 字段,目标执行人取该节点历史办理人 (与 BackNodes 的办理人展示同源);意见为空时跳过意见写入(引擎拒绝空评论)。 @param ctx 操作上下文 @param req 退回请求(TaskID/UserCode 必填) @param targetActivityID 退回目标节点 ID(必填) @return 错误
type BaseColumns ¶
type BaseColumns struct {
ID string // 主键
Creator string // 创建人身份 Id
CreatorName string // 创建人姓名
CreateTime time.Time // 创建时间
Updater string // 更新人身份 Id
UpdateTime time.Time // 更新时间
TenantID string // 租户 = 业务系统代号 systemSymbol
}
BaseColumns 是 workflow_* 表的公共审计列(003 文档 §2): id varchar(64) 主键由调用方(internal/idgen)生成传入; create_time/update_time 由仓储统一填充,调用方显式提供时尊重原值。
type BaseProcessVo ¶
type BaseProcessVo = api.BaseProcessVo
BaseProcessVo 办结类操作基础请求(任务/操作人/意见/实例/意见类型)。
type BusinessCallbackHook ¶
type BusinessCallbackHook struct {
// contains filtered or unexported fields
}
BusinessCallbackHook 是任务创建时的业务回调全局钩子(TASK_CREATED)。 016 号审计:CallbackClient 此前实现完整但生产代码零调用点,文档 007:53 承诺 "P1.2 在 TASK_CREATED 等钩子内组包并调用"从未落地,D5 回调能力实际不生效。
实现约束:钩子在引擎命令内同步执行且持有引擎互斥写锁,HTTP 回调绝不允许在锁内发起, 因此组包在钩子内完成、实际发送经 ctl.Defer 延迟到命令提交并释放锁后执行。 回调失败只记录日志与异常表(经 CallbackClient 的 ExceptionRecorder),不影响流程推进, 与 Java isFailOnException 语义一致。
func NewBusinessCallbackHook ¶
func NewBusinessCallbackHook(meta *ModelMetaService, client *CallbackClient) *BusinessCallbackHook
NewBusinessCallbackHook 创建业务回调钩子。 @param meta 模型元数据服务 @param client 业务回调 client(nil 时钩子为空操作) @return 回调钩子
func (*BusinessCallbackHook) Hook ¶
func (h *BusinessCallbackHook) Hook(ctx context.Context, task *api.Task, ctl api.HookControl) error
Hook 业务回调钩子主体(api.TaskHook 签名)。 节点未声明回调属性时直接返回;声明时组包并经 ctl.Defer 延迟发送。 @param ctx 命令上下文(与所在引擎命令共用,命令失败整体回滚且不执行延迟动作) @param task 任务快照 @param ctl 钩子控制 @return 错误(始终返回 nil:回调失败不影响流程推进)
func (*BusinessCallbackHook) Register ¶
func (h *BusinessCallbackHook) Register(eng api.Engine)
Register 将业务回调钩子注册到引擎任务创建事件(TASK_CREATED)。 与执行人重写钩子同为全局任务钩子:注册后所有用户任务创建命令都会同步执行 Hook。 client 未装配(未接入业务系统注册存储)时为空操作。 @param eng 引擎门面
type BusinessSystem ¶
type BusinessSystem struct {
ID string // 主键(internal/idgen 生成)
SystemSymbol string // 系统代号(唯一,= 流程租户 tenantId)
SystemName string // 系统名称
TaskCallAddr string // 任务回调地址(BusinessCallTaskListener 目标,空则跳过回调)
ExecutionCallAddr string // 执行回调地址(BusinessCallExecutionListener 目标,空则跳过回调)
Secret string // 回调签名密钥(注册时自动生成,可注入)
TenantID string // 租户(惯例与系统代号一致,独立存储便于按租户检索)
Creator string // 创建人
CreatorName string // 创建人姓名
CreateTime time.Time // 创建时间
Updater string // 更新人
UpdateTime time.Time // 更新时间
}
BusinessSystem 是业务系统注册信息(对位 Java auth BusinessSystemEntity,按 Flowtide DDL 裁剪)。
type BusinessSystemOption ¶
type BusinessSystemOption func(*BusinessSystemOptions)
BusinessSystemOption 是服务选项函数。
func WithBusinessSystemIDs ¶
func WithBusinessSystemIDs(generator idgen.Generator) BusinessSystemOption
WithBusinessSystemIDs 注入 ID 生成器。 @param generator ID 生成器 @return 选项
func WithBusinessSystemNow ¶
func WithBusinessSystemNow(now func() time.Time) BusinessSystemOption
WithBusinessSystemNow 注入时间源。 @param now 时间源 @return 选项
func WithBusinessSystemSecrets ¶
func WithBusinessSystemSecrets(generator SecretGenerator) BusinessSystemOption
WithBusinessSystemSecrets 注入密钥生成器。 @param generator 密钥生成器 @return 选项
type BusinessSystemOptions ¶
type BusinessSystemOptions struct {
IDs idgen.Generator // ID 生成器(默认 UUIDv7)
Secrets SecretGenerator // 密钥生成器(默认 16 字节随机数 hex)
Now func() time.Time // 时间源(默认 time.Now,测试可注入固定时间)
}
BusinessSystemOptions 是业务系统注册服务的可注入依赖。
type BusinessSystemService ¶
type BusinessSystemService struct {
// contains filtered or unexported fields
}
BusinessSystemService 是业务系统注册门面服务(对位 Java BusinessSystemService 的注册/维护能力)。
func NewBusinessSystemService ¶
func NewBusinessSystemService(store BusinessSystemStore, options ...BusinessSystemOption) *BusinessSystemService
NewBusinessSystemService 创建业务系统注册服务。 @param store 存储端口 @param options 可选依赖(ID/密钥/时间源注入) @return 服务实例
func (*BusinessSystemService) Get ¶
func (s *BusinessSystemService) Get(ctx context.Context, symbol string) (*BusinessSystem, error)
Get 按系统代号查询注册信息。 @param ctx 操作上下文 @param symbol 系统代号 @return 注册信息 @return 不存在/查询错误
func (*BusinessSystemService) List ¶
func (s *BusinessSystemService) List(ctx context.Context) ([]BusinessSystem, error)
List 返回全部注册信息(按系统代号升序)。 @param ctx 操作上下文 @return 注册列表 @return 查询错误
func (*BusinessSystemService) Register ¶
func (s *BusinessSystemService) Register(ctx context.Context, input *BusinessSystem) (*BusinessSystem, error)
Register 注册新业务系统:system_symbol 唯一校验,自动生成 ID 与密钥。 @param ctx 操作上下文 @param input 注册入参(SystemSymbol/SystemName/回调地址/TenantID/Creator 必要,Secret 可预先指定否则自动生成) @return 注册成功后的完整信息 @return 代号为空/已注册/密钥生成/存储错误
func (*BusinessSystemService) Remove ¶
func (s *BusinessSystemService) Remove(ctx context.Context, symbol string) error
Remove 注销业务系统。 @param ctx 操作上下文 @param symbol 系统代号 @return 不存在/删除错误
func (*BusinessSystemService) Update ¶
func (s *BusinessSystemService) Update(ctx context.Context, input *BusinessSystem) (*BusinessSystem, error)
Update 更新注册信息(按系统代号定位,仅覆盖传入的非空业务列;代号本身不可改)。 @param ctx 操作上下文 @param input 更新入参(SystemSymbol 定位必填;SystemName/回调地址/Secret 为空表示不修改) @return 更新后的完整信息 @return 不存在/存储错误
type BusinessSystemStore ¶
type BusinessSystemStore interface {
// Save 保存注册信息(按 SystemSymbol 幂等 upsert:不存在则新增,存在则覆盖业务列)。
// @param ctx 操作上下文
// @param system 注册信息(新增时 ID 必须非空,由调用方生成)
// @return 保存错误
Save(ctx context.Context, system *BusinessSystem) error
// GetBySymbol 按系统代号查询。
// @param ctx 操作上下文
// @param symbol 系统代号
// @return 注册信息
// @return 是否存在
// @return 查询错误
GetBySymbol(ctx context.Context, symbol string) (*BusinessSystem, bool, error)
// GetByTenant 按租户查询(回调时 tenantId → 注册信息的查询键)。
// @param ctx 操作上下文
// @param tenantID 租户
// @return 注册信息
// @return 是否存在
// @return 查询错误
GetByTenant(ctx context.Context, tenantID string) (*BusinessSystem, bool, error)
// List 返回全部注册信息(按系统代号升序)。
// @param ctx 操作上下文
// @return 注册列表
// @return 查询错误
List(ctx context.Context) ([]BusinessSystem, error)
// Delete 按系统代号删除注册。
// @param ctx 操作上下文
// @param symbol 系统代号
// @return 删除错误(不存在时返回 not found 错误)
Delete(ctx context.Context, symbol string) error
}
BusinessSystemStore 是业务系统注册的存储端口(内存实现供单测/嵌入式,SQL 适配器走 workflow_business_system 表)。
type CallbackClient ¶
type CallbackClient struct {
// contains filtered or unexported fields
}
CallbackClient 是业务回调 client:查注册表 → 空地址/查无跳过 → POST → 失败指数退避重试 → 记录异常。
func NewCallbackClient ¶
func NewCallbackClient(store BusinessSystemStore, options ...CallbackOption) *CallbackClient
NewCallbackClient 创建业务回调 client。 @param store 业务系统注册表端口 @param options 可选配置(HTTP 客户端/退避/睡眠/日志/记录器) @return 回调 client
func (*CallbackClient) SendExecutionCallback ¶
func (c *CallbackClient) SendExecutionCallback(ctx context.Context, callback *ExecutionCallback) error
SendExecutionCallback 发送执行级回调(报文无 taskId/taskName,与 Java 协议逐字一致)。 @param ctx 操作上下文 @param callback 回调报文 @return 注册表查错/重试耗尽错误;查无注册或地址为空时静默返回 nil(与 Java 一致)
func (*CallbackClient) SendTaskCallback ¶
func (c *CallbackClient) SendTaskCallback(ctx context.Context, callback *TaskCallback) error
SendTaskCallback 发送任务级回调(报文 JSON 字段与 Java 协议逐字一致)。 @param ctx 操作上下文 @param callback 回调报文 @return 注册表查错/重试耗尽错误;查无注册或地址为空时静默返回 nil(与 Java 一致)
type CallbackException ¶
type CallbackException struct {
Kind CallbackKind // 回调类别(task/execution)
TenantID string // 租户(系统代号)
Addr string // 回调目标地址
Payload string // 报文 JSON 原文
Attempts int // 总尝试次数
Cause error // 最终失败原因
OccurTime time.Time // 发生时间
}
CallbackException 是一次回调最终失败的记录(对位 workflow_task_exception 的回调来源字段)。
type CallbackExceptionRecorder ¶
type CallbackExceptionRecorder struct {
// contains filtered or unexported fields
}
CallbackExceptionRecorder 是异常服务到回调异常记录器端口的适配器 (P1-C CallbackClient 的 ExceptionRecorder 实现,装配:WithCallbackRecorder(NewCallbackExceptionRecorder(svc)))。
func NewCallbackExceptionRecorder ¶
func NewCallbackExceptionRecorder(service *ExceptionService) *CallbackExceptionRecorder
NewCallbackExceptionRecorder 创建回调异常记录适配器。 @param service 异常域服务 @return 记录适配器
func (*CallbackExceptionRecorder) RecordCallbackException ¶
func (r *CallbackExceptionRecorder) RecordCallbackException(ctx context.Context, exception *CallbackException) error
RecordCallbackException 记录一次回调失败(委托异常服务落库)。 @param ctx 操作上下文 @param exception 回调异常 @return 记录错误
type CallbackOption ¶
type CallbackOption func(*CallbackOptions)
CallbackOption 是回调 client 选项函数。
func WithCallbackBackoff ¶
func WithCallbackBackoff(intervals []time.Duration) CallbackOption
WithCallbackBackoff 注入重试退避间隔序列。 @param intervals 间隔序列(长度即重试次数;nil 视为不重试) @return 选项
func WithCallbackHTTP ¶
func WithCallbackHTTP(client *http.Client) CallbackOption
WithCallbackHTTP 注入自定义 HTTP 客户端。 @param client HTTP 客户端 @return 选项
func WithCallbackLogger ¶
func WithCallbackLogger(logger *log.Logger) CallbackOption
WithCallbackLogger 注入回调日志。 @param logger 日志 @return 选项
func WithCallbackRecorder ¶
func WithCallbackRecorder(recorder ExceptionRecorder) CallbackOption
WithCallbackRecorder 注入异常记录器。 @param recorder 异常记录器 @return 选项
func WithCallbackSleeper ¶
func WithCallbackSleeper(sleeper func(time.Duration)) CallbackOption
WithCallbackSleeper 注入退避睡眠函数(测试用假实现)。 @param sleeper 睡眠函数 @return 选项
type CallbackOptions ¶
type CallbackOptions struct {
HTTP *http.Client // HTTP 客户端(默认 10 秒超时)
Backoff []time.Duration // 重试退避间隔(默认 1s/2s/4s,D5 指数退避 3 次)
Sleeper func(time.Duration) // 退避睡眠函数(默认 time.Sleep,测试注入假实现消除真实延时)
Logger *log.Logger // 回调日志(默认 stderr)
Recorder ExceptionRecorder // 异常记录器(默认空实现)
}
CallbackOptions 是回调 client 的可注入配置。
type CategoryLookup ¶
type CategoryLookup interface {
// ResolveModelID 解析流程分类代号对应的模型 Id。
// @param ctx 操作上下文
// @param tenantID 租户
// @param flowCategoryCode 分类代号(=定义 Key)
// @return 模型 Id,未解析到返回空串
// @return 错误
ResolveModelID(ctx context.Context, tenantID, flowCategoryCode string) (string, error)
}
CategoryLookup 是流程分类代号解析端口(单分类委托命中时 model_code → workflow_model.id; nil 时按对象 Id 与代号直接相等匹配,适配嵌入模式 id==code 的部署)。
type ChannelProvider ¶
type ChannelProvider interface {
// ChannelsOf 返回待办步骤的通知渠道列表。
// @param ctx 操作上下文
// @param todo 待办扩展
// @return 渠道列表
// @return 错误
ChannelsOf(ctx context.Context, todo *MessageExtend) ([]string, error)
}
ChannelProvider 是催办渠道来源端口(P2-B steprules 的 his_step 渠道完成后由主控接线; 默认空实现返回空渠道)。
type CommentRequest ¶
type CommentRequest struct {
TaskID string // 任务 Id;为空表示流程级意见(AddProcessComment 等价)
ProcessInstanceID string // 流程实例 Id
UserID string // 操作人身份 Id
Message string // 意见内容(>3900 截断,见 AddHisCommentCmd 语义)
Type string // 意见类型 CommentTypeEnum 代码;空时默认 SP(Java 语义)
}
CommentRequest 是添加审批意见请求(对位 Java CommentVo → AddHisCommentCmd)。
type CommentService ¶
type CommentService struct {
// contains filtered or unexported fields
}
CommentService 是审批意见域服务。 行为规格对位 Java WorkflowCommentServiceImpl + AddHisCommentCmd: 任务级意见经引擎 TaskService.AddComment、流程级意见经 AddProcessComment 落 ACT_HI_COMMENT 等价存储;message 折叠空白并按 3900 截断。 说明:type 与 FULL_MSG_ 经 AddCommentDetail 透出(对位 Java AddHisCommentCmd), 办结/退回等动作链的意见类型台账仍同步写 workflow_operation_record.type。
func NewCommentService ¶
func NewCommentService(tasks TaskCommentEngine, history TaskHistoryQuery, users UserQuery) *CommentService
NewCommentService 创建审批意见域服务。 @param tasks 任务评论能力(engine.TaskService()) @param history 历史任务查询(engine.HistoryService()) @param users 身份查询(engine.IdentityService()) @return 域服务
func (*CommentService) Add ¶
func (s *CommentService) Add(ctx context.Context, req CommentRequest) (api.Comment, error)
Add 添加一条审批意见(任务级或流程级)。 @param ctx 操作上下文 @param req 意见请求(TaskID 为空表示流程级意见;Type 为空默认 SP) @return 引擎评论 @return 错误
func (*CommentService) ListByProcessInstance ¶
func (s *CommentService) ListByProcessInstance(ctx context.Context, processInstanceID string) ([]CommentView, error)
ListByProcessInstance 查询实例全部意见并补全展示字段: 任务名(联历史任务)、中文类型名(GetEnumMsgByType 映射)、操作人姓名(联身份库)—— 查不到一律给空(与 Java getFlowCommentVosByProcessInstanceId 行为一致)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 意见视图列表 @return 错误
type CommentView ¶
type CommentView struct {
api.Comment // 引擎评论原始字段
TaskName string // 任务名称(联历史任务,查不到为空)
TypeName string // 意见类型中文名(GetEnumMsgByType 映射,非枚举代码为空)
UserName string // 操作人姓名(联身份库,查不到为空)
}
CommentView 是意见查询视图:引擎评论 + 联查补全的展示字段。
type CompleteResult ¶
type CompleteResult struct {
NextTaskIDs []string // 办结后生成的待办任务 Id(委派分支为归还后的待办任务)
Finished bool // 流程是否已结束(运行表查不到或实例已结束)
}
CompleteResult 是办结结果:新落位的待办任务 ID 与流程是否已结束。
type CompleteService ¶
type CompleteService struct {
// contains filtered or unexported fields
}
CompleteService 是任务办结域服务(P1-E)。 行为规格对位 Java ProcessesUtil#complete:3897 / generalComplete:3979 / completeToTargetActivity:4550 / delegateTask:1793 / transferTask:1848 / resolveTask:1904: 校验链 → 下一步预存 → 权重会签累计 → 引擎办结(自由选路经引擎级迁移兜底)→ 委派 PENDING 分支(克隆子任务+归还+还原下一步)→ 加签父任务联动 → 收尾链(意见/操作记录/待办/已办/表单状态)。
func NewCompleteService ¶
func NewCompleteService(engine api.Engine, meta *ModelMetaService, next *NextActivityService, comments *CommentService, operations *OperationRecordService, messages *MessageExtendService, histories *HistoryExtendService, documents *DocumentService, completeTo CompleteToActivityStore, users UserQuery, c clock.Clock) *CompleteService
NewCompleteService 创建任务办结域服务。 @param engine 引擎门面(七服务) @param meta 模型元数据服务 @param next 下一步预生成域服务 @param comments 审批意见域服务 @param operations 操作记录域服务 @param messages 待办扩展域服务 @param histories 已办扩展域服务 @param documents 业务表单状态域服务 @param completeTo 直送记录存储端口(自由选路兜底轨迹) @param users 身份查询(engine.IdentityService()),nil 时姓名展示留空 @param c 时间源,nil 时回退真实时钟 @return 域服务
func (*CompleteService) Complete ¶
func (s *CompleteService) Complete(ctx context.Context, vo *api.CompleteTaskVo) (CompleteResult, error)
Complete 办结任务(对位 Java generalComplete 主链路)。 校验链(任务存在/操作人与意见非空/实例未挂起)→ 预存下一步(end 与委派任务跳过)→ 权重会签累计 → 引擎办结(operationType 注入触发执行人重写门控)→ 自由选路兜底迁移 → 委派 PENDING 分支 → 加签父任务联动 → 收尾链 → 返回新待办与结束标记。 @param ctx 操作上下文 @param vo 办结请求 @return 办结结果(新待办任务 Id 与流程是否结束) @return 错误
func (*CompleteService) DelegateTask ¶
func (s *CompleteService) DelegateTask(ctx context.Context, req *DelegateTaskRequest) error
DelegateTask 委派任务(对位 Java delegateTask:1793): 显式置 owner → 引擎 Delegate(PENDING)→ WP 意见 → 操作记录 → 删除委派节点预存记录(排除自环)→ 待办 consigner 字段更新。 @param ctx 操作上下文 @param req 委派请求 @return 错误
func (*CompleteService) ResolveTask ¶
func (s *CompleteService) ResolveTask(ctx context.Context, req *ResolveTaskRequest) error
ResolveTask 归还(处理委派,对位 Java resolveTask:1904): 引擎 Resolve(owner 还原 + DelegationState=RESOLVED)→ 意见 → 操作记录 → 待办还给 owner。 @param ctx 操作上下文 @param req 归还请求 @return 错误
func (*CompleteService) TransferTask ¶
func (s *CompleteService) TransferTask(ctx context.Context, req *TransferTaskRequest) error
TransferTask 转办任务(对位 Java transferTask:1848): setOwner + setAssignee → ZB 意见 → 操作记录 → 删预存记录(排除自环)→ 待办更新给接收人。 @param ctx 操作上下文 @param req 转办请求 @return 错误
type CompleteToActivity ¶
type CompleteToActivity struct {
BaseColumns // 公共审计列
FlowID string // 连线 Id(Java 内存改线时生成的随机连线 ID;Go 引擎级迁移不产生新连线,为空)
SourceActivityID string // 来源节点 ID(办结任务的 taskDefinitionKey)
TargetActivityID string // 目标节点 ID(自由选路指定的直送目标)
TaskID string // 办结任务 Id
ProcessInstanceID string // 流程实例 Id
}
CompleteToActivity 是 workflow_complete_to_activity(直送记录)的领域实体。 对位 Java WorkflowCompleteToActivityEntity:自由选路兜底迁移时落一条 "从当前节点强制提交到目标节点"的轨迹(flow_id 对应 Java 随机连线 ID,Go 迁移语义不产生新连线,保留空值)。
type CompleteToActivityStore ¶
type CompleteToActivityStore interface {
// Save 插入一条直送记录(id 由调用方生成)。
// @param ctx 操作上下文
// @param record 直送记录(必填 target/task/process_instance_id)
// @return 错误
Save(ctx context.Context, record *CompleteToActivity) error
// ListByProcessInstance 查询实例的直送记录(按创建时间升序)。
// @param ctx 操作上下文
// @param processInstanceID 流程实例 Id
// @return 记录列表
// @return 错误
ListByProcessInstance(ctx context.Context, processInstanceID string) ([]*CompleteToActivity, error)
// ListByTask 查询任务的直送记录。
// @param ctx 操作上下文
// @param taskID 任务 Id
// @return 记录列表
// @return 错误
ListByTask(ctx context.Context, taskID string) ([]*CompleteToActivity, error)
}
CompleteToActivityStore 是直送记录的存储端口(P1-E 新增,对位 Java workflowCompleteToActivityService)。
type CountersignOption ¶
type CountersignOption func(*CountersignService)
CountersignOption 是会签服务选项函数。
func WithCountersignMembers ¶
func WithCountersignMembers(members GroupMemberQuery) CountersignOption
WithCountersignMembers 注入组成员查询(org/role 执行者经身份服务展开)。 @param members 组成员查询 @return 选项
func WithCountersignNext ¶
func WithCountersignNext(next *NextActivityService) CountersignOption
WithCountersignNext 注入下一步预生成域服务(next_activity 执行者来源)。 @param next 下一步预生成域服务 @return 选项
func WithCountersignRules ¶
func WithCountersignRules(rules StepRuleProvider) CountersignOption
WithCountersignRules 注入比例退回规则端口(his_step 步骤规则)。 @param rules 规则端口 @return 选项
func WithCountersignWeights ¶
func WithCountersignWeights(store CountersignWeightStore) CountersignOption
WithCountersignWeights 注入权重存储(workflow_countersign_weight 表端口)。 @param store 权重存储 @return 选项
type CountersignService ¶
type CountersignService struct {
// contains filtered or unexported fields
}
CountersignService 是会签域服务(P3-A)。 对位 Java ProcessesUtil#countersignCollectionConfig:4829 / countersignByWeightParameterSet:4247 / getCountersignWeight:4291 / complete:3897 比例退回段: 集合配置监听器 + 权重监听器 + 比例退回累计判定。权重累计(totalWeight)的办结侧 实现在 complete.go accumulateCountersignWeight,本服务不重复。
func NewCountersignService ¶
func NewCountersignService(engine api.Engine, meta *ModelMetaService, options ...CountersignOption) *CountersignService
NewCountersignService 构造会签域服务。 @param engine 引擎门面(七服务) @param meta 模型元数据服务 @param options 可选配置(next_activity 来源、权重存储、组成员展开、时钟) @return 会签域服务
func (*CountersignService) CountersignPercentResult ¶
func (s *CountersignService) CountersignPercentResult(ctx context.Context, taskID string, countersignResult int) (bool, error)
CountersignPercentResult 会签比例退回累计与超线判定(供 complete 链调用)。 按会签结论累计 countersignPass/countersignReturn(0 退回 / 1 通过); 全部实例完成后计算退回率 countersignReturn/(pass+return) 与 returnPercent/100 比较 (shopspring/decimal 定点比较,修复 Java 两位小数格式化的四舍五入误判),超线返回 true。 @param ctx 操作上下文 @param taskID 任务 ID(当前会签实例任务) @param countersignResult 会签结论:0 否决退回 / 1 通过 @return 是否超过退回比例(需要触发比例退回) @return 错误
func (*CountersignService) ListNodeWeights ¶
func (s *CountersignService) ListNodeWeights(ctx context.Context, definitionID string, key CountersignWeightKey) ([]CountersignWeight, error)
ListNodeWeights 读取节点权重配置:权重存储优先,其次模型 weightList(ParseWeightList)。 @param ctx 操作上下文 @param definitionID 流程定义 ID(模型来源解析用) @param key 节点定位键(定义 Key + 节点 ID) @return 权重配置列表 @return 错误
func (*CountersignService) RegisterCountersignListeners ¶
func (s *CountersignService) RegisterCountersignListeners(eng api.Engine) error
RegisterCountersignListeners 注册会签执行监听器(对位 Java listener 包的两个 @Component)。 按 BPMN flowable:executionListener 的 class 名分发:countersignCollectionConfig(集合配置)与 countersignByWeight(权重配置)。引擎不支持扩展监听器注册时返回错误。 接线约定:部署新定义后必须调用 Warmup(或 WarmupAll)预热节点元数据缓存—— 监听器在引擎命令内同步执行,命令持有引擎互斥写锁,监听器内调用 GetBpmnModel 等引擎 公有 API 会重入死锁(与 executor_rewrite.go 同一约束),因此监听器只读预热缓存。 @param eng 引擎门面 @return 错误
func (*CountersignService) SaveNodeWeights ¶
func (s *CountersignService) SaveNodeWeights(ctx context.Context, key CountersignWeightKey, configs []CountersignWeight) error
SaveNodeWeights 保存节点权重配置(先删后插,对位 Java workflow_countersign_weight 写入口)。 @param ctx 操作上下文 @param key 节点定位键(定义 Key + 节点 ID) @param configs 权重配置列表 @return 错误
func (*CountersignService) ValidateCountersignConfig ¶
func (s *CountersignService) ValidateCountersignConfig(ctx context.Context, definitionID string) error
ValidateCountersignConfig 部署强校验:会签节点必须配置集合变量设置监听器(P3.6, 对位 Java ProcessesUtil#checkCountersignListenerConfig:316)。 凡配置了多实例(MultiInstance!=nil)的用户任务节点:
- weightType=average 需含开始执行监听器 countersignCollectionConfig(或 Java 全限定类名);
- weightType=custom 需含开始执行监听器 countersignByWeight(或 Java 全限定类名), 且 weightThreshold 非空(缺省报"未设置会签权重阈值");
- weightType 缺失按 Java 语义同样报未配置监听器(Java weightType=null 时命中标记不置位)。
@param ctx 操作上下文 @param definitionID 流程定义 ID @return 错误(首个不合规节点)
type CountersignWeight ¶
type CountersignWeight struct {
IdentityID string // 身份 Id
AgreeWeight float64 // 通过权重
RejectWeight float64 // 拒绝权重
}
CountersignWeight 是单身份的会签权重配置。
type CountersignWeightKey ¶
type CountersignWeightKey struct {
ProcessDefinitionKey string // 流程定义 Key
ActivityID string // 节点 ID
TenantID string // 租户,空表示不隔离
}
CountersignWeightKey 是权重配置定位键(对位 workflow_countersign_weight 唯一维度: 流程定义 Key + 节点 ID,租户可选隔离)。
type CountersignWeightStore ¶
type CountersignWeightStore interface {
// SaveByNode 先删后插保存节点权重配置(对位 Java 按 definitionKey+activityId 先删后插)。
// @param ctx 操作上下文
// @param key 节点定位键
// @param configs 权重配置列表
// @return 错误
SaveByNode(ctx context.Context, key CountersignWeightKey, configs []CountersignWeight) error
// ListByNode 查询节点权重配置。
// @param ctx 操作上下文
// @param key 节点定位键
// @return 权重配置列表(无记录返回空列表)
// @return 错误
ListByNode(ctx context.Context, key CountersignWeightKey) ([]CountersignWeight, error)
}
CountersignWeightStore 是会签权重存储端口(workflow_countersign_weight 表,/weight 接口数据用)。
type CreatedProcessModel ¶
type CreatedProcessModel struct {
EngineModelID string // 引擎模型 Id(model_id)
BusinessID string // 业务模型/分类主键(workflow_model.id)
ModelCode string // 模型代号(=流程定义 Key)
ModelName string // 模型名称
}
CreatedProcessModel 是设计器建模结果(引擎模型与业务模型绑定信息)。
type DefinitionQuery ¶
type DefinitionQuery interface {
// GetProcessDefinition 按 ID 查询流程定义。
GetProcessDefinition(ctx context.Context, id string) (api.ProcessDefinition, error)
}
DefinitionQuery 是流程定义查询能力(api.RepositoryService 子集)。
type DelSignRequest ¶
type DelSignRequest = api.DelSignRequest // 减签请求(对位加签的逆操作语义)
协议 DTO 归属 api 包(门面契约引用),此处保留包内别名以维持既有引用不变。
type DelSignResult ¶
type DelSignResult struct {
ParentResolved bool // 剩余子任务为空时父任务是否已恢复(resolve 还原 assignee=owner)
ParentFinished bool // 后加签且父任务已随之办结
CommentType string // 意见类型代码(QJQ/HJQ,与作用域对应)
}
DelSignResult 是减签结果。
type DelegateConsignObj ¶
type DelegateConsignObj struct {
ID string // 行主键(空时由存储生成)
DelegateID string // 委托规则 Id(主表外键)
OwnerType string // 对象类型(=主表委托范围:SingleProject/SingleFlowCategory…)
OwnerID string // 对象 Id(项目 Id 或 workflow_model.id)
OwnerName string // 对象名称
}
DelegateConsignObj 是 workflow_task_consign_obj(委托对象)的领域实体。
type DelegateConsigner ¶
type DelegateConsigner struct {
ID string // 行主键(空时由存储生成)
DelegateID string // 委托规则 Id(主表外键)
ConsignerID string // 被委托人身份 Id
ConsignerName string // 被委托人姓名
}
DelegateConsigner 是 workflow_task_consigners(被委托人)的领域实体。
type DelegateRule ¶
type DelegateRule struct {
BaseColumns // 公共审计列
ConsignType string // 委托范围(ConsignType* 常量)
OwnerID string // 委托人身份 Id
OwnerName string // 委托人姓名
Source string // 来源系统 Id
SourceCode string // 来源系统代号(= 租户,必填)
SourceName string // 来源系统名称
Type string // 类型(协议保留列)
Condition string // 条件串(保留字列,"@ProjId='...'" / "@FlowCategory='...'")
VaildFrom time.Time // 生效时间(保留 Java 拼写)
VaildTo time.Time // 失效时间(保留 Java 拼写)
Enable int // 启用:0 停用、1 启用
Retire int // 退休:0 正常、1 退休
Remark string // 备注
Consigners []DelegateConsigner // 被委托人(级联)
ConsignObjs []DelegateConsignObj // 委托对象(级联)
}
DelegateRule 是 workflow_task_delegate(委托规则主表)的领域实体, 级联携带被委托人与委托对象(三表模型)。
type DelegateRuleService ¶
type DelegateRuleService struct {
// contains filtered or unexported fields
}
DelegateRuleService 是规则型委托域服务:委托规则维护、命中判定与待办调整。
func NewDelegateRuleService ¶
func NewDelegateRuleService(store TaskDelegateStore, mirrors DelegateTaskMirrorStore, messages *MessageExtendService, next *NextActivityService, operations *OperationRecordService, engine api.Engine, users UserQuery, categories CategoryLookup, todos TodoSource, c clock.Clock) *DelegateRuleService
NewDelegateRuleService 创建规则型委托域服务。 @param store 委托规则三表存储 @param mirrors 委托镜像待办存储(可 nil,镜像功能降级跳过) @param messages 待办扩展服务(待办改派用,可 nil) @param next 下一步预生成服务(待办调整用,可 nil) @param operations 操作记录服务(WP 留痕用,可 nil) @param engine 引擎门面(任务 assignee 改写用,可 nil) @param users 身份查询(可 nil,姓名留空) @param categories 分类代号解析(可 nil,按 Id 直接匹配) @param todos 待办扫描数据源(可 nil,TriggerDelegateScan 停用) @param c 时间源,nil 时回退真实时钟 @return 域服务
func (*DelegateRuleService) Add ¶
func (s *DelegateRuleService) Add(ctx context.Context, rule *DelegateRule) error
Add 新增委托规则(对位 Java WorkflowTaskDelegateServiceImpl#add:58): 校验链(系统代号可选存在 / 委托人与时间必填 / 被委托人非空且非本人 / 时间重叠 / 禁止传递) → 生成 condition 串 → 级联保存(enable=1)。 @param ctx 操作上下文 @param rule 委托规则 @return 错误
func (*DelegateRuleService) AdjustTaskOwner ¶
func (s *DelegateRuleService) AdjustTaskOwner(ctx context.Context, req AdjustOwnerRequest) error
AdjustTaskOwner 待办调整(对位 Java doTaskOwnerAdjustment:5856): 校验 → 按 next_activity 的 taskId+identityId 复制新记录给多 owner(keepCurrentTask=false 删原记录) → 引擎任务 assignee 改写(首个新 owner,租户上下文取自任务)→ 待办重建 + 委托镜像 + WP 操作记录。 @param ctx 操作上下文 @param req 待办调整请求 @return 错误
func (*DelegateRuleService) ApplyOnTodoCreate ¶
func (s *DelegateRuleService) ApplyOnTodoCreate(ctx context.Context, msg *MessageExtend) (*MessageExtend, error)
ApplyOnTodoCreate 待办生成时的规则委托改派钩子(本阶段实现方法本体,接线挂到待办创建链由主控完成): 命中委托 → 待办 owner 改派为被委托人 + consigner 记录 + 委托镜像落库。 项目上下文取待办扩展列 extend_s1(Java 会签/委托场景约定列)。 @param ctx 操作上下文 @param msg 新生成的待办扩展(必填 OwnerID/FlowCategoryCode/TenantID) @return 改派后的待办(未命中或依赖缺失时原样返回) @return 错误
func (*DelegateRuleService) Disable ¶
func (s *DelegateRuleService) Disable(ctx context.Context, id string) error
Disable 停用委托规则。 @param ctx 操作上下文 @param id 委托规则 Id @return 错误
func (*DelegateRuleService) Enable ¶
func (s *DelegateRuleService) Enable(ctx context.Context, id string) error
Enable 启用委托规则。 @param ctx 操作上下文 @param id 委托规则 Id @return 错误
func (*DelegateRuleService) HitConsigner ¶
func (s *DelegateRuleService) HitConsigner(ctx context.Context, ownerID, tenantID, projectID, flowCategory string) (string, error)
HitConsigner 命中委托(对位 Java getTaskConsignerId:627): 优先级 单项目委托 > 单流程分类委托 > 全部委托,按当前时间过滤启用中的委托。 @param ctx 操作上下文 @param ownerID 待办处理人身份 Id(委托人) @param tenantID 租户(=source_code) @param projectID 项目 Id(可空) @param flowCategory 流程分类代号(可空) @return 命中的被委托人 Id,无命中返回空串 @return 错误
func (*DelegateRuleService) List ¶
func (s *DelegateRuleService) List(ctx context.Context, ownerID, tenantID string) ([]*DelegateRule, error)
List 查询委托人在指定租户下的全部规则(含停用,管理台列表用)。 @param ctx 操作上下文 @param ownerID 委托人 Id @param tenantID 租户 @return 规则列表 @return 错误
func (*DelegateRuleService) Remove ¶
func (s *DelegateRuleService) Remove(ctx context.Context, id string) error
Remove 删除委托规则(级联子表)。 @param ctx 操作上下文 @param id 委托规则 Id @return 错误
func (*DelegateRuleService) Retire ¶
func (s *DelegateRuleService) Retire(ctx context.Context, id string) error
Retire 退休委托规则(retire=1 且停用,Java Retire 语义)。 @param ctx 操作上下文 @param id 委托规则 Id @return 错误
func (*DelegateRuleService) TriggerScan ¶ added in v0.1.2
func (s *DelegateRuleService) TriggerScan(ctx context.Context) (*DelegateScanResult, error)
TriggerScan 扫描未委托的活跃待办并对命中规则执行改派。 对位 Java FlowableScheduleTask.scheduledDelegatedTask 批扫(@Scheduled 已注释停用)+ WorkflowTaskDelegateServiceImpl.scheduledDelegatedTask(entity) 单条链路: getDelegatedMessageList(consigner_id IS NULL)→ getTaskConsignerId 三级命中 → doTaskOwnerAdjustmentById(taskId, ownerId, [consignerId], false, 1)。 扫描范围为当前引擎实例(数据租户)内的活跃待办;单条失败记录后继续。 @param ctx 操作上下文 @return 扫描汇总 @return 错误(数据源未接入时返回,逐条改派失败不返回错误)
func (*DelegateRuleService) Update ¶
func (s *DelegateRuleService) Update(ctx context.Context, rule *DelegateRule) error
Update 更新委托规则(对位 Java updateEntity:199):存在性校验 + 复制可变字段 + 与 Add 同款校验链 → 重建 condition → 子表先删后增(存储 Save 内完成)。 @param ctx 操作上下文 @param rule 委托规则(必填 ID) @return 错误
type DelegateScanResult ¶ added in v0.1.2
type DelegateScanResult struct {
Scanned int // 扫描的未委托活跃待办条数
Adjusted int // 命中规则并完成改派的条数
Failed int // 改派失败条数(单条失败不阻断后续扫描,对位 Java 逐条 try-catch)
Errors []string // 失败明细(任务 Id + 错误信息)
}
DelegateScanResult 是委托扫描的执行汇总(TriggerDelegateScan 运维端点返回体)。
type DelegateTaskMirror ¶
type DelegateTaskMirror struct {
MessageExtend // 与待办扩展同构(整行复制)
EntrustID string // 被委托人 Id(多值逗号串)
EntrustName string // 被委托人姓名(多值逗号串)
}
DelegateTaskMirror 是 workflow_delegate_task(委托镜像待办)的领域实体: 待办整行复制 + 被委托人信息(docs 003 §3.8)。
type DelegateTaskMirrorStore ¶
type DelegateTaskMirrorStore interface {
// Save 插入一条委托镜像待办。
// @param ctx 操作上下文
// @param mirror 镜像待办(必填 TaskID/EntrustID)
// @return 错误
Save(ctx context.Context, mirror *DelegateTaskMirror) error
// ListByTaskID 查询任务的镜像待办列表。
// @param ctx 操作上下文
// @param taskID 任务 Id
// @return 镜像列表
// @return 错误
ListByTaskID(ctx context.Context, taskID string) ([]*DelegateTaskMirror, error)
// ListByEntrust 查询被委托人的镜像待办列表。
// @param ctx 操作上下文
// @param entrustID 被委托人 Id
// @return 镜像列表
// @return 错误
ListByEntrust(ctx context.Context, entrustID string) ([]*DelegateTaskMirror, error)
// DeleteByProcessInstance 删除实例下全部镜像待办(实例级联)。
// @param ctx 操作上下文
// @param processInstanceID 流程实例 Id
// @return 错误
DeleteByProcessInstance(ctx context.Context, processInstanceID string) error
}
DelegateTaskMirrorStore 是委托镜像待办的存储端口(workflow_delegate_task)。
type DelegateTaskRequest ¶
type DelegateTaskRequest struct {
TaskID string // 任务 Id(必填)
Owner string // 任务拥有者身份 Id(必填,委派后保留所有者)
DelegateID string // 被委托人身份 Id(必填,受托人)
Message string // 委派意见(必填,域服务意见留痕约束)
}
DelegateTaskRequest 是任务委派请求(对位 Java DelegateTaskVo:taskId/owner/delegateId/message)。
type DeploySnapshotService ¶
type DeploySnapshotService struct {
// contains filtered or unexported fields
}
DeploySnapshotService 是部署快照域服务(P5)。 行为规格:部署流程定义时把模型的设计时步骤(workflow_step)转换为运行期 规则快照(workflow_his_step,字段映射复用 StepRule),并回写模型最近部署 时间(workflow_model.last_deploy_time);同 deploymentID 重复快照替换而非 追加(幂等)。
func NewDeploySnapshotService ¶
func NewDeploySnapshotService(models ModelMgmtStore, designs StepDesignStore, hisSteps HisStepStore, c clock.Clock) *DeploySnapshotService
NewDeploySnapshotService 构造部署快照服务。 @param models 模型存储端口 @param designs 设计时步骤存储端口 @param hisSteps 快照存储端口 @param c 时间源,nil 时回退真实时钟 @return 部署快照服务
func (*DeploySnapshotService) SnapshotForDeploy ¶
func (s *DeploySnapshotService) SnapshotForDeploy(ctx context.Context, tenantID, modelCode, deploymentID, definitionID string) ([]*StepRule, error)
SnapshotForDeploy 为一次部署生成步骤快照。 流程:按(租户+模型代号)定位模型 → 读取设计时步骤 → 逐条映射为 StepRule → 批量替换该部署的快照(幂等)→ 回写模型最近部署时间。 @param ctx 操作上下文 @param tenantID 租户 @param modelCode 模型代号(=流程定义 key) @param deploymentID 部署 ID(快照归属,必填) @param definitionID 流程定义 ID(预留:workflow_his_step 无定义列,运行期经部署 ID 关联定义,当前不落库) @return 生成的快照规则列表 @return 错误
type DictItem ¶
type DictItem struct {
Value string `json:"value"` // 条目值(协议字面值)
Label string `json:"label"` // 中文名称
}
DictItem 是字典条目。
func GetDictItems ¶
GetDictItems 按码名直接取条目副本(内部与同包调用便捷方法)。 @param code 字典码 @return 条目列表 @return 未知名错误
type DictService ¶
type DictService struct{}
DictService 是静态字典服务(无状态,可安全并发使用)。
func (*DictService) GetDict ¶
func (s *DictService) GetDict(code string) (*Dict, error)
GetDict 按码名取字典。 @param code 字典码(如 messageType) @return 字典(含条目列表) @return 未知名错误
func (*DictService) ListDictCodes ¶
func (s *DictService) ListDictCodes() []string
ListDictCodes 返回全部字典码(升序)。 @return 字典码列表
type DirectOption ¶
type DirectOption func(*DirectService)
DirectOption 是直送服务选项函数。
func WithDirectUsers ¶
func WithDirectUsers(users UserQuery) DirectOption
WithDirectUsers 注入身份查询(办理人姓名展示)。 @param users 身份查询 @return 选项
type DirectService ¶
type DirectService struct {
// contains filtered or unexported fields
}
DirectService 是直送(提交流程至某节点)域服务(P2-B)。
与 complete.go 自由选路兜底的语义衔接(不可改其文件,注释说明演进关系): CompleteService.Complete 在常规办结后按"实际落位节点 != 指定目标"做引擎迁移兜底 (applyFreeSelectFallback),并在迁移发生时补记直送轨迹;本服务是"以直送为主语义" 的引擎级门面——办结动作经 WorkflowExtService().CompleteToTarget 在单条引擎命令内 直接迁往目标(Java completeToTargetActivity 伪造连线的等价能力),不再依赖 "先按模型出线办结、后纠偏迁移"的两段式路径。两入口并存:常规办结 + 自由选路 参数继续走 Complete(兜底仍生效),显式直送场景走本门面。
func NewDirectService ¶
func NewDirectService(engine api.Engine, meta *ModelMetaService, next *NextActivityService, comments *CommentService, operations *OperationRecordService, messages *MessageExtendService, histories *HistoryExtendService, documents *DocumentService, completeTo CompleteToActivityStore, c clock.Clock, options ...DirectOption) *DirectService
NewDirectService 构造直送域服务。 @param engine 引擎门面(七服务) @param meta 模型元数据服务 @param next 下一步预生成域服务 @param comments 审批意见域服务 @param operations 操作记录域服务 @param messages 待办扩展域服务 @param histories 已办扩展域服务 @param documents 业务表单状态域服务 @param completeTo 直送记录存储端口 @param c 时间源,nil 时回退真实时钟 @param options 可选配置(身份查询) @return 直送域服务
func (*DirectService) CompleteToTargetActivity ¶
func (s *DirectService) CompleteToTargetActivity(ctx context.Context, vo *api.CompleteTaskVo) error
CompleteToTargetActivity 直送:办结当前任务并把流程提交到指定目标节点 (对位 Java completeToTargetActivity:4550): 目标节点预存(saveCompleteToTargetNextActivity 对位)→ 入参/任务/挂起校验 → TZ 类意见 → 引擎 WorkflowExtService().CompleteToTarget(operationType=completeToTarget 门控触发执行人重写)→ 落 workflow_complete_to_activity(flowId 空、source=当前节点)→ 操作记录(isAgree=1) → 删当前节点预存 → 删当前待办 → 已办完成时间 → 新待办生成(目标节点新任务)→ 表单状态机刷新。 意见类型核实结论:Java 直送场景 type 缺省取 CommentTypeEnum.TZ(跳转), 显式传入 vo.Type 时用 vo.Type(L4632)。 @param ctx 操作上下文 @param vo 办结请求(TaskID/TargetActivityID/UserCode 必填;Request 首条为目标执行人预存) @return 错误
type Document ¶
type Document struct {
BaseColumns // 公共审计列
BusinessID string // 业务单据 Id(租户内唯一)
CreateGroupPathIDs string // 创建人组 Id 路径
CreateGroupPaths string // 创建人组全称路径
CreateGroupID string // 创建人组 Id
CreateGroup string // 创建人组简称
UpdaterName string // 更新人姓名
Deleted int // 逻辑删除:0 正常、1 已删除
DocumentURL string // 表单处理地址(=待办 target_url)
DocumentID string // 表单 Id(=business_id)
DocumentTable string // 业务表名(流程变量 tableName)
FlowTitle string // 流程标题(=实例名称)
FlowTaskID string // 当前待办任务 Id 聚合(逗号分隔去重)
FlowInstanceID string // 流程实例 Id
FlowCategoryID string // 流程分类代号 = 定义 Key
FlowCategory string // 流程分类名称 = 定义名称
FlowActionID string // 当前待办步骤代号聚合(逗号分隔去重)
FlowAction string // 当前待办步骤名称聚合(逗号分隔去重)
FlowStatus string // 流程状态(见 FlowStatus* 常量)
FlowCurrentStepName string // 当前待办步骤名称聚合(与 flow_action 同值,Java 语义)
FlowCurrentPersons string // 当前待办人姓名聚合(逗号分隔去重)
FlowStartTime *time.Time // 流程开始时间(Draft 提交时记)
FlowFinishTime *time.Time // 流程完成时间(状态置已完成时记)
FlowTerminationTime *time.Time // 流程终止时间(状态置已终止时记)
ExtendFields // 通用扩展列透传
}
Document 是 workflow_document(业务单据↔流程实例绑定与状态快照)的领域实体。 business_id 在租户内唯一;deleted=1 为逻辑删除(手工过滤)。 状态机(flow_status,对齐 Java WorkflowDocumentServiceImpl): 未提交 → 流转中 → 已完成/已终止;待办步骤代号含签收类(Sign*)时直接置已完成。
type DocumentSaveRequest ¶
type DocumentSaveRequest struct {
Document *Document // 单据状态数据(必填 business_id + tenant_id)
TaskKey string // 提交任务步骤代号;为 Draft 时记录流程开始时间(Java Draft 语义)
}
DocumentSaveRequest 是业务表单状态保存请求(upsert by businessId+tenant)。
type DocumentService ¶
type DocumentService struct {
// contains filtered or unexported fields
}
DocumentService 是业务表单状态(workflow_document)域服务。 行为规格对位 Java WorkflowDocumentServiceImpl#updateWorkflowDocumentByProcessInstanceIdOrTaskId:96 的状态机:
- 最后一条操作记录为 LCZZ → 已终止(清空待办数据 + 终止时间);
- 实例已结束(运行表查不到且历史实例有结束时间)→ 已完成(清空待办数据 + 完成时间);
- 其余 → 操作记录数 <=1 为"未提交"、>1 为"流转中"; 待办聚合:document_url/flow_task_id/flow_action_id/flow_action/flow_current_step_name/ flow_current_persons 取待办扩展去重逗号串; 待办步骤代号命中签收类(Sign/Sign1/Sign2/EngineerSign)→ flow_status=已完成; 办结任务 Key == Draft → 记流程开始时间。
func NewDocumentService ¶
func NewDocumentService(store DocumentStore, msg MessageExtendStore, ops OperationRecordStore, instances InstanceQuery, tasks TaskHistoryQuery, c clock.Clock) *DocumentService
NewDocumentService 创建业务表单状态域服务。 @param store 单据存储端口 @param msg 待办扩展端口 @param ops 操作记录端口 @param instances 实例查询(engine.RuntimeService()/HistoryService()) @param tasks 历史任务查询(engine.HistoryService()) @param c 时间源,nil 时回退真实时钟 @return 域服务
func (*DocumentService) CleanByProcessInstance ¶
func (s *DocumentService) CleanByProcessInstance(ctx context.Context, processInstanceID string) error
CleanByProcessInstance 清空实例的待办聚合数据(状态按状态机重算,终态记录对应时间)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 错误
func (*DocumentService) Finish ¶
func (s *DocumentService) Finish(ctx context.Context, processInstanceID string) error
Finish 完成状态标记辅助:置"已完成"并记录完成时间、清空待办聚合数据。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 错误
func (*DocumentService) GetByBusinessID ¶
func (s *DocumentService) GetByBusinessID(ctx context.Context, businessID, tenantID string) (*Document, bool, error)
GetByBusinessID 按业务单据与租户查询表单状态。 @param ctx 操作上下文 @param businessID 业务单据 Id @param tenantID 租户 @return 单据 @return 是否存在 @return 错误
func (*DocumentService) GetByInstance ¶
func (s *DocumentService) GetByInstance(ctx context.Context, processInstanceID string) (*Document, bool, error)
GetByInstance 按流程实例查询表单状态。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 单据 @return 是否存在 @return 错误
func (*DocumentService) MarkFinishTime ¶
func (s *DocumentService) MarkFinishTime(ctx context.Context, processInstanceID string, finishTime time.Time) error
MarkFinishTime 显式回写完成时间(补偿场景使用)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param finishTime 完成时间 @return 错误
func (*DocumentService) Save ¶
func (s *DocumentService) Save(ctx context.Context, req DocumentSaveRequest) (*Document, error)
Save 按业务单据+租户 upsert 表单状态(flow_status 缺省"未提交";TaskKey 为 Draft 时记流程开始时间)。 @param ctx 操作上下文 @param req 保存请求(Document 必填 business_id + tenant_id) @return 落库后的单据 @return 错误
func (*DocumentService) Terminate ¶
func (s *DocumentService) Terminate(ctx context.Context, processInstanceID string) error
Terminate 终止状态标记辅助:置"已终止"并记录终止时间、清空待办聚合数据。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 错误
func (*DocumentService) UpdateByProcessInstanceOrTask ¶
func (s *DocumentService) UpdateByProcessInstanceOrTask(ctx context.Context, processInstanceID, taskID string) error
UpdateByProcessInstanceOrTask 每次办结后刷新表单状态(状态机主入口; procInstID 与 taskID 至少一个非空,taskID 可反查实例)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param taskID 任务 Id @return 错误
type DocumentStore ¶
type DocumentStore interface {
// Save 按业务单据+租户 upsert:存在则更新非主键/非创建列,不存在则插入。
Save(ctx context.Context, d *Document) error
// GetByBusinessID 按业务单据与租户查询未删除单据。
GetByBusinessID(ctx context.Context, businessID, tenantID string) (*Document, bool, error)
// GetByInstance 按流程实例查询单据。
GetByInstance(ctx context.Context, processInstanceID string) (*Document, bool, error)
// UpdateByInstance 按实例更新指定列(changes 为列名→新值,nil 值表示置 NULL)。
UpdateByInstance(ctx context.Context, processInstanceID string, changes map[string]any) error
// MarkDeletedByBusinessID 按业务单据与租户逻辑删除。
MarkDeletedByBusinessID(ctx context.Context, businessID, tenantID string) error
}
DocumentStore 是业务表单状态(workflow_document)的存储端口。
type DomainClock ¶
DomainClock 是域服务统一时间源别名(与 internal/clock.Clock 一致)。
type DoneTaskView ¶
type DoneTaskView struct {
*HistoryExtend // 已办扩展全字段
EngineFinishTime *time.Time // 引擎历史任务办结时间(查不到为空)
EngineExists bool // 引擎历史任务是否存在
}
DoneTaskView 是已办任务列表视图:已办扩展为主体,联查引擎历史任务补办结时间。
type ExceptionRecorder ¶
type ExceptionRecorder interface {
// RecordCallbackException 记录一次回调失败。
// @param ctx 操作上下文
// @param exception 异常记录
// @return 记录错误
RecordCallbackException(ctx context.Context, exception *CallbackException) error
}
ExceptionRecorder 是回调异常记录器端口(D5:重试耗尽后落 workflow_task_exception 供管理台重发)。 本阶段默认空实现,P4 接管表仓储后替换。
type ExceptionRequest ¶
type ExceptionRequest struct {
TaskID string // 任务 Id
ProcessInstanceID string // 流程实例 Id
ProcessInstanceName string // 流程实例名称
ClassName string // 发生异常的类名
MethodName string // 发生异常的方法名
Message string // 异常消息(>1000 截断)
Params string // 入参 JSON 串
ExceptionType string // 异常类型(显式指定优先于 Err 推断)
ExceptionClass string // 异常类名
ProcessDefinitionID string // 流程定义 Id
ProcessDefinitionKey string // 流程定义 Key
ProcessDefinitionName string // 流程定义名称
StartUserID string // 发起人
TenantID string // 租户
Err error // 原始错误(ExceptionType 为空时按四类判定推断)
}
ExceptionRequest 是异常记录请求(对位 Java ProcessesExceptionAspect 切面入参投影)。
type ExceptionService ¶
type ExceptionService struct {
// contains filtered or unexported fields
}
ExceptionService 是异常记录域服务:四类判定、消息截断、处理流转与原子计数。
func NewExceptionService ¶
func NewExceptionService(store TaskExceptionStore, c clock.Clock) *ExceptionService
NewExceptionService 创建异常记录域服务。 @param store 存储端口 @param c 时间源,nil 时回退真实时钟 @return 域服务
func (*ExceptionService) Count ¶
func (s *ExceptionService) Count() int64
Count 返回进程内异常累计计数(对位 Java Redis incr,重启清零)。 @return 计数值
func (*ExceptionService) Handle ¶
Handle 批量处理异常(处理与忽略均为 handle_status=1 的终态,动作区分由调用方操作留痕; 存储端口保留 status 参数供管理台复位等扩展场景)。 @param ctx 操作上下文 @param ids 异常记录 Id 列表 @param handled true 处理、false 忽略(两者同置已处理终态) @return 错误
func (*ExceptionService) ListByInstance ¶
func (s *ExceptionService) ListByInstance(ctx context.Context, processInstanceID string) ([]*TaskException, error)
ListByInstance 查询实例的异常记录。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 记录列表 @return 错误
func (*ExceptionService) ListByTask ¶
func (s *ExceptionService) ListByTask(ctx context.Context, taskID string) ([]*TaskException, error)
ListByTask 查询任务的异常记录。 @param ctx 操作上下文 @param taskID 任务 Id @return 记录列表 @return 错误
func (*ExceptionService) ListUnhandled ¶
func (s *ExceptionService) ListUnhandled(ctx context.Context) ([]*TaskException, error)
ListUnhandled 查询未处理异常。 @param ctx 操作上下文 @return 记录列表 @return 错误
func (*ExceptionService) Record ¶
func (s *ExceptionService) Record(ctx context.Context, req *ExceptionRequest) (*TaskException, error)
Record 记录一条异常(四类判定 → 消息截断 → 落库 → 计数 +1,对位 Java ProcessesExceptionAspect doAfterThrowingAdvice:61)。判定优先级:显式 ExceptionType > Err 推断(NotTaskMessage 除外, 该类型由僵尸监控显式指定)。 @param ctx 操作上下文 @param req 异常记录请求 @return 落库后的异常记录 @return 错误
func (*ExceptionService) RecordCallbackFailure ¶
func (s *ExceptionService) RecordCallbackFailure(ctx context.Context, exception *CallbackException) error
RecordCallbackFailure 记录一次回调失败(实现 callback.go 的 ExceptionRecorder 端口: P1-C CallbackClient 重试耗尽后落 workflow_task_exception)。 @param ctx 操作上下文 @param exception 回调异常 @return 记录错误
func (*ExceptionService) RecordZombieInstance ¶
func (s *ExceptionService) RecordZombieInstance(ctx context.Context, instance api.ProcessInstance) (*TaskException, error)
RecordZombieInstance 记录"流程未生成待办"异常(NotTaskMessageException,对位 Java ExceptionMonitorSchedule#doSaveflowTaskException:104;调度器 ZombieScanTick 使用)。 @param ctx 操作上下文 @param instance 流程实例 @return 已记录的异常(实例已有同类记录时返回 nil 表示跳过) @return 错误
type ExecutionCallback ¶
type ExecutionCallback struct {
ProcessDefinitionID string `json:"processDefinitionId"` // 流程定义 ID
ProcessInstanceID string `json:"processInstanceId"` // 流程实例 ID
BusinessKey string `json:"businessKey"` // 业务单据 ID
TenantID string `json:"tenantId"` // 租户(= 系统代号)
FlowElementID string `json:"flowElementId"` // 流程节点 ID
FlowElementName string `json:"flowElementName"` // 流程节点名
Params string `json:"params"` // BPMN 扩展属性串 "k:v;k:v"
}
ExecutionCallback 是执行级业务回调报文(对位 Java BusinessCallExecutionListener paramMap,无 taskId/taskName)。
type ExecutorConfig ¶
type ExecutorConfig struct {
IdentityID string `json:"identityId,omitempty"` // 身份 Id(person 类型)
ExecutorType string `json:"executorType,omitempty"` // 执行者类型:person/org/role
OrgID string `json:"orgId,omitempty"` // 组织 Id(org 类型)
RoleID string `json:"roleId,omitempty"` // 角色 Id(role 类型)
AgreeWeight float64 `json:"agreeWeight,omitempty"` // 通过权重(权重会签)
RejectWeight float64 `json:"rejectWeight,omitempty"` // 拒绝权重(权重会签)
}
ExecutorConfig 描述 executorList 扩展属性中的单个执行者配置。 兼容 Java 设计器写入的 JSON 数组形态与逗号分隔的简单串。
func ParseExecutorConfigs ¶
func ParseExecutorConfigs(raw string) []ExecutorConfig
ParseExecutorConfigs 解析 executorList 原始串。 支持 JSON 数组形态(对象含 identityId/executorType/orgId/roleId/权重)与逗号分隔 的身份 Id 串(退化为 person 类型配置)。 @param raw 原始串 @return 执行者配置列表,空串返回 nil
func ParseWeightList ¶
func ParseWeightList(raw string) []ExecutorConfig
ParseWeightList 解析 weightList 原始串(JSON 数组,按身份配置权重)。 @param raw 原始串 @return 执行者权重配置列表,空串或解析失败返回 nil
type ExecutorRewriteHook ¶
type ExecutorRewriteHook struct {
// contains filtered or unexported fields
}
ExecutorRewriteHook 是任务创建全局钩子(执行人重写,TASK_CREATED)。 依赖模型元数据服务(读节点执行者配置)与下一步预生成域服务(读/消耗台账)。 业务回调 client(P1-C CallbackClient)本阶段不接入,预留构造扩展。
模型元数据的读取约束(重要):钩子在引擎命令内同步执行,命令持有引擎互斥写锁, 钩子内调用任何引擎公有 API(含 GetBpmnModel)都会重入死锁(已用探针测试证实)。 因此本钩子不直接调用 ModelMetaService.UserTaskMeta,而是通过 Warmup 预热的 只读缓存取节点元数据;缓存未命中时降级为保留模型默认执行人(兜底),并登记 延迟预热动作,供后续任务命中缓存。接线约定:部署新定义/发起后由门面调用 Warmup(或启动时 WarmupAll)。
func NewExecutorRewriteHook ¶
func NewExecutorRewriteHook(meta *ModelMetaService, next *NextActivityService) *ExecutorRewriteHook
NewExecutorRewriteHook 构造执行人重写钩子。 @param meta 模型元数据服务 @param next 下一步预生成域服务 @return 执行人重写钩子
func (*ExecutorRewriteHook) Hook ¶
func (h *ExecutorRewriteHook) Hook(ctx context.Context, task *api.Task, ctl api.HookControl) error
Hook 执行人重写钩子主体(api.TaskHook 签名)。 流程:门控判定(任务快照变量)→ 读预热的模型执行者配置缓存 → 读未消耗预生成记录 → 非会签/会签分支回填。查询失败或回填失败一律返回错误,由引擎使当前命令整体回滚 (与 Java isFailOnException 相反:Go 引擎侧规格要求错误传播,避免"记录被跳过消耗" 的静默错账)。模型元数据缓存未命中时降级保留模型默认执行人并登记延迟预热 (命令内禁止调用引擎公有 API,会重入死锁)。 @param ctx 命令上下文(与所在引擎命令共用,命令失败整体回滚) @param task 任务快照(含任务可见变量,改写快照无效,必须经 ctl) @param ctl 钩子控制(命令内改写办理人/候选人/候选组) @return 错误(非空则当前引擎命令失败回滚)
func (*ExecutorRewriteHook) Register ¶
func (h *ExecutorRewriteHook) Register(eng api.Engine)
Register 将钩子注册到引擎任务创建事件(TASK_CREATED)。 注册后所有用户任务创建命令都会同步执行 Hook;调用方须在引擎使用前完成注册, 并按接线约定完成元数据预热(Warmup/WarmupAll)。 @param eng 引擎门面
type ExtendFields ¶
type ExtendFields struct {
ExtendS1 string // 扩展串 1(Java 会签场景存 projectId,见 P4 委托)
ExtendS2 string // 扩展串 2
ExtendS3 string // 扩展串 3
ExtendS4 string // 扩展串 4
ExtendS5 string // 扩展串 5
ExtendS6 string // 扩展串 6
ExtendS7 string // 扩展串 7
ExtendS8 string // 扩展串 8
ExtendI1 *int64 // 扩展整型 1
ExtendI2 *int64 // 扩展整型 2
ExtendI3 *int64 // 扩展整型 3
ExtendF1 *float64 // 扩展浮点 1
ExtendF2 *float64 // 扩展浮点 2
ExtendF3 *float64 // 扩展浮点 3
ExtendD1 *time.Time // 扩展时间 1
ExtendD2 *time.Time // 扩展时间 2
ExtendD3 *time.Time // 扩展时间 3
}
ExtendFields 是通用扩展列(extend_s1..s8/i1..i3/f1..f3/d1..d3), 与 Java 实体 Extend 注解字段一致:业务系统透传,workflow 层不解释其含义。 指针类型区分"未设置"与"零值",nil 不落库。
type FirstStepRequest ¶
type FirstStepRequest struct {
ProcessInstanceID string // 流程实例 Id
ActivityID string // 首个用户任务节点 ID(taskDefinitionKey)
IdentityIDs []string // 执行人身份 Id 列表(必填,与 Java 执行人校验一致)
GroupIDs []string // 执行人候选组 Id 列表:与 IdentityIDs 等长按下标配对,单值则全部共用,否则留空
SendIdentityID string // 发送人身份 Id(=发起人 operator)
SendUserName string // 发送人姓名
TaskID string // 首个任务 Id(写入 task_id,Java 语义必须携带)
PreTaskID string // 来源任务 Id(首步场景 Java 不设置,保留字段给调用方灵活传入)
TenantID string // 租户
Creator string // 创建人身份 Id(=operator)
}
FirstStepRequest 是首步预生成请求(对位 Java ProcessesUtil#saveFirstTaskUserNextActivity:1142)。 语义:首步记录 used=1、taskId=首任务 ID(首个任务尚未办结,记录即视为已消耗, 执行人重写钩子对该记录无需再次回填)。
type GroupMemberQuery ¶
type GroupMemberQuery interface {
// ListMembers 返回组成员。
ListMembers(ctx context.Context, groupID string) ([]api.User, error)
}
GroupMemberQuery 是组成员查询能力(api.IdentityService 子集,org/role 执行者展开用)。
type HighlightData ¶
type HighlightData struct {
CompletedActivityIDs []string // 已完成节点集合(历史活动去重,剔除 sequenceFlow 连线)
ActiveActivityIDs []string // 运行态活动节点集合(RuntimeService 查询,实例已结束为空)
TakenFlowIDs []string // 已走连线集合(按 BPMN 拓扑推断)
TodoActivityIDs []string // 当前待办任务节点集合(当前任务 taskDefinitionKey 去重)
}
HighlightData 是流程图高亮数据(前端按图元 ID 套色)。 全部列表去重并按字典序排序,保证同一实例多次查询输出稳定。
type HighlightService ¶
type HighlightService struct {
// contains filtered or unexported fields
}
HighlightService 是流程图高亮数据服务(P5-B)。 数据来源:历史活动(完成节点)+ 运行态活动实例(当前活动)+ 当前待办任务(待办节点) + BPMN 模型拓扑(已走连线推断),与推演一致性回归同源(同一内存引擎语料)。
func NewHighlightService ¶
func NewHighlightService(engine api.Engine) *HighlightService
NewHighlightService 创建流程图高亮域服务。 @param engine 引擎门面(七服务) @return 高亮域服务
func (*HighlightService) FlowHighlight ¶
func (s *HighlightService) FlowHighlight(ctx context.Context, processInstanceID string) (*HighlightData, error)
FlowHighlight 按流程实例查询高亮数据。 已结束实例回退全历史:ActiveActivityIDs/TodoActivityIDs 为空、CompletedActivityIDs 取全部历史节点。 @param ctx 操作上下文 @param processInstanceID 流程实例 ID(必填) @return 高亮数据 @return 错误
func (*HighlightService) FlowHighlightByTask ¶
func (s *HighlightService) FlowHighlightByTask(ctx context.Context, taskID string) (*HighlightData, error)
FlowHighlightByTask 按任务查询高亮数据(先解析任务归属实例)。 @param ctx 操作上下文 @param taskID 任务 ID(必填) @return 高亮数据 @return 错误
type HisStepStore ¶
type HisStepStore interface {
// GetByDeploymentAndActivity 按部署与节点定位单条快照规则。
// @param ctx 操作上下文
// @param deploymentID 部署 ID(=流程定义的 deploymentId)
// @param activityID 节点 ID(=步骤代号 step_code)
// @return 快照规则
// @return 是否存在
// @return 查询错误
GetByDeploymentAndActivity(ctx context.Context, deploymentID, activityID string) (*StepRule, bool, error)
// ListByDeployment 查询部署下全部快照规则(按 sort 升序)。
// @param ctx 操作上下文
// @param deploymentID 部署 ID
// @return 快照规则列表(无记录返回空列表)
// @return 查询错误
ListByDeployment(ctx context.Context, deploymentID string) ([]*StepRule, error)
// Put 批量替换部署的全部快照规则(同 deploymentID 重复调用替换而非追加,幂等)。
// @param ctx 操作上下文
// @param deploymentID 部署 ID
// @param rules 快照规则列表(空列表表示清空该部署快照)
// @return 错误
Put(ctx context.Context, deploymentID string, rules []*StepRule) error
// DeleteByDeployment 删除部署的全部快照规则。
// @param ctx 操作上下文
// @param deploymentID 部署 ID
// @return 错误
DeleteByDeployment(ctx context.Context, deploymentID string) error
}
HisStepStore 是 workflow_his_step(步骤部署快照)的存储端口。 快照以部署维度隔离(deployment_id 引擎内唯一,运行期规则字典只读), 方法语义为既有 StepStore 端口(见 steprules.go)的超集:任何 HisStepStore 实现均可直接充任 StepStore(编译期断言见本文件末尾),主线程装配时把 同一实现同时传给 NewStepRuleService 与 NewDeploySnapshotService 即可。
type HistoryExtend ¶
type HistoryExtend struct {
MessageExtend // 与待办扩展同构
TaskFinishTime *time.Time // 实际办结时间
}
HistoryExtend 是 workflow_task_history_extend(已办扩展,ACT_HI_TASKINST 1:1)的领域实体。 Java 侧由待办扩展整行复制生成(BeanUtils.copyProperties),故直接内嵌 MessageExtend。
type HistoryExtendService ¶
type HistoryExtendService struct {
// contains filtered or unexported fields
}
HistoryExtendService 是已办扩展域服务(ACT_HI_TASKINST 1:1)。 行为规格对位 Java WorkflowTaskHistoryExtendServiceImpl:已办记录由待办扩展整行复制生成; 办结回写按(任务+处理人)置办结时间并删除同任务其他处理人的记录(updateByTaskIdAndOwnerId)。
func NewHistoryExtendService ¶
func NewHistoryExtendService(store HistoryExtendStore, c clock.Clock) *HistoryExtendService
NewHistoryExtendService 创建已办扩展域服务。 @param store 存储端口 @param c 时间源,nil 时回退真实时钟 @return 域服务
func (*HistoryExtendService) CreateForTask ¶
func (s *HistoryExtendService) CreateForTask(ctx context.Context, req *HistoryExtend) (*HistoryExtend, error)
CreateForTask 为任务创建一条已办扩展(Java 由待办扩展复制生成,此处直接承接完整字段; 办结时间初始为空,由 UpdateFinishTime 回写)。 @param ctx 操作上下文 @param req 已办扩展数据(必填 task_id/owner_id/tenant_id) @return 落库后的已办扩展 @return 错误
func (*HistoryExtendService) DeleteByBusinessID ¶
func (s *HistoryExtendService) DeleteByBusinessID(ctx context.Context, businessID, tenantID string) error
DeleteByBusinessID 按业务单据与租户删除已办扩展。 @param ctx 操作上下文 @param businessID 业务单据 Id @param tenantID 租户 @return 错误
func (*HistoryExtendService) DeleteByInstance ¶
func (s *HistoryExtendService) DeleteByInstance(ctx context.Context, processInstanceID string) error
DeleteByInstance 按实例删除全部已办扩展。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 错误
func (*HistoryExtendService) DeleteByProcessInstanceAndActivityIDs ¶
func (s *HistoryExtendService) DeleteByProcessInstanceAndActivityIDs(ctx context.Context, processInstanceID string, stepCodes []string) error
DeleteByProcessInstanceAndActivityIDs 按实例与步骤代号集合删除已办扩展(退回/撤回清理)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param stepCodes 步骤代号集合 @return 错误
func (*HistoryExtendService) DeleteByTaskID ¶
func (s *HistoryExtendService) DeleteByTaskID(ctx context.Context, taskID string) error
DeleteByTaskID 按任务删除已办扩展(办结流转/删除实例时级联)。 @param ctx 操作上下文 @param taskID 任务 Id @return 错误
func (*HistoryExtendService) GetByTaskID ¶
func (s *HistoryExtendService) GetByTaskID(ctx context.Context, taskID string) (*HistoryExtend, bool, error)
GetByTaskID 按任务查询已办扩展。 @param ctx 操作上下文 @param taskID 任务 Id @return 已办扩展 @return 是否存在 @return 错误
func (*HistoryExtendService) ListByBusinessID ¶
func (s *HistoryExtendService) ListByBusinessID(ctx context.Context, businessID, tenantID string) ([]*HistoryExtend, error)
ListByBusinessID 按业务单据与租户查询已办扩展。 @param ctx 操作上下文 @param businessID 业务单据 Id @param tenantID 租户 @return 列表 @return 错误
func (*HistoryExtendService) ListByInstance ¶
func (s *HistoryExtendService) ListByInstance(ctx context.Context, processInstanceID string) ([]*HistoryExtend, error)
ListByInstance 查询实例下全部已办扩展(按办结时间/创建时间排序聚合轨迹)。 TODO-P5:his_step 快照排序字段(sort)接入后改为按步骤排序号聚合。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 列表 @return 错误
func (*HistoryExtendService) ListByOwner ¶
func (s *HistoryExtendService) ListByOwner(ctx context.Context, ownerID, tenantID string, page PageQuery) (PageResult[*HistoryExtend], error)
ListByOwner 按处理人分页查询已办(租户过滤,已办列表主查询)。 @param ctx 操作上下文 @param ownerID 处理人 Id @param tenantID 租户 @param page 分页参数 @return 分页结果 @return 错误
func (*HistoryExtendService) UpdateFinishTime ¶
func (s *HistoryExtendService) UpdateFinishTime(ctx context.Context, taskID, ownerID string, finishTime time.Time) error
UpdateFinishTime 办结回写:置(任务+处理人)记录的办结时间并删除同任务其他处理人的记录 (时间为零值时取当前时间,对位 Java updateByTaskIdAndOwnerId)。 @param ctx 操作上下文 @param taskID 任务 Id @param ownerID 处理人 Id @param finishTime 办结时间 @return 错误
type HistoryExtendStore ¶
type HistoryExtendStore interface {
// Save 插入一条已办扩展(id 由调用方生成)。
Save(ctx context.Context, h *HistoryExtend) error
// GetByTaskID 按任务 ID 查询已办扩展。
GetByTaskID(ctx context.Context, taskID string) (*HistoryExtend, bool, error)
// ListByInstance 查询实例下全部已办扩展(按办结时间/创建时间排序,聚合轨迹)。
ListByInstance(ctx context.Context, processInstanceID string) ([]*HistoryExtend, error)
// ListByBusinessID 按业务单据与租户查询已办扩展。
ListByBusinessID(ctx context.Context, businessID, tenantID string) ([]*HistoryExtend, error)
// ListByOwner 按处理人分页查询已办扩展(租户过滤),返回当前页与总数。
ListByOwner(ctx context.Context, ownerID, tenantID string, page PageQuery) ([]*HistoryExtend, int64, error)
// UpdateFinishTime 办结回写:置(任务+处理人)记录的办结时间,并删除同任务其他处理人的记录
//(对位 Java updateByTaskIdAndOwnerId)。
UpdateFinishTime(ctx context.Context, taskID, ownerID string, finishTime time.Time) error
// DeleteByTaskID 按任务删除已办扩展。
DeleteByTaskID(ctx context.Context, taskID string) error
// DeleteByInstance 按实例删除全部已办扩展。
DeleteByInstance(ctx context.Context, processInstanceID string) error
// DeleteByBusinessID 按业务单据与租户删除已办扩展。
DeleteByBusinessID(ctx context.Context, businessID, tenantID string) error
// DeleteByProcessInstanceAndActivityIDs 按实例与步骤代号集合删除已办扩展(退回/撤回清理)。
DeleteByProcessInstanceAndActivityIDs(ctx context.Context, processInstanceID string, stepCodes []string) error
}
HistoryExtendStore 是已办扩展的存储端口。
type IdentityAccount ¶
type IdentityAccount struct {
ID string `json:"id"` // 用户 ID
Name string `json:"name"` // 显示名
Email string `json:"email,omitempty"` // 邮箱
Roles []string `json:"roles,omitempty"` // 角色 ID 列表
Groups []string `json:"groups,omitempty"` // 所属组 ID 列表
Disabled bool `json:"disabled,omitempty"` // 是否禁用
TenantID string `json:"tenantId,omitempty"` // 租户
}
IdentityAccount 是账号搜索结果视图。
type IdentityAdapter ¶
type IdentityAdapter interface {
// UserTree 返回外部用户树。
// @param ctx 操作上下文
// @return 树节点列表
// @return 查询错误
UserTree(ctx context.Context) ([]IdentityNode, error)
// OrgTree 返回外部组织树。
// @param ctx 操作上下文
// @return 树节点列表
// @return 查询错误
OrgTree(ctx context.Context) ([]IdentityNode, error)
// ResourceTree 返回外部资源树。
// @param ctx 操作上下文
// @return 树节点列表
// @return 查询错误
ResourceTree(ctx context.Context) ([]IdentityNode, error)
// SearchAccount 按关键字模糊搜索账号。
// @param ctx 操作上下文
// @param keyword 关键字(姓名/ID)
// @return 账号列表
// @return 查询错误
SearchAccount(ctx context.Context, keyword string) ([]IdentityAccount, error)
}
IdentityAdapter 是外部身份适配器接口(D10 预留): 企业已有独立 auth/组织中心时,实现本接口注入 IdentityFacade,即可整体替换内置身份库数据源; 本阶段不提供实现,引擎内置身份库为默认数据源。
type IdentityFacade ¶
type IdentityFacade struct {
// contains filtered or unexported fields
}
IdentityFacade 是身份门面(D10):用户树/组织树/角色/组/账号搜索/资源树。
func NewIdentityFacade ¶
func NewIdentityFacade(engine api.Engine, options ...IdentityOption) *IdentityFacade
NewIdentityFacade 创建身份门面。 @param engine 引擎门面(七服务) @param options 可选配置(外部适配器注入) @return 身份门面
func (*IdentityFacade) AccountSearch ¶
func (f *IdentityFacade) AccountSearch(ctx context.Context, keyword string) ([]IdentityAccount, error)
AccountSearch 按关键字模糊搜索账号(命中用户 ID/显示名/姓/名/邮箱,不区分大小写)。 关键字为空时返回全部用户。 @param ctx 操作上下文 @param keyword 关键字(姓名/ID 模糊) @return 账号列表 @return 引擎查询错误
func (*IdentityFacade) OrgTree ¶
func (f *IdentityFacade) OrgTree(ctx context.Context) ([]IdentityNode, error)
OrgTree 返回组织树:引擎组无父子层级(D10 降级),平铺为单根 + 一层组节点。 @param ctx 操作上下文 @return 树节点列表(单根) @return 引擎查询错误
func (*IdentityFacade) ResourceTree ¶
func (f *IdentityFacade) ResourceTree(ctx context.Context) ([]IdentityNode, error)
ResourceTree 返回资源树:本阶段引擎无资源/菜单模型,返回单根空树(D10 预留, 外部 auth 适配器实现 IdentityAdapter.ResourceTree 后即有真实数据)。 @param ctx 操作上下文 @return 树节点列表(单根,无子节点) @return 引擎查询错误
func (*IdentityFacade) UserTree ¶
func (f *IdentityFacade) UserTree(ctx context.Context) ([]IdentityNode, error)
UserTree 返回用户树:按组维度组织(组节点 → 成员用户节点),未入组用户挂"未分组"节点。 引擎组无父子层级(ACT_ID_GROUP 无 parent 列),树深固定两层;完全缺组数据时退化为平铺用户列表。 @param ctx 操作上下文 @return 树节点列表(单根) @return 引擎查询错误
type IdentityFacadeOptions ¶
type IdentityFacadeOptions struct {
Adapter IdentityAdapter // 外部身份适配器(nil 时用引擎内置身份库)
}
IdentityFacadeOptions 是身份门面的可注入配置。
type IdentityNode ¶
type IdentityNode struct {
ID string `json:"id"` // 节点 ID(组/用户/角色 ID,虚拟根用固定代号)
ParentID string `json:"parentId,omitempty"` // 父节点 ID(根为空)
Name string `json:"name"` // 节点显示名
Type string `json:"type"` // 节点类型(root/group/role/user/resource)
Children []IdentityNode `json:"children,omitempty"` // 子节点
}
IdentityNode 是身份树节点(用户树/组织树/资源树通用)。
type IdentityOption ¶
type IdentityOption func(*IdentityFacadeOptions)
IdentityOption 是身份门面选项函数。
func WithIdentityAdapter ¶
func WithIdentityAdapter(adapter IdentityAdapter) IdentityOption
WithIdentityAdapter 注入外部身份适配器(D10 预留,优先于引擎内置身份库)。 @param adapter 适配器 @return 选项
type InstanceQuery ¶
type InstanceQuery interface {
// GetProcessInstance 查询运行中实例(实例已结束时返回不存在错误)。
GetProcessInstance(ctx context.Context, id string) (api.ProcessInstance, error)
// GetHistoricProcessInstance 查询历史实例(含已结束)。
GetHistoricProcessInstance(ctx context.Context, processInstanceID string) (api.HistoricProcessInstance, error)
}
InstanceQuery 是流程实例查询能力(api.RuntimeService / HistoryService 子集)。
type InstanceVariableSource ¶
type InstanceVariableSource interface {
// GetVariable 读取流程实例变量。
// @param ctx 操作上下文
// @param processInstanceID 实例 Id
// @param name 变量名
// @return 变量值
// @return 查询错误
GetVariable(ctx context.Context, processInstanceID, name string) (any, error)
}
InstanceVariableSource 是流程变量读取端口(${initiator} 展开用,api.RuntimeService 子集)。
type LogNotifier ¶
LogNotifier 是送达器的日志实现(默认装配;仅打印不外发)。
func (LogNotifier) Notify ¶
func (n LogNotifier) Notify(ctx context.Context, notification *RemindNotification) error
Notify 打印催办通知。 @param ctx 操作上下文 @param notification 通知报文 @return 恒为 nil
type MemActExtendStore ¶
type MemActExtendStore struct {
// contains filtered or unexported fields
}
MemActExtendStore 是 ActExtendStore 的内存实现(线程安全 map + 时钟注入 + 克隆存取)。
func NewMemActExtendStore ¶
func NewMemActExtendStore() *MemActExtendStore
NewMemActExtendStore 创建审阅人绑定内存存储。 @return 内存存储
func (*MemActExtendStore) Delete ¶
func (m *MemActExtendStore) Delete(ctx context.Context, id string) error
Delete 按主键删除绑定。 @param ctx 操作上下文 @param id 绑定 Id @return 错误
func (*MemActExtendStore) GetByDefinitionKeyAndActivity ¶
func (m *MemActExtendStore) GetByDefinitionKeyAndActivity(ctx context.Context, definitionKey, activityID string) ([]*ActExtend, error)
GetByDefinitionKeyAndActivity 按流程定义 Key 与 BPMN 节点 ID 查询绑定(按创建时间升序)。 @param ctx 操作上下文 @param definitionKey 流程定义 Key @param activityID BPMN 节点 ID @return 绑定列表 @return 错误
func (*MemActExtendStore) ListByDefinitionKey ¶
func (m *MemActExtendStore) ListByDefinitionKey(ctx context.Context, definitionKey string) ([]*ActExtend, error)
ListByDefinitionKey 查询流程定义 Key 下全部绑定(按创建时间升序)。 @param ctx 操作上下文 @param definitionKey 流程定义 Key @return 绑定列表 @return 错误
type MemCompleteToActivityStore ¶
type MemCompleteToActivityStore struct {
// contains filtered or unexported fields
}
MemCompleteToActivityStore 是直送记录端口的内存实现(线程安全 map + 行克隆存取), 供单元测试与嵌入式无 DB 模式使用。
func NewMemCompleteToActivityStore ¶
func NewMemCompleteToActivityStore(c clock.Clock) *MemCompleteToActivityStore
NewMemCompleteToActivityStore 创建内存直送记录存储。 @param c 时间源,nil 时回退真实时钟 @return 内存存储
func (*MemCompleteToActivityStore) ListByProcessInstance ¶
func (m *MemCompleteToActivityStore) ListByProcessInstance(ctx context.Context, processInstanceID string) ([]*CompleteToActivity, error)
ListByProcessInstance 查询实例的直送记录(按创建时间升序)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 记录列表 @return 错误
func (*MemCompleteToActivityStore) ListByTask ¶
func (m *MemCompleteToActivityStore) ListByTask(ctx context.Context, taskID string) ([]*CompleteToActivity, error)
ListByTask 查询任务的直送记录(按创建时间升序)。 @param ctx 操作上下文 @param taskID 任务 Id @return 记录列表 @return 错误
func (*MemCompleteToActivityStore) Save ¶
func (m *MemCompleteToActivityStore) Save(ctx context.Context, record *CompleteToActivity) error
Save 插入一条直送记录(ID 缺失时自动生成,审计列缺失时按当前时间填充)。 @param ctx 操作上下文 @param record 直送记录 @return 错误
type MemCountersignWeightStore ¶
type MemCountersignWeightStore struct {
// contains filtered or unexported fields
}
MemCountersignWeightStore 是权重存储端口的内存实现(单测与嵌入式无 DB 模式)。
func NewMemCountersignWeightStore ¶
func NewMemCountersignWeightStore() *MemCountersignWeightStore
NewMemCountersignWeightStore 创建内存权重存储。 @return 内存存储
func (*MemCountersignWeightStore) ListByNode ¶
func (m *MemCountersignWeightStore) ListByNode(_ context.Context, key CountersignWeightKey) ([]CountersignWeight, error)
ListByNode 查询节点权重配置。 @param ctx 操作上下文 @param key 节点定位键 @return 权重配置列表(无记录返回空列表) @return 错误 @param _ 接口占位参数(实现不使用)
func (*MemCountersignWeightStore) SaveByNode ¶
func (m *MemCountersignWeightStore) SaveByNode(_ context.Context, key CountersignWeightKey, configs []CountersignWeight) error
SaveByNode 先删后插保存节点权重配置。 @param ctx 操作上下文 @param key 节点定位键 @param configs 权重配置列表 @return 错误 @param _ 接口占位参数(实现不使用)
type MemDelegateTaskMirrorStore ¶
type MemDelegateTaskMirrorStore struct {
// contains filtered or unexported fields
}
MemDelegateTaskMirrorStore 是委托镜像待办端口的内存实现。
func NewMemDelegateTaskMirrorStore ¶
func NewMemDelegateTaskMirrorStore(c clock.Clock) *MemDelegateTaskMirrorStore
NewMemDelegateTaskMirrorStore 创建内存委托镜像存储。 @param c 时间源,nil 时回退真实时钟 @return 内存存储
func (*MemDelegateTaskMirrorStore) DeleteByProcessInstance ¶
func (m *MemDelegateTaskMirrorStore) DeleteByProcessInstance(ctx context.Context, processInstanceID string) error
DeleteByProcessInstance 删除实例下全部镜像待办。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 错误
func (*MemDelegateTaskMirrorStore) ListByEntrust ¶
func (m *MemDelegateTaskMirrorStore) ListByEntrust(ctx context.Context, entrustID string) ([]*DelegateTaskMirror, error)
ListByEntrust 查询被委托人的镜像待办列表(按创建时间升序)。 @param ctx 操作上下文 @param entrustID 被委托人 Id @return 镜像列表 @return 错误
func (*MemDelegateTaskMirrorStore) ListByTaskID ¶
func (m *MemDelegateTaskMirrorStore) ListByTaskID(ctx context.Context, taskID string) ([]*DelegateTaskMirror, error)
ListByTaskID 查询任务的镜像待办列表(按创建时间升序)。 @param ctx 操作上下文 @param taskID 任务 Id @return 镜像列表 @return 错误
func (*MemDelegateTaskMirrorStore) Save ¶
func (m *MemDelegateTaskMirrorStore) Save(ctx context.Context, mirror *DelegateTaskMirror) error
Save 插入一条委托镜像待办(ID 缺失自动生成,审计列按当前时间填充)。 @param ctx 操作上下文 @param mirror 镜像待办 @return 错误
type MemDocumentStore ¶
type MemDocumentStore struct {
// contains filtered or unexported fields
}
MemDocumentStore 是 DocumentStore 的内存实现。
func NewMemDocumentStore ¶
func NewMemDocumentStore(c clock.Clock) *MemDocumentStore
NewMemDocumentStore 创建业务表单状态内存存储。 @param c 时间源,nil 时回退真实时钟 @return 内存存储
func (*MemDocumentStore) GetByBusinessID ¶
func (m *MemDocumentStore) GetByBusinessID(ctx context.Context, businessID, tenantID string) (*Document, bool, error)
GetByBusinessID 按业务单据与租户查询未删除单据。 @param ctx 操作上下文 @param businessID 业务单据 Id @param tenantID 租户 @return 单据 @return 是否存在 @return 错误
func (*MemDocumentStore) GetByInstance ¶
func (m *MemDocumentStore) GetByInstance(ctx context.Context, processInstanceID string) (*Document, bool, error)
GetByInstance 按流程实例查询单据。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 单据 @return 是否存在 @return 错误
func (*MemDocumentStore) MarkDeletedByBusinessID ¶
func (m *MemDocumentStore) MarkDeletedByBusinessID(ctx context.Context, businessID, tenantID string) error
MarkDeletedByBusinessID 按业务单据与租户逻辑删除。 @param ctx 操作上下文 @param businessID 业务单据 Id @param tenantID 租户 @return 错误
func (*MemDocumentStore) Now ¶
func (m *MemDocumentStore) Now() time.Time
Now 返回单据存储时间源当前时间。 @return 当前时间
func (*MemDocumentStore) Save ¶
func (m *MemDocumentStore) Save(ctx context.Context, d *Document) error
Save 按业务单据+租户 upsert:存在则更新非主键/非创建列,不存在则插入。 @param ctx 操作上下文 @param d 单据状态(必填 id/business_id/tenant_id) @return 错误
func (*MemDocumentStore) UpdateByInstance ¶
func (m *MemDocumentStore) UpdateByInstance(ctx context.Context, processInstanceID string, changes map[string]any) error
UpdateByInstance 按实例更新指定列(changes 为列名→新值,nil 值表示置 NULL)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param changes 变更列 @return 错误
type MemHisStepStore ¶
type MemHisStepStore struct {
// contains filtered or unexported fields
}
MemHisStepStore 是 HisStepStore 的内存实现(部署维度 map + 存取双向克隆)。
func NewMemHisStepStore ¶
func NewMemHisStepStore() *MemHisStepStore
NewMemHisStepStore 创建内存快照存储。 @return 内存存储
func (*MemHisStepStore) DeleteByDeployment ¶
func (m *MemHisStepStore) DeleteByDeployment(_ context.Context, deploymentID string) error
DeleteByDeployment 删除部署的全部快照规则。 @param ctx 操作上下文 @param deploymentID 部署 ID @return 错误 @param _ 接口占位参数(实现不使用)
func (*MemHisStepStore) GetByDeploymentAndActivity ¶
func (m *MemHisStepStore) GetByDeploymentAndActivity(_ context.Context, deploymentID, activityID string) (*StepRule, bool, error)
GetByDeploymentAndActivity 按部署与节点定位单条快照规则(返回副本)。 @param ctx 操作上下文 @param deploymentID 部署 ID @param activityID 节点 ID @return 快照规则副本 @return 是否存在 @return 查询错误 @param _ 接口占位参数(实现不使用)
func (*MemHisStepStore) ListByDeployment ¶
func (m *MemHisStepStore) ListByDeployment(_ context.Context, deploymentID string) ([]*StepRule, error)
ListByDeployment 查询部署下全部快照规则(存储内已按 sort 升序)。 @param ctx 操作上下文 @param deploymentID 部署 ID @return 快照规则副本列表 @return 查询错误 @param _ 接口占位参数(实现不使用)
type MemHistoryStore ¶
type MemHistoryStore struct {
// contains filtered or unexported fields
}
MemHistoryStore 是 HistoryExtendStore 的内存实现。
func NewMemHistoryStore ¶
func NewMemHistoryStore(c clock.Clock) *MemHistoryStore
NewMemHistoryStore 创建已办扩展内存存储。 @param c 时间源,nil 时回退真实时钟 @return 内存存储
func (*MemHistoryStore) DeleteByBusinessID ¶
func (m *MemHistoryStore) DeleteByBusinessID(ctx context.Context, businessID, tenantID string) error
DeleteByBusinessID 按业务单据与租户删除已办扩展。 @param ctx 操作上下文 @param businessID 业务单据 Id @param tenantID 租户 @return 错误
func (*MemHistoryStore) DeleteByInstance ¶
func (m *MemHistoryStore) DeleteByInstance(ctx context.Context, processInstanceID string) error
DeleteByInstance 按实例删除全部已办扩展。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 错误
func (*MemHistoryStore) DeleteByProcessInstanceAndActivityIDs ¶
func (m *MemHistoryStore) DeleteByProcessInstanceAndActivityIDs(ctx context.Context, processInstanceID string, stepCodes []string) error
DeleteByProcessInstanceAndActivityIDs 按实例与步骤代号集合删除已办扩展(退回/撤回清理)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param stepCodes 步骤代号集合 @return 错误
func (*MemHistoryStore) DeleteByTaskID ¶
func (m *MemHistoryStore) DeleteByTaskID(ctx context.Context, taskID string) error
DeleteByTaskID 按任务删除已办扩展。 @param ctx 操作上下文 @param taskID 任务 Id @return 错误
func (*MemHistoryStore) GetByTaskID ¶
func (m *MemHistoryStore) GetByTaskID(ctx context.Context, taskID string) (*HistoryExtend, bool, error)
GetByTaskID 按任务 ID 查询已办扩展。 @param ctx 操作上下文 @param taskID 任务 Id @return 已办扩展 @return 是否存在 @return 错误
func (*MemHistoryStore) ListByBusinessID ¶
func (m *MemHistoryStore) ListByBusinessID(ctx context.Context, businessID, tenantID string) ([]*HistoryExtend, error)
ListByBusinessID 按业务单据与租户查询已办扩展。 @param ctx 操作上下文 @param businessID 业务单据 Id @param tenantID 租户 @return 列表 @return 错误
func (*MemHistoryStore) ListByInstance ¶
func (m *MemHistoryStore) ListByInstance(ctx context.Context, processInstanceID string) ([]*HistoryExtend, error)
ListByInstance 查询实例下全部已办扩展(按办结时间/创建时间升序,聚合轨迹)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 列表 @return 错误
func (*MemHistoryStore) ListByOwner ¶
func (m *MemHistoryStore) ListByOwner(ctx context.Context, ownerID, tenantID string, page PageQuery) ([]*HistoryExtend, int64, error)
ListByOwner 按处理人分页查询已办扩展(租户过滤),返回当前页与总数。 @param ctx 操作上下文 @param ownerID 处理人 Id @param tenantID 租户 @param page 分页参数 @return 当前页列表 @return 总数 @return 错误
func (*MemHistoryStore) Now ¶
func (m *MemHistoryStore) Now() time.Time
Now 返回已办扩展存储时间源当前时间。 @return 当前时间
func (*MemHistoryStore) Save ¶
func (m *MemHistoryStore) Save(ctx context.Context, h *HistoryExtend) error
Save 插入一条已办扩展。 @param ctx 操作上下文 @param h 已办扩展(必填 id) @return 错误
func (*MemHistoryStore) UpdateFinishTime ¶
func (m *MemHistoryStore) UpdateFinishTime(ctx context.Context, taskID, ownerID string, finishTime time.Time) error
UpdateFinishTime 办结回写:置(任务+处理人)记录的办结时间,并删除同任务其他处理人的记录。 @param ctx 操作上下文 @param taskID 任务 Id @param ownerID 处理人 Id @param finishTime 办结时间 @return 错误
type MemMessageStore ¶
type MemMessageStore struct {
// contains filtered or unexported fields
}
MemMessageStore 是 MessageExtendStore 的内存实现。
func NewMemMessageStore ¶
func NewMemMessageStore(c clock.Clock) *MemMessageStore
NewMemMessageStore 创建待办扩展内存存储。 @param c 时间源,nil 时回退真实时钟 @return 内存存储
func (*MemMessageStore) DeleteByBusinessID ¶
func (m *MemMessageStore) DeleteByBusinessID(ctx context.Context, businessID, tenantID string) error
DeleteByBusinessID 按业务单据与租户删除待办扩展。 @param ctx 操作上下文 @param businessID 业务单据 Id @param tenantID 租户 @return 错误
func (*MemMessageStore) DeleteByInstance ¶
func (m *MemMessageStore) DeleteByInstance(ctx context.Context, processInstanceID string) error
DeleteByInstance 按实例删除全部待办扩展。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 错误
func (*MemMessageStore) DeleteByProcessInstanceAndActivityIDs ¶
func (m *MemMessageStore) DeleteByProcessInstanceAndActivityIDs(ctx context.Context, processInstanceID string, stepCodes []string) error
DeleteByProcessInstanceAndActivityIDs 按实例与步骤代号集合删除待办扩展(退回/撤回清理)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param stepCodes 步骤代号集合 @return 错误
func (*MemMessageStore) DeleteByTaskID ¶
func (m *MemMessageStore) DeleteByTaskID(ctx context.Context, taskID string) error
DeleteByTaskID 按任务删除待办扩展。 @param ctx 操作上下文 @param taskID 任务 Id @return 错误
func (*MemMessageStore) DeleteByTaskIDAndOwner ¶
func (m *MemMessageStore) DeleteByTaskIDAndOwner(ctx context.Context, taskID, ownerID string) error
DeleteByTaskIDAndOwner 按任务与处理人删除待办扩展。 @param ctx 操作上下文 @param taskID 任务 Id @param ownerID 处理人 Id @return 错误
func (*MemMessageStore) GetByTaskID ¶
func (m *MemMessageStore) GetByTaskID(ctx context.Context, taskID string) (*MessageExtend, bool, error)
GetByTaskID 按任务 ID 查询待办扩展。 @param ctx 操作上下文 @param taskID 任务 Id @return 待办扩展 @return 是否存在 @return 错误
func (*MemMessageStore) ListByBusinessID ¶
func (m *MemMessageStore) ListByBusinessID(ctx context.Context, businessID, tenantID string) ([]*MessageExtend, error)
ListByBusinessID 按业务单据与租户查询待办扩展(按创建时间升序)。 @param ctx 操作上下文 @param businessID 业务单据 Id @param tenantID 租户 @return 列表 @return 错误
func (*MemMessageStore) ListByInstance ¶
func (m *MemMessageStore) ListByInstance(ctx context.Context, processInstanceID string) ([]*MessageExtend, error)
ListByInstance 查询实例下全部待办扩展(按创建时间升序)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 列表 @return 错误
func (*MemMessageStore) ListByOwner ¶
func (m *MemMessageStore) ListByOwner(ctx context.Context, ownerID, tenantID string, page PageQuery) ([]*MessageExtend, int64, error)
ListByOwner 按处理人分页查询待办扩展(租户过滤),返回当前页与总数。 @param ctx 操作上下文 @param ownerID 处理人 Id @param tenantID 租户 @param page 分页参数 @return 当前页列表 @return 总数 @return 错误
func (*MemMessageStore) Now ¶
func (m *MemMessageStore) Now() time.Time
Now 返回待办扩展存储时间源当前时间。 @return 当前时间
func (*MemMessageStore) Save ¶
func (m *MemMessageStore) Save(ctx context.Context, msg *MessageExtend) error
Save 插入一条待办扩展。 @param ctx 操作上下文 @param msg 待办扩展(必填 id) @return 错误
func (*MemMessageStore) SetPlanFinishTime ¶
func (m *MemMessageStore) SetPlanFinishTime(ctx context.Context, taskID string, planFinishTime *time.Time) error
SetPlanFinishTime 设置计划办结时间(nil 表示清空)。 @param ctx 操作上下文 @param taskID 任务 Id @param planFinishTime 计划办结时间 @return 错误
func (*MemMessageStore) UpdateDelay ¶
func (m *MemMessageStore) UpdateDelay(ctx context.Context, taskID string, delayTime time.Time) error
UpdateDelay 标记待办已延时并回写延时时间点。 @param ctx 操作上下文 @param taskID 任务 Id @param delayTime 延时时间点 @return 错误
func (*MemMessageStore) UpdateRead ¶
func (m *MemMessageStore) UpdateRead(ctx context.Context, taskID, ownerID string, readTime time.Time) error
UpdateRead 标记待办已读并回写阅读时间(按任务+处理人)。 @param ctx 操作上下文 @param taskID 任务 Id @param ownerID 处理人 Id @param readTime 阅读时间 @return 错误
type MemModelMgmtStore ¶
type MemModelMgmtStore struct {
// contains filtered or unexported fields
}
MemModelMgmtStore 是 ModelMgmtStore 的内存实现。
func NewMemModelMgmtStore ¶
func NewMemModelMgmtStore(c clock.Clock) *MemModelMgmtStore
NewMemModelMgmtStore 创建模型内存存储。 @param c 时间源,nil 时回退真实时钟 @return 内存存储
func (*MemModelMgmtStore) DeleteByIDs ¶
func (m *MemModelMgmtStore) DeleteByIDs(_ context.Context, ids []string) error
DeleteByIDs 按主键批量物理删除(缺失主键忽略,与 pwf 删除零影响行数语义一致)。 @param ctx 操作上下文 @param ids 主键集合 @return 错误 @param _ 接口占位参数(实现不使用)
func (*MemModelMgmtStore) GetByCode ¶
func (m *MemModelMgmtStore) GetByCode(_ context.Context, tenantID, modelCode string) (*ModelCategory, bool, error)
GetByCode 按租户与模型代号查询(返回副本)。 @param ctx 操作上下文 @param tenantID 租户 @param modelCode 模型代号 @return 实体副本 @return 是否存在 @return 查询错误 @param _ 接口占位参数(实现不使用)
func (*MemModelMgmtStore) GetByPK ¶
func (m *MemModelMgmtStore) GetByPK(_ context.Context, id string) (*ModelCategory, bool, error)
GetByPK 按主键查询(返回副本)。 @param ctx 操作上下文 @param id 主键 @return 实体副本 @return 是否存在 @return 查询错误 @param _ 接口占位参数(实现不使用)
func (*MemModelMgmtStore) Insert ¶
func (m *MemModelMgmtStore) Insert(_ context.Context, row *ModelCategory) error
Insert 插入一条模型/分类(缺主键/空实体报错;缺审计时间按时钟填充)。 @param ctx 操作上下文 @param m 实体 @return 错误 @param _ 接口占位参数(实现不使用) @param row 参数 row
func (*MemModelMgmtStore) ListByTenant ¶
func (m *MemModelMgmtStore) ListByTenant(_ context.Context, tenantID string) ([]*ModelCategory, error)
ListByTenant 查询租户下全部模型与分类(按 sort 升序,同号按代号)。 @param ctx 操作上下文 @param tenantID 租户 @return 实体副本列表 @return 查询错误 @param _ 接口占位参数(实现不使用)
func (*MemModelMgmtStore) Update ¶
func (m *MemModelMgmtStore) Update(_ context.Context, row *ModelCategory) error
Update 按主键更新整行业务列(不存在时报未找到;更新时间刷新为当前时钟)。 @param ctx 操作上下文 @param row 实体 @return 错误 @param _ 接口占位参数(实现不使用)
func (*MemModelMgmtStore) UpdateLastDeployTime ¶
func (m *MemModelMgmtStore) UpdateLastDeployTime(_ context.Context, id string, deployTime time.Time) error
UpdateLastDeployTime 回写模型最近部署时间(不存在时报未找到)。 @param ctx 操作上下文 @param id 模型主键 @param deployTime 部署时间 @return 错误 @param _ 接口占位参数(实现不使用)
type MemModelStore ¶
type MemModelStore struct {
// contains filtered or unexported fields
}
MemModelStore 是 ModelStore 的内存实现(单测与嵌入式无 DB 模式)。
func NewMemModelStore ¶
func NewMemModelStore() *MemModelStore
NewMemModelStore 创建内存模型主数据存储。 @return 内存存储
func (*MemModelStore) PutReturnSort ¶
func (m *MemModelStore) PutReturnSort(processDefinitionKey string, returnSort bool)
PutReturnSort 写入/覆盖定义 Key 的退回排序方式(测试播种用)。 @param processDefinitionKey 流程定义 Key @param returnSort 退回排序方式
func (*MemModelStore) ReturnSortOf ¶
ReturnSortOf 读取定义 Key 的退回排序方式(未播种返回 true,对位 Java 缺省升序)。 @param ctx 操作上下文 @param processDefinitionKey 流程定义 Key @return 退回排序方式 @return 查询错误 @param _ 接口占位参数(实现不使用)
type MemNextStore ¶
type MemNextStore struct {
// contains filtered or unexported fields
}
MemNextStore 是 NextActivityStore 的内存实现。
func NewMemNextStore ¶
func NewMemNextStore(c clock.Clock) *MemNextStore
NewMemNextStore 创建下一步内存存储。 @param c 时间源,nil 时回退真实时钟 @return 内存存储
func (*MemNextStore) DeleteByProcessInstance ¶
func (m *MemNextStore) DeleteByProcessInstance(ctx context.Context, processInstanceID string) error
DeleteByProcessInstance 删除实例的全部运行态记录。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 错误
func (*MemNextStore) DeleteByProcessInstanceAndActivityIDs ¶
func (m *MemNextStore) DeleteByProcessInstanceAndActivityIDs(ctx context.Context, processInstanceID string, nextActivityIDs []string) error
DeleteByProcessInstanceAndActivityIDs 删除实例下指定节点集合的运行态与历史记录。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param nextActivityIDs 节点 ID 集合 @return 错误
func (*MemNextStore) DeleteForBackToStep ¶
func (m *MemNextStore) DeleteForBackToStep(ctx context.Context, processInstanceID, nextActivityID string) error
DeleteForBackToStep 退回清理:删除实例下目标节点(含已消耗)的全部运行态记录。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param nextActivityID 目标节点 ID @return 错误
func (*MemNextStore) DeleteForResolve ¶
func (m *MemNextStore) DeleteForResolve(ctx context.Context, processInstanceID, nextActivityID, taskID, identityID string) error
DeleteForResolve 处理委派清理:删除实例下指定节点+任务+执行人的记录。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param nextActivityID 节点 ID @param taskID 任务 Id @param identityID 执行人 Id @return 错误
func (*MemNextStore) DeleteForRollback ¶
func (m *MemNextStore) DeleteForRollback(ctx context.Context, processInstanceID, preTaskID, keepActivityID string) error
DeleteForRollback 撤回清理:删除实例下以 preTaskID 为来源、目标节点之外的记录(仅运行态)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param preTaskID 来源任务 Id @param keepActivityID 保留的目标节点 ID(撤回重做的节点) @return 错误
func (*MemNextStore) FindAssignSource ¶
func (m *MemNextStore) FindAssignSource(ctx context.Context, processInstanceID, nextActivityID, sendIdentityID, taskID string) (*NextActivity, bool, error)
FindAssignSource 按(实例/节点/发送人/任务)定位既有记录(转办/委派/还原继承组用)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param nextActivityID 节点 ID @param sendIdentityID 发送人 Id @param taskID 任务 Id @return 记录 @return 是否存在 @return 错误
func (*MemNextStore) GetFirstUnusedByActivity ¶
func (m *MemNextStore) GetFirstUnusedByActivity(ctx context.Context, processInstanceID, nextActivityID string) (*NextActivity, bool, error)
GetFirstUnusedByActivity 按创建时间升序返回实例下指定节点的第一条未消耗记录。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param nextActivityID 节点 ID @return 记录 @return 是否存在 @return 错误
func (*MemNextStore) InsertDual ¶
func (m *MemNextStore) InsertDual(ctx context.Context, act *NextActivity) error
InsertDual 双写运行态与历史表(同 ID 同内容)。 @param ctx 操作上下文 @param act 下一步记录(必填 id/process_instance_id/next_activity_id) @return 双写错误
func (*MemNextStore) LatestVersion ¶
func (m *MemNextStore) LatestVersion(ctx context.Context, processInstanceID, nextActivityID string) (int, error)
LatestVersion 返回实例下指定节点已消耗(used=1)记录的最大版本号,无记录返回 0。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param nextActivityID 节点 ID @return 最大版本号 @return 错误
func (*MemNextStore) ListByPreTask ¶
func (m *MemNextStore) ListByPreTask(ctx context.Context, preTaskID string) ([]*NextActivity, error)
ListByPreTask 查询以上一任务为来源的运行态记录(按版本升序)。 @param ctx 操作上下文 @param preTaskID 上一任务 Id @return 记录列表 @return 错误
func (*MemNextStore) ListByTaskID ¶
func (m *MemNextStore) ListByTaskID(ctx context.Context, taskID string) ([]*NextActivity, error)
ListByTaskID 查询已挂到任务上的运行态记录(按创建时间升序)。 @param ctx 操作上下文 @param taskID 任务 Id @return 记录列表 @return 错误
func (*MemNextStore) ListHisByInstance ¶
func (m *MemNextStore) ListHisByInstance(ctx context.Context, processInstanceID string) ([]*NextActivity, error)
ListHisByInstance 查询实例的全部历史记录(按版本升序)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 记录列表 @return 错误
func (*MemNextStore) ListHisByTaskID ¶
func (m *MemNextStore) ListHisByTaskID(ctx context.Context, taskID string) ([]*NextActivity, error)
ListHisByTaskID 查询历史表中任务相关且非自环(pre_task_id != taskID)的记录(按创建时间升序)。 @param ctx 操作上下文 @param taskID 任务 Id @return 记录列表 @return 错误
func (*MemNextStore) ListUnusedByInstance ¶
func (m *MemNextStore) ListUnusedByInstance(ctx context.Context, processInstanceID string) ([]*NextActivity, error)
ListUnusedByInstance 查询实例下全部未消耗记录(按版本升序)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 记录列表 @return 错误
func (*MemNextStore) ListUnusedByInstanceAndActivity ¶
func (m *MemNextStore) ListUnusedByInstanceAndActivity(ctx context.Context, processInstanceID, nextActivityID string) ([]*NextActivity, error)
ListUnusedByInstanceAndActivity 查询实例下指定节点未消耗记录(按版本升序)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param nextActivityID 节点 ID @return 记录列表 @return 错误
func (*MemNextStore) ListUsedByInstance ¶
func (m *MemNextStore) ListUsedByInstance(ctx context.Context, processInstanceID string) ([]*NextActivity, error)
ListUsedByInstance 查询实例下已回写任务 ID 的记录。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 记录列表 @return 错误
func (*MemNextStore) MarkUsedAndWriteBack ¶
MarkUsedAndWriteBack 置 used=1 并回写任务 ID(运行态与历史表同步,仅未消耗记录生效)。 @param ctx 操作上下文 @param ids 记录 Id 集合 @param taskID 任务 Id @return 错误
type MemOperationStore ¶
type MemOperationStore struct {
// contains filtered or unexported fields
}
MemOperationStore 是 OperationRecordStore 的内存实现。
func NewMemOperationStore ¶
func NewMemOperationStore(c clock.Clock) *MemOperationStore
NewMemOperationStore 创建操作记录内存存储。 @param c 时间源,nil 时回退真实时钟 @return 内存存储
func (*MemOperationStore) CountByInstance ¶
func (m *MemOperationStore) CountByInstance(ctx context.Context, processInstanceID string) (int, error)
CountByInstance 统计实例的操作记录数(状态机"未提交/流转中"判据)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 记录数 @return 错误
func (*MemOperationStore) LastTypeByInstance ¶
func (m *MemOperationStore) LastTypeByInstance(ctx context.Context, processInstanceID string) (string, error)
LastTypeByInstance 返回实例最后一条(按处理时间)操作记录的类型代码,无记录返回空串。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 类型代码 @return 错误
func (*MemOperationStore) ListByBusinessID ¶
func (m *MemOperationStore) ListByBusinessID(ctx context.Context, businessID string) ([]*OperationRecord, error)
ListByBusinessID 查询业务单据的操作记录(按处理时间升序)。 @param ctx 操作上下文 @param businessID 业务单据 Id @return 列表 @return 错误
func (*MemOperationStore) ListByBusinessIDs ¶
func (m *MemOperationStore) ListByBusinessIDs(ctx context.Context, businessIDs []string) ([]*OperationRecord, error)
ListByBusinessIDs 查询多个业务单据的操作记录(按处理时间升序)。 @param ctx 操作上下文 @param businessIDs 业务单据 Id 集合 @return 列表 @return 错误
func (*MemOperationStore) ListByInstance ¶
func (m *MemOperationStore) ListByInstance(ctx context.Context, processInstanceID string) ([]*OperationRecord, error)
ListByInstance 查询实例的操作记录(按处理时间升序)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 列表 @return 错误
func (*MemOperationStore) ListByTask ¶
func (m *MemOperationStore) ListByTask(ctx context.Context, taskID string) ([]*OperationRecord, error)
ListByTask 查询任务的操作记录(按处理时间升序)。 @param ctx 操作上下文 @param taskID 任务 Id @return 列表 @return 错误
func (*MemOperationStore) ListSignable ¶
func (m *MemOperationStore) ListSignable(ctx context.Context, businessIDs []string) ([]*OperationRecord, error)
ListSignable 查询"可签名"记录:type ∈ {TJ,SP,TZ} 且步骤代号非空(Java getSignableOperationRecordListByBusinessIds)。 @param ctx 操作上下文 @param businessIDs 业务单据 Id 集合 @return 列表 @return 错误
func (*MemOperationStore) Now ¶
func (m *MemOperationStore) Now() time.Time
Now 返回操作记录存储时间源当前时间。 @return 当前时间
func (*MemOperationStore) Save ¶
func (m *MemOperationStore) Save(ctx context.Context, r *OperationRecord) error
Save 插入一条操作记录。 @param ctx 操作上下文 @param r 操作记录(必填 id) @return 错误
type MemRemindStore ¶
type MemRemindStore struct {
// contains filtered or unexported fields
}
MemRemindStore 是催办配置端口的内存实现(线程安全 map + 行克隆存取)。
func NewMemRemindStore ¶
func NewMemRemindStore(c clock.Clock) *MemRemindStore
NewMemRemindStore 创建内存催办配置存储。 @param c 时间源,nil 时回退真实时钟 @return 内存存储
func (*MemRemindStore) Get ¶
Get 按主键查询催办配置。 @param ctx 操作上下文 @param id 催办配置 Id @return 催办配置 @return 是否存在 @return 错误
func (*MemRemindStore) ListActive ¶
func (m *MemRemindStore) ListActive(ctx context.Context) ([]*Remind, error)
ListActive 查询全部未删除配置。 @param ctx 操作上下文 @return 配置列表 @return 错误
func (*MemRemindStore) ListByModel ¶
ListByModel 查询模型下的催办配置(deleted=0)。 @param ctx 操作上下文 @param modelID 模型 Id @return 配置列表 @return 错误
func (*MemRemindStore) ListNotSent ¶
func (m *MemRemindStore) ListNotSent(ctx context.Context) ([]*Remind, error)
ListNotSent 查询未发送且未删除的配置。 @param ctx 操作上下文 @return 配置列表 @return 错误
func (*MemRemindStore) MarkDeleted ¶
func (m *MemRemindStore) MarkDeleted(ctx context.Context, id string) error
MarkDeleted 按主键逻辑删除。 @param ctx 操作上下文 @param id 催办配置 Id @return 错误
func (*MemRemindStore) MarkDeletedByIDs ¶
func (m *MemRemindStore) MarkDeletedByIDs(ctx context.Context, ids []string) error
MarkDeletedByIDs 批量逻辑删除。 @param ctx 操作上下文 @param ids 催办配置 Id 列表 @return 错误
type MemRemindTargetStore ¶
type MemRemindTargetStore struct {
// contains filtered or unexported fields
}
MemRemindTargetStore 是催办对象端口的内存实现。
func NewMemRemindTargetStore ¶
func NewMemRemindTargetStore(c clock.Clock) *MemRemindTargetStore
NewMemRemindTargetStore 创建内存催办对象存储。 @param c 时间源,nil 时回退真实时钟 @return 内存存储
func (*MemRemindTargetStore) DeleteByRemind ¶
func (m *MemRemindTargetStore) DeleteByRemind(ctx context.Context, remindID string) error
DeleteByRemind 删除配置的全部对象。 @param ctx 操作上下文 @param remindID 催办配置 Id @return 错误
func (*MemRemindTargetStore) ListByRemind ¶
func (m *MemRemindTargetStore) ListByRemind(ctx context.Context, remindID string) ([]*RemindTarget, error)
ListByRemind 查询配置的启用对象列表(enable=1 & deleted=0,按创建时间升序)。 @param ctx 操作上下文 @param remindID 催办配置 Id @return 对象列表 @return 错误
func (*MemRemindTargetStore) MarkSent ¶
func (m *MemRemindTargetStore) MarkSent(ctx context.Context, id string) error
MarkSent 标记对象已发送。 @param ctx 操作上下文 @param id 对象 Id @return 错误
func (*MemRemindTargetStore) Save ¶
func (m *MemRemindTargetStore) Save(ctx context.Context, target *RemindTarget) error
Save 插入催办对象(ID 缺失自动生成)。 @param ctx 操作上下文 @param target 催办对象 @return 错误
func (*MemRemindTargetStore) UpdateRetryCount ¶
UpdateRetryCount 回写重试计数。 @param ctx 操作上下文 @param id 对象 Id @param count 新计数 @return 错误
type MemReviewTaskStore ¶
type MemReviewTaskStore struct {
// contains filtered or unexported fields
}
MemReviewTaskStore 是 ReviewTaskStore 的内存实现(线程安全 map + 时钟注入 + 租户隔离 + 克隆存取)。
func NewMemReviewTaskStore ¶
func NewMemReviewTaskStore(c clock.Clock) *MemReviewTaskStore
NewMemReviewTaskStore 创建审阅影子任务内存存储。 @param c 时间源,nil 时回退真实时钟 @return 内存存储
func (*MemReviewTaskStore) CountUnread ¶
func (m *MemReviewTaskStore) CountUnread(ctx context.Context, reviewer, tenantID string) (int64, error)
CountUnread 统计审阅人的待审阅数(status=待审阅,租户过滤,空租户不过滤)。 @param ctx 操作上下文 @param reviewer 审阅人 Id @param tenantID 租户 @return 待审阅数 @return 错误
func (*MemReviewTaskStore) DeleteByInstance ¶
func (m *MemReviewTaskStore) DeleteByInstance(ctx context.Context, processInstanceID string) error
DeleteByInstance 删除实例下全部审阅影子任务。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 错误
func (*MemReviewTaskStore) Get ¶
func (m *MemReviewTaskStore) Get(ctx context.Context, id string) (*ReviewTask, bool, error)
Get 按主键查询审阅影子任务。 @param ctx 操作上下文 @param id 影子任务 Id @return 影子任务 @return 是否存在 @return 错误
func (*MemReviewTaskStore) Insert ¶
func (m *MemReviewTaskStore) Insert(ctx context.Context, rt *ReviewTask) error
Insert 插入一条审阅影子任务。 @param ctx 操作上下文 @param rt 影子任务(必填 id) @return 错误
func (*MemReviewTaskStore) ListByInstance ¶
func (m *MemReviewTaskStore) ListByInstance(ctx context.Context, processInstanceID string) ([]*ReviewTask, error)
ListByInstance 查询实例下全部审阅影子任务(按创建时间升序)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 列表 @return 错误
func (*MemReviewTaskStore) ListByReviewer ¶
func (m *MemReviewTaskStore) ListByReviewer(ctx context.Context, reviewer, tenantID string, page PageQuery) ([]*ReviewTask, int64, error)
ListByReviewer 按审阅人分页查询(租户过滤,空租户不过滤;按 start_time 升序)。 @param ctx 操作上下文 @param reviewer 审阅人 Id @param tenantID 租户 @param page 分页参数 @return 当前页列表 @return 总数 @return 错误
func (*MemReviewTaskStore) Now ¶
func (m *MemReviewTaskStore) Now() time.Time
Now 返回审阅影子任务存储时间源当前时间。 @return 当前时间
func (*MemReviewTaskStore) Update ¶
func (m *MemReviewTaskStore) Update(ctx context.Context, rt *ReviewTask) error
Update 办结回写:按主键回写可变列(status/opinion/review_time/remark/updater/update_time)。 主键不存在时静默忽略(与 SQL UpdateByPK 影响 0 行语义一致)。 @param ctx 操作上下文 @param rt 影子任务(必填 id,可变列取实体现值) @return 错误
type MemStepDesignStore ¶
type MemStepDesignStore struct {
// contains filtered or unexported fields
}
MemStepDesignStore 是 StepDesignStore 的内存实现。
func NewMemStepDesignStore ¶
func NewMemStepDesignStore(c clock.Clock) *MemStepDesignStore
NewMemStepDesignStore 创建设计时步骤内存存储。 @param c 时间源,nil 时回退真实时钟 @return 内存存储
func (*MemStepDesignStore) DeleteByIDs ¶
func (m *MemStepDesignStore) DeleteByIDs(_ context.Context, ids []string) error
DeleteByIDs 按主键批量物理删除(缺失主键忽略)。 @param ctx 操作上下文 @param ids 主键集合 @return 错误 @param _ 接口占位参数(实现不使用)
func (*MemStepDesignStore) GetByModelAndCode ¶
func (m *MemStepDesignStore) GetByModelAndCode(_ context.Context, modelID, stepCode string) (*StepDesign, bool, error)
GetByModelAndCode 按模型与步骤代号查询(返回副本)。 @param ctx 操作上下文 @param modelID 模型 ID @param stepCode 步骤代号 @return 实体副本 @return 是否存在 @return 查询错误 @param _ 接口占位参数(实现不使用)
func (*MemStepDesignStore) GetByPK ¶
func (m *MemStepDesignStore) GetByPK(_ context.Context, id string) (*StepDesign, bool, error)
GetByPK 按主键查询(返回副本)。 @param ctx 操作上下文 @param id 主键 @return 实体副本 @return 是否存在 @return 查询错误 @param _ 接口占位参数(实现不使用)
func (*MemStepDesignStore) Insert ¶
func (m *MemStepDesignStore) Insert(_ context.Context, s *StepDesign) error
Insert 插入一条设计时步骤(缺主键/空实体报错;缺审计时间按时钟填充)。 @param ctx 操作上下文 @param s 实体 @return 错误 @param _ 接口占位参数(实现不使用)
func (*MemStepDesignStore) ListByModel ¶
func (m *MemStepDesignStore) ListByModel(_ context.Context, modelID string) ([]*StepDesign, error)
ListByModel 查询模型下全部步骤配置(按 sort 升序,同号按代号)。 @param ctx 操作上下文 @param modelID 模型 ID @return 实体副本列表 @return 查询错误 @param _ 接口占位参数(实现不使用)
func (*MemStepDesignStore) Update ¶
func (m *MemStepDesignStore) Update(_ context.Context, s *StepDesign) error
Update 按主键更新整行业务列(不存在时报未找到;更新时间刷新为当前时钟)。 @param ctx 操作上下文 @param s 实体 @return 错误 @param _ 接口占位参数(实现不使用)
type MemStepStore ¶
type MemStepStore struct {
// contains filtered or unexported fields
}
MemStepStore 是 StepStore 的内存实现(单测与嵌入式无 DB 模式)。
func NewMemStepStore ¶
func NewMemStepStore() *MemStepStore
NewMemStepStore 创建内存步骤规则存储。 @return 内存存储
func (*MemStepStore) GetByDeploymentAndActivity ¶
func (m *MemStepStore) GetByDeploymentAndActivity(_ context.Context, deploymentID, activityID string) (*StepRule, bool, error)
GetByDeploymentAndActivity 按部署与节点定位单条步骤规则。 @param ctx 操作上下文 @param deploymentID 部署 ID @param activityID 节点 ID @return 步骤规则副本 @return 是否存在 @return 查询错误 @param _ 接口占位参数(实现不使用)
func (*MemStepStore) ListByDeployment ¶
func (m *MemStepStore) ListByDeployment(_ context.Context, deploymentID string) ([]*StepRule, error)
ListByDeployment 查询部署下全部步骤规则(按 sort 升序,同 sort 按步骤代号)。 @param ctx 操作上下文 @param deploymentID 部署 ID @return 步骤规则列表 @return 查询错误 @param _ 接口占位参数(实现不使用)
func (*MemStepStore) Put ¶
func (m *MemStepStore) Put(rule *StepRule)
Put 写入/覆盖一条步骤规则(测试播种用)。 @param rule 步骤规则(DeploymentID + StepCode 定位)
type MemStores ¶
type MemStores struct {
Next *MemNextStore // 下一步预生成-消耗
Message *MemMessageStore // 待办扩展
History *MemHistoryStore // 已办扩展
Operation *MemOperationStore // 操作记录
Document *MemDocumentStore // 业务表单状态
}
MemStores 是五大域存储端口的内存实现聚合(线程安全 map + 时钟注入), 供单元测试与嵌入式无 DB 模式使用;行数据按值克隆存取,避免调用方持有内部引用。 五个端口存在同名方法(Save/GetByTaskID 等),故拆分为独立结构体分别实现。
func NewMemStores ¶
NewMemStores 创建内存存储聚合。 @param c 时间源,nil 时回退真实时钟 @return 内存存储聚合
type MemTaskDelegateStore ¶
type MemTaskDelegateStore struct {
// contains filtered or unexported fields
}
MemTaskDelegateStore 是委托规则端口的内存实现(线程安全 map + 行克隆存取)。
func NewMemTaskDelegateStore ¶
func NewMemTaskDelegateStore(c clock.Clock) *MemTaskDelegateStore
NewMemTaskDelegateStore 创建内存委托规则存储。 @param c 时间源,nil 时回退真实时钟 @return 内存存储
func (*MemTaskDelegateStore) Delete ¶
func (m *MemTaskDelegateStore) Delete(ctx context.Context, id string) error
Delete 按主键级联删除委托规则。 @param ctx 操作上下文 @param id 委托规则 Id @return 错误
func (*MemTaskDelegateStore) Get ¶
func (m *MemTaskDelegateStore) Get(ctx context.Context, id string) (*DelegateRule, bool, error)
Get 按主键级联读取委托规则。 @param ctx 操作上下文 @param id 委托规则 Id @return 委托规则 @return 是否存在 @return 错误
func (*MemTaskDelegateStore) ListByConsigner ¶
func (m *MemTaskDelegateStore) ListByConsigner(ctx context.Context, consignerID, tenantID string) ([]*DelegateRule, error)
ListByConsigner 查询指定身份作为被委托人的启用规则(按创建时间升序)。 @param ctx 操作上下文 @param consignerID 被委托人 Id @param tenantID 租户(=source_code) @return 启用中的规则列表 @return 错误
func (*MemTaskDelegateStore) ListByOwner ¶
func (m *MemTaskDelegateStore) ListByOwner(ctx context.Context, ownerID, tenantID string) ([]*DelegateRule, error)
ListByOwner 查询委托人在指定租户下的全部规则(按创建时间升序)。 @param ctx 操作上下文 @param ownerID 委托人 Id @param tenantID 租户(=source_code) @return 规则列表 @return 错误
func (*MemTaskDelegateStore) Save ¶
func (m *MemTaskDelegateStore) Save(ctx context.Context, rule *DelegateRule) error
Save 级联保存委托规则(主表 upsert,子表先删后增,ID 缺失自动生成)。 @param ctx 操作上下文 @param rule 委托规则 @return 错误
func (*MemTaskDelegateStore) UpdateState ¶
func (m *MemTaskDelegateStore) UpdateState(ctx context.Context, id string, enable, retire int) error
UpdateState 更新规则启用/退休标记。 @param ctx 操作上下文 @param id 委托规则 Id @param enable 启用标记 @param retire 退休标记 @return 错误
type MemTaskExceptionStore ¶
type MemTaskExceptionStore struct {
// contains filtered or unexported fields
}
MemTaskExceptionStore 是任务异常端口的内存实现(线程安全 map + 行克隆存取)。
func NewMemTaskExceptionStore ¶
func NewMemTaskExceptionStore(c clock.Clock) *MemTaskExceptionStore
NewMemTaskExceptionStore 创建内存任务异常存储。 @param c 时间源,nil 时回退真实时钟 @return 内存存储
func (*MemTaskExceptionStore) Get ¶
func (m *MemTaskExceptionStore) Get(ctx context.Context, id string) (*TaskException, bool, error)
Get 按主键查询异常记录。 @param ctx 操作上下文 @param id 异常记录 Id @return 异常记录 @return 是否存在 @return 错误
func (*MemTaskExceptionStore) ListByInstance ¶
func (m *MemTaskExceptionStore) ListByInstance(ctx context.Context, processInstanceID string) ([]*TaskException, error)
ListByInstance 查询实例的异常记录。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 记录列表 @return 错误
func (*MemTaskExceptionStore) ListByTask ¶
func (m *MemTaskExceptionStore) ListByTask(ctx context.Context, taskID string) ([]*TaskException, error)
ListByTask 查询任务的异常记录。 @param ctx 操作上下文 @param taskID 任务 Id @return 记录列表 @return 错误
func (*MemTaskExceptionStore) ListByTypeAndInstances ¶
func (m *MemTaskExceptionStore) ListByTypeAndInstances(ctx context.Context, exceptionType string, instanceIDs []string) ([]*TaskException, error)
ListByTypeAndInstances 查询指定实例集合下指定类型的异常记录。 @param ctx 操作上下文 @param exceptionType 异常类型 @param instanceIDs 实例 Id 集合 @return 记录列表 @return 错误
func (*MemTaskExceptionStore) ListUnhandled ¶
func (m *MemTaskExceptionStore) ListUnhandled(ctx context.Context) ([]*TaskException, error)
ListUnhandled 查询未处理异常。 @param ctx 操作上下文 @return 记录列表 @return 错误
func (*MemTaskExceptionStore) MarkHandled ¶
MarkHandled 批量更新处理状态。 @param ctx 操作上下文 @param ids 异常记录 Id 列表 @param status 处理状态 @return 错误
func (*MemTaskExceptionStore) Save ¶
func (m *MemTaskExceptionStore) Save(ctx context.Context, e *TaskException) error
Save 插入一条异常记录(ID 缺失自动生成,审计列按当前时间填充)。 @param ctx 操作上下文 @param e 异常记录 @return 错误
type MemTemplateStore ¶
type MemTemplateStore struct {
// contains filtered or unexported fields
}
MemTemplateStore 是 TemplateStore 的内存实现。
func NewMemTemplateStore ¶
func NewMemTemplateStore(c clock.Clock) *MemTemplateStore
NewMemTemplateStore 创建模板内存存储。 @param c 时间源,nil 时回退真实时钟 @return 内存存储
func (*MemTemplateStore) DeleteByIDs ¶
func (m *MemTemplateStore) DeleteByIDs(_ context.Context, ids []string) error
DeleteByIDs 按主键批量物理删除(缺失主键忽略)。 @param ctx 操作上下文 @param ids 主键集合 @return 错误 @param _ 接口占位参数(实现不使用)
func (*MemTemplateStore) GetByPK ¶
func (m *MemTemplateStore) GetByPK(_ context.Context, id string) (*TemplateDef, bool, error)
GetByPK 按主键查询(返回副本)。 @param ctx 操作上下文 @param id 主键 @return 实体副本 @return 是否存在 @return 查询错误 @param _ 接口占位参数(实现不使用)
func (*MemTemplateStore) Insert ¶
func (m *MemTemplateStore) Insert(_ context.Context, t *TemplateDef) error
Insert 插入一条模板(缺主键/空实体报错;缺审计时间按时钟填充)。 @param ctx 操作上下文 @param t 实体 @return 错误 @param _ 接口占位参数(实现不使用)
func (*MemTemplateStore) ListByCategory ¶
func (m *MemTemplateStore) ListByCategory(_ context.Context, categoryID string) ([]*TemplateDef, error)
ListByCategory 查询分类下全部模板(按名称升序)。 @param ctx 操作上下文 @param categoryID 分类 ID @return 实体副本列表 @return 查询错误 @param _ 接口占位参数(实现不使用)
func (*MemTemplateStore) ListByTenant ¶
func (m *MemTemplateStore) ListByTenant(_ context.Context, tenantID string) ([]*TemplateDef, error)
ListByTenant 查询租户下全部模板(按名称升序,同名列按主键)。 @param ctx 操作上下文 @param tenantID 租户 @return 实体副本列表 @return 查询错误 @param _ 接口占位参数(实现不使用)
func (*MemTemplateStore) Update ¶
func (m *MemTemplateStore) Update(_ context.Context, t *TemplateDef) error
Update 按主键更新整行业务列(不存在时报未找到;更新时间刷新为当前时钟)。 @param ctx 操作上下文 @param t 实体 @return 错误 @param _ 接口占位参数(实现不使用)
type MemTodoSource ¶
type MemTodoSource struct {
// contains filtered or unexported fields
}
MemTodoSource 是待办数据源端口的内存适配(包装 MemMessageStore,同包读取内部行)。
func NewMemTodoSource ¶
func NewMemTodoSource(store *MemMessageStore) *MemTodoSource
NewMemTodoSource 创建内存待办数据源。 @param store 待办内存存储 @return 待办数据源
func (*MemTodoSource) GetByTaskID ¶
func (s *MemTodoSource) GetByTaskID(ctx context.Context, taskID string) (*MessageExtend, bool, error)
GetByTaskID 按任务查询待办扩展。 @param ctx 操作上下文 @param taskID 任务 Id @return 待办扩展 @return 是否存在 @return 错误
func (*MemTodoSource) ListAll ¶
func (s *MemTodoSource) ListAll(ctx context.Context) ([]*MessageExtend, error)
ListAll 返回全部待办扩展(按创建时间升序)。 @param ctx 操作上下文 @return 待办列表 @return 错误
type MemoryBusinessSystemStore ¶
type MemoryBusinessSystemStore struct {
// contains filtered or unexported fields
}
MemoryBusinessSystemStore 是业务系统注册的内存实现(单测与嵌入式无 DB 模式),并发安全。
func NewMemoryBusinessSystemStore ¶
func NewMemoryBusinessSystemStore() *MemoryBusinessSystemStore
NewMemoryBusinessSystemStore 创建内存业务系统存储。 @return 内存存储
func (*MemoryBusinessSystemStore) Delete ¶
func (m *MemoryBusinessSystemStore) Delete(ctx context.Context, symbol string) error
Delete 按系统代号删除注册。 @param ctx 操作上下文 @param symbol 系统代号 @return 删除错误(不存在时报 WORKFLOW-1404)
func (*MemoryBusinessSystemStore) GetBySymbol ¶
func (m *MemoryBusinessSystemStore) GetBySymbol(ctx context.Context, symbol string) (*BusinessSystem, bool, error)
GetBySymbol 按系统代号查询。 @param ctx 操作上下文 @param symbol 系统代号 @return 注册信息 @return 是否存在 @return 查询错误
func (*MemoryBusinessSystemStore) GetByTenant ¶
func (m *MemoryBusinessSystemStore) GetByTenant(ctx context.Context, tenantID string) (*BusinessSystem, bool, error)
GetByTenant 按租户查询(线性扫描,内存实现数据量小可接受)。 @param ctx 操作上下文 @param tenantID 租户 @return 注册信息 @return 是否存在 @return 查询错误
func (*MemoryBusinessSystemStore) List ¶
func (m *MemoryBusinessSystemStore) List(ctx context.Context) ([]BusinessSystem, error)
List 返回全部注册信息,按系统代号升序保证确定性。 @param ctx 操作上下文 @return 注册列表 @return 查询错误
func (*MemoryBusinessSystemStore) Save ¶
func (m *MemoryBusinessSystemStore) Save(ctx context.Context, system *BusinessSystem) error
Save 保存注册信息(按系统代号 upsert)。 @param ctx 操作上下文 @param system 注册信息(新增时 ID 必须非空) @return 保存错误
type MessageCreateRequest ¶
type MessageCreateRequest = MessageExtend
MessageCreateRequest 是待办扩展创建请求。 直接复用领域实体承载业务字段与 extend 透传(Java saveMessageExtendInfo 的单任务落库部分)。
type MessageExtend ¶
type MessageExtend struct {
BaseColumns // 公共审计列
TaskID string // 引擎任务 Id(唯一)
ProcessInstanceID string // 流程实例 Id
Title string // 待办标题 = 实例名称
Message string // 待办说明
BusinessID string // 业务单据 Id = businessKey
TargetURL string // 步骤处理地址(his_step.url)
TaskStepName string // 步骤名称(his_step.stepName)
TaskStepCode string // 步骤代号(his_step.stepCode)
FlowCategoryCode string // 流程分类代号 = 定义 Key
FlowCategoryName string // 流程分类名称 = 定义名称
OwnerID string // 处理人身份 Id
OwnerName string // 处理人姓名
OwnerGroup string // 处理人组简称
OwnerGroupID string // 处理人组 Id
OwnerGroupPaths string // 处理人组全称路径
OwnerGroupPathIDs string // 处理人组 Id 路径
DocumentOwnerID string // 起草人身份 Id(=实例发起人)
DocumentOwnerName string // 起草人姓名
DocumentGroupID string // 起草人组 Id
DocumentGroup string // 起草人组简称
DocumentGroupPaths string // 起草人组全称路径
DocumentGroupPathIDs string // 起草人组 Id 路径
SenderID string // 发送人身份 Id(=预生成记录 send_identity_id)
Sender string // 发送人姓名(=send_user_name)
SenderStepName string // 发送步骤名称(来源任务名)
SenderStepCode string // 发送步骤代号(来源任务 Key)
ConsignerID string // 受托人身份 Id(委托场景)
Consigner string // 受托人姓名
IsRead int // 是否已读:0 否、1 是
ReadTime *time.Time // 阅读时间
PlanFinishTime *time.Time // 计划办结时间
TaskReceiptTime *time.Time // 签收时间 = 任务创建时间
TaskStartTime *time.Time // 开始处理时间
IsDelay int // 是否延时:0 否、1 是
DelayTime *time.Time // 延时时间点
MessageGroupID string // 消息组 Id(同组待办联动删除)
ExtendFields // 通用扩展列透传
}
MessageExtend 是 workflow_task_message_extend(待办扩展,待办中心唯一数据源)的领域实体, 与 ACT_RU_TASK 1:1(task_id 唯一)。
type MessageExtendService ¶
type MessageExtendService struct {
// contains filtered or unexported fields
}
MessageExtendService 是待办扩展域服务(待办中心唯一数据源)。 行为规格对位 Java WorkflowTaskMessageExtendServiceImpl:任务级落库按(实例/任务/处理人) 幂等去重(saveMessageExtendInfo 的 count==0 语义);办结流转时先删待办、 由 HistoryExtendService 承接已办记录。
func NewMessageExtendService ¶
func NewMessageExtendService(store MessageExtendStore, c clock.Clock) *MessageExtendService
NewMessageExtendService 创建待办扩展域服务。 @param store 存储端口 @param c 时间源,nil 时回退真实时钟 @return 域服务
func (*MessageExtendService) CopyAsDelegate ¶
func (s *MessageExtendService) CopyAsDelegate(ctx context.Context, taskID, entrustID, entrustName string) (*MessageExtend, error)
CopyAsDelegate 复制待办为委托镜像(P4 委托域接入,镜像字段 entrust_* 随 P4 落地)。 @param ctx 操作上下文 @param taskID 任务 Id @param entrustID 受托人 Id @param entrustName 受托人姓名 @return 始终返回未实现错误 @return WORKFLOW-0501 错误
func (*MessageExtendService) CreateForTask ¶
func (s *MessageExtendService) CreateForTask(ctx context.Context, req *MessageCreateRequest) (*MessageExtend, error)
CreateForTask 为任务创建一条待办扩展(含业务字段与 extend 透传)。 按(任务)唯一键幂等:已存在时直接返回既有记录(Java count==0 才插入语义, DDL 上 task_id 唯一)。 @param ctx 操作上下文 @param req 待办扩展创建请求(必填 task_id/process_instance_id/owner_id/tenant_id) @return 落库后的待办扩展 @return 错误
func (*MessageExtendService) DeleteByBusinessID ¶
func (s *MessageExtendService) DeleteByBusinessID(ctx context.Context, businessID, tenantID string) error
DeleteByBusinessID 按业务单据与租户删除待办扩展。 @param ctx 操作上下文 @param businessID 业务单据 Id @param tenantID 租户 @return 错误
func (*MessageExtendService) DeleteByInstance ¶
func (s *MessageExtendService) DeleteByInstance(ctx context.Context, processInstanceID string) error
DeleteByInstance 按实例删除全部待办扩展(删除实例时级联清理)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 错误
func (*MessageExtendService) DeleteByProcessInstanceAndActivityIDs ¶
func (s *MessageExtendService) DeleteByProcessInstanceAndActivityIDs(ctx context.Context, processInstanceID string, stepCodes []string) error
DeleteByProcessInstanceAndActivityIDs 按实例与步骤代号集合删除待办扩展(退回/撤回清理)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param stepCodes 步骤代号集合 @return 错误
func (*MessageExtendService) DeleteByTaskID ¶
func (s *MessageExtendService) DeleteByTaskID(ctx context.Context, taskID string) error
DeleteByTaskID 按任务删除待办扩展(办结流转时调用)。 @param ctx 操作上下文 @param taskID 任务 Id @return 错误
func (*MessageExtendService) DeleteByTaskIDAndOwner ¶
func (s *MessageExtendService) DeleteByTaskIDAndOwner(ctx context.Context, taskID, ownerID string) error
DeleteByTaskIDAndOwner 按任务与处理人删除待办扩展。 @param ctx 操作上下文 @param taskID 任务 Id @param ownerID 处理人 Id @return 错误
func (*MessageExtendService) GetByTaskID ¶
func (s *MessageExtendService) GetByTaskID(ctx context.Context, taskID string) (*MessageExtend, bool, error)
GetByTaskID 按任务查询待办扩展。 @param ctx 操作上下文 @param taskID 任务 Id @return 待办扩展 @return 是否存在 @return 错误
func (*MessageExtendService) InstallDelegateHook ¶ added in v0.1.2
func (s *MessageExtendService) InstallDelegateHook(hook func(ctx context.Context, msg *MessageExtend) (*MessageExtend, error))
InstallDelegateHook 注入待办新建委托钩子(由装配层在 DelegateRuleService 构建后调用, 挂接 DelegateRuleService.onTodoCreate;重复注入覆盖旧钩子,nil 卸载)。 钩子契约:仅对新建待办触发一次;钩子内如重建待办(改派)必须保证重建行已带 ConsignerID 并在钩子入口跳过该类待办(对位 Java「不支持第三人再将工作委托」), 否则会因重建再次触发钩子造成递归。 @param hook 钩子函数:入参为已落库的待办,返回改派后的待办(未命中原样返回)与错误
func (*MessageExtendService) ListByBusinessID ¶
func (s *MessageExtendService) ListByBusinessID(ctx context.Context, businessID, tenantID string) ([]*MessageExtend, error)
ListByBusinessID 按业务单据与租户查询待办扩展(表单状态聚合数据源)。 @param ctx 操作上下文 @param businessID 业务单据 Id @param tenantID 租户 @return 列表 @return 错误
func (*MessageExtendService) ListByInstance ¶
func (s *MessageExtendService) ListByInstance(ctx context.Context, processInstanceID string) ([]*MessageExtend, error)
ListByInstance 查询实例下全部待办扩展。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 列表 @return 错误
func (*MessageExtendService) ListByOwner ¶
func (s *MessageExtendService) ListByOwner(ctx context.Context, ownerID, tenantID string, page PageQuery) (PageResult[*MessageExtend], error)
ListByOwner 按处理人分页查询待办(租户过滤,待办列表主查询)。 @param ctx 操作上下文 @param ownerID 处理人 Id @param tenantID 租户 @param page 分页参数 @return 分页结果 @return 错误
func (*MessageExtendService) SetPlanFinishTime ¶
func (s *MessageExtendService) SetPlanFinishTime(ctx context.Context, taskID string, planFinishTime *time.Time) error
SetPlanFinishTime 设置计划办结时间(nil 表示清空;催办/自动办结调度使用)。 @param ctx 操作上下文 @param taskID 任务 Id @param planFinishTime 计划办结时间 @return 错误
func (*MessageExtendService) UpdateDelay ¶
func (s *MessageExtendService) UpdateDelay(ctx context.Context, taskID string, delayTime time.Time) error
UpdateDelay 标记待办已延时并回写延时时间点(时间为零值时取当前时间)。 @param ctx 操作上下文 @param taskID 任务 Id @param delayTime 延时时间点 @return 错误
func (*MessageExtendService) UpdateRead ¶
func (s *MessageExtendService) UpdateRead(ctx context.Context, taskID, ownerID string, readTime time.Time) error
UpdateRead 标记待办已读并回写阅读时间(时间为零值时取当前时间)。 @param ctx 操作上下文 @param taskID 任务 Id @param ownerID 处理人 Id @param readTime 阅读时间 @return 错误
type MessageExtendStore ¶
type MessageExtendStore interface {
// Save 插入一条待办扩展(id 由调用方生成)。
Save(ctx context.Context, m *MessageExtend) error
// GetByTaskID 按任务 ID 查询待办扩展。
GetByTaskID(ctx context.Context, taskID string) (*MessageExtend, bool, error)
// ListByInstance 查询实例下全部待办扩展。
ListByInstance(ctx context.Context, processInstanceID string) ([]*MessageExtend, error)
// ListByBusinessID 按业务单据与租户查询待办扩展。
ListByBusinessID(ctx context.Context, businessID, tenantID string) ([]*MessageExtend, error)
// ListByOwner 按处理人分页查询待办扩展(租户过滤),返回当前页与总数。
ListByOwner(ctx context.Context, ownerID, tenantID string, page PageQuery) ([]*MessageExtend, int64, error)
// DeleteByTaskID 按任务删除待办扩展。
DeleteByTaskID(ctx context.Context, taskID string) error
// DeleteByTaskIDAndOwner 按任务与处理人删除待办扩展。
DeleteByTaskIDAndOwner(ctx context.Context, taskID, ownerID string) error
// DeleteByInstance 按实例删除全部待办扩展。
DeleteByInstance(ctx context.Context, processInstanceID string) error
// DeleteByBusinessID 按业务单据与租户删除待办扩展。
DeleteByBusinessID(ctx context.Context, businessID, tenantID string) error
// DeleteByProcessInstanceAndActivityIDs 按实例与步骤代号集合删除待办扩展(退回/撤回清理)。
DeleteByProcessInstanceAndActivityIDs(ctx context.Context, processInstanceID string, stepCodes []string) error
// UpdateRead 标记待办已读并回写阅读时间(按任务+处理人)。
UpdateRead(ctx context.Context, taskID, ownerID string, readTime time.Time) error
// UpdateDelay 标记待办已延时并回写延时时间点。
UpdateDelay(ctx context.Context, taskID string, delayTime time.Time) error
// SetPlanFinishTime 设置计划办结时间(nil 表示清空)。
SetPlanFinishTime(ctx context.Context, taskID string, planFinishTime *time.Time) error
}
MessageExtendStore 是待办扩展的存储端口。
type ModelCategory ¶
type ModelCategory struct {
BaseColumns
ResourceID string // resource_id 关联资源 ID
ModelName string // model_name 名称(分类页为分类名称)
ModelCode string // model_code 代号(模型=流程定义 key;分类=分类代号)
Tips string // tips 提示文案
Target string // target 打开目标(如 _blank)
Roles string // roles 角色配置(JSON 原文)
MenuIcon string // menu_icon 菜单图标
Remark string // remark 备注
Sort int // sort 排序号
ParentID string // parent_id 父分类 ID(根节点为空串)
Enable int // enable 启用(1 启用/0 停用)
ReturnSort int // return_sort 退回步骤排序开关
IsLeaf int // is_leaf 叶子标记
ProcessDefinitionKey string // process_definition_key 绑定流程定义 key
Visible int // visible 可见
EngineModelID string // model_id 引擎侧模型 ID(列名 model_id,避免与主键混淆改名)
LastDeployTime *time.Time // last_deploy_time 最近部署时间(nil 未部署)
}
ModelCategory 是 workflow_model 行实体(一表两用:流程分类与流程模型)。 分类与模型共用同一套列:分类节点的 model_code 为分类代号,模型节点的 model_code = 流程定义 key(租户内唯一,(model_code, tenant_id) 唯一索引)。
type ModelMetaService ¶
type ModelMetaService struct {
// contains filtered or unexported fields
}
ModelMetaService 读取部署定义的 BPMN 模型元数据。 全部经 api.RepositoryService().GetBpmnModel 走引擎内存权威模型,不自行解析 XML。
func NewModelMetaService ¶
func NewModelMetaService(engine api.Engine) *ModelMetaService
NewModelMetaService 构造模型元数据服务。 @param engine 引擎门面 @return 模型元数据服务
func (*ModelMetaService) FirstUserTask ¶
func (s *ModelMetaService) FirstUserTask(ctx context.Context, definitionID string) (*UserTaskMeta, error)
FirstUserTask 返回从开始事件可达的第一个用户任务。 穿无条件网关;遇条件网关无法静态判定时报错(应改用推演器)。 @param ctx 上下文 @param definitionID 流程定义 ID @return 元数据 @return 错误
func (*ModelMetaService) ListUserTaskMetas ¶
func (s *ModelMetaService) ListUserTaskMetas(ctx context.Context, definitionID string) ([]*UserTaskMeta, error)
ListUserTaskMetas 返回定义上全部用户任务元数据(按文档顺序,含子流程内节点)。 @param ctx 上下文 @param definitionID 流程定义 ID @return 元数据列表 @return 错误
func (*ModelMetaService) NodeExtensions ¶
func (s *ModelMetaService) NodeExtensions(ctx context.Context, definitionID, elementID string) (*model.ElementExtensions, error)
NodeExtensions 返回任意节点(含连线)的原始扩展属性。 @param ctx 上下文 @param definitionID 流程定义 ID @param elementID 元素 ID @return 扩展集合,无扩展时为 nil @return 元素不存在时返回错误
func (*ModelMetaService) UserTaskMeta ¶
func (s *ModelMetaService) UserTaskMeta(ctx context.Context, definitionID, activityID string) (*UserTaskMeta, error)
UserTaskMeta 返回指定定义上用户任务节点的元数据。 @param ctx 上下文 @param definitionID 流程定义 ID @param activityID 节点 ID(TaskDefinitionKey) @return 元数据 @return 节点不存在或不是用户任务时返回错误
type ModelMgmtStore ¶
type ModelMgmtStore interface {
// Insert 插入一条模型/分类(ID/审计列由调用方生成填充)。
// @param ctx 操作上下文
// @param m 实体(必填 id/tenant_id)
// @return 错误
Insert(ctx context.Context, m *ModelCategory) error
// Update 按主键更新整行业务列(主键与创建审计不参与更新)。
// @param ctx 操作上下文
// @param m 实体(必填 id)
// @return 错误(不存在时报未找到)
Update(ctx context.Context, m *ModelCategory) error
// GetByPK 按主键查询。
// @param ctx 操作上下文
// @param id 主键
// @return 实体
// @return 是否存在
// @return 查询错误
GetByPK(ctx context.Context, id string) (*ModelCategory, bool, error)
// GetByCode 按租户内模型代号(=流程定义 key 或分类代号)查询。
// @param ctx 操作上下文
// @param tenantID 租户
// @param modelCode 模型代号
// @return 实体
// @return 是否存在
// @return 查询错误
GetByCode(ctx context.Context, tenantID, modelCode string) (*ModelCategory, bool, error)
// ListByTenant 查询租户下全部模型与分类(按 sort 升序)。
// @param ctx 操作上下文
// @param tenantID 租户
// @return 实体列表(无记录返回空列表)
// @return 查询错误
ListByTenant(ctx context.Context, tenantID string) ([]*ModelCategory, error)
// UpdateLastDeployTime 回写模型最近部署时间(部署快照后调用)。
// @param ctx 操作上下文
// @param id 模型主键
// @param deployTime 部署时间
// @return 错误(不存在时报未找到)
UpdateLastDeployTime(ctx context.Context, id string, deployTime time.Time) error
// DeleteByIDs 按主键批量物理删除(缺失主键忽略)。
// @param ctx 操作上下文
// @param ids 主键集合
// @return 错误
DeleteByIDs(ctx context.Context, ids []string) error
}
ModelMgmtStore 是 workflow_model(模型/分类主数据)的存储端口。
type ModelService ¶
type ModelService struct {
// contains filtered or unexported fields
}
ModelService 是模型/分类管理域服务。
func NewModelService ¶
func NewModelService(store ModelMgmtStore, c clock.Clock) *ModelService
NewModelService 构造模型/分类管理服务。 @param store 模型存储端口 @param c 时间源,nil 时回退真实时钟 @return 模型服务
func (*ModelService) Add ¶
func (s *ModelService) Add(ctx context.Context, m *ModelCategory) (*ModelCategory, error)
Add 新增模型/分类(校验代号与租户、租户内代号唯一,补齐主键与审计列)。 @param ctx 操作上下文 @param m 模型数据(必填 model_code/tenant_id,主键留空自动生成) @return 落库后的模型实体 @return 错误
func (*ModelService) Delete ¶
func (s *ModelService) Delete(ctx context.Context, ids ...string) error
Delete 按主键批量删除(物理删除,语义取舍见本文件域服务段说明)。 @param ctx 操作上下文 @param ids 主键集合 @return 错误
func (*ModelService) Edit ¶
func (s *ModelService) Edit(ctx context.Context, m *ModelCategory) (*ModelCategory, error)
Edit 编辑模型/分类(保留创建审计与归属租户,刷新更新时间;代号变更需通过租户内查重)。 @param ctx 操作上下文 @param m 模型数据(必填主键) @return 编辑后的模型实体 @return 错误
func (*ModelService) GetByCode ¶
func (s *ModelService) GetByCode(ctx context.Context, tenantID, modelCode string) (*ModelCategory, bool, error)
GetByCode 按租户与代号取模型/分类。 @param ctx 操作上下文 @param tenantID 租户 @param modelCode 模型代号 @return 模型实体 @return 是否存在 @return 错误
func (*ModelService) GetByID ¶
func (s *ModelService) GetByID(ctx context.Context, id string) (*ModelCategory, bool, error)
GetByID 按主键查询模型/分类(部署链路按模型 Id 定位用)。 @param ctx 操作上下文 @param id 模型主键 @return 实体 @return 是否存在 @return 查询错误
func (*ModelService) List ¶
func (s *ModelService) List(ctx context.Context, tenantID string) ([]*ModelCategory, error)
List 查询租户下全部模型与分类(按 sort 升序平铺)。 @param ctx 操作上下文 @param tenantID 租户 @return 模型列表 @return 错误
func (*ModelService) Tree ¶
func (s *ModelService) Tree(ctx context.Context, tenantID string) ([]*ModelTreeNode, error)
Tree 输出租户下模型/分类树(根=父为空或父缺失;孤儿节点提升为根,成环节点不输出)。 @param ctx 操作上下文 @param tenantID 租户 @return 树根列表 @return 错误
type ModelStore ¶
type ModelStore interface {
// ReturnSortOf 读取定义 Key 对应模型的退回排序方式。
// 对位 Java getReturnSortByProcessDefinitionKey:模型缺失/字段为空/为 1 返回 true,
// 为 0 返回 false(true 时父链逆序输出,即最远祖先在前)。
// @param ctx 操作上下文
// @param processDefinitionKey 流程定义 Key
// @return 退回排序方式
// @return 查询错误
ReturnSortOf(ctx context.Context, processDefinitionKey string) (bool, error)
}
ModelStore 是流程模型主数据(workflow_model)的只读端口,供退回祖先链读取 returnSort(退回排序方式)。为 nil 时 BackNodes 跳过祖先链过滤(对位 Java 未启用模型主数据时的降级形态)。
type ModelTreeNode ¶
type ModelTreeNode struct {
Model *ModelCategory // 节点实体
Children []*ModelTreeNode // 子节点(按 sort 升序,同号按代号)
}
ModelTreeNode 是模型/分类树节点(Tree 输出)。
type MultiInstanceMemberPort ¶
type MultiInstanceMemberPort interface {
// AddMember 向多实例活动动态追加一个实例成员。
// @param ctx 操作上下文
// @param processInstanceID 流程实例 ID
// @param activityID 多实例活动 ID
// @param assignee 新成员身份 Id
// @return 错误
AddMember(ctx context.Context, processInstanceID, activityID, assignee string) error
// RemoveMember 移除多实例活动的一个实例成员。
// @param ctx 操作上下文
// @param executionID 被移除实例的执行 ID
// @param completed 移除时是否视作已完成(Java deleteMultiInstanceExecution 同名参数)
// @return 错误
RemoveMember(ctx context.Context, executionID string, completed bool) error
}
MultiInstanceMemberPort 是多实例动态成员的引擎端口(接口位)。 Java 原生能力为 runtimeService.addMultiInstanceExecution(nodeId, proInstId, {assignee}) / deleteMultiInstanceExecution(executionId, completed);Go 引擎 RuntimeService 暂无等价 API (P3-A 结论:引擎侧动态创建/销毁多实例子执行未实现),注入本端口可承接引擎侧能力, 未注入时仅做 workflow 侧 executorList/nrOfInstances 变量维护。
type MultiInstanceMeta ¶
type MultiInstanceMeta struct {
Sequential bool // 是否串行
Collection string // 集合表达式
ElementVariable string // 元素变量名
CompletionCondition string // 完成条件表达式
}
MultiInstanceMeta 是节点的多实例(会签)配置摘要。
type NextActivity ¶
type NextActivity struct {
BaseColumns // 公共审计列
NextActivityID string // 目标节点 ID(BPMN userTask id;流程结束为保留代号 end,end 不落库由调用方跳过)
GroupID string // 候选组 Id(同一候选组的多条记录共享,供组任务聚合)
IdentityID string // 处理人身份 Id
SendIdentityID string // 发送人身份 Id
SendUserName string // 发送人姓名
ProcessInstanceID string // 流程实例 Id
AgreeWeight *float64 // 同意权重(权重会签)
RejectWeight *float64 // 退回权重(权重会签)
Used int // 消耗标记:0 未消耗(待执行人重写)、1 已消耗
PreTaskID string // 来源任务 Id(产生该预生成的任务)
TaskID string // 消耗后回写的引擎任务 Id(ACT_RU_TASK.ID_)
Version int // 版本号:同实例同节点每预生成一轮 +1(按 his 表 used=1 记录的最大版本推算)
}
NextActivity 是 workflow_next_activity / workflow_his_next_activity 的领域实体 (两表列完全一致,His 双写共用同一结构)。 "预生成-消耗"模型:写操作预生成 used=0 记录,任务创建时执行人重写钩子 置 used=1 并回写 task_id;首步(saveFirstTaskUser)直接写 used=1 + taskId。
type NextActivityRequest ¶
type NextActivityRequest = api.NextActivityRequest
NextActivityRequest 下一步节点与处理人预存请求。
type NextActivitySaveRequest ¶
type NextActivitySaveRequest struct {
ProcessInstanceID string // 流程实例 Id
ActivityID string // 目标节点 ID(end 保留代号由调用方跳过,不落库)
IdentityIDs []string // 执行人身份 Id 列表(必填)
GroupIDs []string // 候选组 Id 列表:与 IdentityIDs 等长按下标配对,单值则全部共用,否则留空
PreTaskID string // 当前任务 Id(写入 pre_task_id)
SendIdentityID string // 发送人身份 Id
SendUserName string // 发送人姓名
TenantID string // 租户
Creator string // 创建人身份 Id(=operator)
}
NextActivitySaveRequest 是"同意/退回"方向的下一步预生成请求 (对位 Java saveAgreeNextActivity / saveBackToStepNextActivity:used=0、taskId 空、preTaskId=当前任务)。
type NextActivityService ¶
type NextActivityService struct {
// contains filtered or unexported fields
}
NextActivityService 是"下一步预生成-消耗"记账域服务。 行为规格对位 Java WorkflowNextActivityServiceImpl + ProcessesUtil#saveFirstTaskUserNextActivity:1142: 所有写操作先写 workflow_next_activity(used=0 预生成)并双写 workflow_his_next_activity, 任务创建时执行人重写钩子读 used=0 记录回填处理人并置 used=1、回写 task_id。 版本号语义:同实例同节点每预生成一轮 = 已消耗(used=1)最大版本 + 1 (Java getNextActivityLatestVersionByProcInstAndTaskKey 仅统计 used=1 记录)。
func NewNextActivityService ¶
func NewNextActivityService(store NextActivityStore, c clock.Clock) *NextActivityService
NewNextActivityService 创建下一步预生成域服务。 @param store 存储端口 @param c 时间源,nil 时回退真实时钟 @return 域服务
func (*NextActivityService) DeleteByProcessInstance ¶
func (s *NextActivityService) DeleteByProcessInstance(ctx context.Context, processInstanceID string) error
DeleteByProcessInstance 删除实例的全部运行态记录(删除实例/重置流程时调用)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 错误
func (*NextActivityService) DeleteByProcessInstanceAndActivityIDs ¶
func (s *NextActivityService) DeleteByProcessInstanceAndActivityIDs(ctx context.Context, processInstanceID string, activityIDs []string) error
DeleteByProcessInstanceAndActivityIDs 按实例与节点集合删除预生成记录(运行态+历史,退回/转办清理)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param activityIDs 节点 ID 集合 @return 错误
func (*NextActivityService) DeleteForBackToStep ¶
func (s *NextActivityService) DeleteForBackToStep(ctx context.Context, processInstanceID, activityID string) error
DeleteForBackToStep 退回清理:删除实例下目标节点(含已消耗)的全部运行态记录。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param activityID 目标节点 ID @return 错误
func (*NextActivityService) DeleteForResolve ¶
func (s *NextActivityService) DeleteForResolve(ctx context.Context, processInstanceID, activityID, taskID, identityID string) error
DeleteForResolve 处理委派清理:删除实例下指定节点+任务+执行人的记录。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param activityID 节点 ID @param taskID 任务 Id @param identityID 执行人 Id @return 错误
func (*NextActivityService) DeleteForRollback ¶
func (s *NextActivityService) DeleteForRollback(ctx context.Context, processInstanceID, preTaskID, keepActivityID string) error
DeleteForRollback 撤回清理:删除实例下以 preTaskID 为来源、目标节点之外的记录(仅运行态)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param preTaskID 来源任务 Id @param keepActivityID 保留的目标节点 ID @return 错误
func (*NextActivityService) GetFirstUnusedByActivity ¶
func (s *NextActivityService) GetFirstUnusedByActivity(ctx context.Context, processInstanceID, activityID string) (*NextActivity, bool, error)
GetFirstUnusedByActivity 按创建时间升序取实例下指定节点的第一条未消耗记录。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param activityID 节点 ID @return 记录 @return 是否存在 @return 错误
func (*NextActivityService) InsertDual ¶
func (s *NextActivityService) InsertDual(ctx context.Context, act *NextActivity, operator string) error
InsertDual 写入一条下一步记录并双写历史表。 version 为该实例该节点当前最大已消耗版本 + 1(调用方显式传入正数版本时尊重原值)。 @param ctx 操作上下文 @param act 下一步记录(必填 process_instance_id/next_activity_id/identity_id) @param operator 操作人身份 Id(写入 creator/updater) @return 错误
func (*NextActivityService) LatestVersion ¶
func (s *NextActivityService) LatestVersion(ctx context.Context, processInstanceID, taskKey string) (int, error)
LatestVersion 返回实例下指定节点当前最大已消耗版本号(无记录为 0)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param taskKey 节点 ID @return 最大版本号 @return 错误
func (*NextActivityService) ListByPreTask ¶
func (s *NextActivityService) ListByPreTask(ctx context.Context, preTaskID string) ([]*NextActivity, error)
ListByPreTask 查询以上一任务为来源的预生成记录(退回/撤回清理入口)。 @param ctx 操作上下文 @param preTaskID 上一任务 Id @return 记录列表 @return 错误
func (*NextActivityService) ListByTaskID ¶
func (s *NextActivityService) ListByTaskID(ctx context.Context, taskID string) ([]*NextActivity, error)
ListByTaskID 查询已挂到任务上的预生成记录。 @param ctx 操作上下文 @param taskID 任务 Id @return 记录列表 @return 错误
func (*NextActivityService) ListHisByInstance ¶
func (s *NextActivityService) ListHisByInstance(ctx context.Context, processInstanceID string) ([]*NextActivity, error)
ListHisByInstance 查询实例全部历史记录(轨迹回放,按版本升序)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 记录列表 @return 错误
func (*NextActivityService) ListHisByTaskID ¶
func (s *NextActivityService) ListHisByTaskID(ctx context.Context, taskID string) ([]*NextActivity, error)
ListHisByTaskID 查询历史表中任务相关且非自环的记录(撤回链路回溯)。 @param ctx 操作上下文 @param taskID 任务 Id @return 记录列表 @return 错误
func (*NextActivityService) ListUnusedByInstance ¶
func (s *NextActivityService) ListUnusedByInstance(ctx context.Context, processInstanceID string) ([]*NextActivity, error)
ListUnusedByInstance 查询实例下全部未消耗记录(执行人重写钩子读取)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 记录列表 @return 错误
func (*NextActivityService) ListUnusedByInstanceAndActivity ¶
func (s *NextActivityService) ListUnusedByInstanceAndActivity(ctx context.Context, processInstanceID, activityID string) ([]*NextActivity, error)
ListUnusedByInstanceAndActivity 查询实例下指定节点未消耗(used=0)的预生成记录。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param activityID 节点 ID @return 记录列表 @return 错误
func (*NextActivityService) MarkUsedAndWriteBack ¶
func (s *NextActivityService) MarkUsedAndWriteBack(ctx context.Context, ids []string, taskID string) error
MarkUsedAndWriteBack 置 used=1 并回写任务 ID(执行人重写钩子消耗入口,两套表同步)。 @param ctx 操作上下文 @param ids 记录 Id 集合 @param taskID 任务 Id @return 错误
func (*NextActivityService) SaveAgreeNext ¶
func (s *NextActivityService) SaveAgreeNext(ctx context.Context, req NextActivitySaveRequest) error
SaveAgreeNext 预存"同意"方向下一步(对位 Java saveAgreeNextActivity: used=0、taskId 空、preTaskId=当前任务;目标为保留代号 end 时由调用方跳过不落库)。 @param ctx 操作上下文 @param req 预存请求 @return 错误
func (*NextActivityService) SaveBackToStepNext ¶
func (s *NextActivityService) SaveBackToStepNext(ctx context.Context, req NextActivitySaveRequest) error
SaveBackToStepNext 预存"退回到指定步骤"方向下一步(对位 Java saveBackToStepNextActivity: used=0、taskId 空、preTaskId=当前任务,与同意预存同构,独立方法保持语义可追溯)。 @param ctx 操作上下文 @param req 预存请求 @return 错误
func (*NextActivityService) SaveFirstTaskUser ¶
func (s *NextActivityService) SaveFirstTaskUser(ctx context.Context, req FirstStepRequest) error
SaveFirstTaskUser 首步预生成(对位 Java publishAndGetFirstTaskByKey:1142 的 saveFirstTaskUserNextActivity:首步记录 used=1、taskId=首任务 ID、preTaskId 不设置; 版本号 = 已消耗最大版本 + 1)。 @param ctx 操作上下文 @param req 首步预生成请求 @return 错误
func (*NextActivityService) SaveResolveNext ¶
func (s *NextActivityService) SaveResolveNext(ctx context.Context, req ResolveNextSaveRequest) error
SaveResolveNext 预存"处理委派/还原"方向下一步(对位 Java saveResolveNextActivity: used=1、taskId=当前任务、groupId 继承既有记录;未找到既有记录时不落库,与 Java 一致)。 @param ctx 操作上下文 @param req 还原预存请求 @return 错误
type NextActivityStore ¶
type NextActivityStore interface {
// InsertDual 双写运行态与历史表(同 ID 同内容)。
InsertDual(ctx context.Context, act *NextActivity) error
// LatestVersion 返回实例下指定节点已消耗(used=1)记录的最大版本号,无记录返回 0。
LatestVersion(ctx context.Context, processInstanceID, nextActivityID string) (int, error)
// ListUnusedByInstanceAndActivity 查询实例下指定节点未消耗记录。
ListUnusedByInstanceAndActivity(ctx context.Context, processInstanceID, nextActivityID string) ([]*NextActivity, error)
// ListUnusedByInstance 查询实例下全部未消耗记录(执行人重写钩子读取)。
ListUnusedByInstance(ctx context.Context, processInstanceID string) ([]*NextActivity, error)
// GetFirstUnusedByActivity 按创建时间升序返回实例下指定节点的第一条未消耗记录。
GetFirstUnusedByActivity(ctx context.Context, processInstanceID, nextActivityID string) (*NextActivity, bool, error)
// ListByPreTask 查询以上一任务为来源的运行态记录。
ListByPreTask(ctx context.Context, preTaskID string) ([]*NextActivity, error)
// ListByTaskID 查询已挂到任务上的运行态记录。
ListByTaskID(ctx context.Context, taskID string) ([]*NextActivity, error)
// ListUsedByInstance 查询实例下已回写任务 ID 的记录(轨迹补全)。
ListUsedByInstance(ctx context.Context, processInstanceID string) ([]*NextActivity, error)
// MarkUsedAndWriteBack 置 used=1 并回写任务 ID(运行态与历史表同步,仅未消耗记录生效)。
MarkUsedAndWriteBack(ctx context.Context, ids []string, taskID string) error
// ListHisByInstance 查询实例的全部历史记录(轨迹回放,按版本升序)。
ListHisByInstance(ctx context.Context, processInstanceID string) ([]*NextActivity, error)
// ListHisByTaskID 查询历史表中任务相关且非自环(pre_task_id != taskID)的记录。
ListHisByTaskID(ctx context.Context, taskID string) ([]*NextActivity, error)
// DeleteByProcessInstance 删除实例的全部运行态记录。
DeleteByProcessInstance(ctx context.Context, processInstanceID string) error
// DeleteByProcessInstanceAndActivityIDs 删除实例下指定节点集合的运行态与历史记录。
DeleteByProcessInstanceAndActivityIDs(ctx context.Context, processInstanceID string, nextActivityIDs []string) error
// DeleteForBackToStep 退回清理:删除实例下目标节点(含已消耗)的全部记录。
DeleteForBackToStep(ctx context.Context, processInstanceID, nextActivityID string) error
// DeleteForRollback 撤回清理:删除实例下以 taskID 为来源、目标节点之外的记录(仅运行态,Java 语义)。
DeleteForRollback(ctx context.Context, processInstanceID, preTaskID, keepActivityID string) error
// DeleteForResolve 处理委派清理:删除实例下指定节点+任务+执行人的记录。
DeleteForResolve(ctx context.Context, processInstanceID, nextActivityID, taskID, identityID string) error
// FindAssignSource 按(实例/节点/发送人/任务)定位既有记录(转办/委派/还原继承组用)。
FindAssignSource(ctx context.Context, processInstanceID, nextActivityID, sendIdentityID, taskID string) (*NextActivity, bool, error)
}
NextActivityStore 是"下一步预生成-消耗"记账的存储端口(运行态 + 历史双写)。
type NextUserTaskView ¶
type NextUserTaskView struct {
ActivityID string // 节点 ID(保留代号 end 表示办结)
ActivityName string // 节点名称
ExecutorIDs []string // 执行人身份 Id 列表
ExecutorNames []string // 执行人姓名列表(与 ExecutorIDs 按下标对应,查不到回退 Id)
DynamicRoleIDs []string // 动态角色 Id 列表(需业务系统二次解析的角色,对应 Java dynamicRoles)
Sort int // 步骤排序号(his_step.sort,缺失为 0)
ReturnStep bool // 是否退回步骤(模式 1/3/4 的退回目标、模式 5 历史步骤均为 true)
}
NextUserTaskView 是下一步推演视图(对位 Java NextUserTaskVo 的数据面)。
type NopChannelProvider ¶
type NopChannelProvider struct{}
NopChannelProvider 是催办渠道来源的空实现(默认装配)。
func (NopChannelProvider) ChannelsOf ¶
func (NopChannelProvider) ChannelsOf(ctx context.Context, todo *MessageExtend) ([]string, error)
ChannelsOf 空实现:无渠道。 @param ctx 操作上下文 @param todo 待办扩展 @return 空渠道列表 @return 恒为 nil
type NopExceptionRecorder ¶
type NopExceptionRecorder struct{}
NopExceptionRecorder 是异常记录器的空实现(本阶段默认,P4 替换为 workflow_task_exception 仓储)。
func (NopExceptionRecorder) RecordCallbackException ¶
func (NopExceptionRecorder) RecordCallbackException(ctx context.Context, exception *CallbackException) error
RecordCallbackException 空实现:仅保证接口可用,不做任何持久化。 @param ctx 操作上下文 @param exception 异常记录 @return 恒为 nil
type NopScheduleRuleProvider ¶
type NopScheduleRuleProvider struct{}
NopScheduleRuleProvider 是步骤规则提供方的空实现(默认装配;规则数据接通前全部判空跳过)。
func (NopScheduleRuleProvider) AutoCompleteRuleOf ¶
func (NopScheduleRuleProvider) AutoCompleteRuleOf(ctx context.Context, stepCode string) (AutoCompleteRule, error)
AutoCompleteRuleOf 空实现:无自动办结规则。 @param ctx 操作上下文 @param stepCode 步骤代号 @return 零值规则 @return 恒为 nil
func (NopScheduleRuleProvider) RemindLimitOf ¶
func (NopScheduleRuleProvider) RemindLimitOf(ctx context.Context, stepCode string) (*float64, string, error)
RemindLimitOf 空实现:无时限配置。 @param ctx 操作上下文 @param stepCode 步骤代号 @return 恒为 nil @return 空单位 @return 恒为 nil
type Notifier ¶
type Notifier interface {
// Notify 送达一条催办通知。
// @param ctx 操作上下文
// @param notification 通知报文
// @return 错误
Notify(ctx context.Context, notification *RemindNotification) error
}
Notifier 是催办送达器端口(默认日志实现;P6 接真实消息渠道)。
type OperationRecord ¶
type OperationRecord struct {
BaseColumns // 公共审计列
BusinessID string // 业务单据 Id
TaskID string // 任务 Id
ProcessInstanceID string // 流程实例 Id
Message string // 操作说明(审批意见内容)
IsAgree *int // 是否同意:1 同意、0 不同意,nil 表示不适用
TaskStepCode string // 步骤代号(=任务 Key)
TaskStepName string // 步骤名称(=任务名)
FlowCategoryCode string // 流程分类代号 = 定义 Key
FlowCategoryName string // 流程分类名称 = 定义名称
OwnerID string // 处理人身份 Id
OwnerName string // 处理人姓名
OwnerGroup string // 处理人组简称
OwnerGroupID string // 处理人组 Id
OwnerGroupPaths string // 处理人组全称路径
OwnerGroupPathIDs string // 处理人组 Id 路径
DealTime *time.Time // 处理时间
TaskReceiptTime *time.Time // 签收时间(任务创建时间)
TaskStartTime *time.Time // 开始处理时间
TaskFinishTime *time.Time // 任务办结时间
Type string // 意见类型 CommentTypeEnum 代码(如 TJ/SP/TH)
}
OperationRecord 是 workflow_operation_record(操作记录/意见留痕)的领域实体。 type 取意见类型 CommentTypeEnum 代码;"可签名记录"只取 TJ/SP/TZ 三类。
type OperationRecordService ¶
type OperationRecordService struct {
// contains filtered or unexported fields
}
OperationRecordService 是操作记录(意见留痕)域服务。 行为规格对位 Java WorkflowOperationRecordServiceImpl#saveWorkflowOperationRecord:52: 请求仅携带任务/实例/处理人/意见,任务步骤、流程定义、业务键、租户、处理人姓名与组织 信息由服务经引擎查询补全;可签名记录只取 TJ/SP/TZ 三类。
func NewOperationRecordService ¶
func NewOperationRecordService(store OperationRecordStore, history TaskHistoryQuery, instances InstanceQuery, definitions DefinitionQuery, users UserQuery, c clock.Clock) *OperationRecordService
NewOperationRecordService 创建操作记录域服务。 @param store 存储端口 @param history 历史任务查询(engine.HistoryService()) @param instances 实例查询(engine.RuntimeService()/HistoryService()) @param definitions 定义查询(engine.RepositoryService()) @param users 身份查询(engine.IdentityService()) @param c 时间源,nil 时回退真实时钟 @return 域服务
func (*OperationRecordService) ListByBusinessIDs ¶
func (s *OperationRecordService) ListByBusinessIDs(ctx context.Context, businessIDs []string) ([]*OperationRecord, error)
ListByBusinessIDs 查询多个业务单据的操作记录(按处理时间升序)。 @param ctx 操作上下文 @param businessIDs 业务单据 Id 集合 @return 记录列表 @return 错误
func (*OperationRecordService) ListByInstance ¶
func (s *OperationRecordService) ListByInstance(ctx context.Context, processInstanceID string) ([]*OperationRecord, error)
ListByInstance 查询实例的操作记录(按处理时间升序)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 记录列表 @return 错误
func (*OperationRecordService) ListSignable ¶
func (s *OperationRecordService) ListSignable(ctx context.Context, businessIDs []string) ([]*OperationRecord, error)
ListSignable 查询"可签名"记录(type ∈ {TJ,SP,TZ} 且步骤代号非空)。 @param ctx 操作上下文 @param businessIDs 业务单据 Id 集合 @return 记录列表 @return 错误
func (*OperationRecordService) Save ¶
func (s *OperationRecordService) Save(ctx context.Context, req OperationRequest) (*OperationRecord, error)
Save 写入一条操作记录(按 Java saveWorkflowOperationRecord 语义补全可空字段)。 @param ctx 操作上下文 @param req 操作请求(ProcessInstanceID/OwnerID/Type 必填) @return 落库后的记录 @return 错误
type OperationRecordStore ¶
type OperationRecordStore interface {
// Save 插入一条操作记录(id 由调用方生成)。
Save(ctx context.Context, r *OperationRecord) error
// ListByTask 查询任务的操作记录(按处理时间升序)。
ListByTask(ctx context.Context, taskID string) ([]*OperationRecord, error)
// ListByInstance 查询实例的操作记录(按处理时间升序)。
ListByInstance(ctx context.Context, processInstanceID string) ([]*OperationRecord, error)
// ListByBusinessID 查询业务单据的操作记录(按处理时间升序)。
ListByBusinessID(ctx context.Context, businessID string) ([]*OperationRecord, error)
// ListByBusinessIDs 查询多个业务单据的操作记录(按处理时间升序)。
ListByBusinessIDs(ctx context.Context, businessIDs []string) ([]*OperationRecord, error)
// ListSignable 查询"可签名"记录:type ∈ {TJ,SP,TZ} 且步骤代号非空(Java getSignableOperationRecordListByBusinessIds)。
ListSignable(ctx context.Context, businessIDs []string) ([]*OperationRecord, error)
// CountByInstance 统计实例的操作记录数(状态机"未提交/流转中"判据)。
CountByInstance(ctx context.Context, processInstanceID string) (int, error)
// LastTypeByInstance 返回实例最后一条(按处理时间)操作记录的类型的类型代码,无记录返回空串。
LastTypeByInstance(ctx context.Context, processInstanceID string) (string, error)
}
OperationRecordStore 是操作记录(意见留痕)的存储端口。
type OperationRequest ¶
type OperationRequest struct {
TaskID string // 任务 Id(非空时补全任务步骤与签收/办结时间)
ProcessInstanceID string // 流程实例 Id(必填)
OwnerID string // 处理人身份 Id(必填,补全姓名与组织)
IsAgree *int // 是否同意:1/0,nil 不适用
Message string // 操作说明(审批意见内容)
Type string // 意见类型代码(必填,如 TJ/SP/TH)
}
OperationRequest 是写操作记录请求(对位 Java WorkflowOperationRecordRequest)。 任务/定义/业务/租户/处理人信息由服务经引擎查询补全(saveWorkflowOperationRecord 语义)。
type Option ¶
type Option func(*Options)
Option 是 workflow 服务选项函数。
func WithAdjacentActivitySameOwnerAutoComplete ¶
WithAdjacentActivitySameOwnerAutoComplete 设置相邻同人自动办结开关。 @param enabled 是否启用 @return 选项
func WithNoHandleAutoComplete ¶
WithNoHandleAutoComplete 设置超时无处理自动办结开关。 @param enabled 是否启用 @return 选项
func WithSQLStores ¶
WithSQLStores 切换 workflow 业务表存储为真实库行仓储。 @param store workflow 仓储入口(internal/persistence/workflow.New) @param db 独立数据库连接,可为 nil(使用 store 自带连接) @return 选项
func WithSendTodoRemind ¶
WithSendTodoRemind 设置发送待办提醒开关。 @param enabled 是否启用 @return 选项
func WithSendWorkflowRemind ¶
WithSendWorkflowRemind 设置发送流程提醒开关。 @param enabled 是否启用 @return 选项
func WithTaskTimeoutRemind ¶
WithTaskTimeoutRemind 设置任务超时提醒开关。 @param enabled 是否启用 @return 选项
type Options ¶
type Options struct {
// NoHandleAutoComplete 调度开关:超时无处理自动办结。
NoHandleAutoComplete bool
// TaskTimeoutRemind 调度开关:任务超时提醒。
TaskTimeoutRemind bool
// SendWorkflowRemind 调度开关:发送流程提醒。
SendWorkflowRemind bool
// SendTodoRemind 调度开关:发送待办提醒。
SendTodoRemind bool
// AdjacentActivitySameOwnerAutoComplete 调度开关:相邻节点同人自动办结。
AdjacentActivitySameOwnerAutoComplete bool
// Clock 时钟注入(调度与测试用),nil 时使用 clock.Real。
Clock clock.Clock
// contains filtered or unexported fields
}
Options 是 workflow 服务的配置选项(调度开关与注入点,对位 Java application-dev.yml 业务开关,默认全 false)。 行仓储(internal/persistence/workflow 适配器)与回调配置在 P1 阶段接入本结构。
type PageResult ¶
type PageResult[T any] struct { Data []T `json:"data"` // 当前页数据 Total int64 `json:"total"` // 总条数 Start int `json:"start"` // 偏移量 Size int `json:"size"` // 每页数量 }
PageResult 是 workflow 分页结果,字段对齐 Java PageUtil 的公共分页语义。
type PercentReturnRule ¶
type PercentReturnRule struct {
CountersignPercentReturn bool // 是否启用比例退回
ReturnPercent *float64 // 退回比例(百分数,0-100)
}
PercentReturnRule 是节点的会签比例退回规则(对位 his_step.countersignPercentReturn/returnPercent)。
type ProcessInstanceView ¶
type ProcessInstanceView struct {
ProcessInstanceID string // 实例 ID
ProcessDefinitionKey string // 流程定义 Key
ProcessDefinitionID string // 流程定义 ID
Title string // 实例标题(=实例名称)
BusinessID string // 业务单据 Id(=businessKey)
StartUserID string // 发起人身份 Id
StartTime time.Time // 发起时间
EndTime *time.Time // 结束时间,运行中为空
Status int // 状态:0 运行中 / 1 已完成 / 2 已终止
CurrentStep string // 当前待办步骤聚合(document.flow_action)
CurrentPersons string // 当前待办人聚合(document.flow_current_persons)
}
ProcessInstanceView 是流程实例列表视图(字段对位调研 005 §1.1 instance/list)。
type QueryService ¶
type QueryService struct {
// contains filtered or unexported fields
}
QueryService 是待办/已办/任务/实例查询门面(P1.8)。 数据契约:待办以 workflow_task_message_extend 为唯一数据源、已办以 workflow_task_history_extend 为唯一数据源,引擎任务/历史任务仅作实时状态联查补齐; 实例列表经引擎历史实例查询,状态经 document 状态机映射(0/1/2)。
func NewQueryService ¶
func NewQueryService(engine api.Engine, messages *MessageExtendService, histories *HistoryExtendService, operations *OperationRecordService, documents *DocumentService) *QueryService
NewQueryService 创建查询门面服务。 @param engine 引擎门面(七服务) @param messages 待办扩展域服务 @param histories 已办扩展域服务 @param operations 操作记录域服务 @param documents 业务表单状态域服务 @return 查询门面
func (*QueryService) AllInstanceList ¶
func (s *QueryService) AllInstanceList(ctx context.Context, query PageQuery) (PageResult[*ProcessInstanceView], error)
AllInstanceList 分页查询全部流程实例(含运行中与已结束)。 @param ctx 操作上下文 @param query 分页参数 @return 分页实例视图 @return 错误
func (*QueryService) DoneListByIdentityID ¶
func (s *QueryService) DoneListByIdentityID(ctx context.Context, identityID string, query PageQuery) (PageResult[*DoneTaskView], error)
DoneListByIdentityID 按身份 Id 分页查询已办任务(HistoryExtendService.ListByOwner + 引擎历史任务联查)。 @param ctx 操作上下文 @param identityID 身份 Id @param query 分页参数 @return 分页视图 @return 错误
func (*QueryService) InstanceListByUser ¶
func (s *QueryService) InstanceListByUser(ctx context.Context, userID string, query PageQuery) (PageResult[*ProcessInstanceView], error)
InstanceListByUser 按用户分页查询流程实例(用户发起的实例;参与的实例经待办/已办列表呈现)。 @param ctx 操作上下文 @param userID 用户身份 Id @param query 分页参数 @return 分页实例视图 @return 错误
func (*QueryService) SignableOperationRecords ¶
func (s *QueryService) SignableOperationRecords(ctx context.Context, businessIDs []string) ([]*OperationRecord, error)
SignableOperationRecords 查询"可签名"操作记录(type ∈ {TJ,SP,TZ} 且步骤代号非空,透传端口)。 @param ctx 操作上下文 @param businessIDs 业务单据 Id 集合 @return 记录列表 @return 错误
func (*QueryService) TaskHistoryListByBusinessID ¶
func (s *QueryService) TaskHistoryListByBusinessID(ctx context.Context, tenantID, businessID string) ([]*HistoryExtend, error)
TaskHistoryListByBusinessID 按业务单据查询已办扩展列表。 @param ctx 操作上下文 @param tenantID 租户(业务系统代号) @param businessID 业务单据 Id @return 已办扩展列表 @return 错误
func (*QueryService) TaskHistoryListByInstance ¶
func (s *QueryService) TaskHistoryListByInstance(ctx context.Context, processInstanceID string) ([]*HistoryExtend, error)
TaskHistoryListByInstance 按流程实例查询已办扩展列表(轨迹聚合)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 已办扩展列表 @return 错误
func (*QueryService) TaskHistoryListByTaskID ¶
func (s *QueryService) TaskHistoryListByTaskID(ctx context.Context, taskID string) (*HistoryExtend, error)
TaskHistoryListByTaskID 按任务查询已办扩展记录(无记录返回 nil)。 @param ctx 操作上下文 @param taskID 任务 Id @return 已办扩展,不存在为 nil @return 错误
func (*QueryService) TaskInfoByTaskID ¶
func (s *QueryService) TaskInfoByTaskID(ctx context.Context, taskID string) (*TaskInfoView, error)
TaskInfoByTaskID 按任务 ID 查询任务详情(引擎任务 + workflow 扩展列)。 @param ctx 操作上下文 @param taskID 任务 Id @return 任务详情视图 @return 错误(任务不存在)
func (*QueryService) TaskMessageListByBusinessID ¶
func (s *QueryService) TaskMessageListByBusinessID(ctx context.Context, tenantID, businessID string) ([]*MessageExtend, error)
TaskMessageListByBusinessID 按业务单据查询待办扩展列表。 @param ctx 操作上下文 @param tenantID 租户(业务系统代号) @param businessID 业务单据 Id @return 待办扩展列表 @return 错误
func (*QueryService) TodoListByIdentityID ¶
func (s *QueryService) TodoListByIdentityID(ctx context.Context, identityID string, query PageQuery) (PageResult[*TodoTaskView], error)
TodoListByIdentityID 按身份 Id 分页查询待办任务(MessageExtendService.ListByOwner + 引擎任务联查)。 @param ctx 操作上下文 @param identityID 身份 Id @param query 分页参数 @return 分页视图 @return 错误
type Remind ¶
type Remind struct {
ID string // 主键
Creator string // 创建人
CreateTime time.Time // 创建时间
Updater string // 更新人
UpdateTime time.Time // 更新时间
TenantID string // 租户
PID string // 模型 Id(→ workflow_model.id)
StepIDs string // 步骤 Id 逗号串(白名单;空表示无可催步骤,Java 同款跳过)
EnablePre int // 启用预警:0/1
EnablePost int // 启用延时:0/1
Sent int // 已发送:0 未发送、1 已发送
Deleted int // 逻辑删除:0 正常、1 已删除
Targets []*RemindTarget // 级联对象(Get 时填充)
}
Remind 是 workflow_remind(催办配置主表)的领域实体 (不继承 BaseEntity,自带 creator/create_time/deleted,docs 003 §3.18)。
type RemindHit ¶
type RemindHit struct {
Remind *Remind // 催办配置
Target *RemindTarget // 命中的催办对象
Todo *MessageExtend // 命中的待办
Channels []string // 渠道(渠道提供方注入)
Kind string // 类别(预警提醒/延迟提醒/手动催办)
Content string // 建议内容(Java sendToUser 同款格式)
}
RemindHit 是一次催办命中(判定结果,供调度器送达与标记)。
type RemindInstanceContext ¶
type RemindInstanceContext struct {
Todo *MessageExtend // 当前待办(-1111 展开为当前待办人)
Initiator string // 发起人(${initiator} 展开)
}
RemindInstanceContext 是催办对象展开的实例上下文。
type RemindNotification ¶
type RemindNotification struct {
ReceiverID string // 接收人 Id
ReceiverName string // 接收人姓名
Subject string // 主题(=待办标题)
Content string // 内容(Java sendToUser 同款格式)
Channels []string // 渠道列表(渠道提供方注入)
Kind string // 类别(预警提醒/延迟提醒/任务超时提醒/手动催办)
}
RemindNotification 是一次催办送达的报文(Notifier 消费)。
type RemindSaveRequest ¶
type RemindSaveRequest struct {
Remind *Remind // 主表数据(必填 PID)
Targets []*RemindTarget // 对象列表;Add 时为空则生成默认"当前处理人"(-1111)预警行
ReplaceStepIDs bool // Update 时白名单允许清空(true 表示用 Remind.StepIDs 覆盖,含清空)
}
RemindSaveRequest 是催办配置保存请求(Add/Update 共用)。
type RemindService ¶
type RemindService struct {
// contains filtered or unexported fields
}
RemindService 是催办域服务:配置维护、对象展开、到期扫描与手动催办。
func NewRemindService ¶
func NewRemindService(reminds RemindStore, targets RemindTargetStore, todos TodoSource, rules ScheduleRuleProvider, channels ChannelProvider, resolver StepResolver, members RoleMemberLookup, vars InstanceVariableSource, c clock.Clock) *RemindService
NewRemindService 创建催办域服务。 @param reminds 催办配置存储 @param targets 催办对象存储 @param todos 待办数据源 @param rules 步骤规则提供方,nil 时使用空实现 @param channels 渠道提供方,nil 时使用空实现 @param resolver 步骤代号解析(可 nil,按代号直匹配) @param members 角色成员查询(可 nil,角色对象展开为空) @param vars 流程变量读取(可 nil,${initiator} 展开为空) @param c 时间源,nil 时回退真实时钟 @return 域服务
func (*RemindService) Add ¶
func (s *RemindService) Add(ctx context.Context, req RemindSaveRequest) (*Remind, error)
Add 新增催办配置(pid + 步骤白名单 + 对象列表;对象缺省生成 -1111 当前处理人预警行)。 @param ctx 操作上下文 @param req 保存请求 @return 落库后的催办配置 @return 错误
func (*RemindService) Deliver ¶
func (s *RemindService) Deliver(ctx context.Context, hit *RemindHit, notifier Notifier) (int, error)
Deliver 送达一次命中:展开对象 → 逐用户通知 → 落发送/重试标记(对位 Java sendToUser + updateSendWithReception + updateRetryCount)。 @param ctx 操作上下文 @param hit 命中 @param notifier 送达器 @return 实际送达用户数 @return 错误
func (*RemindService) ExpandTargets ¶
func (s *RemindService) ExpandTargets(ctx context.Context, target *RemindTarget, instance *RemindInstanceContext) []string
ExpandTargets 展开催办对象为具体用户 Id 列表(对位 Java updateRoleRemind:268 的执行者解析段): -1111 → 当前待办人;${initiator} → 流程发起人;角色对象 → 静态组成员;其余按字面用户。 动态角色 PATH 取值本阶段留接口位(RoleMemberLookup 注释与报告说明,主控后续接线)。 @param ctx 操作上下文 @param target 催办对象 @param instance 实例上下文(当前待办 + 发起人) @return 具体用户 Id 列表(保持展开顺序,去重)
func (*RemindService) Get ¶
Get 查询催办配置(主表 + 启用对象级联,服务层聚合两表)。 @param ctx 操作上下文 @param id 配置 Id @return 催办配置 @return 是否存在 @return 错误
func (*RemindService) List ¶
func (s *RemindService) List(ctx context.Context, modelID string, page PageQuery) (PageResult[*Remind], error)
List 按模型分页查询催办配置(deleted=0)。 @param ctx 操作上下文 @param modelID 模型 Id @param page 分页参数 @return 分页结果 @return 错误
func (*RemindService) Remove ¶
func (s *RemindService) Remove(ctx context.Context, id string) error
Remove 按主键逻辑删除催办配置。 @param ctx 操作上下文 @param id 配置 Id @return 错误
func (*RemindService) RemoveBatch ¶
func (s *RemindService) RemoveBatch(ctx context.Context, ids []string) error
RemoveBatch 批量逻辑删除催办配置。 @param ctx 操作上下文 @param ids 配置 Id 列表 @return 错误
func (*RemindService) ScanDue ¶
ScanDue 扫描到期催办(对位 Java ReminderSchedule#updateWithCheckWorkflowReminds:92 判定段): 预警型 dueTime-duration<=now(或计划完成时间);延时型 dueTime+duration<=now 或按任务接收时间; 步骤白名单过滤(白名单为空跳过,Java 同款);已发送对象按重试配置门槛过滤。 @param ctx 操作上下文 @param now 当前时间 @return 命中列表 @return 错误
func (*RemindService) SendNow ¶
SendNow 手动催办(查待办 → 命中该任务步骤的催办配置 → 即时产生命中,不落发送标记)。 @param ctx 操作上下文 @param taskID 任务 Id @return 命中列表 @return 错误
func (*RemindService) Update ¶
func (s *RemindService) Update(ctx context.Context, req RemindSaveRequest) (*Remind, error)
Update 更新催办配置(主表更新 + 对象先删后增)。 @param ctx 操作上下文 @param req 保存请求(Remind.ID 必填) @return 更新后的催办配置 @return 错误
type RemindStore ¶
type RemindStore interface {
// Save 插入或更新催办配置。
// @param ctx 操作上下文
// @param remind 催办配置(必填 PID)
// @return 错误
Save(ctx context.Context, remind *Remind) error
// Get 按主键查询催办配置(级联对象)。
// @param ctx 操作上下文
// @param id 催办配置 Id
// @return 催办配置
// @return 是否存在
// @return 错误
Get(ctx context.Context, id string) (*Remind, bool, error)
// ListByModel 查询模型下的催办配置(deleted=0)。
// @param ctx 操作上下文
// @param modelID 模型 Id
// @return 配置列表
// @return 错误
ListByModel(ctx context.Context, modelID string) ([]*Remind, error)
// ListActive 查询全部未删除配置(手动催办数据源)。
// @param ctx 操作上下文
// @return 配置列表
// @return 错误
ListActive(ctx context.Context) ([]*Remind, error)
// ListNotSent 查询未发送且未删除的配置(扫描数据源,Java getWorkflowRemindNotSent)。
// @param ctx 操作上下文
// @return 配置列表
// @return 错误
ListNotSent(ctx context.Context) ([]*Remind, error)
// MarkSent 标记配置已发送。
// @param ctx 操作上下文
// @param id 催办配置 Id
// @return 错误
MarkSent(ctx context.Context, id string) error
// MarkDeleted 按主键逻辑删除。
// @param ctx 操作上下文
// @param id 催办配置 Id
// @return 错误
MarkDeleted(ctx context.Context, id string) error
// MarkDeletedByIDs 批量逻辑删除。
// @param ctx 操作上下文
// @param ids 催办配置 Id 列表
// @return 错误
MarkDeletedByIDs(ctx context.Context, ids []string) error
}
RemindStore 是催办配置主表的存储端口。
type RemindTarget ¶
type RemindTarget struct {
ID string // 主键
Creator string // 创建人
CreateTime time.Time // 创建时间
TenantID string // 租户
PID string // 催办配置 Id(→ workflow_remind.id)
ExecutorID string // 执行者(用户 Id / 角色 Id / -1111 / ${initiator})
Enable int // 启用:0/1
Name string // 对象名称
TargetType int // 对象类型:1 用户、2 角色
Type int // 催办类型:1 预警、2 延时
Retry int // 是否重试:0/1
RetryDuration float64 // 重试间隔
RetryTimes int // 重试次数上限
RetryCount int // 已重试次数
RetryTimeUnit string // 重试间隔单位
Ahead float64 // 提前量(预警型)
Delay float64 // 延迟量(延时型)
TimeUnit string // 时间单位(天/小时/分钟)
ByPlanCompleteTime int // 按计划完成时间判定:0/1
Removable int // 可移除标记:0/1
Sent int // 已发送:0/1
Deleted int // 逻辑删除:0/1
}
RemindTarget 是 workflow_remind_target(催办对象)的领域实体。
type RemindTargetStore ¶
type RemindTargetStore interface {
// Save 插入催办对象。
// @param ctx 操作上下文
// @param target 催办对象(必填 PID)
// @return 错误
Save(ctx context.Context, target *RemindTarget) error
// ListByRemind 查询配置的启用对象列表(enable=1 & deleted=0)。
// @param ctx 操作上下文
// @param remindID 催办配置 Id
// @return 对象列表
// @return 错误
ListByRemind(ctx context.Context, remindID string) ([]*RemindTarget, error)
// DeleteByRemind 删除配置的全部对象(配置重建时先删后增)。
// @param ctx 操作上下文
// @param remindID 催办配置 Id
// @return 错误
DeleteByRemind(ctx context.Context, remindID string) error
// MarkSent 标记对象已发送。
// @param ctx 操作上下文
// @param id 对象 Id
// @return 错误
MarkSent(ctx context.Context, id string) error
// UpdateRetryCount 回写重试计数。
// @param ctx 操作上下文
// @param id 对象 Id
// @param count 新计数
// @return 错误
UpdateRetryCount(ctx context.Context, id string, count int) error
}
RemindTargetStore 是催办对象表的存储端口。
type ResetService ¶
type ResetService struct {
// contains filtered or unexported fields
}
ResetService 是流程重置域服务(P2 波2-B)。 引擎级重置(清场全部活动任务并把执行迁回首节点)已由 api.WorkflowExtService().ResetProcess 承载,本服务负责校验、首步执行人重建与收尾账务。
func NewResetService ¶
func NewResetService(engine api.Engine, meta *ModelMetaService, next *NextActivityService, comments *CommentService, operations *OperationRecordService, messages *MessageExtendService, histories *HistoryExtendService, documents *DocumentService, c clock.Clock) *ResetService
NewResetService 创建流程重置域服务。 @param engine 引擎门面(七服务) @param meta 模型元数据服务 @param next 下一步预生成域服务 @param comments 审批意见服务 @param operations 操作记录服务 @param messages 待办扩展服务 @param histories 已办扩展服务 @param documents 业务表单状态服务 @param c 时间源,nil 时回退真实时钟 @return 重置域服务
func (*ResetService) Reset ¶
func (s *ResetService) Reset(ctx context.Context, processInstanceID, operator string) error
Reset 重置流程实例(对位 Java doResetProcess:3766)。 链路:入参校验 → 实例运行中校验 → 活动任务存在校验 → 引擎软回首 → 收尾(LCCZ 意见/操作记录 → next_activity 双表清理 → 待办与已办清理 → 首步执行人重建(used=1 预生成)→ 首任务待办/已办镜像重建 → document 刷新)。 与 Java 的对照差异:
- Java 按任务循环逐个 BackUserTaskCmd 迁移并逐任务写意见/记录;Go 引擎 ResetProcess 单命令完成全部执行迁移,故意见/操作记录收敛为一条(任务列取重置前首任务)。
- Java 按推演 actIds 清理 next_activity/待办/已办;Go 语义为"重置后全量预存与 扩展台账全部过期",故按实例全量清理(净效果等价,覆盖并行多分支场景)。
- Java 重置后不重建首任务待办(历史缺口);Go 补建待办与已办镜像, 保证重置后待办中心可用(与发起链落位一致)。
@param ctx 操作上下文 @param processInstanceID 流程实例 Id @param operator 操作人身份 Id @return 错误
type ResolveNextSaveRequest ¶
type ResolveNextSaveRequest struct {
ProcessInstanceID string // 流程实例 Id
ActivityID string // 目标节点 ID
IdentityIDs []string // 执行人身份 Id 列表(必填)
TaskID string // 当前任务 Id(写入 task_id 与匹配条件)
SendIdentityID string // 发送人身份 Id(与既有记录匹配条件之一)
SendUserName string // 发送人姓名
TenantID string // 租户
Creator string // 创建人身份 Id(=operator)
}
ResolveNextSaveRequest 是"委派处理/转办还原"方向的下一步预生成请求 (对位 Java saveResolveNextActivity:used=1、taskId=当前任务、groupId 继承既有记录)。
type ResolveTaskRequest ¶
type ResolveTaskRequest struct {
TaskID string // 任务 Id(必填)
UserCode string // 操作人身份 Id(空时按任务所有者留痕)
Message string // 归还意见(必填)
Type string // 意见类型代码,空时默认 SP
Variables map[string]any // 任务局部变量(对位 Activiti resolveTask(taskId, variables),可空)
}
ResolveTaskRequest 是归还(处理委派)请求(对位 Java ProcessesUtil#resolveTask:2318)。
type ReviewTask ¶
type ReviewTask struct {
BaseColumns // 公共审计列
StartTime time.Time // 影子任务生成时间(start_time)
TaskID string // 关联引擎任务 Id(ACT_RU_TASK.ID_)
TaskName string // 任务名称
ProcessInstanceID string // 流程实例 Id
ProcessDefinitionID string // 流程定义 Id
TaskKey string // 任务节点 ID(BPMN userTask id)
BusinessKey string // 业务键(=实例 businessKey)
ProcessName string // 实例名称(列 process_name 与 process_definition_name 区分)
ProcessDefinitionKey string // 流程定义 Key
ProcessDefinitionName string // 流程定义名称
SenderID string // 发送人身份 Id(sender 列,对齐 creator/creator_name 的"值/名"约定)
SenderName string // 发送人姓名(sender_name 列)
Reviewer string // 审阅人身份 Id(org/role 未解析时保留原组/角色值)
ReviewTime *time.Time // 审阅时间(办结回写)
Remark string // 备注
Opinion string // 审阅意见(办结回写)
Status int // 状态:0 待审阅、1 已办结、2 待解析(ReviewStatus* 常量)
}
ReviewTask 是 workflow_review_task(审阅/知会影子任务)的领域实体。 影子任务与引擎任务 1:N:同一任务节点按审阅人绑定展开出 N 条审阅记录, 幂等键为(task_id + reviewer)。
type ReviewTaskService ¶
type ReviewTaskService struct {
// contains filtered or unexported fields
}
ReviewTaskService 是审阅/知会影子任务域服务(P5-B,对位 Java workflow_review_task 同步与办结语义): 任务到达绑定节点时按 workflow_act_extend 审阅人配置生成影子任务(幂等), 审阅人办结时回写意见与状态;org/role 绑定经身份服务展开成员。
func NewReviewTaskService ¶
func NewReviewTaskService(engine api.Engine, tasks ReviewTaskStore, extends ActExtendStore, c clock.Clock) *ReviewTaskService
NewReviewTaskService 创建审阅影子任务域服务。 @param engine 引擎门面(七服务,org/role 展开与实例信息查询依赖;nil 时仅 person 绑定同步不可用) @param tasks 影子任务存储端口 @param extends 审阅人绑定存储端口 @param c 时间源,nil 时回退真实时钟 @return 域服务
func (*ReviewTaskService) Complete ¶
func (s *ReviewTaskService) Complete(ctx context.Context, reviewTaskID, opinion, operator string) (*ReviewTask, error)
Complete 办结审阅:回写审阅时间/意见/状态(status=已办结)。 @param ctx 操作上下文 @param reviewTaskID 审阅影子任务 Id @param opinion 审阅意见 @param operator 操作人身份 Id(回写 updater,可空) @return 办结后的影子任务 @return 错误
func (*ReviewTaskService) CountUnreadByReviewer ¶
func (s *ReviewTaskService) CountUnreadByReviewer(ctx context.Context, reviewer, tenantID string) (int64, error)
CountUnreadByReviewer 统计审阅人的待审阅数(status=待审阅)。 @param ctx 操作上下文 @param reviewer 审阅人 Id @param tenantID 租户 @return 待审阅数 @return 错误
func (*ReviewTaskService) Get ¶
func (s *ReviewTaskService) Get(ctx context.Context, reviewTaskID string) (*ReviewTask, bool, error)
Get 按主键查询审阅影子任务。 @param ctx 操作上下文 @param reviewTaskID 影子任务 Id @return 影子任务 @return 是否存在 @return 错误
func (*ReviewTaskService) ListByInstance ¶
func (s *ReviewTaskService) ListByInstance(ctx context.Context, processInstanceID string) ([]*ReviewTask, error)
ListByInstance 查询实例下全部审阅影子任务(按生成时间升序)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 列表 @return 错误
func (*ReviewTaskService) ListByReviewer ¶
func (s *ReviewTaskService) ListByReviewer(ctx context.Context, reviewer, tenantID string, page PageQuery) (PageResult[*ReviewTask], error)
ListByReviewer 按审阅人分页查询影子任务(租户过滤,审阅人待办/已办列表主查询)。 @param ctx 操作上下文 @param reviewer 审阅人 Id @param tenantID 租户 @param page 分页参数 @return 分页结果 @return 错误
func (*ReviewTaskService) SyncForTask ¶
func (s *ReviewTaskService) SyncForTask(ctx context.Context, task *api.Task, senderID, senderName string) ([]*ReviewTask, error)
SyncForTask 为任务节点同步生成审阅影子任务(幂等)。 流程:定义解析 → 读取 act_extend 审阅人绑定 → 逐绑定解析审阅人(person 直用; org/role 经 IdentityService.ListMembers 展开,展开失败保留原值并置待解析)→ 按(task_id + reviewer)幂等插入。 @param ctx 操作上下文 @param task 引擎任务(必填 id/process_instance_id/task_definition_key) @param senderID 发送人身份 Id @param senderName 发送人姓名 @return 本次新生成的影子任务列表(节点无绑定为空列表) @return 错误
type ReviewTaskStore ¶
type ReviewTaskStore interface {
// Insert 插入一条审阅影子任务(id 由调用方生成)。
Insert(ctx context.Context, rt *ReviewTask) error
// Get 按主键查询审阅影子任务。
Get(ctx context.Context, id string) (*ReviewTask, bool, error)
// Update 办结回写:按主键回写可变列(status/opinion/review_time/remark/updater/update_time)。
Update(ctx context.Context, rt *ReviewTask) error
// ListByReviewer 按审阅人分页查询(租户过滤,空租户不过滤),按 start_time 升序,返回当前页与总数。
ListByReviewer(ctx context.Context, reviewer, tenantID string, page PageQuery) ([]*ReviewTask, int64, error)
// ListByInstance 查询实例下全部审阅影子任务(按创建时间升序)。
ListByInstance(ctx context.Context, processInstanceID string) ([]*ReviewTask, error)
// DeleteByInstance 删除实例下全部审阅影子任务(实例级联清理)。
DeleteByInstance(ctx context.Context, processInstanceID string) error
// CountUnread 统计审阅人的待审阅数(status=待审阅,租户过滤)。
CountUnread(ctx context.Context, reviewer, tenantID string) (int64, error)
}
ReviewTaskStore 是审阅影子任务的存储端口。
type RoleMemberLookup ¶
type RoleMemberLookup interface {
// ListMembers 返回角色(组)成员用户列表。
// @param ctx 操作上下文
// @param groupID 角色/组 Id
// @return 用户列表
// @return 错误
ListMembers(ctx context.Context, groupID string) ([]api.User, error)
}
RoleMemberLookup 是角色成员查询端口(静态角色展开,api.IdentityService 子集; 动态角色 PATH 取值本阶段留接口位:由主控在 P6 前接入取值范围 SQL 执行器)。
type RollbackService ¶
type RollbackService struct {
// contains filtered or unexported fields
}
RollbackService 是撤回域服务(P2 波2-B)。 引擎级撤回(工厂判定/后继任务与历史清理/ROLLBACK_* 变量)已由 api.WorkflowExtService().RollbackTask 承载,本服务只做前置校验与收尾账务。
func NewRollbackService ¶
func NewRollbackService(engine api.Engine, next *NextActivityService, comments *CommentService, operations *OperationRecordService, messages *MessageExtendService, histories *HistoryExtendService, documents *DocumentService, c clock.Clock) *RollbackService
NewRollbackService 创建撤回域服务。 @param engine 引擎门面(七服务) @param next 下一步预生成域服务 @param comments 审批意见服务 @param operations 操作记录服务 @param messages 待办扩展服务 @param histories 已办扩展服务 @param documents 业务表单状态服务 @param c 时间源,nil 时回退真实时钟 @return 撤回域服务
func (*RollbackService) Rollback ¶
func (s *RollbackService) Rollback(ctx context.Context, processInstanceID, taskID, operator string) error
Rollback 撤回任务(对位 Java doRollbackTask:4373)。 链路:入参校验 → 历史任务定位与已办结校验 → 实例运行中/未挂起校验 → 引擎撤回(工厂判定 + ROLLBACK_* 变量 + 后继任务/历史清理 + 重做执行重建)→ 收尾(CH 意见/CH 操作记录/DeleteForRollback/待办遗留清理/表单状态刷新)。 与 Java 的对照差异(均为 Go 侧规格决策):
- CH 意见为流程级意见:引擎评论 API 绑定运行态任务,被撤回任务已办结 (引擎侧无对应运行任务),Java 直插 ACT_HI_COMMENT 的任务级路径不可达; 类型权威台账在操作记录 type=CH(意见服务既有约定)。
- 收尾新增待办遗留清理:引擎撤回会删除后继运行任务,其待办扩展成为悬挂行 (Java 无任务删除监听,悬挂行残留;Go 侧按"删除原任务关联待办遗留"规格清理)。 重做任务的新待办由收尾链 generateTodosAfterRollback 重建(其待办镜像已在 办结时消耗,执行人重写钩子只回填办理人不建待办)。
- processInstanceID 与历史任务归属不一致时拒绝(Java 静默覆盖为历史任务归属, Go 侧显式暴露调用方传参错误)。
@param ctx 操作上下文 @param processInstanceID 流程实例 Id(协议入参,与历史任务归属不一致时报错) @param taskID 待撤回任务 Id(历史任务 Id,必须已办结) @param operator 操作人身份 Id(撤回后任务的办理人,对位 Java userCode/assignee) @return 错误
type SQLActExtendStore ¶
type SQLActExtendStore struct {
// contains filtered or unexported fields
}
SQLActExtendStore 是 ActExtendStore 的 SQL 适配器。
func (*SQLActExtendStore) Delete ¶
func (s *SQLActExtendStore) Delete(ctx context.Context, id string) error
Delete 按主键删除审阅人绑定。 @param ctx 操作上下文 @param id 绑定 Id @return 错误
func (*SQLActExtendStore) GetByDefinitionKeyAndActivity ¶
func (s *SQLActExtendStore) GetByDefinitionKeyAndActivity(ctx context.Context, definitionKey, activityID string) ([]*ActExtend, error)
GetByDefinitionKeyAndActivity 按流程定义 Key 与 BPMN 节点 ID 查询绑定。 @param ctx 操作上下文 @param definitionKey 流程定义 Key @param activityID BPMN 节点 ID @return 绑定列表 @return 错误
func (*SQLActExtendStore) ListByDefinitionKey ¶
func (s *SQLActExtendStore) ListByDefinitionKey(ctx context.Context, definitionKey string) ([]*ActExtend, error)
ListByDefinitionKey 查询流程定义 Key 下全部绑定(仓储缺口,裸 SQL 只读补齐)。 @param ctx 操作上下文 @param definitionKey 流程定义 Key @return 绑定列表 @return 错误
type SQLBusinessSystemStore ¶
type SQLBusinessSystemStore struct {
// contains filtered or unexported fields
}
SQLBusinessSystemStore 是业务系统注册的 SQL 适配器: 组合 internal/persistence/workflow 已有 BusinessSystemRepository 完成常规 CRUD, 仓储缺失的方法(按租户查询)以裸 SQL 补齐(不修改 internal/persistence 包)。
func NewSQLBusinessSystemStore ¶
func NewSQLBusinessSystemStore(db *sql.DB, dialect string, store *pwf.Store) (*SQLBusinessSystemStore, error)
NewSQLBusinessSystemStore 创建 SQL 适配器。 @param db 数据库连接池(与引擎共享同一连接池) @param dialect 数据库方言(mysql/postgres) @param store workflow 行仓储入口 @return SQL 适配器 @return 入参为空错误
func (*SQLBusinessSystemStore) Delete ¶
func (s *SQLBusinessSystemStore) Delete(ctx context.Context, symbol string) error
Delete 按系统代号删除(先查 ID 再按主键删除,复用既有仓储)。 @param ctx 操作上下文 @param symbol 系统代号 @return 删除错误(不存在时报 WORKFLOW-1404)
func (*SQLBusinessSystemStore) GetBySymbol ¶
func (s *SQLBusinessSystemStore) GetBySymbol(ctx context.Context, symbol string) (*BusinessSystem, bool, error)
GetBySymbol 按系统代号查询(委托既有仓储)。 @param ctx 操作上下文 @param symbol 系统代号 @return 注册信息 @return 是否存在 @return 查询错误
func (*SQLBusinessSystemStore) GetByTenant ¶
func (s *SQLBusinessSystemStore) GetByTenant(ctx context.Context, tenantID string) (*BusinessSystem, bool, error)
GetByTenant 按租户查询(既有仓储无此方法,裸 SQL 补齐)。 @param ctx 操作上下文 @param tenantID 租户 @return 注册信息 @return 是否存在 @return 查询错误
func (*SQLBusinessSystemStore) List ¶
func (s *SQLBusinessSystemStore) List(ctx context.Context) ([]BusinessSystem, error)
List 返回全部注册信息(委托既有仓储 ListAll,按系统代号排序)。 @param ctx 操作上下文 @return 注册列表 @return 查询错误
func (*SQLBusinessSystemStore) Save ¶
func (s *SQLBusinessSystemStore) Save(ctx context.Context, system *BusinessSystem) error
Save 保存注册信息(按系统代号 upsert)。 @param ctx 操作上下文 @param system 注册信息(新增时 ID 必须非空) @return 保存错误
type SQLCompleteToActivityStore ¶
type SQLCompleteToActivityStore struct {
// contains filtered or unexported fields
}
SQLCompleteToActivityStore 是直送记录端口的 SQL 适配器(组合 pwf 仓储,独立构造, 便于在不改动 store_sql.go 的前提下随 SQLStoreSet 并行装配)。
func NewSQLCompleteToActivityStore ¶
func NewSQLCompleteToActivityStore(store *pwf.Store) *SQLCompleteToActivityStore
NewSQLCompleteToActivityStore 创建直送记录 SQL 适配器。 @param store workflow 仓储入口(与 SQLStoreSet 共用同一 pwf.Store,事务经 ctx 透传) @return SQL 适配器
func (*SQLCompleteToActivityStore) ListByProcessInstance ¶
func (s *SQLCompleteToActivityStore) ListByProcessInstance(ctx context.Context, processInstanceID string) ([]*CompleteToActivity, error)
ListByProcessInstance 查询实例的直送记录(按创建时间升序)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 记录列表 @return 错误
func (*SQLCompleteToActivityStore) ListByTask ¶
func (s *SQLCompleteToActivityStore) ListByTask(ctx context.Context, taskID string) ([]*CompleteToActivity, error)
ListByTask 查询任务的直送记录。 @param ctx 操作上下文 @param taskID 任务 Id @return 记录列表 @return 错误
func (*SQLCompleteToActivityStore) Save ¶
func (s *SQLCompleteToActivityStore) Save(ctx context.Context, record *CompleteToActivity) error
Save 插入一条直送记录。 @param ctx 操作上下文 @param record 直送记录 @return 错误
type SQLCountersignWeightStore ¶
type SQLCountersignWeightStore struct {
// contains filtered or unexported fields
}
SQLCountersignWeightStore 是权重存储端口的 SQL 适配器,组合 pwf 仓储 (workflow_countersign_weight 行仓储,先删后插语义经逐主键删除实现)。
func NewSQLCountersignWeightStore ¶
func NewSQLCountersignWeightStore(store *pwf.Store) *SQLCountersignWeightStore
NewSQLCountersignWeightStore 创建权重存储 SQL 适配器。 @param store workflow 仓储入口(internal/persistence/workflow.New) @return SQL 适配器
func (*SQLCountersignWeightStore) ListByNode ¶
func (s *SQLCountersignWeightStore) ListByNode(ctx context.Context, key CountersignWeightKey) ([]CountersignWeight, error)
ListByNode 查询节点权重配置。 @param ctx 操作上下文 @param key 节点定位键 @return 权重配置列表(无记录返回空列表) @return 错误
func (*SQLCountersignWeightStore) SaveByNode ¶
func (s *SQLCountersignWeightStore) SaveByNode(ctx context.Context, key CountersignWeightKey, configs []CountersignWeight) error
SaveByNode 先删后插保存节点权重配置。 @param ctx 操作上下文 @param key 节点定位键 @param configs 权重配置列表 @return 错误
type SQLDelegateTaskMirrorStore ¶
type SQLDelegateTaskMirrorStore struct {
// contains filtered or unexported fields
}
SQLDelegateTaskMirrorStore 是委托镜像待办端口的 SQL 适配器。
func NewSQLDelegateTaskMirrorStore ¶
func NewSQLDelegateTaskMirrorStore(store *pwf.Store) *SQLDelegateTaskMirrorStore
NewSQLDelegateTaskMirrorStore 创建委托镜像 SQL 适配器。 @param store workflow 仓储入口 @return SQL 适配器
func (*SQLDelegateTaskMirrorStore) DeleteByProcessInstance ¶
func (s *SQLDelegateTaskMirrorStore) DeleteByProcessInstance(ctx context.Context, processInstanceID string) error
DeleteByProcessInstance 删除实例下全部镜像待办。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 错误
func (*SQLDelegateTaskMirrorStore) ListByEntrust ¶
func (s *SQLDelegateTaskMirrorStore) ListByEntrust(ctx context.Context, entrustID string) ([]*DelegateTaskMirror, error)
ListByEntrust 查询被委托人的镜像待办列表。 @param ctx 操作上下文 @param entrustID 被委托人 Id @return 镜像列表 @return 错误
func (*SQLDelegateTaskMirrorStore) ListByTaskID ¶
func (s *SQLDelegateTaskMirrorStore) ListByTaskID(ctx context.Context, taskID string) ([]*DelegateTaskMirror, error)
ListByTaskID 查询任务的镜像待办列表。 @param ctx 操作上下文 @param taskID 任务 Id @return 镜像列表 @return 错误
func (*SQLDelegateTaskMirrorStore) Save ¶
func (s *SQLDelegateTaskMirrorStore) Save(ctx context.Context, mirror *DelegateTaskMirror) error
Save 插入一条委托镜像待办。 @param ctx 操作上下文 @param mirror 镜像待办 @return 错误
type SQLDocumentStore ¶
type SQLDocumentStore struct {
// contains filtered or unexported fields
}
SQLDocumentStore 是 DocumentStore 的 SQL 适配器。
func (*SQLDocumentStore) GetByBusinessID ¶
func (s *SQLDocumentStore) GetByBusinessID(ctx context.Context, businessID, tenantID string) (*Document, bool, error)
GetByBusinessID 按业务单据与租户查询未删除单据。 @param ctx 操作上下文 @param businessID 业务单据 Id @param tenantID 租户 @return 单据 @return 是否存在 @return 错误
func (*SQLDocumentStore) GetByInstance ¶
func (s *SQLDocumentStore) GetByInstance(ctx context.Context, processInstanceID string) (*Document, bool, error)
GetByInstance 按流程实例查询单据(实例下多行时取首行,Java selectOne 语义)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 单据 @return 是否存在 @return 错误
func (*SQLDocumentStore) MarkDeletedByBusinessID ¶
func (s *SQLDocumentStore) MarkDeletedByBusinessID(ctx context.Context, businessID, tenantID string) error
MarkDeletedByBusinessID 按业务单据与租户逻辑删除。 @param ctx 操作上下文 @param businessID 业务单据 Id @param tenantID 租户 @return 错误
func (*SQLDocumentStore) Save ¶
func (s *SQLDocumentStore) Save(ctx context.Context, d *Document) error
Save 按业务单据+租户 upsert(存在则更新非主键/非创建列,不存在则插入)。 @param ctx 操作上下文 @param d 单据状态 @return 错误
func (*SQLDocumentStore) UpdateByInstance ¶
func (s *SQLDocumentStore) UpdateByInstance(ctx context.Context, processInstanceID string, changes map[string]any) error
UpdateByInstance 按实例更新指定列(仓储无按实例更新方法,经列表逐条按主键更新补齐)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param changes 变更列(列名→新值,nil 值表示置 NULL) @return 错误
type SQLHisStepStore ¶
type SQLHisStepStore struct {
// contains filtered or unexported fields
}
SQLHisStepStore 是 HisStepStore 的 SQL 适配器(workflow_his_step 行仓储)。 快照行为 StepRule 规则子集,行主键由适配器生成(StepRule 无 ID 字段); 批量替换经"先查后删再插"补齐(仓储无按部署删除方法),依赖 ctx 事务保证原子性。
func NewSQLHisStepStore ¶
func NewSQLHisStepStore(store *pwf.Store) *SQLHisStepStore
NewSQLHisStepStore 创建快照 SQL 适配器(独立于聚合使用)。 @param store workflow 仓储入口 @return 快照适配器
func (*SQLHisStepStore) DeleteByDeployment ¶
func (s *SQLHisStepStore) DeleteByDeployment(ctx context.Context, deploymentID string) error
DeleteByDeployment 删除部署的全部快照规则(先查后逐条删除补齐仓储缺口)。 @param ctx 操作上下文 @param deploymentID 部署 ID @return 错误
func (*SQLHisStepStore) GetByDeploymentAndActivity ¶
func (s *SQLHisStepStore) GetByDeploymentAndActivity(ctx context.Context, deploymentID, activityID string) (*StepRule, bool, error)
GetByDeploymentAndActivity 按部署与节点定位单条快照规则(复用仓储部署+代号查询)。 @param ctx 操作上下文 @param deploymentID 部署 ID @param activityID 节点 ID(=step_code) @return 快照规则 @return 是否存在 @return 查询错误
func (*SQLHisStepStore) ListByDeployment ¶
func (s *SQLHisStepStore) ListByDeployment(ctx context.Context, deploymentID string) ([]*StepRule, error)
ListByDeployment 查询部署下全部快照规则(仓储按 sort 升序返回)。 @param ctx 操作上下文 @param deploymentID 部署 ID @return 快照规则列表 @return 查询错误
type SQLHistoryStore ¶
type SQLHistoryStore struct {
// contains filtered or unexported fields
}
SQLHistoryStore 是 HistoryExtendStore 的 SQL 适配器。
func (*SQLHistoryStore) DeleteByBusinessID ¶
func (s *SQLHistoryStore) DeleteByBusinessID(ctx context.Context, businessID, tenantID string) error
DeleteByBusinessID 按业务单据与租户删除已办扩展。 @param ctx 操作上下文 @param businessID 业务单据 Id @param tenantID 租户 @return 错误
func (*SQLHistoryStore) DeleteByInstance ¶
func (s *SQLHistoryStore) DeleteByInstance(ctx context.Context, processInstanceID string) error
DeleteByInstance 按实例删除全部已办扩展。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 错误
func (*SQLHistoryStore) DeleteByProcessInstanceAndActivityIDs ¶
func (s *SQLHistoryStore) DeleteByProcessInstanceAndActivityIDs(ctx context.Context, processInstanceID string, stepCodes []string) error
DeleteByProcessInstanceAndActivityIDs 按实例与步骤代号集合删除已办扩展(退回/撤回清理,仓储缺口经列表过滤补齐)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param stepCodes 步骤代号集合 @return 错误
func (*SQLHistoryStore) DeleteByTaskID ¶
func (s *SQLHistoryStore) DeleteByTaskID(ctx context.Context, taskID string) error
DeleteByTaskID 按任务删除已办扩展(经锚点行定位实例后逐条删除补齐)。 @param ctx 操作上下文 @param taskID 任务 Id @return 错误
func (*SQLHistoryStore) GetByTaskID ¶
func (s *SQLHistoryStore) GetByTaskID(ctx context.Context, taskID string) (*HistoryExtend, bool, error)
GetByTaskID 按任务 ID 查询已办扩展。 @param ctx 操作上下文 @param taskID 任务 Id @return 已办扩展 @return 是否存在 @return 错误
func (*SQLHistoryStore) ListByBusinessID ¶
func (s *SQLHistoryStore) ListByBusinessID(ctx context.Context, businessID, tenantID string) ([]*HistoryExtend, error)
ListByBusinessID 按业务单据与租户查询已办扩展。 @param ctx 操作上下文 @param businessID 业务单据 Id @param tenantID 租户 @return 列表 @return 错误
func (*SQLHistoryStore) ListByInstance ¶
func (s *SQLHistoryStore) ListByInstance(ctx context.Context, processInstanceID string) ([]*HistoryExtend, error)
ListByInstance 查询实例下全部已办扩展(按办结时间排序,聚合轨迹)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 列表 @return 错误
func (*SQLHistoryStore) ListByOwner ¶
func (s *SQLHistoryStore) ListByOwner(ctx context.Context, ownerID, tenantID string, page PageQuery) ([]*HistoryExtend, int64, error)
ListByOwner 按处理人分页查询已办扩展(仓储缺口,裸 SQL 只读补齐;P1.2 接入已办列表时再评估下推分页)。 @param ctx 操作上下文 @param ownerID 处理人 Id @param tenantID 租户 @param page 分页参数 @return 当前页列表 @return 总数 @return 错误
func (*SQLHistoryStore) Save ¶
func (s *SQLHistoryStore) Save(ctx context.Context, h *HistoryExtend) error
Save 插入一条已办扩展。 @param ctx 操作上下文 @param h 已办扩展 @return 错误
func (*SQLHistoryStore) UpdateFinishTime ¶
func (s *SQLHistoryStore) UpdateFinishTime(ctx context.Context, taskID, ownerID string, finishTime time.Time) error
UpdateFinishTime 办结回写:置(任务+处理人)记录的办结时间,并删除同任务其他处理人的记录 (对位 Java updateByTaskIdAndOwnerId;仓储无按任务枚举方法,经实例列表过滤补齐)。 @param ctx 操作上下文 @param taskID 任务 Id @param ownerID 处理人 Id @param finishTime 办结时间 @return 错误
type SQLMessageStore ¶
type SQLMessageStore struct {
// contains filtered or unexported fields
}
SQLMessageStore 是 MessageExtendStore 的 SQL 适配器。
func (*SQLMessageStore) DeleteByBusinessID ¶
func (s *SQLMessageStore) DeleteByBusinessID(ctx context.Context, businessID, tenantID string) error
DeleteByBusinessID 按业务单据与租户删除待办扩展。 @param ctx 操作上下文 @param businessID 业务单据 Id @param tenantID 租户 @return 错误
func (*SQLMessageStore) DeleteByInstance ¶
func (s *SQLMessageStore) DeleteByInstance(ctx context.Context, processInstanceID string) error
DeleteByInstance 按实例删除全部待办扩展(仓储无按实例删除方法,经列表逐条按主键删除补齐)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 错误
func (*SQLMessageStore) DeleteByProcessInstanceAndActivityIDs ¶
func (s *SQLMessageStore) DeleteByProcessInstanceAndActivityIDs(ctx context.Context, processInstanceID string, stepCodes []string) error
DeleteByProcessInstanceAndActivityIDs 按实例与步骤代号集合删除待办扩展(退回/撤回清理)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param stepCodes 步骤代号集合 @return 错误
func (*SQLMessageStore) DeleteByTaskID ¶
func (s *SQLMessageStore) DeleteByTaskID(ctx context.Context, taskID string) error
DeleteByTaskID 按任务删除待办扩展。 @param ctx 操作上下文 @param taskID 任务 Id @return 错误
func (*SQLMessageStore) DeleteByTaskIDAndOwner ¶
func (s *SQLMessageStore) DeleteByTaskIDAndOwner(ctx context.Context, taskID, ownerID string) error
DeleteByTaskIDAndOwner 按任务与处理人删除待办扩展(经 GetByTask 定位后按主键删除)。 @param ctx 操作上下文 @param taskID 任务 Id @param ownerID 处理人 Id @return 错误
func (*SQLMessageStore) GetByTaskID ¶
func (s *SQLMessageStore) GetByTaskID(ctx context.Context, taskID string) (*MessageExtend, bool, error)
GetByTaskID 按任务 ID 查询待办扩展。 @param ctx 操作上下文 @param taskID 任务 Id @return 待办扩展 @return 是否存在 @return 错误
func (*SQLMessageStore) ListByBusinessID ¶
func (s *SQLMessageStore) ListByBusinessID(ctx context.Context, businessID, tenantID string) ([]*MessageExtend, error)
ListByBusinessID 按业务单据与租户查询待办扩展。 @param ctx 操作上下文 @param businessID 业务单据 Id @param tenantID 租户 @return 列表 @return 错误
func (*SQLMessageStore) ListByInstance ¶
func (s *SQLMessageStore) ListByInstance(ctx context.Context, processInstanceID string) ([]*MessageExtend, error)
ListByInstance 查询实例下全部待办扩展。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 列表 @return 错误
func (*SQLMessageStore) ListByOwner ¶
func (s *SQLMessageStore) ListByOwner(ctx context.Context, ownerID, tenantID string, page PageQuery) ([]*MessageExtend, int64, error)
ListByOwner 按处理人分页查询待办扩展(实现 MessageExtendStore.ListByOwner; 仓储暂无租户+分页下推,先全量取回后内存过滤分页,P1.2 接入待办列表接口时再补下推)。 @param ctx 操作上下文 @param ownerID 处理人 Id @param tenantID 租户 @param page 分页参数 @return 当前页列表 @return 总数 @return 错误
func (*SQLMessageStore) Save ¶
func (s *SQLMessageStore) Save(ctx context.Context, msg *MessageExtend) error
Save 插入一条待办扩展。 @param ctx 操作上下文 @param msg 待办扩展 @return 错误
func (*SQLMessageStore) SetPlanFinishTime ¶
func (s *SQLMessageStore) SetPlanFinishTime(ctx context.Context, taskID string, planFinishTime *time.Time) error
SetPlanFinishTime 设置计划办结时间(经 GetByTask 定位主键后按主键更新,nil 表示清空)。 @param ctx 操作上下文 @param taskID 任务 Id @param planFinishTime 计划办结时间 @return 错误
func (*SQLMessageStore) UpdateDelay ¶
func (s *SQLMessageStore) UpdateDelay(ctx context.Context, taskID string, delayTime time.Time) error
UpdateDelay 标记待办已延时并回写延时时间点(经 GetByTask 定位主键后按主键更新)。 @param ctx 操作上下文 @param taskID 任务 Id @param delayTime 延时时间点 @return 错误
func (*SQLMessageStore) UpdateRead ¶
func (s *SQLMessageStore) UpdateRead(ctx context.Context, taskID, ownerID string, readTime time.Time) error
UpdateRead 标记待办已读并回写阅读时间(仅(任务+处理人)命中时更新)。 @param ctx 操作上下文 @param taskID 任务 Id @param ownerID 处理人 Id @param readTime 阅读时间 @return 错误
type SQLModelMgmtStore ¶
type SQLModelMgmtStore struct {
// contains filtered or unexported fields
}
SQLModelMgmtStore 是 ModelMgmtStore 的 SQL 适配器(workflow_model 行仓储)。
func (*SQLModelMgmtStore) DeleteByIDs ¶
func (s *SQLModelMgmtStore) DeleteByIDs(ctx context.Context, ids []string) error
DeleteByIDs 按主键批量物理删除(仓储无批量删除,逐条删除,依赖 ctx 事务保证批次原子性)。 @param ctx 操作上下文 @param ids 主键集合 @return 错误
func (*SQLModelMgmtStore) GetByCode ¶
func (s *SQLModelMgmtStore) GetByCode(ctx context.Context, tenantID, modelCode string) (*ModelCategory, bool, error)
GetByCode 按租户内模型代号查询(复用仓储 (model_code, tenant_id) 查询)。 @param ctx 操作上下文 @param tenantID 租户 @param modelCode 模型代号 @return 模型实体 @return 是否存在 @return 查询错误
func (*SQLModelMgmtStore) GetByPK ¶
func (s *SQLModelMgmtStore) GetByPK(ctx context.Context, id string) (*ModelCategory, bool, error)
GetByPK 按主键查询。 @param ctx 操作上下文 @param id 主键 @return 模型实体 @return 是否存在 @return 查询错误
func (*SQLModelMgmtStore) Insert ¶
func (s *SQLModelMgmtStore) Insert(ctx context.Context, m *ModelCategory) error
Insert 插入一条模型/分类。 @param ctx 操作上下文(携带事务时透传同一工作单元) @param m 模型实体(必填 id/tenant_id) @return 错误
func (*SQLModelMgmtStore) ListByTenant ¶
func (s *SQLModelMgmtStore) ListByTenant(ctx context.Context, tenantID string) ([]*ModelCategory, error)
ListByTenant 查询租户下全部模型与分类(仓储按 sort 升序返回)。 @param ctx 操作上下文 @param tenantID 租户 @return 模型列表 @return 查询错误
func (*SQLModelMgmtStore) Update ¶
func (s *SQLModelMgmtStore) Update(ctx context.Context, m *ModelCategory) error
Update 按主键更新整行业务列(仓储剔除 id 列,create_time 原值回写不改变创建审计)。 @param ctx 操作上下文 @param m 模型实体(必填 id) @return 错误
func (*SQLModelMgmtStore) UpdateLastDeployTime ¶
func (s *SQLModelMgmtStore) UpdateLastDeployTime(ctx context.Context, id string, deployTime time.Time) error
UpdateLastDeployTime 回写模型最近部署时间(复用仓储专项更新,更新时间由仓储填充)。 @param ctx 操作上下文 @param id 模型主键 @param deployTime 部署时间 @return 错误
type SQLModelMgmtStoreSet ¶
type SQLModelMgmtStoreSet struct {
Model *SQLModelMgmtStore // 模型/分类主数据
Step *SQLStepDesignStore // 设计时步骤配置
Template *SQLTemplateStore // 设计器模板
HisStep *SQLHisStepStore // 步骤部署快照
}
SQLModelMgmtStoreSet 是模型管理域四个 SQL 适配器的聚合。
func NewSQLModelMgmtStores ¶
func NewSQLModelMgmtStores(store *pwf.Store) *SQLModelMgmtStoreSet
NewSQLModelMgmtStores 创建模型管理域 SQL 适配器聚合(不带裸 SQL 补齐通道, Template.ListByTenant 将报 SQL-ADAPTER-001,其余能力完整)。 @param store workflow 仓储入口(internal/persistence/workflow.New) @return 适配器聚合
func NewSQLModelMgmtStoresWithDB ¶
func NewSQLModelMgmtStoresWithDB(store *pwf.Store, db *sql.DB) *SQLModelMgmtStoreSet
NewSQLModelMgmtStoresWithDB 创建模型管理域 SQL 适配器聚合并附带裸 SQL 补齐通道。 @param store workflow 仓储入口 @param db 连接池(与 store 共用同一连接池) @return 适配器聚合
type SQLNextStore ¶
type SQLNextStore struct {
// contains filtered or unexported fields
}
SQLNextStore 是 NextActivityStore 的 SQL 适配器。
func (*SQLNextStore) DeleteByProcessInstance ¶
func (s *SQLNextStore) DeleteByProcessInstance(ctx context.Context, processInstanceID string) error
DeleteByProcessInstance 删除实例的全部运行态记录。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 错误
func (*SQLNextStore) DeleteByProcessInstanceAndActivityIDs ¶
func (s *SQLNextStore) DeleteByProcessInstanceAndActivityIDs(ctx context.Context, processInstanceID string, nextActivityIDs []string) error
DeleteByProcessInstanceAndActivityIDs 删除实例下指定节点集合的运行态与历史记录。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param nextActivityIDs 节点 ID 集合 @return 错误
func (*SQLNextStore) DeleteForBackToStep ¶
func (s *SQLNextStore) DeleteForBackToStep(ctx context.Context, processInstanceID, nextActivityID string) error
DeleteForBackToStep 退回清理:删除实例下目标节点(含已消耗)的全部运行态记录。 说明:Java 原实现附带"顺带删除更早创建记录"的 create_time 全表比较,语义模糊且副作用大, Go 侧收敛为删除目标节点全部记录。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param nextActivityID 目标节点 ID @return 错误
func (*SQLNextStore) DeleteForResolve ¶
func (s *SQLNextStore) DeleteForResolve(ctx context.Context, processInstanceID, nextActivityID, taskID, identityID string) error
DeleteForResolve 处理委派清理:删除实例下指定节点+任务+执行人的记录。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param nextActivityID 节点 ID @param taskID 任务 Id @param identityID 执行人 Id @return 错误
func (*SQLNextStore) DeleteForRollback ¶
func (s *SQLNextStore) DeleteForRollback(ctx context.Context, processInstanceID, preTaskID, keepActivityID string) error
DeleteForRollback 撤回清理:删除实例下以 preTaskID 为来源、目标节点之外的记录(仅运行态,Java 语义)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param preTaskID 来源任务 Id @param keepActivityID 保留的目标节点 ID @return 错误
func (*SQLNextStore) FindAssignSource ¶
func (s *SQLNextStore) FindAssignSource(ctx context.Context, processInstanceID, nextActivityID, sendIdentityID, taskID string) (*NextActivity, bool, error)
FindAssignSource 按(实例/节点/发送人/任务)定位既有记录(转办/委派/还原继承组用)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param nextActivityID 节点 ID @param sendIdentityID 发送人 Id @param taskID 任务 Id @return 记录 @return 是否存在 @return 错误
func (*SQLNextStore) GetFirstUnusedByActivity ¶
func (s *SQLNextStore) GetFirstUnusedByActivity(ctx context.Context, processInstanceID, nextActivityID string) (*NextActivity, bool, error)
GetFirstUnusedByActivity 按创建时间升序返回实例下指定节点的第一条未消耗记录。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param nextActivityID 节点 ID @return 记录 @return 是否存在 @return 错误
func (*SQLNextStore) InsertDual ¶
func (s *SQLNextStore) InsertDual(ctx context.Context, act *NextActivity) error
InsertDual 双写运行态与历史表(同 ID 同内容),依赖 ctx 事务保证原子性。 @param ctx 操作上下文 @param act 下一步记录 @return 错误
func (*SQLNextStore) LatestVersion ¶
func (s *SQLNextStore) LatestVersion(ctx context.Context, processInstanceID, nextActivityID string) (int, error)
LatestVersion 返回实例下指定节点已消耗(used=1)记录的最大版本号,无记录返回 0。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param nextActivityID 节点 ID @return 最大版本号 @return 错误
func (*SQLNextStore) ListByPreTask ¶
func (s *SQLNextStore) ListByPreTask(ctx context.Context, preTaskID string) ([]*NextActivity, error)
ListByPreTask 查询以上一任务为来源的运行态记录。 @param ctx 操作上下文 @param preTaskID 上一任务 Id @return 记录列表 @return 错误
func (*SQLNextStore) ListByTaskID ¶
func (s *SQLNextStore) ListByTaskID(ctx context.Context, taskID string) ([]*NextActivity, error)
ListByTaskID 查询已挂到任务上的运行态记录。 @param ctx 操作上下文 @param taskID 任务 Id @return 记录列表 @return 错误
func (*SQLNextStore) ListHisByInstance ¶
func (s *SQLNextStore) ListHisByInstance(ctx context.Context, processInstanceID string) ([]*NextActivity, error)
ListHisByInstance 查询实例的全部历史记录(按版本升序)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 记录列表 @return 错误
func (*SQLNextStore) ListHisByTaskID ¶
func (s *SQLNextStore) ListHisByTaskID(ctx context.Context, taskID string) ([]*NextActivity, error)
ListHisByTaskID 查询历史表中任务相关且非自环(pre_task_id != taskID)的记录(仓储缺口,裸 SQL 只读补齐)。 @param ctx 操作上下文 @param taskID 任务 Id @return 记录列表 @return 错误
func (*SQLNextStore) ListUnusedByInstance ¶
func (s *SQLNextStore) ListUnusedByInstance(ctx context.Context, processInstanceID string) ([]*NextActivity, error)
ListUnusedByInstance 查询实例下全部未消耗记录。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 记录列表 @return 错误
func (*SQLNextStore) ListUnusedByInstanceAndActivity ¶
func (s *SQLNextStore) ListUnusedByInstanceAndActivity(ctx context.Context, processInstanceID, nextActivityID string) ([]*NextActivity, error)
ListUnusedByInstanceAndActivity 查询实例下指定节点未消耗记录。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param nextActivityID 节点 ID @return 记录列表 @return 错误
func (*SQLNextStore) ListUsedByInstance ¶
func (s *SQLNextStore) ListUsedByInstance(ctx context.Context, processInstanceID string) ([]*NextActivity, error)
ListUsedByInstance 查询实例下已回写任务 ID 的记录(仓储缺口,裸 SQL 只读补齐)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 记录列表 @return 错误
func (*SQLNextStore) MarkUsedAndWriteBack ¶
MarkUsedAndWriteBack 置 used=1 并回写任务 ID(运行态与历史表同步,仅未消耗记录生效)。 @param ctx 操作上下文 @param ids 记录 Id 集合 @param taskID 任务 Id @return 错误
type SQLOperationStore ¶
type SQLOperationStore struct {
// contains filtered or unexported fields
}
SQLOperationStore 是 OperationRecordStore 的 SQL 适配器。
func (*SQLOperationStore) CountByInstance ¶
func (s *SQLOperationStore) CountByInstance(ctx context.Context, processInstanceID string) (int, error)
CountByInstance 统计实例的操作记录数(状态机"未提交/流转中"判据)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 记录数 @return 错误
func (*SQLOperationStore) LastTypeByInstance ¶
func (s *SQLOperationStore) LastTypeByInstance(ctx context.Context, processInstanceID string) (string, error)
LastTypeByInstance 返回实例最后一条(按处理时间)操作记录的类型代码,无记录返回空串。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 类型代码 @return 错误
func (*SQLOperationStore) ListByBusinessID ¶
func (s *SQLOperationStore) ListByBusinessID(ctx context.Context, businessID string) ([]*OperationRecord, error)
ListByBusinessID 查询业务单据的操作记录(按处理时间升序)。 @param ctx 操作上下文 @param businessID 业务单据 Id @return 列表 @return 错误
func (*SQLOperationStore) ListByBusinessIDs ¶
func (s *SQLOperationStore) ListByBusinessIDs(ctx context.Context, businessIDs []string) ([]*OperationRecord, error)
ListByBusinessIDs 查询多个业务单据的操作记录(仓储无 IN 查询,逐单据取回后按处理时间归并)。 @param ctx 操作上下文 @param businessIDs 业务单据 Id 集合 @return 列表 @return 错误
func (*SQLOperationStore) ListByInstance ¶
func (s *SQLOperationStore) ListByInstance(ctx context.Context, processInstanceID string) ([]*OperationRecord, error)
ListByInstance 查询实例的操作记录(按处理时间升序)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 列表 @return 错误
func (*SQLOperationStore) ListByTask ¶
func (s *SQLOperationStore) ListByTask(ctx context.Context, taskID string) ([]*OperationRecord, error)
ListByTask 查询任务的操作记录(按处理时间升序)。 @param ctx 操作上下文 @param taskID 任务 Id @return 列表 @return 错误
func (*SQLOperationStore) ListSignable ¶
func (s *SQLOperationStore) ListSignable(ctx context.Context, businessIDs []string) ([]*OperationRecord, error)
ListSignable 查询"可签名"记录:type ∈ {TJ,SP,TZ} 且步骤代号非空(Java getSignableOperationRecordListByBusinessIds)。 @param ctx 操作上下文 @param businessIDs 业务单据 Id 集合 @return 列表 @return 错误
func (*SQLOperationStore) Save ¶
func (s *SQLOperationStore) Save(ctx context.Context, r *OperationRecord) error
Save 插入一条操作记录。 @param ctx 操作上下文 @param r 操作记录 @return 错误
type SQLRemindStore ¶
type SQLRemindStore struct {
// contains filtered or unexported fields
}
SQLRemindStore 是催办配置端口的 SQL 适配器(组合 pwf 仓储)。
func NewSQLRemindStore ¶
func NewSQLRemindStore(store *pwf.Store, c clock.Clock) *SQLRemindStore
NewSQLRemindStore 创建催办配置 SQL 适配器。 @param store workflow 仓储入口 @param c 时间源(审计列填充),nil 回退真实时钟 @return SQL 适配器
func (*SQLRemindStore) Get ¶
Get 按主键查询催办配置(级联对象)。 @param ctx 操作上下文 @param id 催办配置 Id @return 催办配置 @return 是否存在 @return 错误
func (*SQLRemindStore) ListActive ¶
func (s *SQLRemindStore) ListActive(ctx context.Context) ([]*Remind, error)
ListActive 查询全部未删除配置(仓储无全量查询,退化为按模型逐个扫描不可行—— 这里经裸 SQL 缺口由主控接线,SQL 适配返回按租户过滤结果为空时与内存语义一致)。 @param ctx 操作上下文 @return 配置列表 @return 错误
func (*SQLRemindStore) ListByModel ¶
ListByModel 查询模型下的催办配置。 @param ctx 操作上下文 @param modelID 模型 Id @return 配置列表 @return 错误
func (*SQLRemindStore) ListNotSent ¶
func (s *SQLRemindStore) ListNotSent(ctx context.Context) ([]*Remind, error)
ListNotSent 查询未发送且未删除的配置。 @param ctx 操作上下文 @return 配置列表 @return 错误
func (*SQLRemindStore) MarkDeleted ¶
func (s *SQLRemindStore) MarkDeleted(ctx context.Context, id string) error
MarkDeleted 按主键逻辑删除。 @param ctx 操作上下文 @param id 催办配置 Id @return 错误
func (*SQLRemindStore) MarkDeletedByIDs ¶
func (s *SQLRemindStore) MarkDeletedByIDs(ctx context.Context, ids []string) error
MarkDeletedByIDs 批量逻辑删除。 @param ctx 操作上下文 @param ids 催办配置 Id 列表 @return 错误
type SQLRemindTargetStore ¶
type SQLRemindTargetStore struct {
// contains filtered or unexported fields
}
SQLRemindTargetStore 是催办对象端口的 SQL 适配器。
func NewSQLRemindTargetStore ¶
func NewSQLRemindTargetStore(store *pwf.Store) *SQLRemindTargetStore
NewSQLRemindTargetStore 创建催办对象 SQL 适配器。 @param store workflow 仓储入口 @return SQL 适配器
func (*SQLRemindTargetStore) DeleteByRemind ¶
func (s *SQLRemindTargetStore) DeleteByRemind(ctx context.Context, remindID string) error
DeleteByRemind 删除配置的全部对象。 @param ctx 操作上下文 @param remindID 催办配置 Id @return 错误
func (*SQLRemindTargetStore) ListByRemind ¶
func (s *SQLRemindTargetStore) ListByRemind(ctx context.Context, remindID string) ([]*RemindTarget, error)
ListByRemind 查询配置的启用对象列表。 @param ctx 操作上下文 @param remindID 催办配置 Id @return 对象列表 @return 错误
func (*SQLRemindTargetStore) MarkSent ¶
func (s *SQLRemindTargetStore) MarkSent(ctx context.Context, id string) error
MarkSent 标记对象已发送。 @param ctx 操作上下文 @param id 对象 Id @return 错误
func (*SQLRemindTargetStore) Save ¶
func (s *SQLRemindTargetStore) Save(ctx context.Context, target *RemindTarget) error
Save 插入催办对象(存在则更新主键行)。 @param ctx 操作上下文 @param target 催办对象 @return 错误
func (*SQLRemindTargetStore) UpdateRetryCount ¶
UpdateRetryCount 回写重试计数。 @param ctx 操作上下文 @param id 对象 Id @param count 新计数 @return 错误
type SQLReviewStores ¶
type SQLReviewStores struct {
Tasks *SQLReviewTaskStore // 审阅影子任务
Extends *SQLActExtendStore // 审阅人绑定(活动扩展)
}
SQLReviewStores 是审阅域两个存储端口 SQL 适配器的聚合 (审阅影子任务 + 审阅人绑定),复用 store_sql.go 的 sqlCore 共享内核。
func NewSQLReviewStores ¶
func NewSQLReviewStores(store *pwf.Store) *SQLReviewStores
NewSQLReviewStores 创建审阅域 SQL 适配器(不带裸 SQL 补齐通道)。 @param store workflow 仓储入口 @return 适配器聚合
func NewSQLReviewStoresWithDB ¶
func NewSQLReviewStoresWithDB(store *pwf.Store, db *sql.DB) *SQLReviewStores
NewSQLReviewStoresWithDB 创建审阅域 SQL 适配器并附带裸 SQL 只读补齐通道。 ListByReviewer / CountUnread / ListByDefinitionKey 在 pwf 仓储暂无对应方法, 经裸 SQL 下推补齐(模式与 store_sql.go 的仓储缺口补齐一致)。 @param store workflow 仓储入口 @param db 连接池(与 store 共用同一连接池) @return 适配器聚合
type SQLReviewTaskStore ¶
type SQLReviewTaskStore struct {
// contains filtered or unexported fields
}
SQLReviewTaskStore 是 ReviewTaskStore 的 SQL 适配器。
func (*SQLReviewTaskStore) CountUnread ¶
func (s *SQLReviewTaskStore) CountUnread(ctx context.Context, reviewer, tenantID string) (int64, error)
CountUnread 统计审阅人的待审阅数(status=0,租户过滤;仓储缺口,裸 SQL 只读补齐)。 @param ctx 操作上下文 @param reviewer 审阅人 Id @param tenantID 租户 @return 待审阅数 @return 错误
func (*SQLReviewTaskStore) DeleteByInstance ¶
func (s *SQLReviewTaskStore) DeleteByInstance(ctx context.Context, processInstanceID string) error
DeleteByInstance 删除实例下全部审阅影子任务(仓储无按实例删除方法,经列表逐条按主键删除补齐)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 错误
func (*SQLReviewTaskStore) Get ¶
func (s *SQLReviewTaskStore) Get(ctx context.Context, id string) (*ReviewTask, bool, error)
Get 按主键查询审阅影子任务。 @param ctx 操作上下文 @param id 影子任务 Id @return 审阅影子任务 @return 是否存在 @return 错误
func (*SQLReviewTaskStore) Insert ¶
func (s *SQLReviewTaskStore) Insert(ctx context.Context, rt *ReviewTask) error
Insert 插入一条审阅影子任务。 @param ctx 操作上下文 @param rt 审阅影子任务 @return 错误
func (*SQLReviewTaskStore) ListByInstance ¶
func (s *SQLReviewTaskStore) ListByInstance(ctx context.Context, processInstanceID string) ([]*ReviewTask, error)
ListByInstance 查询实例下全部审阅影子任务(按创建时间升序)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 列表 @return 错误
func (*SQLReviewTaskStore) ListByReviewer ¶
func (s *SQLReviewTaskStore) ListByReviewer(ctx context.Context, reviewer, tenantID string, page PageQuery) ([]*ReviewTask, int64, error)
ListByReviewer 按审阅人分页查询(租户过滤,空租户不过滤;仓储缺口,裸 SQL 只读补齐, 内存分页与 ListByOwner 既有模式一致)。 @param ctx 操作上下文 @param reviewer 审阅人 Id @param tenantID 租户 @param page 分页参数 @return 当前页列表 @return 总数 @return 错误
func (*SQLReviewTaskStore) Update ¶
func (s *SQLReviewTaskStore) Update(ctx context.Context, rt *ReviewTask) error
Update 办结回写:按主键回写可变列(status/opinion/review_time/remark/updater/update_time)。 @param ctx 操作上下文 @param rt 审阅影子任务(必填 id) @return 错误
type SQLStepDesignStore ¶
type SQLStepDesignStore struct {
// contains filtered or unexported fields
}
SQLStepDesignStore 是 StepDesignStore 的 SQL 适配器(workflow_step 行仓储)。
func (*SQLStepDesignStore) DeleteByIDs ¶
func (s *SQLStepDesignStore) DeleteByIDs(ctx context.Context, ids []string) error
DeleteByIDs 按主键批量物理删除(逐条删除,依赖 ctx 事务保证批次原子性)。 @param ctx 操作上下文 @param ids 主键集合 @return 错误
func (*SQLStepDesignStore) GetByModelAndCode ¶
func (s *SQLStepDesignStore) GetByModelAndCode(ctx context.Context, modelID, stepCode string) (*StepDesign, bool, error)
GetByModelAndCode 按模型与步骤代号查询单条配置。 @param ctx 操作上下文 @param modelID 模型 ID @param stepCode 步骤代号 @return 步骤实体 @return 是否存在 @return 查询错误
func (*SQLStepDesignStore) GetByPK ¶
func (s *SQLStepDesignStore) GetByPK(ctx context.Context, id string) (*StepDesign, bool, error)
GetByPK 按主键查询。 @param ctx 操作上下文 @param id 主键 @return 步骤实体 @return 是否存在 @return 查询错误
func (*SQLStepDesignStore) Insert ¶
func (s *SQLStepDesignStore) Insert(ctx context.Context, d *StepDesign) error
Insert 插入一条设计时步骤。 @param ctx 操作上下文(携带事务时透传同一工作单元) @param d 步骤实体(必填 id/model_id/step_code/tenant_id) @return 错误
func (*SQLStepDesignStore) ListByModel ¶
func (s *SQLStepDesignStore) ListByModel(ctx context.Context, modelID string) ([]*StepDesign, error)
ListByModel 查询模型下全部步骤配置(仓储按 sort 升序返回)。 @param ctx 操作上下文 @param modelID 模型 ID @return 步骤列表 @return 查询错误
func (*SQLStepDesignStore) Update ¶
func (s *SQLStepDesignStore) Update(ctx context.Context, d *StepDesign) error
Update 按主键更新整行业务列。 @param ctx 操作上下文 @param d 步骤实体(必填 id) @return 错误
type SQLStepStore ¶
type SQLStepStore struct {
// contains filtered or unexported fields
}
SQLStepStore 是 StepStore 的 SQL 适配器,组合 pwf HisStep 仓储 (workflow_his_step 行仓储,行结构通用于列级映射)。
func NewSQLStepStore ¶
func NewSQLStepStore(store *pwf.Store) *SQLStepStore
NewSQLStepStore 创建步骤规则 SQL 适配器。 @param store workflow 仓储入口(internal/persistence/workflow.New) @return SQL 适配器
func (*SQLStepStore) GetByDeploymentAndActivity ¶
func (s *SQLStepStore) GetByDeploymentAndActivity(ctx context.Context, deploymentID, activityID string) (*StepRule, bool, error)
GetByDeploymentAndActivity 按部署与节点定位单条步骤规则(复用仓储的部署+代号查询)。 @param ctx 操作上下文 @param deploymentID 部署 ID @param activityID 节点 ID(=step_code) @return 步骤规则 @return 是否存在 @return 查询错误
func (*SQLStepStore) ListByDeployment ¶
func (s *SQLStepStore) ListByDeployment(ctx context.Context, deploymentID string) ([]*StepRule, error)
ListByDeployment 查询部署下全部步骤规则(仓储按 sort 升序返回)。 @param ctx 操作上下文 @param deploymentID 部署 ID @return 步骤规则列表 @return 查询错误
type SQLStoreSet ¶
type SQLStoreSet struct {
Next *SQLNextStore // 下一步预生成-消耗
Message *SQLMessageStore // 待办扩展
History *SQLHistoryStore // 已办扩展
Operation *SQLOperationStore // 操作记录
Document *SQLDocumentStore // 业务表单状态
}
SQLStoreSet 是五大域存储端口 SQL 适配器的聚合。
func NewSQLStores ¶
func NewSQLStores(store *pwf.Store) *SQLStoreSet
NewSQLStores 创建 SQL 适配器聚合(不带裸 SQL 补齐通道)。 @param store workflow 仓储入口 @return 适配器聚合
func NewSQLStoresWithDB ¶
func NewSQLStoresWithDB(store *pwf.Store, db *sql.DB) *SQLStoreSet
NewSQLStoresWithDB 创建 SQL 适配器聚合并附带裸 SQL 只读补齐通道。 @param store workflow 仓储入口 @param db 连接池(与 store 共用同一连接池) @return 适配器聚合
type SQLTaskDelegateStore ¶
type SQLTaskDelegateStore struct {
// contains filtered or unexported fields
}
SQLTaskDelegateStore 是委托规则端口的 SQL 适配器(组合 pwf 三表仓储)。
func NewSQLTaskDelegateStore ¶
func NewSQLTaskDelegateStore(store *pwf.Store) *SQLTaskDelegateStore
NewSQLTaskDelegateStore 创建委托规则 SQL 适配器。 @param store workflow 仓储入口(事务经 ctx 透传) @return SQL 适配器
func (*SQLTaskDelegateStore) Delete ¶
func (s *SQLTaskDelegateStore) Delete(ctx context.Context, id string) error
Delete 按主键级联删除委托规则(主表 + 两张子表)。 @param ctx 操作上下文 @param id 委托规则 Id @return 错误
func (*SQLTaskDelegateStore) Get ¶
func (s *SQLTaskDelegateStore) Get(ctx context.Context, id string) (*DelegateRule, bool, error)
Get 按主键级联读取委托规则(主表 + 子表聚合)。 @param ctx 操作上下文 @param id 委托规则 Id @return 委托规则 @return 是否存在 @return 错误
func (*SQLTaskDelegateStore) ListByConsigner ¶
func (s *SQLTaskDelegateStore) ListByConsigner(ctx context.Context, consignerID, tenantID string) ([]*DelegateRule, error)
ListByConsigner 查询指定身份作为被委托人的启用规则 (行仓储按来源代号查询启用规则后内存过滤被委托人;启用过滤与仓储 SQL 一致)。 @param ctx 操作上下文 @param consignerID 被委托人 Id @param tenantID 租户(=source_code) @return 启用中的规则列表 @return 错误
func (*SQLTaskDelegateStore) ListByOwner ¶
func (s *SQLTaskDelegateStore) ListByOwner(ctx context.Context, ownerID, tenantID string) ([]*DelegateRule, error)
ListByOwner 查询委托人在指定租户下的全部规则(逐条级联)。 @param ctx 操作上下文 @param ownerID 委托人 Id @param tenantID 租户(=source_code) @return 规则列表 @return 错误
func (*SQLTaskDelegateStore) Save ¶
func (s *SQLTaskDelegateStore) Save(ctx context.Context, rule *DelegateRule) error
Save 级联保存委托规则(主表 upsert:更新命中行则完成;0 行或失败回退插入;子表先删后增)。 @param ctx 操作上下文 @param rule 委托规则 @return 错误
func (*SQLTaskDelegateStore) UpdateState ¶
func (s *SQLTaskDelegateStore) UpdateState(ctx context.Context, id string, enable, retire int) error
UpdateState 更新规则启用/退休标记。 @param ctx 操作上下文 @param id 委托规则 Id @param enable 启用标记 @param retire 退休标记 @return 错误
type SQLTaskExceptionStore ¶
type SQLTaskExceptionStore struct {
// contains filtered or unexported fields
}
SQLTaskExceptionStore 是任务异常端口的 SQL 适配器(组合 pwf 仓储)。
func NewSQLTaskExceptionStore ¶
func NewSQLTaskExceptionStore(store *pwf.Store) *SQLTaskExceptionStore
NewSQLTaskExceptionStore 创建任务异常 SQL 适配器。 @param store workflow 仓储入口 @return SQL 适配器
func (*SQLTaskExceptionStore) Get ¶
func (s *SQLTaskExceptionStore) Get(ctx context.Context, id string) (*TaskException, bool, error)
Get 按主键查询异常记录。 @param ctx 操作上下文 @param id 异常记录 Id @return 异常记录 @return 是否存在 @return 错误
func (*SQLTaskExceptionStore) ListByInstance ¶
func (s *SQLTaskExceptionStore) ListByInstance(ctx context.Context, processInstanceID string) ([]*TaskException, error)
ListByInstance 查询实例的异常记录。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @return 记录列表 @return 错误
func (*SQLTaskExceptionStore) ListByTask ¶
func (s *SQLTaskExceptionStore) ListByTask(ctx context.Context, taskID string) ([]*TaskException, error)
ListByTask 查询任务的异常记录。 @param ctx 操作上下文 @param taskID 任务 Id @return 记录列表 @return 错误
func (*SQLTaskExceptionStore) ListByTypeAndInstances ¶
func (s *SQLTaskExceptionStore) ListByTypeAndInstances(ctx context.Context, exceptionType string, instanceIDs []string) ([]*TaskException, error)
ListByTypeAndInstances 查询指定实例集合下指定类型的异常记录 (行仓储无组合查询,逐实例取指定类型记录后聚合)。 @param ctx 操作上下文 @param exceptionType 异常类型 @param instanceIDs 实例 Id 集合 @return 记录列表 @return 错误
func (*SQLTaskExceptionStore) ListUnhandled ¶
func (s *SQLTaskExceptionStore) ListUnhandled(ctx context.Context) ([]*TaskException, error)
ListUnhandled 查询未处理异常。 @param ctx 操作上下文 @return 记录列表 @return 错误
func (*SQLTaskExceptionStore) MarkHandled ¶
MarkHandled 批量更新处理状态。 @param ctx 操作上下文 @param ids 异常记录 Id 列表 @param status 处理状态 @return 错误
func (*SQLTaskExceptionStore) Save ¶
func (s *SQLTaskExceptionStore) Save(ctx context.Context, e *TaskException) error
Save 插入一条异常记录。 @param ctx 操作上下文 @param e 异常记录 @return 错误
type SQLTemplateStore ¶
type SQLTemplateStore struct {
// contains filtered or unexported fields
}
SQLTemplateStore 是 TemplateStore 的 SQL 适配器(workflow_template 行仓储)。 按租户列表为仓储缺口,经裸 SQL 只读补齐(需 WithDB 注入连接池)。
func (*SQLTemplateStore) DeleteByIDs ¶
func (s *SQLTemplateStore) DeleteByIDs(ctx context.Context, ids []string) error
DeleteByIDs 按主键批量物理删除(逐条删除,依赖 ctx 事务保证批次原子性)。 @param ctx 操作上下文 @param ids 主键集合 @return 错误
func (*SQLTemplateStore) GetByPK ¶
func (s *SQLTemplateStore) GetByPK(ctx context.Context, id string) (*TemplateDef, bool, error)
GetByPK 按主键查询。 @param ctx 操作上下文 @param id 主键 @return 模板实体 @return 是否存在 @return 查询错误
func (*SQLTemplateStore) Insert ¶
func (s *SQLTemplateStore) Insert(ctx context.Context, t *TemplateDef) error
Insert 插入一条模板。 @param ctx 操作上下文(携带事务时透传同一工作单元) @param t 模板实体(必填 id/tenant_id) @return 错误
func (*SQLTemplateStore) ListByCategory ¶
func (s *SQLTemplateStore) ListByCategory(ctx context.Context, categoryID string) ([]*TemplateDef, error)
ListByCategory 查询分类下全部模板(仓储按名称升序返回)。 @param ctx 操作上下文 @param categoryID 分类 ID @return 模板列表 @return 查询错误
func (*SQLTemplateStore) ListByTenant ¶
func (s *SQLTemplateStore) ListByTenant(ctx context.Context, tenantID string) ([]*TemplateDef, error)
ListByTenant 查询租户下全部模板(仓储缺口,裸 SQL 只读补齐,按名称升序)。 @param ctx 操作上下文 @param tenantID 租户 @return 模板列表 @return 查询错误(未注入连接池时报 SQL-ADAPTER-001)
func (*SQLTemplateStore) Update ¶
func (s *SQLTemplateStore) Update(ctx context.Context, t *TemplateDef) error
Update 按主键更新整行业务列。 @param ctx 操作上下文 @param t 模板实体(必填 id) @return 错误
type ScheduleRuleProvider ¶
type ScheduleRuleProvider interface {
// RemindLimitOf 返回步骤的催办时限与单位(对位 Java VO 的 remindTimeLimit/remindTimeLimitUnit)。
// @param ctx 操作上下文
// @param stepCode 步骤代号
// @return 时限数值,未配置返回 nil
// @return 单位
// @return 错误
RemindLimitOf(ctx context.Context, stepCode string) (*float64, string, error)
// AutoCompleteRuleOf 返回步骤的自动办结规则。
// @param ctx 操作上下文
// @param stepCode 步骤代号
// @return 自动办结规则
// @return 错误
AutoCompleteRuleOf(ctx context.Context, stepCode string) (AutoCompleteRule, error)
}
ScheduleRuleProvider 是步骤规则提供方端口(his_step 规则字典;P2-B steprules 完成后由主控接线, 默认空实现返回空规则,即自动办结/催办时限判定全部跳过)。
type Scheduler ¶
type Scheduler struct {
// 可注入触发函数(nil 时使用内置 tick;测试可替换以断言调度触发)
AutoCompleteFn func(ctx context.Context) error // 自动办结触发函数
TimeoutRemindFn func(ctx context.Context) error // 超时提醒触发函数
RemindScanFn func(ctx context.Context) error // 催办扫描触发函数
ZombieScanFn func(ctx context.Context) error // 僵尸监控触发函数
// contains filtered or unexported fields
}
Scheduler 是 workflow 调度器聚合:Start 启动后台 goroutine,Stop 优雅停止; 四个 tick 方法可单独直调(测试不真 sleep),亦可经 AutoCompleteFn 等字段替换触发实现。
func NewScheduler ¶
func NewScheduler(cfg SchedulerConfig) *Scheduler
NewScheduler 创建调度器(不启动,需显式 Start)。 @param cfg 装配配置 @return 调度器
func (*Scheduler) AutoCompleteTick ¶
AutoCompleteTick 自动办结扫描(对位 Java FlowableScheduleTask#autoCompleteTask:44): 逾期待办(autoComplete=1/2 且 timeLimit 到期)按预存下一步自动完成(意见"同意(自动办结)"type=SP), autoComplete=2 且 allowReturn 走退回执行器(意见"退回(自动办结)")。 P5 依赖缺口:Java 经推演服务 getNextUserTaskAndUserList/getBackNodesByTaskId 决定去向, Go 推演服务未实现(P5 补),本实现以"同意方向预存记录 / 退回目标预存记录"为去向来源, 预存缺失时跳过该待办(记录日志不报错)。 @param ctx 操作上下文 @return 错误
func (*Scheduler) RemindScanTick ¶
RemindScanTick 催办扫描(对位 Java ReminderSchedule#updateWithCheckWorkflowReminds:92): RemindService.ScanDue 判定到期命中 → 逐命中送达(展开对象 → Notifier)→ sent/retry 标记。 @param ctx 操作上下文 @return 错误
func (*Scheduler) Start ¶
Start 启动调度器后台循环(重复调用幂等;Stop 后可重启)。 @param ctx 上下文(传递给各 tick;取消后循环内的 tick 以取消态执行)
func (*Scheduler) TimeoutRemindTick ¶
TimeoutRemindTick 超时提醒(对位 Java FlowableScheduleTask#taskTimeoutRemind:114,每日 8 点): 超时待办(接收时间 + 步骤催办时限已过)逐条送达"任务超时提醒"。 @param ctx 操作上下文 @return 错误
type SchedulerConfig ¶
type SchedulerConfig struct {
Engine api.Engine // 引擎门面(僵尸监控实例查询)
Options Options // 调度开关与时钟(Service.Options() 透传)
TodoSource TodoSource // 待办数据源(自动办结/超时提醒/僵尸监控)
Rules ScheduleRuleProvider // 步骤规则(autoComplete/timeLimit),nil 用空实现
Complete *CompleteService // 自动办结(同意型)执行器
Next *NextActivityService // 下一步预存读取(自动办结的下一步来源)
Back AutoCompleteBackExecutor // 退回执行器(P2-B 后接线,nil 跳过退回型)
Remind *RemindService // 催办服务(扫描 + 送达)
Notifier Notifier // 催办送达器,nil 用日志实现
Exceptions *ExceptionService // 异常记录服务(僵尸监控落库)
}
SchedulerConfig 是调度器装配配置(全部依赖注入,测试可用轻量桩)。
type SecretGenerator ¶
SecretGenerator 是回调签名密钥生成器(可注入)。 @return 密钥文本 @return 生成错误
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service 是 WorkflowFacade 的门面实现。 内部子服务(发起/办结/查询/意见/操作记录/待办/已办/表单/预生成)由 assembleComponents 统一装配,存储默认内存实现(嵌入式无 DB 模式), 可经 WithSQLStores 切换为真实库行仓储。
func NewWorkflowService ¶
NewWorkflowService 创建 workflow 门面服务。 @param engine 引擎门面(七服务) @param options 可选配置(调度开关、时钟注入、存储实现) @return 服务实例
func NewWorkflowServiceChecked ¶
NewWorkflowServiceChecked 创建不允许 SQL 装配失败后回退内存的门面,供业务系统嵌入。 @param engine 执行内核 @param options 门面配置 @return 已装配服务 @return SQL 组件装配错误
func (*Service) ActivateProcessInstances ¶
func (s *Service) ActivateProcessInstances(ctx context.Context, processInstanceIDs []string, operator string) (R, error)
ActivateProcessInstances 批量恢复挂起的流程实例。 @param ctx 上下文 @param processInstanceIDs 实例 Id 列表 @param operator 操作人身份 Id @return 统一返回(data 含 activated 数) @return 错误
func (*Service) AddDelegateTask ¶
AddDelegateTask 新增委托规则。 @param ctx 上下文 @param rule 委托规则(Create 时 ID 可为空由存储生成) @return 统一返回(data 为规则 Id) @return 错误
func (*Service) AddExecution ¶
AddExecution 加签:为当前任务追加办理人(前加签/后加签)。 @param ctx 上下文 @param req 加签请求 @return 统一返回(data 为加签结果) @return 错误
func (*Service) AddModelCategory ¶
AddModelCategory 新增模型/分类(一表两用:模型与分类)。 @param ctx 上下文 @param m 实体(ModelName/ModelCode/租户必填) @return 统一返回(data 为落库实体) @return 错误
func (*Service) AddMultiInstanceMember ¶
func (s *Service) AddMultiInstanceMember(ctx context.Context, processInstanceID, activityID, assignee string) (R, error)
AddMultiInstanceMember 向多实例(会签)活动动态追加一个实例成员。 @param ctx 上下文 @param processInstanceID 流程实例 ID @param activityID 多实例活动 ID @param assignee 新成员身份 Id @return 统一返回 @return 错误
func (*Service) AddRemind ¶
AddRemind 新增催办配置。 @param ctx 上下文 @param req 催办保存请求 @return 统一返回(data 为催办配置) @return 错误
func (*Service) AddStepDesign ¶
AddStepDesign 新增设计时步骤配置。 @param ctx 上下文 @param d 实体(Name/StepCode/ModelID 必填) @return 统一返回(data 为落库实体) @return 错误
func (*Service) AddTemplateDef ¶
AddTemplateDef 新增设计器模板。 @param ctx 上下文 @param t 实体(Name 必填) @return 统一返回(data 为落库实体) @return 错误
func (*Service) BackTask ¶
BackTask 退回任务到上一节点(仅串行流程)。 @param ctx 上下文 @param vo 退回请求 @return 统一返回 @return 错误
func (*Service) BackToStepTask ¶
BackToStepTask 退回任务到指定步骤(任意节点退回;目标为空时由服务端计算)。 @param ctx 上下文 @param vo 退回请求 @return 统一返回 @return 错误
func (*Service) ClaimTask ¶
ClaimTask 签收任务(组任务认领到个人)。 @param ctx 上下文 @param taskID 任务 ID @param userID 签收人身份 Id @return 统一返回 @return 错误
func (*Service) Complete ¶
Complete 办结任务(预存下一步校验、权重累计、委派分支、收尾链)。 @param ctx 上下文 @param vo 办结请求 @return 统一返回(data 含 nextTaskIds/finished) @return 错误
func (*Service) CompleteReviewTask ¶
func (s *Service) CompleteReviewTask(ctx context.Context, reviewTaskID, opinion, operator string) (R, error)
CompleteReviewTask 办结审阅影子任务(回写意见与审阅时间)。 @param ctx 上下文 @param reviewTaskID 影子任务 ID @param opinion 审阅意见 @param operator 操作人身份 Id @return 统一返回(data 为更新后影子任务) @return 错误
func (*Service) CompleteSign ¶
func (s *Service) CompleteSign(ctx context.Context, taskID string, countersignResult int) (R, error)
CompleteSign 会签比例结论:按已办比例判定会签是否通过。 @param ctx 上下文 @param taskID 会签任务 ID @param countersignResult 会签结论:0 否决 / 1 通过 @return 统一返回(data 为是否达成比例) @return 错误
func (*Service) CompleteToTargetActivity ¶
CompleteToTargetActivity 直送:办结并提交至指定目标节点。 @param ctx 上下文 @param vo 办结请求(TargetActivityID 必填) @return 统一返回 @return 错误
func (*Service) CopyProcess ¶
func (s *Service) CopyProcess(ctx context.Context, sourceModelID string, targetModelIDs []string) (R, error)
CopyProcess 复制源模型 XML 到目标模型列表(copyProcess:resourceId=源业务模型,modelIdList=目标业务模型)。 目标未绑定引擎模型时自动创建引擎模型再回填绑定。 @param ctx 上下文 @param sourceModelID 源业务模型主键 @param targetModelIDs 目标业务模型主键列表 @return 统一返回(data 含 copied 数) @return 错误
func (*Service) CountUnreadReviews ¶
CountUnreadReviews 统计审阅人未读影子任务数。 @param ctx 上下文 @param reviewer 审阅人身份 Id @param tenantID 租户 @return 统一返回(data 为未读数) @return 错误
func (*Service) CreateProcessModel ¶
func (s *Service) CreateProcessModel(ctx context.Context, tenantID, name, modelCode, xml string) (R, error)
CreateProcessModel 设计器建模型:创建引擎模型并写入编辑源,同步建立业务模型绑定(EngineModelID)。 @param ctx 上下文 @param tenantID 租户(业务系统代号) @param name 模型名称(必填) @param modelCode 模型代号 = 流程定义 Key(必填) @param xml BPMN XML 源(可空,空则仅建骨架) @return 统一返回(data 为 CreatedProcessModel) @return 错误
func (*Service) DelExecution ¶
DelExecution 减签:移除被加签人子任务并按需恢复父任务。 @param ctx 上下文 @param req 减签请求 @return 统一返回(data 为减签结果) @return 错误
func (*Service) DelegateTask ¶
DelegateTask 委派任务(delegate/task:处理人转他人办理,resolve 归还)。 @param ctx 上下文 @param taskID 任务 ID @param userID 被委派人身份 Id @return 统一返回 @return 错误
func (*Service) DeleteCountersignWeights ¶
func (s *Service) DeleteCountersignWeights(ctx context.Context, processDefinitionKey, activityID, tenantID string) (R, error)
DeleteCountersignWeights 清空节点会签权重配置(weight/delete:SaveByNode 先删后插空集)。 @param ctx 上下文 @param processDefinitionKey 流程定义 Key @param activityID 节点 ID @param tenantID 租户(空不隔离) @return 统一返回 @return 错误
func (*Service) DeleteDelegateTask ¶
DeleteDelegateTask 删除委托规则。 @param ctx 上下文 @param id 规则 ID @return 统一返回 @return 错误
func (*Service) DeleteModelCategory ¶
DeleteModelCategory 批量删除模型/分类(物理删除,启停经 Edit 调整)。 @param ctx 上下文 @param ids 主键集合 @return 统一返回 @return 错误
func (*Service) DeleteRemind ¶
DeleteRemind 删除催办配置。 @param ctx 上下文 @param id 催办配置 ID @return 统一返回 @return 错误
func (*Service) DeleteStepDesign ¶
DeleteStepDesign 批量删除设计时步骤配置。 @param ctx 上下文 @param ids 主键集合 @return 统一返回 @return 错误
func (*Service) DeleteTemplateDef ¶
DeleteTemplateDef 批量删除设计器模板。 @param ctx 上下文 @param ids 主键集合 @return 统一返回 @return 错误
func (*Service) DeployModel ¶
DeployModel 部署模型并生成步骤快照:引擎部署绑定的 BPMN XML → 设计时步骤转运行期 his_step 快照 → 回写最近部署时间。 @param ctx 上下文 @param tenantID 租户(业务系统代号) @param modelID 模型主键(须已绑定引擎模型 EngineModelID) @return 统一返回(data 含 deploymentId/definitionId/snapshotCount) @return 错误
func (*Service) DisableDelegateTask ¶
DisableDelegateTask 停用委托规则。 @param ctx 上下文 @param id 规则 ID @return 统一返回 @return 错误
func (*Service) DoActivateProcessInstance ¶
func (s *Service) DoActivateProcessInstance(ctx context.Context, processInstanceID, operator string) (R, error)
DoActivateProcessInstance 恢复挂起的流程实例。 @param ctx 上下文 @param processInstanceID 流程实例 ID @param operator 操作人身份 Id @return 统一返回 @return 错误
func (*Service) DoAddComment ¶ added in v0.1.2
func (s *Service) DoAddComment(ctx context.Context, taskID, userID, processInstanceID, typ, msg string) (R, error)
DoAddComment 添加审批意见(对位 Java WorkflowCommentService.addComment → AddHisCommentCmd: 任务级/流程级二选一,TYPE_ 缺省 SP,MESSAGE_ 归一化截断 3900,FULL_MSG_ 存原文)。 @param ctx 上下文 @param taskID 任务 ID(可为空) @param userID 作者身份 Id @param processInstanceID 流程实例 Id(taskID 为空时必填) @param typ 意见类型代码(CommentTypeEnum,空时默认 SP) @param msg 意见内容 @return 统一返回(data 为落库评论) @return 错误
func (*Service) DoDeleteProcessByBusinessID ¶
func (s *Service) DoDeleteProcessByBusinessID(ctx context.Context, tenantID, businessKey, operator string) (R, error)
DoDeleteProcessByBusinessID 按业务单据删除其流程实例。 @param ctx 上下文 @param tenantID 租户(业务系统代号) @param businessKey 业务单据 ID @param operator 操作人身份 Id @return 统一返回 @return 错误
func (*Service) DoDeleteProcessInstance ¶
func (s *Service) DoDeleteProcessInstance(ctx context.Context, processInstanceID, operator, reason string) (R, error)
DoDeleteProcessInstance 删除流程实例(运行态删除 + 历史留痕)。 @param ctx 上下文 @param processInstanceID 流程实例 ID @param operator 操作人身份 Id @param reason 删除原因 @return 统一返回 @return 错误
func (*Service) DoMoveActivity ¶ added in v0.1.2
func (s *Service) DoMoveActivity(ctx context.Context, processInstanceID, fromActivityID, toActivityID string) (R, error)
DoMoveActivity 普通节点跳转(对位 Java ProcessesUtil#moveActivity:3526-3548)。 @param ctx 上下文 @param processInstanceID 实例 Id(Java 入参 proInstId) @param fromActivityID 来源活动 Id(Java 入参 nodeId) @param toActivityID 目标活动 Id(Java 入参 toNodeId) @return 统一返回 @return 错误
func (*Service) DoMoveExecution ¶ added in v0.1.2
func (s *Service) DoMoveExecution(ctx context.Context, processInstanceID, toActivityID string) (R, error)
DoMoveExecution 执行迁移(对位 Java ProcessesUtil#moveExecution:3610-3632 moveExecutionToActivityId)。 @param ctx 上下文 @param processInstanceID 实例 Id(Java 入参 proInstId) @param toActivityID 目标活动 Id(Java 入参 toNodeId) @return 统一返回 @return 错误
func (*Service) DoReactivateProcess ¶
func (s *Service) DoReactivateProcess(ctx context.Context, historicProcessInstanceID, targetActivityID, operator string) (R, error)
DoReactivateProcess 重激活已结束实例到指定节点(重激活生命周期)。 @param ctx 上下文 @param historicProcessInstanceID 历史实例 ID @param targetActivityID 重激活目标节点 ID @param operator 操作人身份 Id @return 统一返回(data 含新实例 ID) @return 错误
func (*Service) DoResetProcess ¶
func (s *Service) DoResetProcess(ctx context.Context, processInstanceID, operator string) (R, error)
DoResetProcess 重置流程实例(清空运行态回到发起节点)。 @param ctx 上下文 @param processInstanceID 流程实例 ID @param operator 操作人身份 Id @return 统一返回 @return 错误
func (*Service) DoRollbackTask ¶
func (s *Service) DoRollbackTask(ctx context.Context, processInstanceID, taskID, operator string) (R, error)
DoRollbackTask 撤回任务(发起人/特权人撤回已流转任务,策略族执行)。 @param ctx 上下文 @param processInstanceID 流程实例 ID @param taskID 待撤回任务 ID @param operator 操作人身份 Id @return 统一返回 @return 错误
func (*Service) DoStopProcessInstance ¶
func (s *Service) DoStopProcessInstance(ctx context.Context, processInstanceID, operator, message string) (R, error)
DoStopProcessInstance 软终止流程实例(按实例 ID,写终态留痕)。 @param ctx 上下文 @param processInstanceID 流程实例 ID @param operator 操作人身份 Id @param message 终止意见 @return 统一返回 @return 错误
func (*Service) DoStopTaskByTaskID ¶
DoStopTaskByTaskID 按任务软终止其所在流程实例。 @param ctx 上下文 @param taskID 任务 ID @param operator 操作人身份 Id @return 统一返回 @return 错误
func (*Service) DoSuspendProcessInstance ¶
func (s *Service) DoSuspendProcessInstance(ctx context.Context, processInstanceID, operator string) (R, error)
DoSuspendProcessInstance 挂起流程实例。 @param ctx 上下文 @param processInstanceID 流程实例 ID @param operator 操作人身份 Id @return 统一返回 @return 错误
func (*Service) DoTaskOwnerAdjustment ¶
func (s *Service) DoTaskOwnerAdjustment(ctx context.Context, processInstanceID, taskKey, fromOwner, toOwner, operator string) (R, error)
DoTaskOwnerAdjustment 按节点调整运行中任务的处理人(遍历实例下该节点任务逐个改写)。 @param ctx 上下文 @param processInstanceID 流程实例 ID @param taskKey 目标节点 Key @param fromOwner 原处理人,空表示不限 @param toOwner 新处理人 @param operator 操作人身份 Id @return 统一返回(data 含调整任务数) @return 错误
func (*Service) DoTaskOwnerAdjustmentByID ¶
func (s *Service) DoTaskOwnerAdjustmentByID(ctx context.Context, taskID, toOwner, operator string) (R, error)
DoTaskOwnerAdjustmentByID 按任务 ID 调整处理人。 @param ctx 上下文 @param taskID 任务 ID @param toOwner 新处理人 @param operator 操作人身份 Id @return 统一返回 @return 错误
func (*Service) EditDelegateTask ¶
EditDelegateTask 更新委托规则。 @param ctx 上下文 @param rule 委托规则(ID 必填) @return 统一返回 @return 错误
func (*Service) EditModelCategory ¶
EditModelCategory 更新模型/分类。 @param ctx 上下文 @param m 实体(ID 必填) @return 统一返回(data 为更新后实体) @return 错误
func (*Service) EditRemind ¶
EditRemind 更新催办配置。 @param ctx 上下文 @param req 催办保存请求(ID 必填) @return 统一返回(data 为催办配置) @return 错误
func (*Service) EditStepDesign ¶
EditStepDesign 更新设计时步骤配置。 @param ctx 上下文 @param d 实体(ID 必填) @return 统一返回(data 为更新后实体) @return 错误
func (*Service) EditTemplateDef ¶
EditTemplateDef 更新设计器模板。 @param ctx 上下文 @param t 实体(ID 必填) @return 统一返回(data 为更新后实体) @return 错误
func (*Service) EnableDelegateTask ¶
EnableDelegateTask 启用委托规则。 @param ctx 上下文 @param id 规则 ID @return 统一返回 @return 错误
func (*Service) GetBackNodes ¶
GetBackNodes 查询任务的可退回节点列表(前端"退回"按钮的数据源)。 @param ctx 上下文 @param taskID 当前任务 ID @return 统一返回(data 为可退节点视图列表) @return 错误
func (*Service) GetDefinitionXML ¶
GetDefinitionXML 读取流程定义的 BPMN XML(getHisModelJson / getProcessDefinitionJsonInfo 数据面)。 @param ctx 上下文 @param definitionID 流程定义 Id @return 统一返回(data 为 {definitionId, definitionKey, xml}) @return 错误
func (*Service) GetDoneTaskListByIdentityID ¶
func (s *Service) GetDoneTaskListByIdentityID(ctx context.Context, identityID string, query PageQuery) (R, error)
GetDoneTaskListByIdentityID 按身份 Id 分页查询已办任务。 @param ctx 上下文 @param identityID 身份 Id @param query 分页参数 @return 统一返回(data 为分页已办视图) @return 错误
func (*Service) GetFlowHighlight ¶
GetFlowHighlight 查询流程图高亮数据(已走节点/在途节点/已走连线/待办节点)。 @param ctx 上下文 @param processInstanceID 流程实例 ID @return 统一返回(data 为高亮数据) @return 错误
func (*Service) GetFlowHighlightByTask ¶
GetFlowHighlightByTask 按任务查询其所在实例的流程图高亮数据。 @param ctx 上下文 @param taskID 任务 ID @return 统一返回(data 为高亮数据) @return 错误
func (*Service) GetIdentityTree ¶
GetIdentityTree 查询内置身份库树(用户与组两级:组 → 组成员用户;未分组用户挂根)。 @param ctx 上下文 @return 统一返回(data 为树节点列表) @return 错误
func (*Service) GetModelAndStepPage ¶
GetModelAndStepPage 查询租户下模型列表并附带各自设计时步骤(findModelAndStepPageList 数据面)。 @param ctx 上下文 @param tenantID 租户 @return 统一返回(data 为 {model, steps} 列表) @return 错误
func (*Service) GetModelCategoryByCode ¶
func (s *Service) GetModelCategoryByCode(ctx context.Context, tenantID, modelCode string) (R, error)
GetModelCategoryByCode 按租户内代号查询模型/分类。 @param ctx 上下文 @param tenantID 租户 @param modelCode 模型代号(=定义 Key 或分类代号) @return 统一返回(data 为实体,未命中 data 为 null) @return 错误
func (*Service) GetModelCategoryByID ¶
GetModelCategoryByID 按主键查询模型/分类。 @param ctx 上下文 @param id 主键 @return 统一返回(data 为实体,未命中 data 为 null) @return 错误
func (*Service) GetModelCategoryTree ¶
GetModelCategoryTree 查询租户下模型/分类树(分类层级投影)。 @param ctx 上下文 @param tenantID 租户 @return 统一返回(data 为树节点列表) @return 错误
func (*Service) GetModelXML ¶
GetModelXML 读取业务模型绑定的引擎模型编辑源(getModelJsonByType type=model 与 export/xml 数据面)。 @param ctx 上下文 @param modelID 业务模型主键(workflow_model.id) @return 统一返回(data 为 {modelId, engineModelId, modelCode, xml}) @return 错误
func (*Service) GetNextUserTaskAndUserList ¶
GetNextUserTaskAndUserList 推演当前任务之后的节点与候选处理人。 @param ctx 上下文 @param taskID 任务 ID @return 统一返回(data 为节点与用户视图列表) @return 错误
func (*Service) GetNextUserTaskAndUserListByKey ¶
func (s *Service) GetNextUserTaskAndUserListByKey(ctx context.Context, tenantID, processDefinitionKey, businessKey string, vars map[string]any) (R, error)
GetNextUserTaskAndUserListByKey 未发起实例按流程定义推演(不含办结伪节点)。 @param ctx 上下文 @param tenantID 租户(业务系统代号) @param processDefinitionKey 流程定义 Key(取最新版本) @param businessKey 业务单据 Id(预留透传) @param vars 表单/条件变量 @return 统一返回(data 为节点与用户视图列表) @return 错误
func (*Service) GetOperationButtons ¶
GetOperationButtons 按实例状态聚合可用操作按钮(前端 operationButtonList 数据面)。 运行中:终止/挂起/退回/撤回/删除;挂起:激活;已结束:重激活/删除。 @param ctx 上下文 @param processInstanceID 流程实例 ID @return 统一返回(data 为按钮代号列表) @return 错误
func (*Service) GetProcessGlobalVariableByBusinessID ¶
func (s *Service) GetProcessGlobalVariableByBusinessID(ctx context.Context, tenantID, businessKey string, names []string) (R, error)
GetProcessGlobalVariableByBusinessID 按业务键查询运行实例的全局变量。 @param ctx 上下文 @param tenantID 租户(业务系统代号) @param businessKey 业务单据 ID @param names 变量名列表,nil 表示全部 @return 统一返回(data 为变量映射) @return 错误
func (*Service) GetProcessGlobalVariableByProcessInstanceID ¶
func (s *Service) GetProcessGlobalVariableByProcessInstanceID(ctx context.Context, processInstanceID string, names []string) (R, error)
GetProcessGlobalVariableByProcessInstanceID 按实例查询全局变量。 @param ctx 上下文 @param processInstanceID 流程实例 ID @param names 变量名列表,nil 表示全部 @return 统一返回(data 为变量映射) @return 错误
func (*Service) GetProcessInstancePageList ¶
GetProcessInstancePageList 分页查询运行中实例(引擎全量列表 + 门面内存分页)。 @param ctx 上下文 @param query 分页参数 @return 统一返回(data 为 PageResult,行为实例列表) @return 错误
func (*Service) GetRemind ¶
GetRemind 查询单条催办配置。 @param ctx 上下文 @param id 催办配置 ID @return 统一返回(data 为催办配置,未命中 data 为 null) @return 错误
func (*Service) GetRemindPageList ¶
func (s *Service) GetRemindPageList(ctx context.Context, modelID string, query PageQuery) (R, error)
GetRemindPageList 分页查询催办配置(可按流程模型过滤)。 @param ctx 上下文 @param modelID 流程模型 ID(空表示全部) @param query 分页参数 @return 统一返回(data 为分页结果) @return 错误
func (*Service) GetReviewTask ¶
GetReviewTask 查询单条审阅影子任务。 @param ctx 上下文 @param reviewTaskID 影子任务 ID @return 统一返回(data 为影子任务,未命中 data 为 null) @return 错误
func (*Service) GetStepDesign ¶
GetStepDesign 按主键查询设计时步骤(step/findById 数据面)。 @param ctx 上下文 @param id 步骤主键 @return 统一返回(data 为步骤实体,未命中 data 为 null) @return 错误
func (*Service) GetTaskHistoryListByBusinessID ¶
func (s *Service) GetTaskHistoryListByBusinessID(ctx context.Context, tenantID, businessKey string) (R, error)
GetTaskHistoryListByBusinessID 按业务单据查询任务历史列表。 @param ctx 上下文 @param tenantID 租户(业务系统代号) @param businessKey 业务单据 ID @return 统一返回(data 为历史列表) @return 错误
func (*Service) GetTaskHistoryListByProcessInstanceID ¶
func (s *Service) GetTaskHistoryListByProcessInstanceID(ctx context.Context, processInstanceID string) (R, error)
GetTaskHistoryListByProcessInstanceID 按实例查询任务历史(已办)列表。 @param ctx 上下文 @param processInstanceID 流程实例 ID @return 统一返回(data 为历史列表) @return 错误
func (*Service) GetTaskHistoryListByTaskID ¶
GetTaskHistoryListByTaskID 按任务查询历史扩展记录。 @param ctx 上下文 @param taskID 任务 ID @return 统一返回(data 为历史记录) @return 错误
func (*Service) GetTaskInfoByTaskID ¶
GetTaskInfoByTaskID 按任务 ID 查询任务详情(含 workflow 扩展列)。 Java 方法名 geTaskInfoByTaskId(拼写保留)。 @param ctx 上下文 @param taskID 任务 ID @return 统一返回(data 为任务详情) @return 错误
func (*Service) GetTaskMessageListByBusinessID ¶
func (s *Service) GetTaskMessageListByBusinessID(ctx context.Context, tenantID, businessKey string) (R, error)
GetTaskMessageListByBusinessID 按业务单据查询任务消息(待办)列表。 @param ctx 上下文 @param tenantID 租户(业务系统代号) @param businessKey 业务单据 ID @return 统一返回(data 为消息列表) @return 错误
func (*Service) GetTodoTaskListByIdentityID ¶
func (s *Service) GetTodoTaskListByIdentityID(ctx context.Context, identityID string, query PageQuery) (R, error)
GetTodoTaskListByIdentityID 按身份 Id 分页查询待办任务。 @param ctx 上下文 @param identityID 身份 Id @param query 分页参数 @return 统一返回(data 为分页待办视图) @return 错误
func (*Service) GetUserTaskMetas ¶
GetUserTaskMetas 查询定义上全部用户任务节点元数据(getUserTaskJsonInfo 数据面: 设计器属性面板按定义读取各节点的执行人/步骤/权重扩展配置)。 @param ctx 上下文 @param definitionID 流程定义 Id @return 统一返回(data 为节点元数据列表) @return 错误
func (*Service) GetWorkflowStatusByBusinessID ¶
func (s *Service) GetWorkflowStatusByBusinessID(ctx context.Context, tenantID, processDefinitionKey, businessKey string) (R, error)
GetWorkflowStatusByBusinessID 查询业务单据流程状态(表单状态机中文值)。 @param ctx 上下文 @param tenantID 租户(业务系统代号) @param processDefinitionKey 流程定义 Key @param businessKey 业务单据 ID @return 统一返回(data 为状态对象) @return 错误
func (*Service) HandleTaskExceptions ¶
HandleTaskExceptions 批量标记异常处理状态。 @param ctx 上下文 @param ids 异常 ID 列表 @param handled true 置为已处理 / false 回退未处理 @return 统一返回 @return 错误
func (*Service) IsExistRunningProcess ¶
func (s *Service) IsExistRunningProcess(ctx context.Context, tenantID, processDefinitionKey, businessKey string) (R, error)
IsExistRunningProcess 判断业务键下是否存在运行中实例。 @param ctx 上下文 @param tenantID 租户(业务系统代号) @param processDefinitionKey 流程定义 Key @param businessKey 业务单据 ID @return 统一返回(data 为 bool) @return 错误
func (*Service) IsMultiInstanceLastPerson ¶ added in v0.1.2
IsMultiInstanceLastPerson 判断会签任务是否为最后一名待办成员(对位 Java ProcessesUtil#isMultiInstanceLastPerson:非会签用户任务恒 true;会签按完成条件比例 以 (completed+1)/all 整数除法判定;无完成条件或非用户任务返回 false)。 @param ctx 上下文 @param taskID 任务 ID @return 统一返回(data 为布尔值) @return 错误
func (*Service) IsProcessDeployed ¶
func (s *Service) IsProcessDeployed(ctx context.Context, tenantID, processDefinitionKey string) (R, error)
IsProcessDeployed 判断流程定义是否已部署(按租户解析最新定义)。 @param ctx 上下文 @param tenantID 租户(业务系统代号) @param processDefinitionKey 流程定义 Key @return 统一返回(data 为 bool) @return 错误
func (*Service) ListActExtends ¶
ListActExtends 按定义 Key(可加节点)查询审阅人绑定列表。 @param ctx 上下文 @param definitionKey 流程定义 Key @param activityID 节点 ID(空表示该定义全部) @return 统一返回(data 为绑定列表) @return 错误
func (*Service) ListCountersignWeights ¶
func (s *Service) ListCountersignWeights(ctx context.Context, processDefinitionKey, activityID, tenantID string) (R, error)
ListCountersignWeights 查询节点会签权重配置(/weight/getWeightByProcessDefKeyAndActId 数据面)。 @param ctx 上下文 @param processDefinitionKey 流程定义 Key @param activityID 节点 ID @param tenantID 租户(空不隔离) @return 统一返回(data 为权重配置列表) @return 错误
func (*Service) ListDelegateTask ¶
ListDelegateTask 分页查询委托规则列表。 @param ctx 上下文 @param ownerID 委托人身份 Id @param tenantID 租户(业务系统代号) @return 统一返回(data 为规则列表) @return 错误
func (*Service) ListHisSteps ¶
ListHisSteps 查询部署下的步骤快照(运行期规则字典只读)。 @param ctx 上下文 @param deploymentID 部署 ID @return 统一返回(data 为快照规则列表) @return 错误
func (*Service) ListModelCategory ¶
ListModelCategory 查询租户下模型与分类列表(sort 升序)。 @param ctx 上下文 @param tenantID 租户 @return 统一返回(data 为列表) @return 错误
func (*Service) ListReviewTasksByInstance ¶
func (s *Service) ListReviewTasksByInstance(ctx context.Context, processInstanceID string) (R, error)
ListReviewTasksByInstance 按实例查询审阅影子任务。 @param ctx 上下文 @param processInstanceID 流程实例 ID @return 统一返回(data 为影子任务列表) @return 错误
func (*Service) ListReviewTasksByReviewer ¶
func (s *Service) ListReviewTasksByReviewer(ctx context.Context, reviewer, tenantID string, query PageQuery) (R, error)
ListReviewTasksByReviewer 按审阅人分页查询影子任务。 @param ctx 上下文 @param reviewer 审阅人身份 Id @param tenantID 租户 @param query 分页参数 @return 统一返回(data 为分页结果) @return 错误
func (*Service) ListStepDesignByModel ¶
ListStepDesignByModel 按模型查询设计时步骤列表。 @param ctx 上下文 @param modelID 模型主键 @return 统一返回(data 为步骤列表) @return 错误
func (*Service) ListTaskExceptions ¶
ListTaskExceptions 按实例查询未处理任务异常。 @param ctx 上下文 @param processInstanceID 流程实例 ID @return 统一返回(data 为异常列表) @return 错误
func (*Service) ListTemplateDefs ¶
ListTemplateDefs 查询租户下设计器模板列表。 @param ctx 上下文 @param tenantID 租户 @return 统一返回(data 为模板列表) @return 错误
func (*Service) RegisterBusinessCallbackHook ¶
RegisterBusinessCallbackHook 注册业务回调全局钩子(TASK_CREATED)并预热元数据缓存。 未装配业务系统注册存储时为空操作(回调能力停用)。 016 号审计:CallbackClient 此前零调用点,本方法把 D5 回调能力真正接入生产链路。 @param ctx 上下文(用于预热,可取消) @return 预热错误(注册本身不失败)
func (*Service) RegisterCountersignRuntime ¶
RegisterCountersignRuntime 注册会签执行监听器并预热节点元数据缓存。 对位文档 011 §部署强校验:监听器在引擎命令内同步执行且只读预热缓存, 因此注册后必须预热,否则会签节点在首单触发 WORKFLOW-2104。 016 号审计:此前该方法无生产调用点,会签集合配置与权重监听器永不触发。 @param ctx 上下文(用于预热,可取消) @return 注册或预热错误(引擎不支持监听器注册时返回错误)
func (*Service) RegisterExecutorRewriteHook ¶
RegisterExecutorRewriteHook 注册执行人重写全局钩子(TASK_CREATED)。 部署新定义后应调用 RewriteWarmupAll 预热元数据缓存(锁外)。 @param ctx 上下文(用于注册期预热,可取消) @return 预热错误(注册本身不失败)
func (*Service) RemoveMultiInstanceMember ¶
func (s *Service) RemoveMultiInstanceMember(ctx context.Context, processInstanceID, activityID, assignee, executionID string, completed bool) (R, error)
RemoveMultiInstanceMember 移除多实例(会签)活动的一个实例成员。 @param ctx 上下文 @param processInstanceID 流程实例 ID @param activityID 多实例活动 ID @param assignee 成员身份 Id @param executionID 被移除实例的执行 ID @param completed 移除时是否视作已完成 @return 统一返回 @return 错误
func (*Service) ResolveTask ¶
ResolveTask 处理委派任务并将处理人恢复为所有者。 @param ctx 上下文 @param taskID 任务 ID @param userID 处理人 ID @return 统一返回 @return 错误
func (*Service) ResolveTaskWithVariables ¶ added in v0.1.2
func (s *Service) ResolveTaskWithVariables(ctx context.Context, taskID, userID string, variables map[string]any) (R, error)
ResolveTaskWithVariables 处理委派任务并写入任务局部变量。 @param ctx 上下文 @param taskID 任务 ID @param userID 处理人身份 Id @param variables 任务局部变量(对位 Java resolveTask(taskId, variables),可空) @return 统一返回 @return 错误
func (*Service) RetireDelegateTask ¶
RetireDelegateTask 注销委托规则(不可再启用)。 @param ctx 上下文 @param id 规则 ID @return 统一返回 @return 错误
func (*Service) RewarmBusinessCallbackDefinition ¶
RewarmBusinessCallbackDefinition 部署新定义后预热业务回调元数据缓存。 @param ctx 上下文 @param definitionID 流程定义 Id @return 预热错误
func (*Service) RewarmCountersignDefinition ¶
RewarmCountersignDefinition 部署新定义后预热指定定义的会签节点元数据缓存。 部署链路调用(DeployModel),不注册监听器(启动期已注册)。 @param ctx 上下文 @param definitionID 流程定义 Id @return 预热错误
func (*Service) RewarmExecutorRewriteDefinition ¶
RewarmExecutorRewriteDefinition 部署新定义后预热执行人重写钩子的元数据缓存。 016 号审计:此前仅启动期预热,新部署定义的首个实例会静默退回模型默认执行人。 @param ctx 上下文 @param definitionID 流程定义 Id @return 预热错误
func (*Service) SaveActExtend ¶
SaveActExtend 保存审阅人绑定(活动扩展,workflow_act_extend 一行)。 @param ctx 上下文 @param ext 绑定实体(ActivityID/ProcessDefinitionKey/OwnerType/OwnerValue 必填) @return 统一返回(data 为落库实体) @return 错误
func (*Service) SaveAgreeNextActivity ¶
SaveAgreeNextActivity 预存"同意"方向下一步节点与处理人(多节点逐个预存, 目标为保留代号 end 或无执行人的节点跳过)。 @param ctx 上下文 @param req 预存请求 @return 统一返回 @return 错误
func (*Service) SaveCountersignWeights ¶
func (s *Service) SaveCountersignWeights(ctx context.Context, processDefinitionKey, activityID, tenantID string, configs []CountersignWeight) (R, error)
SaveCountersignWeights 保存节点会签权重配置(/weight/save 数据面)。 @param ctx 上下文 @param processDefinitionKey 流程定义 Key @param activityID 节点 ID @param tenantID 租户(空不隔离) @param configs 权重配置列表 @return 统一返回 @return 错误
func (*Service) SaveModelXML ¶
SaveModelXML 保存业务模型的 BPMN XML 编辑源(save/xml;空源骨架模型可直接首存)。 @param ctx 上下文 @param modelID 业务模型主键 @param xml BPMN XML 源 @return 统一返回 @return 错误
func (*Service) StartProcess ¶
StartProcess 发起流程实例(注入协议变量并生成首步待办)。 @param ctx 上下文 @param vo 发起请求 @return 统一返回(data 含 processInstanceId/taskId 等) @return 错误
func (*Service) StartProcessAndFirstStep ¶
func (s *Service) StartProcessAndFirstStep(ctx context.Context, vo *StartProcessInstanceVo) (R, error)
StartProcessAndFirstStep 发起流程并预存首步执行人(与 StartProcess 同实现: 首步预生成在发起链路内必做,两个入口保留以兼容 Java 门面方法集)。 @param ctx 上下文 @param vo 发起请求 @return 统一返回 @return 错误
func (*Service) StartSchedulers ¶
StartSchedulers 启动后台调度(自动办结/超时提醒/催办扫描/僵尸监控,按配置开关生效)。 @param ctx 上下文(取消后调度循环以取消态执行 tick)
func (*Service) SuspendProcessInstances ¶
func (s *Service) SuspendProcessInstances(ctx context.Context, processInstanceIDs []string, operator string) (R, error)
SuspendProcessInstances 批量挂起流程实例(逐个挂起,失败即中断并返回已处理数)。 @param ctx 上下文 @param processInstanceIDs 实例 Id 列表 @param operator 操作人身份 Id @return 统一返回(data 含 suspended 数) @return 错误
func (*Service) SyncReviewForTask ¶
func (s *Service) SyncReviewForTask(ctx context.Context, task *api.Task, senderID, senderName string) (R, error)
SyncReviewForTask 为任务同步审阅影子任务(按 act_extend 审阅人绑定,幂等)。 @param ctx 上下文 @param task 引擎任务 @param senderID 发送人身份 Id @param senderName 发送人姓名 @return 统一返回(data 为生成的影子任务列表) @return 错误
func (*Service) TriggerDelegateScan ¶ added in v0.1.2
TriggerDelegateScan 触发一次定时委托扫描(对位 Java FlowableScheduleTask.scheduledDelegatedTask):扫描未委托活跃待办,三级命中 委托规则后按 doTaskOwnerAdjustmentById 语义改派;返回扫描汇总。 @param ctx 上下文 @return 统一返回(data 为 DelegateScanResult:scanned/adjusted/failed/errors) @return 错误(扫描数据源未接入等)
func (*Service) UpdateModelFromDefinition ¶
func (s *Service) UpdateModelFromDefinition(ctx context.Context, tenantID, definitionID string) (R, error)
UpdateModelFromDefinition 将历史定义 XML 回填到同 Key 业务模型的引擎模型源 (updateHisModelXml:复制历史版本到设计器再编辑保存的入口)。 @param ctx 上下文 @param tenantID 租户(业务系统代号) @param definitionID 历史流程定义 Id @return 统一返回 @return 错误
func (*Service) UpdateProcessGlobalVariable ¶
func (s *Service) UpdateProcessGlobalVariable(ctx context.Context, processInstanceID string, variables map[string]any) (R, error)
UpdateProcessGlobalVariable 更新流程实例全局变量(逐个变量设置)。 @param ctx 上下文 @param processInstanceID 流程实例 ID @param variables 变量名到值 @return 统一返回 @return 错误
func (*Service) UpdateWorkflowDocumentByProcessInstanceIDOrTaskID ¶
func (s *Service) UpdateWorkflowDocumentByProcessInstanceIDOrTaskID(ctx context.Context, processInstanceID, taskID string, document map[string]any) (R, error)
UpdateWorkflowDocumentByProcessInstanceIDOrTaskID 按实例或任务回写表单状态 (刷新状态机;document 覆盖参数当前由状态机统一计算,保留协议位)。 @param ctx 上下文 @param processInstanceID 流程实例 ID(与 taskID 至少一个非空) @param taskID 任务 ID @param document 回写数据(协议兼容参数) @return 统一返回 @return 错误
type SimulateOption ¶
type SimulateOption func(*SimulateService)
SimulateOption 是推演服务选项函数。
func WithSimulateSteps ¶
func WithSimulateSteps(steps StepStore) SimulateOption
WithSimulateSteps 注入 his_step 步骤规则存储(sort/returnApprovalStep 读取)。 未注入时跳过退回模式分支,输出按静态遍历顺序(对位 Java 无规则时的行为)。 @param steps 步骤规则存储端口 @return 选项
type SimulateService ¶
type SimulateService struct {
// contains filtered or unexported fields
}
SimulateService 是下一步推演器(P5.3,对位 Java ProcessesUtil#getNextUserTaskAndUserList:3073 / getNextUserTaskAndUserListByKey:3375 / FlowUtils#getNextUserTasks:39 静态图遍历)。 推演是纯静态图遍历:不考虑会签已完成/并行已走分支等运行时事实, 唯一运行时校正 = his_next_activity 历史执行人优先(与 Java 行为一致)。
func NewSimulateService ¶
func NewSimulateService(engine api.Engine, meta *ModelMetaService, next *NextActivityService, histories *HistoryExtendService, messages *MessageExtendService, identity api.IdentityService, c clock.Clock, opts ...SimulateOption) *SimulateService
NewSimulateService 构造下一步推演域服务。 @param engine 引擎门面(七服务) @param meta 模型元数据服务 @param next 下一步预生成域服务(his_next_activity 历史执行人来源,可 nil) @param histories 已办扩展域服务(预留,可 nil) @param messages 待办扩展域服务(退回步骤 sender 信息来源,可 nil) @param identity 身份服务(组成员展开/姓名补全,可 nil) @param c 时间源,nil 时回退真实时钟 @param opts 选项(步骤规则注入等) @return 推演域服务
func (*SimulateService) SimulateByKey ¶
func (s *SimulateService) SimulateByKey(ctx context.Context, tenantID, processDefinitionKey, businessKey string, vars map[string]any) ([]NextUserTaskView, error)
SimulateByKey 未发起实例按流程定义推演(对位 getNextUserTaskAndUserListByKey:3375, 从开始事件遍历、不包含办结伪节点)。 @param ctx 操作上下文 @param tenantID 租户(透传给调用方上下文校验,推演本身按定义遍历) @param processDefinitionKey 流程定义 Key(取最新版本) @param businessKey 业务单据 Id(预留参数,仅透传语义) @param vars 表单/条件变量(连线求值与 ${xxx} 执行人取值) @return 推演视图列表(不含 end 伪节点,与 Java getNextUserTasksWithoutEndNode 一致) @return 错误
func (*SimulateService) SimulateByTask ¶
func (s *SimulateService) SimulateByTask(ctx context.Context, taskID string, extraVars map[string]any) ([]NextUserTaskView, error)
SimulateByTask 按当前任务推演下一步用户任务及执行人(对位 getNextUserTaskAndUserList:3073)。 流程:三源变量合并 → isReturnStep 判定(五种退回模式)→ 静态图遍历 → 执行人解析 → 排序输出。 @param ctx 操作上下文 @param taskID 当前任务 Id(空或任务不存在返回空列表) @param extraVars 前端入参变量(连线条件过滤用,优先级最高) @return 推演视图列表(含保留代号 end 的"办结"项,与 Java getNextUserTasks 一致) @return 错误
type StartProcessInstanceVo ¶
type StartProcessInstanceVo = api.StartProcessInstanceVo
StartProcessInstanceVo 发起流程实例请求(必填:定义 Key/标题/操作人/租户/业务键)。
type StartResult ¶
type StartResult struct {
ProcessInstanceID string // 流程实例 Id
ProcessDefinitionID string // 流程定义 Id
TaskID string // 首个用户任务 Id
TaskName string // 首个用户任务名称
TaskKey string // 首个用户任务节点 Key(taskDefinitionKey)
}
StartResult 是发起流程结果(对位 Java publishAndGetFirstTaskByKey 返回 Map)。
type StartService ¶
type StartService struct {
// contains filtered or unexported fields
}
StartService 是流程发起域服务。 依赖注入风格与既有域服务一致:引擎门面 + 各域服务(意见/操作记录/待办/已办/表单/预生成)。
func NewStartService ¶
func NewStartService(engine api.Engine, meta *ModelMetaService, next *NextActivityService, comments *CommentService, operations *OperationRecordService, messages *MessageExtendService, histories *HistoryExtendService, documents *DocumentService) *StartService
NewStartService 构造流程发起域服务。 @param engine 引擎门面(七服务) @param meta 模型元数据服务 @param next 下一步预生成域服务 @param comments 审批意见服务 @param operations 操作记录服务 @param messages 待办扩展服务 @param histories 已办扩展服务 @param documents 业务表单状态服务 @return 发起域服务
func (*StartService) IsProcessDeployed ¶
func (s *StartService) IsProcessDeployed(ctx context.Context, tenantID, processDefinitionKey string) (api.ProcessDefinition, error)
IsProcessDeployed 判断流程定义是否已部署(按租户+Key 定位最新定义)。 引擎多租户语义:GetProcessDefinitionByKey 按上下文租户解析最新版本,故先注入租户上下文。 @param ctx 操作上下文 @param tenantID 租户(业务系统代号) @param processDefinitionKey 流程定义 Key @return 最新流程定义(已部署时) @return 错误(未部署返回 WORKFLOW-1651)
func (*StartService) Start ¶
func (s *StartService) Start(ctx context.Context, vo *StartProcessInstanceVo) (StartResult, error)
Start 发起流程实例并落位首任务全部扩展数据(对位 Java publishAndGetFirstTaskByKey)。 步骤:五参校验 → 部署校验(租户+Key)→ 协议变量注入 → 引擎发起 → 首任务定位 → 首步执行者解析与预生成(used=1+taskId)→ TJ 意见/操作记录/待办/已办镜像/表单状态。 @param ctx 上下文(租户信息由 vo.TenantID 注入引擎上下文,引擎多租户按上下文隔离) @param vo 发起请求(必填 ProcessDefinitionKey/Title/Operator/TenantID/BusinessKey) @return 发起结果(实例/定义/首任务三元组) @return 错误(参数缺失、流程未部署、发起失败、步骤未设置执行者等)
type StepDesign ¶
type StepDesign struct {
BaseColumns
Name string // name 步骤名称
StepCode string // step_code 步骤代号(=BPMN 节点 ID)
Description string // description 描述
Value string // value 扩展值
AccountName string // account_name 账套名
Source int // source 来源
ModelID string // model_id 所属模型 ID
ResourceID string // resource_id 关联资源 ID
Sort float64 // sort 排序号(DDL double)
Agree string // agree 同意配置
Reject string // reject 拒绝配置
Remark string // remark 备注
Fix string // fix 固定配置(text)
URL string // url 步骤处理地址
Visible int // visible 可见
TaskType string // task_type 任务类型
EditInfo string // edit_info 编辑信息(text)
OperateAuth string // operate_auth 操作权限(text)
AllowReturn string // allow_return 允许退回原始值("0" 禁止/"1" 允许)
BackStepCodes string // back_step_codes 可退回步骤代号白名单(逗号分隔)
BackStepNames string // back_step_names 可退回步骤名称(逗号分隔)
AutoComplete int // auto_complete 自动办结开关
AutoCompleteStartTime *time.Time // auto_complete_start_time 自动办结起始
AutoCompleteEndTime *time.Time // auto_complete_end_time 自动办结截止
TimeLimit float64 // time_limit 办结时限
TimeLimitUnit string // time_limit_unit 办结时限单位
RemindTimeLimit float64 // remind_time_limit 提醒时限
RemindTimeLimitUnit string // remind_time_limit_unit 提醒时限单位
ChannelTypeName string // channel_type_name 渠道类型
ChannelTypeNameCN string // channel_type_name_cn 渠道类型中文名
ReturnApprovalStep string // return_approval_step 退回审批步骤原始值
CountersignPercentReturn string // countersign_percent_return 会签比例退回原始值("1" 启用)
ReturnPercent string // return_percent 退回比例原始值(百分数)
}
StepDesign 是 workflow_step 行实体(设计时步骤配置)。 allow_return/countersign_percent_return/return_percent 等规则列原样保留 数据库形态,部署时经 DeploySnapshotService 转为运行期 StepRule。
type StepDesignService ¶
type StepDesignService struct {
// contains filtered or unexported fields
}
StepDesignService 是设计时步骤管理域服务。
func NewStepDesignService ¶
func NewStepDesignService(store StepDesignStore, c clock.Clock) *StepDesignService
NewStepDesignService 构造设计时步骤管理服务。 @param store 步骤存储端口 @param c 时间源,nil 时回退真实时钟 @return 步骤服务
func (*StepDesignService) Add ¶
func (s *StepDesignService) Add(ctx context.Context, d *StepDesign) (*StepDesign, error)
Add 新增设计时步骤(校验模型/代号/租户,模型内代号唯一,补齐主键与审计列)。 @param ctx 操作上下文 @param s 步骤数据(必填 model_id/step_code/tenant_id) @return 落库后的步骤实体 @return 错误 @param d 参数 d
func (*StepDesignService) Delete ¶
func (s *StepDesignService) Delete(ctx context.Context, ids ...string) error
Delete 按主键批量删除步骤(物理删除,语义取舍见本文件域服务段说明)。 @param ctx 操作上下文 @param ids 主键集合 @return 错误
func (*StepDesignService) Edit ¶
func (s *StepDesignService) Edit(ctx context.Context, d *StepDesign) (*StepDesign, error)
Edit 编辑设计时步骤(保留创建审计,刷新更新时间;代号变更需通过模型内查重)。 @param ctx 操作上下文 @param s 步骤数据(必填主键) @return 编辑后的步骤实体 @return 错误 @param d 参数 d
func (*StepDesignService) GetByID ¶
func (s *StepDesignService) GetByID(ctx context.Context, id string) (*StepDesign, bool, error)
GetByID 按主键查询设计时步骤(step/findById 门面数据面)。 @param ctx 操作上下文 @param id 步骤主键 @return 实体 @return 是否存在 @return 查询错误
func (*StepDesignService) ListByModel ¶
func (s *StepDesignService) ListByModel(ctx context.Context, modelID string) ([]*StepDesign, error)
ListByModel 查询模型下全部设计时步骤(按 sort 升序)。 @param ctx 操作上下文 @param modelID 模型 ID @return 步骤列表 @return 错误
type StepDesignStore ¶
type StepDesignStore interface {
// Insert 插入一条设计时步骤(ID/审计列由调用方生成填充)。
// @param ctx 操作上下文
// @param s 实体(必填 id/model_id/step_code/tenant_id)
// @return 错误
Insert(ctx context.Context, s *StepDesign) error
// Update 按主键更新整行业务列(主键与创建审计不参与更新)。
// @param ctx 操作上下文
// @param s 实体(必填 id)
// @return 错误(不存在时报未找到)
Update(ctx context.Context, s *StepDesign) error
// GetByPK 按主键查询。
// @param ctx 操作上下文
// @param id 主键
// @return 实体
// @return 是否存在
// @return 查询错误
GetByPK(ctx context.Context, id string) (*StepDesign, bool, error)
// GetByModelAndCode 按模型与步骤代号查询单条配置。
// @param ctx 操作上下文
// @param modelID 模型 ID
// @param stepCode 步骤代号
// @return 实体
// @return 是否存在
// @return 查询错误
GetByModelAndCode(ctx context.Context, modelID, stepCode string) (*StepDesign, bool, error)
// ListByModel 查询模型下全部步骤配置(按 sort 升序)。
// @param ctx 操作上下文
// @param modelID 模型 ID
// @return 实体列表(无记录返回空列表)
// @return 查询错误
ListByModel(ctx context.Context, modelID string) ([]*StepDesign, error)
// DeleteByIDs 按主键批量物理删除(缺失主键忽略)。
// @param ctx 操作上下文
// @param ids 主键集合
// @return 错误
DeleteByIDs(ctx context.Context, ids []string) error
}
StepDesignStore 是 workflow_step(设计时步骤配置)的存储端口。
type StepResolver ¶
type StepResolver interface {
// ResolveStepID 按步骤代号解析设计时步骤 Id。
// @param ctx 操作上下文
// @param stepCode 步骤代号
// @return 步骤 Id,未解析到返回空串
// @return 错误
ResolveStepID(ctx context.Context, stepCode string) (string, error)
}
StepResolver 是步骤代号→设计时步骤 Id 的解析端口(催办白名单匹配用; P2-B steprules 完成后由主控接线,nil 时按代号直匹配白名单)。
type StepRule ¶
type StepRule struct {
DeploymentID string // 部署 ID(快照归属)
StepCode string // 步骤代号 = BPMN 节点 ID(taskDefinitionKey)
StepName string // 步骤名称
AllowReturn string // 是否允许退回原始值("0" 禁止,其余/缺失允许)
BackStepCodes string // 允许退回到的步骤代号白名单(逗号分隔)
ReturnApprovalStep string // 退回审批步骤原始值(P2 仅透传,暂无消费方)
CountersignPercentReturn string // 是否启用会签比例退回原始值("1" 启用)
ReturnPercent string // 退回比例原始值(百分数,如 "50")
Sort int // 步骤排序号(可退节点视图排序用)
URL string // 步骤处理地址
}
StepRule 是 workflow_his_step 步骤快照中与退回/会签/展示相关的规则字段子集 (字段语义对位 Java WorkflowHisStepEntity;step_code 即 BPMN 节点 ID)。 allow_return/back_step_codes/countersign_percent_return/return_percent 原样保留 数据库形态("0"/"1"/数值串),由服务层按 Java 语义解释。
type StepRuleProvider ¶
type StepRuleProvider interface {
// PercentReturnRule 返回任务所属节点的会签比例退回规则。
// @param ctx 操作上下文
// @param taskID 任务 ID
// @return 规则
// @return 是否启用比例退回(false 时调用方跳过判定)
// @return 错误
PercentReturnRule(ctx context.Context, taskID string) (*PercentReturnRule, bool, error)
}
StepRuleProvider 是比例退回规则端口(his_step 步骤规则,P3-A 仅接口位: his_step 仓储尚未抽象为引擎外端口,nil 时比例退回恒判定"不超线")。
type StepRuleService ¶
type StepRuleService struct {
// contains filtered or unexported fields
}
StepRuleService 是步骤规则域服务(his_step 端口的消费门面): 提供 allowReturn 开关、backStepCodes 白名单、排序号、步骤名、退回比例等规则读取; 并实现 P3-A 定义的 StepRuleProvider(按任务 ID 定位会签比例退回规则)。
func NewStepRuleService ¶
func NewStepRuleService(store StepStore, engine api.Engine) *StepRuleService
NewStepRuleService 构造步骤规则域服务。 @param store 步骤规则存储端口 @param engine 引擎门面(仅按任务 ID 的规则读取需要,可 nil) @return 步骤规则服务
func (*StepRuleService) AllowReturn ¶
func (s *StepRuleService) AllowReturn(ctx context.Context, deploymentID, activityID string) (bool, error)
AllowReturn 判断部署上指定节点是否允许退回(Java:"0" 显式禁止,其余/缺失允许)。 @param ctx 操作上下文 @param deploymentID 部署 ID @param activityID 节点 ID @return 是否允许退回 @return 查询错误
func (*StepRuleService) BackStepCodes ¶
func (s *StepRuleService) BackStepCodes(ctx context.Context, deploymentID, activityID string) ([]string, error)
BackStepCodes 读取节点的可退回步骤白名单(逗号拆分)。 @param ctx 操作上下文 @param deploymentID 部署 ID @param activityID 节点 ID @return 步骤代号列表(未配置返回空列表) @return 查询错误
func (*StepRuleService) PercentReturnRule ¶
func (s *StepRuleService) PercentReturnRule(ctx context.Context, taskID string) (*PercentReturnRule, bool, error)
PercentReturnRule 按任务定位其节点的会签比例退回规则(实现 P3-A StepRuleProvider)。 任务 → 实例定义 → 部署 → his_step 规则链;节点未启用比例退回时 (nil,false,nil)。 @param ctx 操作上下文 @param taskID 任务 ID @return 规则 @return 是否启用比例退回 @return 错误
func (*StepRuleService) ReturnPercentOf ¶
func (s *StepRuleService) ReturnPercentOf(ctx context.Context, deploymentID, activityID string) (*float64, bool, error)
ReturnPercentOf 读取节点的会签比例退回配置。 @param ctx 操作上下文 @param deploymentID 部署 ID @param activityID 节点 ID @return 退回比例(百分数),未配置为 nil @return 是否启用比例退回(countersign_percent_return=="1") @return 查询错误
func (*StepRuleService) SortOf ¶
SortOf 读取节点的步骤排序号(未配置返回 0)。 @param ctx 操作上下文 @param deploymentID 部署 ID @param activityID 节点 ID @return 排序号 @return 查询错误
func (*StepRuleService) StepNameOf ¶
func (s *StepRuleService) StepNameOf(ctx context.Context, deploymentID, activityID string) (string, error)
StepNameOf 读取节点的步骤名称(未配置返回空串)。 @param ctx 操作上下文 @param deploymentID 部署 ID @param activityID 节点 ID @return 步骤名称 @return 查询错误
type StepStore ¶
type StepStore interface {
// GetByDeploymentAndActivity 按部署与节点定位单条步骤规则。
// @param ctx 操作上下文
// @param deploymentID 部署 ID(=流程定义的 deploymentId)
// @param activityID 节点 ID(=步骤代号 step_code)
// @return 步骤规则
// @return 是否存在
// @return 查询错误
GetByDeploymentAndActivity(ctx context.Context, deploymentID, activityID string) (*StepRule, bool, error)
// ListByDeployment 查询部署下全部步骤规则(按 sort 升序)。
// @param ctx 操作上下文
// @param deploymentID 部署 ID
// @return 步骤规则列表(无记录返回空列表)
// @return 查询错误
ListByDeployment(ctx context.Context, deploymentID string) ([]*StepRule, error)
}
StepStore 是步骤规则(workflow_his_step 快照)的存储端口。 部署后规则以 deployment_id + step_code 定位,运行期只读。
type TaskCallback ¶
type TaskCallback struct {
ProcessDefinitionID string `json:"processDefinitionId"` // 流程定义 ID
ProcessInstanceID string `json:"processInstanceId"` // 流程实例 ID
BusinessKey string `json:"businessKey"` // 业务单据 ID
TenantID string `json:"tenantId"` // 租户(= 系统代号)
TaskID string `json:"taskId"` // 任务 ID(执行级报文无此字段)
TaskName string `json:"taskName"` // 任务名(执行级报文无此字段)
FlowElementID string `json:"flowElementId"` // 流程节点 ID
FlowElementName string `json:"flowElementName"` // 流程节点名
Params string `json:"params"` // BPMN 扩展属性串 "k:v;k:v"(Java 报文即字符串)
}
TaskCallback 是任务级业务回调报文(对位 Java BusinessCallTaskListener paramMap,JSON 字段名逐字兼容)。
type TaskCommentEngine ¶
type TaskCommentEngine interface {
// AddCommentDetail 添加评论并显式指定类型与完整原文(对位 Java AddHisCommentCmd;
// taskID 为空时按流程级落库)。
AddCommentDetail(ctx context.Context, taskID, processInstanceID, userID, typ, message, fullMessage string) (api.Comment, error)
// ListInstanceComments 返回流程实例下的全部评论,含任务评论。
ListInstanceComments(ctx context.Context, processInstanceID string) ([]api.Comment, error)
}
TaskCommentEngine 是评论域服务所需的任务评论能力(api.TaskService 子集)。
type TaskDelegateStore ¶
type TaskDelegateStore interface {
// Save 级联保存委托规则:主表 upsert,被委托人/委托对象先删后增(Java updateEntity 同款)。
// @param ctx 操作上下文
// @param rule 委托规则(必填 SourceCode/OwnerID)
// @return 错误
Save(ctx context.Context, rule *DelegateRule) error
// Get 按主键级联读取委托规则。
// @param ctx 操作上下文
// @param id 委托规则 Id
// @return 委托规则
// @return 是否存在
// @return 错误
Get(ctx context.Context, id string) (*DelegateRule, bool, error)
// ListByOwner 查询委托人在指定租户下的全部规则(含停用,供时间重叠校验)。
// @param ctx 操作上下文
// @param ownerID 委托人 Id
// @param tenantID 租户(=source_code)
// @return 规则列表
// @return 错误
ListByOwner(ctx context.Context, ownerID, tenantID string) ([]*DelegateRule, error)
// ListByConsigner 查询指定身份作为被委托人的启用规则(禁止传递校验的跨 owner 反查)。
// @param ctx 操作上下文
// @param consignerID 被委托人 Id
// @param tenantID 租户(=source_code)
// @return 启用中的规则列表
// @return 错误
ListByConsigner(ctx context.Context, consignerID, tenantID string) ([]*DelegateRule, error)
// UpdateState 更新规则启用/退休标记(Enable/Disable/Retire 共用)。
// @param ctx 操作上下文
// @param id 委托规则 Id
// @param enable 启用标记
// @param retire 退休标记
// @return 错误
UpdateState(ctx context.Context, id string, enable, retire int) error
// Delete 按主键级联删除委托规则(含被委托人与委托对象,Java deleteBatch 语义)。
// @param ctx 操作上下文
// @param id 委托规则 Id
// @return 错误
Delete(ctx context.Context, id string) error
}
TaskDelegateStore 是委托规则三表的存储端口(主表 + consigners + consignObj 级联)。
type TaskException ¶
type TaskException struct {
BaseColumns // 公共审计列
TaskID string // 任务 Id
ProcessInstanceID string // 流程实例 Id
ProcessInstanceName string // 流程实例名称
ClassName string // 异常发生类名
MethodName string // 异常发生方法名
Message string // 异常消息(>1000 截断)
Params string // 方法入参 JSON 串
ExceptionType string // 异常类型(四类常量)
ExceptionClass string // 异常类全名
ProcessDefinitionID string // 流程定义 Id
ProcessDefinitionKey string // 流程定义 Key
ProcessDefinitionName string // 流程定义名称
StartUserID string // 发起人
HandleStatus int // 处理状态:0 未处理、1 已处理
}
TaskException 是 workflow_task_exception(任务异常)的领域实体。
type TaskExceptionStore ¶
type TaskExceptionStore interface {
// Save 插入一条异常记录(id 由调用方生成)。
// @param ctx 操作上下文
// @param e 异常记录
// @return 错误
Save(ctx context.Context, e *TaskException) error
// Get 按主键查询异常记录。
// @param ctx 操作上下文
// @param id 异常记录 Id
// @return 异常记录
// @return 是否存在
// @return 错误
Get(ctx context.Context, id string) (*TaskException, bool, error)
// ListUnhandled 查询未处理异常(handle_status=0,管理台重发与僵尸监控数据源)。
// @param ctx 操作上下文
// @return 记录列表
// @return 错误
ListUnhandled(ctx context.Context) ([]*TaskException, error)
// ListByInstance 查询实例的异常记录。
// @param ctx 操作上下文
// @param processInstanceID 流程实例 Id
// @return 记录列表
// @return 错误
ListByInstance(ctx context.Context, processInstanceID string) ([]*TaskException, error)
// ListByTask 查询任务的异常记录。
// @param ctx 操作上下文
// @param taskID 任务 Id
// @return 记录列表
// @return 错误
ListByTask(ctx context.Context, taskID string) ([]*TaskException, error)
// ListByTypeAndInstances 查询指定实例集合下指定类型的异常记录(僵尸监控去重判据)。
// @param ctx 操作上下文
// @param exceptionType 异常类型
// @param instanceIDs 实例 Id 集合
// @return 记录列表
// @return 错误
ListByTypeAndInstances(ctx context.Context, exceptionType string, instanceIDs []string) ([]*TaskException, error)
// MarkHandled 批量更新处理状态(处理/忽略 → handle_status)。
// @param ctx 操作上下文
// @param ids 异常记录 Id 列表
// @param status 处理状态(ExceptionUnhandled/ExceptionHandled)
// @return 错误
MarkHandled(ctx context.Context, ids []string, status int) error
}
TaskExceptionStore 是任务异常的存储端口。
type TaskHistoryQuery ¶
type TaskHistoryQuery interface {
// GetHistoricTaskInstance 查询历史任务。
GetHistoricTaskInstance(ctx context.Context, taskID string) (api.HistoricTaskInstance, error)
}
TaskHistoryQuery 是历史任务查询能力(api.HistoryService 子集)。
type TaskInfoView ¶
type TaskInfoView struct {
api.Task // 引擎任务全字段
Extend *MessageExtend // 待办扩展(存在时非空)
History *HistoryExtend // 已办扩展(存在时非空)
}
TaskInfoView 是任务详情视图:引擎任务 + workflow 扩展列。
type TemplateDef ¶
type TemplateDef struct {
BaseColumns
Name string // name 模板名称
Layout string // layout 布局配置(JSON 原文)
FlowXML string // flow_xml 流程 XML
IsVisible int // is_visible 可见
IsDefault int // is_default 默认模板
Source int // source 来源
CategoryID string // category_id 所属分类
}
TemplateDef 是 workflow_template 行实体(设计器模板)。
type TemplateService ¶
type TemplateService struct {
// contains filtered or unexported fields
}
TemplateService 是设计器模板管理域服务。
func NewTemplateService ¶
func NewTemplateService(store TemplateStore, c clock.Clock) *TemplateService
NewTemplateService 构造设计器模板管理服务。 @param store 模板存储端口 @param c 时间源,nil 时回退真实时钟 @return 模板服务
func (*TemplateService) Add ¶
func (s *TemplateService) Add(ctx context.Context, t *TemplateDef) (*TemplateDef, error)
Add 新增设计器模板(校验名称与租户,补齐主键与审计列;模板无唯一约束不查重)。 @param ctx 操作上下文 @param t 模板数据(必填 name/tenant_id) @return 落库后的模板实体 @return 错误
func (*TemplateService) Delete ¶
func (s *TemplateService) Delete(ctx context.Context, ids ...string) error
Delete 按主键批量删除模板(物理删除,语义取舍见本文件域服务段说明)。 @param ctx 操作上下文 @param ids 主键集合 @return 错误
func (*TemplateService) Edit ¶
func (s *TemplateService) Edit(ctx context.Context, t *TemplateDef) (*TemplateDef, error)
Edit 编辑设计器模板(保留创建审计,刷新更新时间)。 @param ctx 操作上下文 @param t 模板数据(必填主键) @return 编辑后的模板实体 @return 错误
func (*TemplateService) List ¶
func (s *TemplateService) List(ctx context.Context, tenantID string) ([]*TemplateDef, error)
List 查询租户下全部设计器模板(按名称升序)。 @param ctx 操作上下文 @param tenantID 租户 @return 模板列表 @return 错误
func (*TemplateService) ListByCategory ¶
func (s *TemplateService) ListByCategory(ctx context.Context, categoryID string) ([]*TemplateDef, error)
ListByCategory 查询分类下全部设计器模板(按名称升序)。 @param ctx 操作上下文 @param categoryID 分类 ID @return 模板列表 @return 错误
type TemplateStore ¶
type TemplateStore interface {
// Insert 插入一条模板(ID/审计列由调用方生成填充)。
// @param ctx 操作上下文
// @param t 实体(必填 id/tenant_id)
// @return 错误
Insert(ctx context.Context, t *TemplateDef) error
// Update 按主键更新整行业务列(主键与创建审计不参与更新)。
// @param ctx 操作上下文
// @param t 实体(必填 id)
// @return 错误(不存在时报未找到)
Update(ctx context.Context, t *TemplateDef) error
// GetByPK 按主键查询。
// @param ctx 操作上下文
// @param id 主键
// @return 实体
// @return 是否存在
// @return 查询错误
GetByPK(ctx context.Context, id string) (*TemplateDef, bool, error)
// ListByTenant 查询租户下全部模板(按名称升序)。
// @param ctx 操作上下文
// @param tenantID 租户
// @return 实体列表(无记录返回空列表)
// @return 查询错误
ListByTenant(ctx context.Context, tenantID string) ([]*TemplateDef, error)
// ListByCategory 查询分类下全部模板(按名称升序,跨租户以分类归属隔离)。
// @param ctx 操作上下文
// @param categoryID 分类 ID
// @return 实体列表(无记录返回空列表)
// @return 查询错误
ListByCategory(ctx context.Context, categoryID string) ([]*TemplateDef, error)
// DeleteByIDs 按主键批量物理删除(缺失主键忽略)。
// @param ctx 操作上下文
// @param ids 主键集合
// @return 错误
DeleteByIDs(ctx context.Context, ids []string) error
}
TemplateStore 是 workflow_template(设计器模板)的存储端口。
type TerminateOption ¶
type TerminateOption func(*TerminateService)
TerminateOption 是终止域服务的可选注入函数。
func WithTerminateDocumentStore ¶
func WithTerminateDocumentStore(store DocumentStore) TerminateOption
WithTerminateDocumentStore 注入单据存储端口(实例删除/业务键删除的 MarkDeleted 逻辑删除用)。 未注入时删除链路跳过 document 逻辑删除(DocumentService 未透出该能力)。 @param store 单据存储端口 @return 选项
type TerminateService ¶
type TerminateService struct {
// contains filtered or unexported fields
}
TerminateService 是终止/删除/挂起/激活/重激活域服务(P2 波2-B)。 引擎级软终止(StopProcessToEvent)与历史实例复活(ReactivateProcessInstance) 已由 api.WorkflowExtService 承载,本服务负责校验、挂起门控与收尾账务。
func NewTerminateService ¶
func NewTerminateService(engine api.Engine, next *NextActivityService, comments *CommentService, operations *OperationRecordService, messages *MessageExtendService, histories *HistoryExtendService, documents *DocumentService, c clock.Clock, options ...TerminateOption) *TerminateService
NewTerminateService 创建终止/删除/挂起激活/重激活域服务。 @param engine 引擎门面(七服务) @param next 下一步预生成域服务 @param comments 审批意见服务 @param operations 操作记录服务 @param messages 待办扩展服务 @param histories 已办扩展服务 @param documents 业务表单状态服务 @param c 时间源,nil 时回退真实时钟 @param options 可选注入(单据存储端口等) @return 终止域服务
func (*TerminateService) Activate ¶
func (s *TerminateService) Activate(ctx context.Context, processInstanceID, operator string) error
Activate 激活流程实例(对位 Java activateProcessInstanceByProcessInstanceId:1316): 引擎激活 + LCJH 意见 + 操作记录。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param operator 操作人身份 Id @return 错误
func (*TerminateService) DeleteByBusinessID ¶
func (s *TerminateService) DeleteByBusinessID(ctx context.Context, tenantID, businessKey, operator string) error
DeleteByBusinessID 按业务单据 Id 批量删除流程(对位 Java deleteProcessByBusinessId:5970): 历史实例(含运行中实例的历史行)逐个 DeleteInstance,再按业务键清扫待办/已办/document。 @param ctx 操作上下文 @param tenantID 租户(业务系统代号),空表示不过滤租户 @param businessKey 业务单据 Id @param operator 操作人身份 Id @return 错误
func (*TerminateService) DeleteInstance ¶
func (s *TerminateService) DeleteInstance(ctx context.Context, processInstanceID, operator, reason string) error
DeleteInstance 删除流程实例(对位 Java deleteProcessInstanceById:5216): LCSC 操作记录 → 运行实例引擎级联删除(DeleteProcessInstance+原因 + 历史清除, 对位 Java cascade=true)或已结束实例历史删除(DeleteHistoricProcessInstance)→ next_activity 双表/待办/已办/document(MarkDeleted)级联清理。 与 Java 的对照差异:操作记录与直送记录无删除端口(且 Java 亦保留操作记录作审计轨迹), 本服务保留 LCSC 及此前记录不删(差异已在注释与报告说明)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param operator 操作人身份 Id @param reason 删除原因,空时取默认"删除流程实例" @return 错误
func (*TerminateService) Reactivate ¶
func (s *TerminateService) Reactivate(ctx context.Context, historicProcessInstanceID, targetActivityID, operator string) error
Reactivate 重激活历史实例(对位 Java ReactivateProcessInstanceCmd): 引擎按历史实例重建运行实例(历史变量按创建时间升序覆盖、发起人重写为操作人)→ BZJH 意见 + 操作记录 → document 重建(Save upsert)→ 新待办/已办镜像生成 → 表单状态刷新。 @param ctx 操作上下文 @param historicProcessInstanceID 历史实例 Id @param targetActivityID 落位活动 Id,空串表示回开始事件后首个用户任务 @param operator 操作人身份 Id(重写发起人) @return 错误
func (*TerminateService) StopByInstance ¶
func (s *TerminateService) StopByInstance(ctx context.Context, processInstanceID, operator, message string) error
StopByInstance 按实例软终止流程(对位 Java doStopProcessByProcessInstanceId:726): 引擎 StopProcessToEvent(全部活动执行迁至首个正常结束事件,保留 end 事件历史)→ LCZZ 意见 + 操作记录 → 删 next_activity 双表 → 待办/已办清理 → document 置已终止。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param operator 操作人身份 Id @param message 终止意见文案,空时取默认"流程终止" @return 错误
func (*TerminateService) StopByTask ¶
func (s *TerminateService) StopByTask(ctx context.Context, taskID, operator string) error
StopByTask 按任务终止流程(对位 Java doStopProcessByTaskId:675)。 校验链后委托 StopByInstance 复用软终止收尾链。 @param ctx 操作上下文 @param taskID 运行任务 Id @param operator 操作人身份 Id @return 错误
func (*TerminateService) Suspend ¶
func (s *TerminateService) Suspend(ctx context.Context, processInstanceID, operator string) error
Suspend 挂起流程实例(对位 Java suspendProcessInstanceByProcessInstanceId:1300): 引擎挂起 + LCZT 意见 + 操作记录;next_activity 不动(Java 同语义,已核实)。 @param ctx 操作上下文 @param processInstanceID 流程实例 Id @param operator 操作人身份 Id @return 错误
type TodoSource ¶
type TodoSource interface {
// ListAll 返回全部待办扩展。
// @param ctx 操作上下文
// @return 待办列表
// @return 错误
ListAll(ctx context.Context) ([]*MessageExtend, error)
// GetByTaskID 按任务查询待办扩展。
// @param ctx 操作上下文
// @param taskID 任务 Id
// @return 待办扩展
// @return 是否存在
// @return 错误
GetByTaskID(ctx context.Context, taskID string) (*MessageExtend, bool, error)
}
TodoSource 是催办/调度扫描的待办数据源端口(SQL 模式由主控接裸 SQL 查询; 内存模式经 MemTodoSource 适配 MemMessageStore)。
type TodoTaskView ¶
type TodoTaskView struct {
*MessageExtend // 待办扩展全字段(待办中心唯一数据源)
EngineTaskName string // 引擎任务名称(任务仍在办时非空,已流转为空)
EngineCreate time.Time // 引擎任务创建时间
EngineExists bool // 引擎任务是否仍存在(false 表示已办结/已流转)
}
TodoTaskView 是待办任务列表视图:待办扩展为主体,联查引擎任务补实时状态。
type TransferTaskRequest ¶
type TransferTaskRequest struct {
TaskID string // 任务 Id(必填)
Owner string // 原处理人身份 Id(必填,写入任务所有者)
Receiver string // 接收人身份 Id(必填,新处理人)
Message string // 转办意见(必填)
}
TransferTaskRequest 是任务转办请求(对位 Java TransferTaskVo:taskId/owner/receiver/message)。
type UserQuery ¶
type UserQuery interface {
// GetUser 查询用户。
GetUser(ctx context.Context, userID string) (api.User, error)
// ListUserGroups 返回用户所属组。
ListUserGroups(ctx context.Context, userID string) ([]api.Group, error)
}
UserQuery 是身份用户查询能力(api.IdentityService 子集)。
type UserTaskMeta ¶
type UserTaskMeta struct {
ActivityID string // 节点 ID(= TaskDefinitionKey)
ActivityName string // 节点名称
Assignee string // 处理人表达式(原样)
CandidateUsers []string // 候选用户表达式
CandidateGroups []string // 候选组表达式
StepCode string // 步骤代号扩展属性
ExecutorType string // 执行类型扩展属性(person/org/role)
ExecutorNumType string // 执行数量类型扩展属性(single/multi)
ExecutorListRaw string // executorList 原始串(JSON 数组或逗号分隔)
WeightType string // 会签权重类型:average/custom
WeightThreshold string // 权重阈值(表达式或数值)
WeightListRaw string // weightList 原始串(按身份的权重 JSON)
Documentation string // 文档说明
MultiInstance *MultiInstanceMeta // 多实例配置,非会签节点为 nil
ExecutionListenerClasses []string // 节点执行监听器注册名(部署校验用)
BusinessCallbackRaw string // 业务回调开关扩展属性原始值("true" 启用)
BusinessCallbackParamsRaw string // 业务回调 params 扩展属性原始串("k:v;k:v")
}
UserTaskMeta 是用户任务节点的模型元数据摘要,供执行人重写/推演/会签消费。
func (*UserTaskMeta) BusinessCallbackEnabled ¶
func (m *UserTaskMeta) BusinessCallbackEnabled() bool
BusinessCallbackEnabled 节点是否声明了业务回调。 @return 是否启用回调
func (*UserTaskMeta) BusinessCallbackParams ¶
func (m *UserTaskMeta) BusinessCallbackParams() string
BusinessCallbackParams 返回回调报文的 params 原始串。 节点未单独声明 params 时回退节点 Documentation(Java paramMap 取自扩展属性)。 @return params 串
Source Files
¶
- addsign.go
- back.go
- business.go
- business_callback_hook.go
- callback.go
- comment.go
- complete.go
- complete_to_activity.go
- countersign.go
- delegate.go
- deploy_check.go
- dict.go
- dict_data.go
- direct.go
- document.go
- entities.go
- exception.go
- executor_rewrite.go
- facade.go
- facade_designer.go
- facade_extra.go
- facade_mgmt.go
- facade_ops.go
- highlight.go
- historyextend.go
- identity.go
- memstore.go
- message.go
- modelmeta.go
- modelmgmt.go
- modelmgmt_snapshot.go
- modelmgmt_sql.go
- nextactivity.go
- operation.go
- query.go
- remind.go
- reset.go
- review.go
- review_sql.go
- rollback.go
- schedulers.go
- service.go
- simulate.go
- start.go
- steprules.go
- store_sql.go
- stores.go
- terminate.go
- types.go