工作流服务接口

版本记录

版本号日期修改内容
v0.14.22024-08-30修复已知问题

工作流

1、启动流程

接口地址

/api/portal/workFlow/External/startProcess

请求方式

POST

请求参数

参数名称参数说明是否必须类型
businessId业务 idtruestring
businessType业务 typetruestring
flowManageId工艺流程 idfalsestring
processDefId流程定义 id,流程部署后返回此 idfalsestring
flowManageCode流程管理 codetrueint
flowManageVersion流程管理版本truestring

请求示例

{
  "businessId": "60b09817-9948-4835-adfd-47b9f2456263",
  "businessType": "formulaAuditFlow",
  "flowManageId": "",
  "processDefId": "",
  "flowManageCode": "FLOW_MES_FORMULAS_AUDIT_STATUS",
  "flowManageVersion": 3,
  "variablesJson": ""
}

响应参数

参数名称参数说明类型
businessId业务 idstring
businessType业务类型string
processInstanceId流程运行实例 idstring

响应示例

{
	"businessId": "60b09817-9948-4835-adfd-47b9f2456263",
	"businessType": "formulaAuditFlow",
	"processInstanceId": "7"
}

2、获取流程运行情况

接口地址

/api/portal/workFlow/External/getProcessInfoByUserId

请求方式

POST

接口描述

根据 businessId 和 businessType 和 userId 获取流程情况

请求参数

参数名称参数说明是否必须类型
businessId业务 idtruestring
businessType业务类型truestring
userId用户 idtruestring

请求示例

{
  "userId": "clhrdrxjd0000k7mkjik8kqd2",
  "businessId": "60b09817-9948-4835-adfd-47b9f2456263",
  "businessType": "formulaAuditFlow"
}

响应参数

参数名称参数说明类型
businessId业务 idstring
businessType业务类型string
taskId任务 idstring
runningProcessInstanceId运行的流程实例 idstring
stopProcessInstanceId结束的流程实例 idstring

响应示例

{
  "code": 0,
  "message": "success",
  "data": {
    "businessId": "60b09817-9948-4835-adfd-47b9f2456263",
    "businessType": "formulaAuditFlow",
    "taskId": "47605",
    "runningProcessInstanceId": "47592",
    "stopProcessInstanceId": null
  }
}

3、获取流程管理信息

接口地址

/api/portal/workFlow/External/getFlowManageGroupByCode

请求方式

POST

请求参数

参数名称参数说明类型是否必须
code编码stringfalse
name名称stringfalse
version版本intfalse
flowType流程类型stringfalse

请求示例

{
  "code": "",
  "name": "",
  "version": "",
  "flowType": ""
}

响应参数

参数名称参数说明类型schema
code流程编码string
versionList版本列表array
flowManageList流程管理列表arrayFlowManageByCodeResp
id流程管理 idstring
name流程管理名string
code流程管理编码string
version流程管理版本int
description描述string
flowType类型string

响应示例

示例如下

{
  "code": 0,
  "message": "success",
  "data": [
    {
      "code": "a",
      "versionList": [1],
      "flowManageList": [
        {
          "id": "1740544831257726978",
          "name": "a",
          "code": "a",
          "version": 1,
          "description": "",
          "flowType": "MES_FLOW_CATEGORY"
        }
      ]
    },
    {
      "code": "a_a",
      "versionList": [1],
      "flowManageList": [
        {
          "id": "1740545066772090881",
          "name": "a_a",
          "code": "a_a",
          "version": 1,
          "description": "",
          "flowType": "MES_FLOW_CATEGORY"
        }
      ]
    },
    {
      "code": "FLOW24020115",
      "versionList": [1],
      "flowManageList": [
        {
          "id": "1752894144294055937",
          "name": "aaa",
          "code": "FLOW24020115",
          "version": 1,
          "description": "",
          "flowType": "MES_FLOW_CATEGORY"
        }
      ]
    },
    {
      "code": "FLOW24012510",
      "versionList": [1],
      "flowManageList": [
        {
          "id": "1750328043538382850",
          "name": "www",
          "code": "FLOW24012510",
          "version": 1,
          "description": "",
          "flowType": "HSM_WORK_FLOW_CATEGORY_DEFAULT"
        }
      ]
    },
    {
      "code": "productionPlan",
      "versionList": [2, 1],
      "flowManageList": [
        {
          "id": "1747851685872676866",
          "name": "生产计划流程管理V2",
          "code": "productionPlan",
          "version": 2,
          "description": "",
          "flowType": "MES_FLOW_CATEGORY"
        },
        {
          "id": "1740546616902963202",
          "name": "生产计划流程管理",
          "code": "productionPlan",
          "version": 1,
          "description": "",
          "flowType": "MES_FLOW_CATEGORY"
        }
      ]
    },
    {
      "code": "FLOW_MES_FORMULAS_AUDIT_STATUS",
      "versionList": [3, 2, 1],
      "flowManageList": [
        {
          "id": "1749714547373236226",
          "name": "变更配方状态审批流程",
          "code": "FLOW_MES_FORMULAS_AUDIT_STATUS",
          "version": 3,
          "description": "",
          "flowType": "MES_FLOW_CATEGORY"
        },
        {
          "id": "1742797571484700673",
          "name": "变更配方状态审批流程",
          "code": "FLOW_MES_FORMULAS_AUDIT_STATUS",
          "version": 2,
          "description": "",
          "flowType": "MES_FLOW_CATEGORY"
        },
        {
          "id": "1740563313437331457",
          "name": "变更配方状态审批流程",
          "code": "FLOW_MES_FORMULAS_AUDIT_STATUS",
          "version": 1,
          "description": "",
          "flowType": "MES_FLOW_CATEGORY"
        }
      ]
    },
    {
      "code": "FLOW24020419",
      "versionList": [1],
      "flowManageList": [
        {
          "id": "1754047621930082305",
          "name": "工作流测试业务",
          "code": "FLOW24020419",
          "version": 1,
          "description": "",
          "flowType": "HSM_WORK_FLOW_CATEGORY_DEFAULT"
        }
      ]
    },
    {
      "code": "FLOW24020417",
      "versionList": [1],
      "flowManageList": [
        {
          "id": "1754015227965530114",
          "name": "测试状态变更",
          "code": "FLOW24020417",
          "version": 1,
          "description": "",
          "flowType": "HSM_WORK_FLOW_CATEGORY_DEFAULT"
        }
      ]
    },
    {
      "code": "FLOW24012913",
      "versionList": [1],
      "flowManageList": [
        {
          "id": "1751797307508158466",
          "name": "flow_XA",
          "code": "FLOW24012913",
          "version": 1,
          "description": "flow_XA",
          "flowType": "HSM_WORK_FLOW_CATEGORY_DEFAULT"
        }
      ]
    },
    {
      "code": "FLOW24012308",
      "versionList": [1],
      "flowManageList": [
        {
          "id": "1749768217397784577",
          "name": "tttteee",
          "code": "FLOW24012308",
          "version": 1,
          "description": "",
          "flowType": "HSM_WORK_FLOW_CATEGORY_DEFAULT"
        }
      ]
    }
  ]
}

