流程中心服务端API

一、前言

该文档仅支持服务端api
部分不带from标识都是需要token的,token会在服务内自动下发。请注意 ⚠️ 如果是异步、多线程的情况下token会失效

二、Maven 依赖

在pom.xml 添加依赖,pai.version版本需要>=1.8.1-RC5

<dependency>
    <groupId>cn.flyrise</groupId>
    <artifactId>pai-api-flow</artifactId>
    <version>1.8.1-RC5</version>
</dependency>

三、代码示例

场景:获取下个环节需要办理的节点

    @Resource
    private IFlowService flowService;

    @PostMapping("/node/next")
    @ApiOperation("获取下个环节需要送办的节点")
    public Reply getNextNode(@Validated @RequestBody NextTaskRequest request) throws IOException {
        return flowService.getNextNode(request);
    }

四、API描述

IFlowService 目前拥有

  • 获取下个环节需要送办的节点
  • 获取流程节点候选人
  • 提交任务(发起)
  • 通过业务标识获取到企业的流程
  • 判断流程是否结束
  • 通过业务标识获取到流程信息
  • 通过业务标识获取到企业的流程
  • 获取审批意见
  • 撤销流程
  • 提交任务(暂存)
  • 待办列表

4.1 获取下个环节需要办理的节点

业务请求需要带token,服务内调用会自动下发
发起的时候todoId 可以不传,但是套件标识,流程标识,企业id 都是必填

代码示例:

     this.flowService.getNextNode(request);

参数解析:

# 名称 key 类型 是否必须 备注
1 请求Body request NextTaskRequest true 请求Body

request参数解析NextTaskRequest

# 名称 key 类型 是否必须 备注
1 待办id todoId String false 待办Id,如果是发起、草稿就不传
2 套件标识 suiteKey String false 发起的时候传
3 流程标识 bizKey String false 发起的时候传
4 企业id tenantId String true 企业id
5 业务表单数据 formData Map<String, Object> false 如果需要使用规则就要传

返回参数 NextNodeResponse

# 名称 key 类型 备注
1 是否存在办理节点 hasNode Bool 是否存在办理环节
2 是否结束环节 isEndNode Bool 是否最后一环节
3 是否需要等待 needWait Bool 例如并行环节需要等待别人完成才能往下办理
4 提示信息 msg String 当需要等待或其他原因导致需要提示内容的时候显示该值
5 节点数据 nodes List 节点数据

返回参数 NodeEntityResponse

# 名称 key 类型 备注
1 节点id id String
2 节点名称 name String
3 是否允许送多人 isMultiInstance Bool 例如并行环节需要等待别人完成才能往下办理
4 或/并 isSequential Bool 当需要等待或其他原因导致需要提示内容的时候显示该值
5 节点选人类型 defaultType Integer 人或岗,人1、岗2
5 节点默认候选人/岗 名称 defaultName String
5 节点默认候选人/岗 id defaultValue String
5 节点数据 ruleId String 节点数据

4.2 获取节点候选人

发起的时候todoId 可以不传,但是套件标识,流程标识,企业id 都是必填

 this.flowService.getNodeCandidate(request);

参数解析:

# 名称 key 类型 是否必须 备注
1 请求Body request NodeCandidateRequest true 请求Body

request参数解析 NodeCandidateRequest

# 名称 key 类型 是否必须 备注
1 待办id todoId String false 待办Id,如果是发起、草稿就不传
2 套件标识 suiteKey String false 发起的时候传
3 流程标识 bizKey String false 发起的时候传
4 企业id tenantId String false 企业id
5 任务标识 taskDefKey String false 节点id
6 业务表单数据 formData Map<String, Object> false 如果需要使用规则就要传

返回参数 HandleResponseVO

# 名称 key 类型 备注
1 默认处理人或岗位 defaultVO HandleCandidateVO
2 处理人或岗列表 handleCandidateVOList List
3 0没有人或岗 1 仅人 2 仅岗位 3 标准(人、岗位) 4 公司下所有人 5 部门下所有人 uiType Integer
4 0单签,1会签,2或签,即多人审批,且需要所有人审批后方可执行下节点 countersign Integer
5 是否跳过节点 skipNode Bool 上节点办理人与当前授权人相同时跳过本节点

返回参数 HandleCandidateVO

