基于jeecgboot-vue3的Flowable流程-集成仿钉钉流程(六)仿钉钉流程的转bpmn流程图

因为这个项目license问题无法开源,更多技术支持与服务请加入我的知识星球。

1、转bpmn流程图接口

java 复制代码
/**
     * 转为bpmn xml格式
     * @param processModel
     * @throws IOException
     */
    @PostMapping("/ddtobpmnxml")
    public Result<?> ddToBpmnXml(@RequestBody ProcessModel processModel) {
    	try {
	        BpmnModel bpmnModel = processModel.toBpmnModel();
	        return Result.OK(new String(new BpmnXMLConverter().convertToXML(bpmnModel)));
    	} catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("创建失败: e=" + e.getMessage());
        }
    }

2、toBpmnModel()方法

java 复制代码
public BpmnModel toBpmnModel() {
        BpmnModel bpmnModel = new BpmnModel();
        // 命名空间
        bpmnModel.setTargetNamespace("https://flowable.org/bpmn20");
        // 创建一个流程
        Process process = new Process();
        // 设置流程的id
        process.setId(this.getCode());
        // 设置流程的name
        process.setName(this.getName());
        // 设置流程的文档
        process.setDocumentation(this.getRemark());
        // 递归构建所有节点
        Node node = this.getProcess();
        List<FlowElement> flowElementList = node.convert();
        for (FlowElement flowElement : flowElementList) {
            process.addFlowElement(flowElement);
        }
        // 设置流程
        bpmnModel.addProcess(process);
        // 自动布局
        new BpmnAutoLayout(bpmnModel).execute();
        return bpmnModel;
    }

3、前端调用接口

javascript 复制代码
const converterBpmn = () => {
  const processModel = {
    code: pCode.value,
    name: pName.value,
    icon: {
      name: 'el:HomeFilled',
      color: '#409EFF'
    },
    process: props.process,
    enable: true,
    version: 1,
    sort: 0,
    groupId: '',
    remark: ''
  }
  ddToBpmnXml(processModel).then(res => {
     console.log("ddToBpmnXml res",res)
     processView.title = pName.value
     processView.index = pCode.value
     processView.xmlData = res.result
     processView.open = true
  })  
}

4、效果图

相关推荐
TST-魚爷20 小时前
易视讯会议摄像头电视安装教程
android·电脑·钉钉·腾讯会议·zoom会议
2601_952047791 天前
单一策略深度教程:用轻易云把集成任务的报错实时推送到钉钉机器人
java·机器人·钉钉
adminwolf9 天前
钉钉群消息自动转发怎么搞?
钉钉
RuoyiOffice13 天前
SpringBoot3+Vue3 低代码业务表单:从拖拽设计、独立建表到审批与数据查询
spring boot·vue3·数据建模·flowable·版本管理·低代码表单·ruoyi office
大龄码农有梦想20 天前
企业工作流系统如何设计用户、部门、角色、岗位、动态关系五类流程办理人?
工作流引擎·flowable·流程引擎·oa·工作流系统·选人规则·bpm平台
RuoyiOffice22 天前
SpringBoot3+Vue3 流程抄送已读:打开详情消红点,待办与知会怎么分开
spring boot·vue3·flowable·spring boot 3·ruoyi office·流程抄送·已读回执
微小冷22 天前
用Mermaid画时序图
运维·流程图·时序图·mermaid·生命线
Xxtaoaooo23 天前
Prometheus 告警怎么推到钉钉?从单群通知到跨网络 Alertmanager 实战
钉钉·webhook·cpolar
RuoyiOffice24 天前
SpringBoot3+Vue3+Flowable 企业审批平台全链路:从表单设计、节点权限到移动审批怎么落地
spring boot·vue3·uniapp·springboot3·flowable·审批系统·ruoyi office
凤山老林1 个月前
Spring Boot 整合 Flowable 的企业级落地指南
数据库·spring boot·后端·flowable·工作流