4、终止流程

接口地址

/api/portal/workFlow/External/forceStopFlow

请求方式

POST

接口描述

根据 businessId 和 businessType 终止流程

请求参数

参数名称参数说明类型是否必须
businessId业务 idstringtrue
businessType业务类型stringtrue

响应参数

参数名称参数说明类型
hasStopped是否成功终止boolean
businessId业务 idstring
businessType业务类型string

响应示例

{
  "hasStopped": true,
  "businessId": "",
  "businessType": ""
}

5、查询是否有正在运行的流程

接口地址

/api/portal/workFlow/External/hasStartedProcessBybusinessId

请求方式

GET

接口描述

查询当前业务 id 与业务类型是否有正在运行的流程

请求参数

参数名称参数说明是否必须类型
businessId业务 idtruestring
businessType业务类型truestring

响应参数

参数名称参数说明类型schema
hasProcess是否有正在运行的流程boolean
processInstanceInfoList流程信息arrayProcessInstanceInfo
processInstanceId流程 idstring
processStatus流程状态string
businessId业务 idstring
businessType业务类型string

响应示例

{
  "hasProcess": true,
  "processInstanceInfoList": [
    {
      "processInstanceId": "7",
      "processStatus": "running",
      "businessId": "a3905e03-7589-4182-bdcb-e22935e45df7",
      "businessType": "formulaAuditFlow"
    }
  ]
}

6、查询待办任务

接口地址

/api/portal/workFlow/task/queryTaskPage

请求方式

POST

请求参数

参数名称参数说明是否必须类型
page当前页trueint
pageSize每页数量trueint
keyword关键字falsestring
processInstanceId流程实例 id,传入 processInstanceId,则只查询给定流程实例的待办。不传则查全部的待办falsestring

请求示例

{
  "page": 1,
  "pageSize": 10,
  "keyword": "",
  "processInstanceId": ""
}

响应参数

参数名称参数说明类型
codeint
message响应信息string
data响应数据Object
current当前页int
pages总页数int
size每页数量int
total总数据量int
records具体返回数据List
ididstring
taskId任务 idstring
serialNumber序列号long
name任务名称String
description说明String
assignee被指派执行该任务的人String
procInstanceId流程实例 IDString
procInstanceName流程实例名称String
startTime开始时间String
dueTime持续时间long
category类别String
businessId业务编号String
flowManageId流程管理编号String
flowManageCode流程管理编码String
flowManageName流程管理名称String
startUserName流程发起人名称String
nodeDesc节点描述String

响应示例

示例如下

{
  "code": 0,
  "message": "success",
  "data": {
    "records": [
      {
        "id": "112514",
        "serialNumber": 1710386448640,
        "taskId": "112514",
        "name": "用户任务1",
        "description": null,
        "assignee": null,
        "procInstanceId": "112501",
        "procInstanceName": "admin在2024-03-14 11:20:48发起了cclc2",
        "startTime": "2024-03-14 11:20:48",
        "dueTime": 18364,
        "category": null,
        "businessId": "businessId",
        "flowManageId": "1767721458079440897",
        "flowManageCode": "cclc",
        "flowManageName": "cclc2",
        "startUserName": "admin",
        "nodeDesc": "用户任务1"
      }
    ],
    "total": 58,
    "size": 3,
    "current": 1,
    "orders": [],
    "optimizeCountSql": true,
    "searchCount": true,
    "maxLimit": null,
    "countId": null,
    "pages": 20
  }
}

7、审批任务

接口地址

/api/portal/workFlow/task/complete

请求方式

POST

请求参数

参数名称参数说明是否必须请求类型
taskId任务 Idtruestring
userId用户 Idfalsestring
comment意见falsestring
variablesJson全局参数 jsonfalsestring

请求示例

{
  "taskId": "52511",
  "comment": "22"
}

响应参数

| 参数名称 | 参数说明 | 类型   | | -------- | -------- | ------ | --- |

code响应码int

| data     | 数据内容 | string |     |

响应示例

{
  "code": 0,
  "message": "success",
  "data": {
    "taskId": "52511",
    "userTaskFlag": true
  }
}