# 名称 key 类型 备注
1 人/岗 id handleId String
2 人/岗 名称 handleName String
3 人或岗 handleType Integer 人1、岗2
4 部门id deptId Integer
5 企业id entId String

4.3 提交任务(发起)

发起的时候todoId 可以不传,但是套件标识,流程标识,企业id 都是必填

 this.flowService.submitApply(request);

参数解析:

# 名称 key 类型 是否必须 备注
1 请求Body request SubmitRequest true 请求Body

request参数解析 SubmitRequest

# 名称 key 类型 是否必须 备注
1 待办id todoId String false 待办Id,如果是发起、草稿就不传
2 套件标识 suiteKey String false 发起的时候传
3 流程标识 bizKey String false 发起的时候传
4 企业id tenantId String false 企业id
5 标题 title String true 任务的标题
6 业务主键 businessKey String true 业务主键
7 业务表单数据 formData Map<String, Object> false 如果需要使用规则就要传
8 节点数据 nodes List true 节点参数

参数解析 NodeEntity

# 名称 key 类型 是否必须 备注
1 任务id/节点 taskDefinitionKey String true 节点id
2 办理人 assignees List true 办理人/岗位
3 是否多实例 isMultiInstance Bool false 0 普通 1会签 多实例
4 竞争 isSequential Bool false true 串 false 并

参数解析NodeAssigneeEntity:

# 名称 key 类型 是否必须 备注
1 id id String true 人/岗 id
2 名称 name String true 办理人/岗位 名称
3 类型 type String true U 人 P 岗位

返回参数 :

# 名称 key 类型 备注
1 流程实例id processInstanceId HandleCandidateVO {processInstanceId: “1d9e9f47-0648-11ed-8ceb-3e1721a96331”}

4.4 撤销流程

撤销流程流程直接终止

代码示例:

 this.flowService.abortApply(processInstanceId,reason);

参数解析:

# 名称 key 类型 是否必须 备注
1 流程实例id processInstanceId String true 请求Body
1 原因 reason String true 原因

返回参数 :

4.5 流程进度详情

 this.flowService.getProgressNew(String procInstId);

参数解析:

# 名称 key 类型 是否必须 备注
1 流程实例Id procInstId String true 流程实例Id

返回参数解析

# 名称 key 类型 备注
1 节点信息 data List<NodeResponse> 节点信息

参数解析 NodeResponse

# 名称 key 类型 是否必须 备注
1 节点名称 nodeName String true 节点id
2 节点状态 nodeState String true 0未办、1进行中、2完成、3终止
3 节点类型 nodeType Integer true 1 开始 ,3 普通,99结束
4 任务列表 todos List<ProgressTodoResponse> true 任务列表
5 是否是自己 self Bool true 当是自己的时候隐藏的已经可以看见

参数解析ProgressTodoResponse:

# 名称 key 类型 是否必须 备注
1 id id String true 待办id
2 退回标记 back Integer true null/0无 1退回 2被退回
3 加签标记 sign Integer true null/0无 1加签 2被加签
4 办理人 assigneeId String true 办理人员工id
5 办理状态 handleState Integer true 0:已办;1:已收在办;2:未收未办;3 终止;4 冻结;8 退回,临时使用,当父节点再次处理时将其变为0;
6 应办人/岗 candidateId String true 应办人/岗 id
7 应办人/岗类型 candidateType String true 应办人/岗类型
8 开始时间 startTime Date false
9 结束时间 endTime Date false
10 意见 ideaInfo ProgressIdeaResponse true
11 加签信息 signInfo ProgressSignResponse false

参数解析ProgressIdeaResponse:

# 名称 key 类型 是否必须 备注
1 id id String true 意见id
2 待办id todoId String true 待办id
3 事件 action String true agree:同意 refuse:拒绝 reply:回复,sign:加签,wait:加签等待
4 办理状态 todoState Integer true 0已办 1已收未办 2未收未办 3终止
5 事件名称 actionName String true
6 用户id userId String true
7 用户名称 userName String true
8 应办人/岗 candidateId String true 应办人/岗 id
9 应办人/岗类型 candidateType String true 应办人/岗类型
10 应办人/岗名称 candidateName String true 应办人/岗名称
11 节点名称 linkName String true
12 附件id attachmentId String true 附件id
13 内容 message String true
14 时间 time Date true
15 是否属于隐藏意见 hidden Integer true 1是 0否
16 任务类型 todoType String true 1开始、3普通 4转发 7加签、77被加签、 8退回、 88 被退回
17 是否显示 show Bool true 1是 0否
18 是否是自己的意见 self Bool true 1是 0否
19 加签内容 sign AddSignResponse false
20 意见回复 reply List<IdeaResponse> false 意见回复意见

