码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • Camunda 使用restapi


    参考:http://camunda-cn.shaochenfeng.com/reference/rest/task/get-query/

    这里我就举一个流程的例子:

    我的流程图:

    以下接口,除了端口和参数,其他无需改动

    POM:

    rest 就是接口

    webapp 是网页

    1. <dependency>
    2. <groupId>org.camunda.bpm.springboot</groupId>
    3. <artifactId>camunda-bpm-spring-boot-starter-rest</artifactId>
    4. </dependency>
    5. <dependency>
    6. <groupId>org.camunda.bpm.springboot</groupId>
    7. <artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId>
    8. </dependency>

    1 发布流程

    http://localhost:9020/engine-rest/deployment/create

    传递你的bpmn名称,通过file类型选择bpmn文件

    2 获取进程定义

    http://localhost:9020/engine-rest/process-definition

    返回:

    1. [
    2. {
    3. "id": "Process_1xebez9:1:7929ac88-64ac-11ed-946f-0892043f3120",
    4. "key": "Process_1xebez9",
    5. "category": "http://bpmn.io/schema/bpmn",
    6. "description": null,
    7. "name": "customerAudit",
    8. "version": 1,
    9. "resource": "customerAudit.bpmn",
    10. "deploymentId": "7924f196-64ac-11ed-946f-0892043f3120",
    11. "diagram": null,
    12. "suspended": false,
    13. "tenantId": null,
    14. "versionTag": null,
    15. "historyTimeToLive": null,
    16. "startableInTasklist": true
    17. },
    18. {
    19. "id": "audit_process:1:57b07816-63fa-11ed-ae19-0892043f3120",
    20. "key": "audit_process",
    21. "category": "http://bpmn.io/schema/bpmn",
    22. "description": null,
    23. "name": "Audit Process",
    24. "version": 1,
    25. "resource": "audit.bpmn",
    26. "deploymentId": "579a30f3-63fa-11ed-ae19-0892043f3120",
    27. "diagram": null,
    28. "suspended": false,
    29. "tenantId": null,
    30. "versionTag": null,
    31. "historyTimeToLive": null,
    32. "startableInTasklist": true
    33. }
    34. ]

    3 启动流程

    http://localhost:9020/engine-rest/process-definition/Process_1xebez9:1:7929ac88-64ac-11ed-946f-0892043f3120/start

    上面的Id就是来自步骤2的id

    参数:

    这里我传递了审批人(流程界面中,设置了${adminList} ${mpmList})

    ${adminList}设置:

    ${mpmList}设置:

     

    并且设置了businessKey

    1. {
    2. "variables": {
    3. "adminList" : {
    4. "value":"[\"admin\"]",
    5. "type":"Object",
    6. "valueInfo":{
    7. "objectTypeName":"java.util.ArrayList",
    8. "serializationDataFormat":"application/json"
    9. }
    10. },
    11. "mpmList": {
    12. "value":"[\"mpm1\"]",
    13. "type":"Object",
    14. "valueInfo":{
    15. "objectTypeName":"java.util.ArrayList",
    16. "serializationDataFormat":"application/json"
    17. }
    18. }
    19. },
    20. "businessKey" : 40
    21. }

    4 获取进程实例

    http://localhost:9020/engine-rest/process-instance/1cef6cfa-64b3-11ed-946f-0892043f3120

    上面的id,就是步骤3返回的id

    5.1 获取待办任务 (某人&进程ID)

    http://localhost:9020/engine-rest/task?assignee=mpm1&processInstanceId=1cef6cfa-64b3-11ed-946f-0892043f3120

    5.2 获取待办任务 (某人)

    http://localhost:9020/engine-rest/task?assignee=admin

    5.3 获取待办任务 (BusinessKey)

    http://localhost:9020/engine-rest/task?processInstanceBusinessKey=40

    6 审批

    http://localhost:9020/engine-rest/task/ae952619-64bd-11ed-946f-0892043f3120/complete

    传参:

    由于taskid已经在url中传递了,所以审批人是可以确定的。

    1. {"variables":
    2. {
    3. "approve": {"value": true},
    4. "comment": {"value": "hello world112"}
    5. },
    6. "withVariablesInReturn": true
    7. }

  • 相关阅读:
    【coocs creator】Objective-C 执行 JS 代码,传递json数据
    剖析虚幻渲染体系(18)- 操作系统
    zabbix-agnet连接zabbix-proxy
    高考假期预习指南:开启你的IT学习之旅
    Spring IoC容器初始化过程
    推荐一个好用的电商开源项目yudao源码
    android 12动态开关USB网络共享
    Spring - 单实例Bean 和 多实例Bean 的不同
    vue最新前端面试题系列(1-5)
    【编程题】【Scratch二级】2021.03 寻找宝石
  • 原文地址:https://blog.csdn.net/hanjun0612/article/details/127871063
  • 最新文章
  • 沪漂五周年了:我越来越迷茫了
    Agentic Skill Routing 实战:别再把所有 Skill 塞进 AI Agent 上下文
    MySQL-Seconds_behind_master的精度误差
    [MAF预定义ChatClient中间件-03]CachingChatClient——利用缓存省钱省时间
    AI的至暗历史:从万众期待到被政府撤资,AI的两次死亡徘徊
    Agent OS :五种驯服不确定性的范式
    PortSwigger SQL注入LAB11
    数据库即时编译JIT
    [Begin]AI Learn Data Day 0
    深度学习进阶(二十七)现代 LLM 的核心架构设计其二:SwiGLU
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
小工具 小游戏
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1

京公网安备 11010502049817号