Skip to content

lzgabel/camunda-bpmn-converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Camunda BPMN Converter

Convert json to bpmn for Camunda Platform.

1. 节点类型(nodeType)

  • serviceTask
    • service 任务节点
  • userTask
    • userTask 任务节点
  • parallelGateway
    • 并行节点
  • exclusiveGateway
    • 排他节点

2. 数据结构

  • serviceTask
{
    "nodeName":"审核人1",
    "nodeType":"serviceTask",
    "nextNode": null
}
  • userTask
{
    "nodeName":"审核人1",
    "nodeType":"userTask",
    "assignee": "aaa",
    "candidateUsers": "bbb,ccc",
    "candidateGroups": "bbb,ddd",
    "nextNode": null
}

对于 parallelGateway/exclusiveGateway 类型,目前建议设置 nextNode 的 nodeType 类型一一对应

  • exclusive
{
    "nodeName":"排他",
    "nodeType":"exclusiveGateway",
    "nextNode":{
        "nodeName":"",
        "nodeType":"exclusiveGateway",
        "nextNode":null
    },
    "branchNodes":[
        {
            "nodeName":"条件1",
            "conditionExpression":"=id>1",
            "nextNode":{
                "nodeName":"审核人2.1",
                "nodeType":"serviceTask",
                "nextNode": null
            }
        },
        {
            "nodeName":"条件2",
            "conditionExpression":"=id<1",
            "nextNode":{
                "nodeName":"审核人2.2",
                "nodeType":"serviceTask",
                "nextNode":null
            }
        },
        {...}
    ]
}
  • parallel
{
    "nodeName":"并行任务",
    "nodeType":"parallelGateway",
    "nextNode":{
        "nodeName":"",
        "nodeType":"parallelGateway",
        "nextNode":null
    },
    "branchNodes":[
        {
            "nextNode":{
                "nodeName":"审核人2.1",
                "nodeType":"serviceTask",
                "nextNode": null
            }
        },
        {
            "nextNode":{
                "nodeName":"审核人2.2",
                "nodeType":"serviceTask",
                "nextNode":null
            }
        },
        {
            "nextNode":{
                "nodeName":"审核人2.3",
                "nodeType":"serviceTask",
                "nextNode":null
            }
        },
        {...}
    ]
}
  • 完整数据结构
{
    "process":{
        "processId":"work-flow-id",
        "name":"合同审批"
    },
    "processNode":{
        "nodeName":"审核人1",
        "nodeType":"serviceTask",
        "taskHeaders":{
            "a":"b",
            "e":"d"
        },
        "nextNode":{
            "nodeName":"排他",
            "nodeType":"exclusiveGateway",
            "nextNode":{
                "nodeName":"排他网关",
                "nodeType":"exclusiveGateway",
                "nextNode":null
            },
            "branchNodes":[
                {
                    "nodeName":"条件1",
                    "conditionExpression":"=id>1",
                    "nextNode":{
                        "nodeName":"审核人2.1",
                        "nodeType":"userTask",
                        "assignee": "aaa",
                        "candidateGroups": "bbb",
                        "nextNode":null
                    }
                },
                {
                    "nodeName":"条件2",
                    "conditionExpression":"=id<1",
                    "nextNode":{
                        "nodeName":"审核人2.2",
                        "nodeType":"serviceTask",
                        "nextNode":null
                    }
                }
            ]
        }
    }
}

3. 示例