1 Star 2 Fork 0

宇宙蒙面侠X / antlinker-flow

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

工作流引擎

工作流设计器

获取项目

go get github.com/antlinker/flow

使用

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 {
		// 处理错误
	}

流程管理 流程设计器

空文件

简介

https://github.com/antlinker/flow 备份 基于bpmn 2.0协议实现的工作流引擎 展开 收起
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/awol2010ex/antlinker-flow.git
git@gitee.com:awol2010ex/antlinker-flow.git
awol2010ex
antlinker-flow
antlinker-flow
develop

搜索帮助