Documentation
¶
Overview ¶
管理扩展领域对象(v1.1.0)——流程设计 / 设计历史 / 委托代理
DDD 聚合根行为——对标 Java 版 domain/ProcessInstance + domain/ProcessTask
Package model 域类型定义——对标 Java 版 domain + model 包
Index ¶
- Constants
- type CcInstanceRow
- type CountersignType
- type DefineRow
- type DefineState
- type FlowEdge
- type FlowModel
- type FlowNode
- type InstanceRow
- type InstanceState
- type PerformType
- type ProcessDefine
- type ProcessDesign
- type ProcessDesignHis
- type ProcessInstance
- func (p *ProcessInstance) AbandonAllDoing(now time.Time) []*ProcessTask
- func (p *ProcessInstance) AbandonTask(task *ProcessTask, now time.Time)
- func (p *ProcessInstance) AddVariable(vars map[string]interface{})
- func (p *ProcessInstance) CompleteTask(task *ProcessTask, operator string, vars map[string]interface{}, now time.Time)
- func (p *ProcessInstance) CreateTask(id int64, taskName, displayName, actor, operator, formKey string, ...) *ProcessTask
- func (p *ProcessInstance) Finish(now time.Time)
- func (p *ProcessInstance) GetDoingTasks() []*ProcessTask
- func (p *ProcessInstance) GetDoneTasks() []*ProcessTask
- func (p *ProcessInstance) IsAllTasksFinished() bool
- func (p *ProcessInstance) Reject(now time.Time)
- func (p *ProcessInstance) Withdraw(now time.Time)
- type ProcessSurrogate
- type ProcessTask
- type SubmitType
- type TaskRow
- type TaskState
- type TaskType
- type UserInfo
Constants ¶
const ( TypeStart = "snaker:start" TypeEnd = "snaker:end" TypeTask = "snaker:task" TypeDecision = "snaker:decision" TypeFork = "snaker:fork" TypeJoin = "snaker:join" TypeCustom = "snaker:custom" )
const BusinessNoKey = "BUSINESS_NO"
业务号变量 key(engine 包 KeyBusinessNo 同值)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CcInstanceRow ¶ added in v1.3.0
type CcInstanceRow struct {
ID int64
ParentID *int64
DefineID int64
State InstanceState
ParentNodeName string
BusinessNo string
Operator string
ExpireTime *time.Time
Variables map[string]interface{}
CreateTime time.Time
CreateUser string
UpdateTime time.Time
UpdateUser string
DefineName string
DefineDisplayName string
DefineVersion int
}
CcInstanceRow 抄送实例行数据(ccList 分页,v1.3.0,对齐 Java InstanceRow 字段)
type CountersignType ¶ added in v1.4.0
type CountersignType int
CountersignType 会签类型(wf_countersign_type)
const ( CountersignTypeParallel CountersignType = 0 CountersignTypeSequential CountersignType = 1 )
type DefineRow ¶ added in v1.5.0
type DefineRow struct {
ID int64 `json:"id"`
Name string `json:"name"`
DisplayName string `json:"displayName"`
Type string `json:"type"`
State int `json:"state"`
Version int `json:"version"`
CreateTime time.Time `json:"createTime"`
CreateUser string `json:"createUser"`
UpdateTime time.Time `json:"updateTime"`
UpdateUser string `json:"updateUser"`
}
DefineRow 流程定义行数据(pageDefines 分页)
type DefineState ¶ added in v1.4.0
type DefineState int
DefineState 流程定义状态(wf_process_define_state)
const ( DefineStateDisable DefineState = 0 DefineStateEnable DefineState = 1 )
type InstanceRow ¶ added in v1.5.0
type InstanceRow struct {
ID int64 `json:"id"`
ParentID *int64 `json:"parentId"`
DefineID int64 `json:"processDefineId"`
State InstanceState `json:"state"`
ParentNodeName string `json:"parentNodeName"`
BusinessNo string `json:"businessNo"`
Operator string `json:"operator"`
ExpireTime *time.Time `json:"expireTime"`
Variables map[string]interface{} `json:"variables"`
CreateTime time.Time `json:"createTime"`
CreateUser string `json:"createUser"`
UpdateTime time.Time `json:"updateTime"`
UpdateUser string `json:"updateUser"`
DefineName string `json:"defineName"`
DefineDisplayName string `json:"defineDisplayName"`
DefineVersion int `json:"defineVersion"`
}
InstanceRow 流程实例行数据(pageInstances 分页)
type InstanceState ¶
type InstanceState int
const ( InstanceStateDoing InstanceState = 10 InstanceStateDone InstanceState = 20 InstanceStateWithdraw InstanceState = 30 InstanceStateInterrupt InstanceState = 40 InstanceStateReject InstanceState = 45 InstanceStatePending InstanceState = 50 InstanceStateAbandon InstanceState = 99 )
type PerformType ¶ added in v1.4.0
type PerformType int
PerformType 任务参与方式(wf_process_task_perform_type)
const ( PerformTypeNormal PerformType = 0 PerformTypeCountersign PerformType = 1 )
type ProcessDefine ¶
type ProcessDesign ¶ added in v1.1.0
type ProcessDesign struct {
ID int64 `json:"id"`
Name string `json:"name"`
DisplayName string `json:"displayName"`
Type string `json:"type"`
Icon string `json:"icon"`
IsDeployed int `json:"isDeployed"`
Remark string `json:"remark"`
CreateTime time.Time `json:"createTime"`
CreateUser string `json:"createUser"`
UpdateTime time.Time `json:"updateTime"`
UpdateUser string `json:"updateUser"`
}
ProcessDesign 流程设计(wf_process_design)——设计器保存的设计稿元信息
type ProcessDesignHis ¶ added in v1.1.0
type ProcessDesignHis struct {
ID int64 `json:"id"`
ProcessDesignID int64 `json:"processDesignId"`
Content []byte `json:"content"`
CreateTime time.Time `json:"createTime"`
CreateUser string `json:"createUser"`
}
ProcessDesignHis 流程设计历史(wf_process_design_his)——每次保存的 content 快照
type ProcessInstance ¶
type ProcessInstance struct {
ID int64
ParentID *int64
DefineID int64
State InstanceState
ParentNodeName string
BusinessNo string
Operator string
ExpireTime *time.Time
Variables map[string]interface{}
Tasks []*ProcessTask
CreateTime time.Time
CreateUser string
UpdateTime time.Time
UpdateUser string
}
func NewProcessInstance ¶
func NewProcessInstance(id, defineID int64, operator string, vars map[string]interface{}, now time.Time) *ProcessInstance
NewProcessInstance 工厂方法——创建流程实例
func (*ProcessInstance) AbandonAllDoing ¶
func (p *ProcessInstance) AbandonAllDoing(now time.Time) []*ProcessTask
AbandonAllDoing 废弃所有进行中任务,返回被废弃的任务列表(供调用方持久化)
func (*ProcessInstance) AbandonTask ¶
func (p *ProcessInstance) AbandonTask(task *ProcessTask, now time.Time)
AbandonTask 废弃单个任务
func (*ProcessInstance) AddVariable ¶
func (p *ProcessInstance) AddVariable(vars map[string]interface{})
AddVariable 追加变量
func (*ProcessInstance) CompleteTask ¶
func (p *ProcessInstance) CompleteTask(task *ProcessTask, operator string, vars map[string]interface{}, now time.Time)
CompleteTask 完成任务(子实体状态转换 + 实例变量合并)
func (*ProcessInstance) CreateTask ¶
func (p *ProcessInstance) CreateTask(id int64, taskName, displayName, actor, operator, formKey string, now time.Time, performType ...int) *ProcessTask
CreateTask 创建任务(子实体工厂)——performType:0 普通 / 1 会签(issues/52 E24 落库对齐 Java)
func (*ProcessInstance) GetDoingTasks ¶
func (p *ProcessInstance) GetDoingTasks() []*ProcessTask
GetDoingTasks 获取进行中任务
func (*ProcessInstance) GetDoneTasks ¶
func (p *ProcessInstance) GetDoneTasks() []*ProcessTask
GetDoneTasks 获取已完成任务
func (*ProcessInstance) IsAllTasksFinished ¶
func (p *ProcessInstance) IsAllTasksFinished() bool
IsAllTasksFinished 所有任务是否都已完成(用于 join 合并判断)
func (*ProcessInstance) Withdraw ¶ added in v1.8.11
func (p *ProcessInstance) Withdraw(now time.Time)
Withdraw 撤回流程(issues/53 E25:withdraw 用 Withdraw(30),与 reject 区分)
type ProcessSurrogate ¶ added in v1.1.0
type ProcessSurrogate struct {
ID int64 `json:"id"`
ProcessName string `json:"processName"`
Operator string `json:"operator"`
Surrogate string `json:"surrogate"`
StartTime *time.Time `json:"startTime"`
EndTime *time.Time `json:"endTime"`
Enabled int `json:"enabled"`
CreateTime time.Time `json:"createTime"`
CreateUser string `json:"createUser"`
UpdateTime time.Time `json:"updateTime"`
UpdateUser string `json:"updateUser"`
}
ProcessSurrogate 流程委托代理(wf_process_surrogate)——授权人把待办委托给代理人
type ProcessTask ¶
type ProcessTask struct {
ID int64
ProcessInstanceID int64
TaskName string
DisplayName string
TaskType int
PerformType int
TaskState TaskState
ActorID string
ActorIDs []string
FinishTime *time.Time
ExpireTime *time.Time
FormKey string
ParentTaskID *int64
Variables map[string]interface{}
CreateTime time.Time
CreateUser string
UpdateTime time.Time
UpdateUser string
}
func (*ProcessTask) Finish ¶
func (t *ProcessTask) Finish(operator string, vars map[string]interface{}, now time.Time)
Finish 完成任务
func (*ProcessTask) IsAllowed ¶
func (t *ProcessTask) IsAllowed(operator string) bool
IsAllowed 操作人是否有权限处理该任务
type SubmitType ¶ added in v1.4.0
type SubmitType int
SubmitType 流程提交类型(wf_process_submit_type)
const ( SubmitTypeApply SubmitType = 0 SubmitTypeAgree SubmitType = 1 SubmitTypeReject SubmitType = 2 SubmitTypeRollback SubmitType = 3 SubmitTypeJump SubmitType = 4 SubmitTypeReApply SubmitType = 5 SubmitTypeRollbackToOperator SubmitType = 6 SubmitTypeCountersignDisagree SubmitType = 20 )
type TaskRow ¶ added in v1.5.0
type TaskRow struct {
ID int64 `json:"id"`
ProcessInstanceID int64 `json:"processInstanceId"`
TaskName string `json:"taskName"`
DisplayName string `json:"displayName"`
TaskType int `json:"taskType"`
PerformType int `json:"performType"`
TaskState TaskState `json:"taskState"`
Operator string `json:"operator"`
FinishTime *time.Time `json:"finishTime"`
ExpireTime *time.Time `json:"expireTime"`
FormKey string `json:"formKey"`
TaskParentID *int64 `json:"taskParentId"`
Variables map[string]interface{} `json:"variables"`
CreateTime time.Time `json:"createTime"`
CreateUser string `json:"createUser"`
UpdateTime time.Time `json:"updateTime"`
UpdateUser string `json:"updateUser"`
ProcessDefineName string `json:"processDefineName"`
ProcessDefineDisplayName string `json:"processDefineDisplayName"`
DefineVersion int `json:"defineVersion"`
InstanceVariable string `json:"instanceVariable"`
InstanceCreateTime time.Time `json:"instanceCreateTime"`
}
TaskRow 任务行数据(pageTodoTasks / pageDoneTasks 分页)