参数解析IdeaResponse

# 名称 key 类型 是否必须 备注
1 id id String true 意见id
2 事件 action String true agree:同意 refuse:拒绝 reply:回复,sign:加签,wait:加签等待
3 内容 message String true
4 时间 time Date true
5 是否属于隐藏意见 hidden Integer true 1是 0否
6 用户id userId String true
7 用户名称 userName String true
8 回复的用户id replyUserId String true
9 回复的用户名称 replyUserName String true
10 附件id attachmentId String true 附件id

参考JSON:

{
    "code":"200",
    "data":[
        {
            "nodeName":"财务审批",
            "nodeState":1,
            "nodeType":3,
            "todos":[
                {
                    "id":"1510440680586231809",
                    "sign":0,
                    "handleState":1,
                    "candidateType":"U",
                    "candidateName":"桃白白",
                    "startTime":"2022-04-03T10:14:56.000+0800"
                }
            ],
            "self":true
        },
        {
            "nodeName":"部门审批",
            "nodeState":2,
            "nodeType":3,
            "todos":[
                {
                    "id":"1510439703500562432",
                    "sign":1,
                    "handleState":0,
                    "assigneeName":"桃白白",
                    "candidateType":"U",
                    "candidateName":"桃白白",
                    "startTime":"2022-04-03T10:11:03.000+0800",
                    "endTime":"2022-04-03T10:14:55.000+0800",
                    "ideaInfo":{
                        "id":"1510440676148658176",
                        "action":"agree",
                        "userId":"1422467875679133696",
                        "userName":"桃白白",
                        "message":"fd ",
                        "time":"2022-04-03T10:14:54.481+0800",
                        "hidden":0,
                        "show":true,
                        "self":true
                    }
                }
            ],
            "self":true
        },
        {
            "nodeName":"桃白白(加签)",
            "nodeState":2,
            "nodeType":3,
            "todos":[
                {
                    "id":"1510439084812943360",
                    "sign":2,
                    "handleState":0,
                    "candidateType":"U",
                    "candidateName":"桃白白",
                    "startTime":"2022-04-03T10:08:35.000+0800",
                    "endTime":"2022-04-03T10:11:02.000+0800",
                    "ideaInfo":{
                        "id":"1510439209413132288",
                        "action":"agree",
                        "userId":"1422467875679133696",
                        "userName":"桃白白",
                        "attachmentId":"",
                        "message":"隐藏意见啊阿啊",
                        "time":"2022-04-03T10:09:04.784+0800",
                        "hidden":0,
                        "show":true,
                        "self":true
                    }
                }
            ],
            "self":true
        },
        {
            "nodeName":"部门审批",
            "nodeState":2,
            "nodeType":3,
            "todos":[
                {
                    "id":"1510438965577269248",
                    "sign":1,
                    "handleState":0,
                    "candidateType":"U",
                    "candidateName":"桃白白",
                    "startTime":"2022-04-03T10:08:07.000+0800",
                    "endTime":"2022-04-03T10:08:35.000+0800",
                    "signInfo":{
                        "id":"1510439084745834496",
                        "todoId":"1510438965577269248",
                        "wait":1,
                        "waitFinish":1,
                        "content":"加钱意见",
                        "createTime":"2022-04-03T10:08:35.000+0800",
                        "waitEndTime":"2022-04-03T10:11:03.000+0800"
                    }
                }
            ],
            "self":true
        },
        {
            "nodeName":"启动流程",
            "nodeState":2,
            "nodeType":1,
            "todos":[
                {
                    "id":"1510438923550343168",
                    "sign":0,
                    "handleState":0,
                    "assigneeName":"桃白白",
                    "candidateType":"U",
                    "candidateName":"桃白白",
                    "startTime":"2022-04-03T10:08:07.000+0800",
                    "endTime":"2022-04-03T10:08:07.000+0800"
                }
            ],
            "self":true
        }
    ],
    "time":1658306410010,
    "msg":"操作成功",
    "success":true
}
文档更新时间: 2023-04-23 10:30   作者:朱灿奕