# README
工作流引擎
工作流设计器
获取项目
cd $GOPATH/src
git clone https://gogs.xiaoyuanjijiehao.com/antlinker/flow.git ant-flow
cd ant-flow
go install -v ./...
使用
1. 初始化工作流引擎
import (
"time"
"ant-flow"
"ant-flow/service/db"
_ "github.com/go-sql-driver/mysql"
)
func main() {
flow.Init(
db.SetDSN("root:123456@tcp(127.0.0.1:3306)/flows?charset=utf8"),
db.SetTrace(true),
)
}
2. 加载工作流文件
err := flow.LoadFile("leave.bpmn")
if err != nil {
// 处理错误
}
3. 发起流程
input := map[string]interface{}{
"day": 1,
}
result, err := flow.StartFlow("流程编号", "开始节点编号", "流程发起人ID", input)
if err != nil {
// 处理错误
}
4. 查询待办流程列表
todos, err := flow.QueryTodoFlows("流程编号", "流程待办人ID")
if err != nil {
// 处理错误
}
5. 处理流程
input := map[string]interface{}{
"action": "pass",
}
result, err = flow.HandleFlow("待办流程节点实例ID", "流程处理人ID", input)
if err != nil {
// 处理错误
}
6. 停止流程
err := flow.StopFlow("待办流程节点实例ID", func(flowInstance *schema.FlowInstance) bool {
return flowInstance.Launcher == "XXX"
})
if err != nil {
// 处理错误
}
7. 接入WEB流程管理
func main() {
serverOptions := []flow.ServerOption{
flow.ServerStaticRootOption("./web"),
flow.ServerPrefixOption("/flow/"),
flow.ServerMiddlewareOption(filter),
}
http.Handle("/flow/", flow.StartServer(serverOptions...))
}
func filter(ctx *gear.Context) error {
fmt.Printf("请求参数:%s - %s \n", ctx.Path, ctx.Method)
return nil
}
8. 查询流程待办数据
result,err := flow.QueryTodoFlows("流程编号","流程处理人ID")
if err != nil {
// 处理错误
}
9. 查询流程历史数据
result,err := flow.QueryFlowHistory("待办流程实例ID")
if err != nil {
// 处理错误
}
10. 查询已办理的流程实例ID列表
ids,err := flow.QueryDoneFlowIDs("流程编号","流程处理人ID")
if err != nil {
// 处理错误
}
11. 查询节点实例的候选人ID列表
ids,err := flow.QueryNodeCandidates("待办流程节点实例ID")
if err != nil {
// 处理错误
}
12. 停止流程实例
err := flow.StopFlowInstance("待办流程节点实例ID", func(flowInstance *schema.FlowInstance) bool {
return flowInstance.Launcher == "XXX"
})
if err != nil {
// 处理错误
}
# Packages
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Functions
AutoStartOption 自动开始流程配置.
GetNodeInstance 获取节点实例.
GetNodeTypeByName 转换节点类型.
HandleFlow 处理流程节点 nodeInstanceID 节点实例内码 userID 处理人 input 输入数据.
Init 初始化流程配置.
LoadFile 加载流程文件数据.
NewIonicRenderer 渲染到ionic.
NewQLangExecer 创建基于qlang的表达式执行器.
NewXMLParser xml解析器.
OnFlowEndOption 注册流程结束事件.
OnNextNodeOption 注册下一节点处理事件配置.
QueryDoneFlowIDs 查询已办理的流程实例ID列表.
QueryFlowHistory 查询流程历史数据 flowInstanceID 流程实例内码.
QueryNodeCandidates 查询节点实例的候选人ID列表.
QueryTodoFlows 查询流程待办数据 flowCode 流程编号 userID 待办人.
ServerMiddlewareOption 中间件.
ServerPrefixOption 访问前缀.
ServerStaticRootOption 静态文件目录.
SetExecer 设定表达式执行器.
SetParser 设定解析器.
StartFlow 启动流程 flowCode 流程编号 nodeCode 开始节点编号 userID 发起人 input 输入数据.
StartServer 启动管理服务.
StopFlow 停止流程.
StopFlowInstance 停止流程实例.
# Constants
EndEvent 结束事件.
ExclusiveGateway 排他网关.
ParallelGateway 并行网关.
StartEvent 开始事件.
TerminateEvent 终止事件.
Unknown 未知类型.
UserTask 人工任务.
# Variables
定义错误.
# Structs
API 提供API管理.
Engine 流程引擎.
FieldOption 枚举选项.
FieldProperty 字段属性.
FieldValidation 字段验证.
FormFieldResult 表单字段.
HandleResult 处理结果.
NextNode 下一节点.
NodeFormResult 节点表单.
NodeResult 节点数据.
NodeRouter 节点路由.
ParseResult 流程数据.
RouterResult 节点路由数据.
Server 流程管理服务.
# Type aliases
No description provided by the author
No description provided by the author
NodeRouterOption 节点路由配置.
NodeType 节点类型.
ServerOption 流程服务配置.