Documentation
¶
Overview ¶
管理扩展领域对象(v1.1.0)——流程设计 / 设计历史 / 委托代理
DDD 聚合根行为——对标 Java 版 domain/ProcessInstance + domain/ProcessTask
Package model 域类型定义——对标 Java 版 domain + model 包
Index ¶
- Constants
- type CcInstanceRow
- type FlowEdge
- type FlowModel
- type FlowNode
- type InstanceState
- 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)
- type ProcessSurrogate
- type ProcessTask
- type TaskState
- 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 InstanceState ¶
type InstanceState int
const ( InstanceStateDoing InstanceState = 10 InstanceStateDone InstanceState = 20 InstanceStateReject InstanceState = 45 )
type ProcessDefine ¶
type ProcessDesign ¶ added in v1.1.0
type ProcessDesign struct {
ID int64
Name string
DisplayName string
Type string
Icon string
IsDeployed int
Remark string
CreateTime time.Time
CreateUser string
UpdateTime time.Time
UpdateUser string
}
ProcessDesign 流程设计(wf_process_design)——设计器保存的设计稿元信息
type ProcessDesignHis ¶ added in v1.1.0
type ProcessDesignHis struct {
ID int64
ProcessDesignID int64
Content []byte
CreateTime time.Time
CreateUser string
}
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) *ProcessTask
CreateTask 创建任务(子实体工厂)
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 合并判断)
type ProcessSurrogate ¶ added in v1.1.0
type ProcessSurrogate struct {
ID int64
ProcessName string
Operator string
Surrogate string
StartTime *time.Time
EndTime *time.Time
Enabled int
CreateTime time.Time
CreateUser string
UpdateTime time.Time
UpdateUser string
}
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 操作人是否有权限处理该任务