• 基于若依的ruoyi-nbcio流程管理系统仿钉钉流程json转bpmn的flowable的xml格式(简单支持发起人与审批人的流程)续


    更多ruoyi-nbcio功能请看演示系统

    gitee源代码地址

    前后端代码: https://gitee.com/nbacheng/ruoyi-nbcio

    演示地址:RuoYi-Nbcio后台管理系统

           之前生产的xml,在bpmn设计里编辑有些内容不正确,包括审批人,关联表单等,所以这部分修正这些问题。

          1、前端增加formKey

         对于发起人节点,初始化时进行表单赋值

    1. initStartNodeData(){
    2. this.initInitiator()
    3. this.startForm.formOperates = this.initFormOperates(this.value)
    4. this.startForm.formKey = this.value.properties.formKey
    5. this.approverForm.formKey = this.value.properties.formKey
    6. },

       同时对确认保存的时候,进行formKey的保存与更新

    1. /**
    2. * 开始节点确认保存
    3. */
    4. startNodeComfirm() {
    5. this.properties.initiator = this.initiator['dep&user']
    6. this.properties.formKey = this.startForm.formKey
    7. const formOperates = this.startForm.formOperates.map(t=>({formId: t.formId, formOperate: t.formOperate}))
    8. Object.assign(this.properties,this.startForm, {formOperates})
    9. this.$emit("confirm", this.properties, '所有人');
    10. this.visible = false;
    11. },

     2、后端修改

      对开始发起人节点进行修改,把发起人赋予的formKey写入到开始节点里,兼容现有的系统

    1. StartEvent createStartEvent(JSONObject flowNode) {
    2. String nodeType = flowNode.getString("type");
    3. StartEvent startEvent = new StartEvent();
    4. startEvent.setId(id("start"));
    5. if (Type.INITIATOR_TASK.isEqual(nodeType)) {
    6. JSONObject properties = flowNode.getJSONObject("properties");
    7. if(StringUtils.isNotEmpty(properties.getString("formKey"))) {
    8. startEvent.setFormKey(properties.getString("formKey"));
    9. }
    10. }
    11. return startEvent;
    12. }

       同时对创建用户任务进行修改,修正之前的用户信息与formKey信息

    1. String createUserTask(JSONObject flowNode, String nodeType) {
    2. List incoming = flowNode.getJSONArray("incoming").toJavaList(String.class);
    3. // 自动生成id
    4. String id = id("userTask");
    5. if (incoming != null && !incoming.isEmpty()) {
    6. UserTask userTask = new UserTask();
    7. JSONObject properties = flowNode.getJSONObject("properties");
    8. userTask.setName(properties.getString("title"));
    9. userTask.setId(id);
    10. List attributes = new ArrayList();
    11. if (Type.INITIATOR_TASK.isEqual(nodeType)) {
    12. ExtensionAttribute extAttribute = new ExtensionAttribute();
    13. extAttribute.setNamespace(ProcessConstants.NAMASPASE);
    14. extAttribute.setName("dataType");
    15. extAttribute.setValue("INITIATOR");
    16. attributes.add(extAttribute);
    17. userTask.addAttribute(extAttribute);
    18. //userTask.setFormKey(properties.getString("formKey"));
    19. userTask.setAssignee("${initiator}");
    20. } else if (Type.USER_TASK.isEqual(nodeType) || Type.APPROVER_TASK.isEqual(nodeType)) {
    21. JSONArray approvers = properties.getJSONArray("approvers");
    22. JSONObject approver = approvers.getJSONObject(0);
    23. ExtensionAttribute extDataTypeAttribute = new ExtensionAttribute();
    24. extDataTypeAttribute.setNamespace(ProcessConstants.NAMASPASE);
    25. extDataTypeAttribute.setName("dataType");
    26. extDataTypeAttribute.setValue("USERS");
    27. userTask.addAttribute(extDataTypeAttribute);
    28. ExtensionAttribute extTextAttribute = new ExtensionAttribute();
    29. extTextAttribute.setNamespace(ProcessConstants.NAMASPASE);
    30. extTextAttribute.setName("text");
    31. extTextAttribute.setValue(approver.getString("nickName"));
    32. userTask.addAttribute(extTextAttribute);
    33. userTask.setFormKey(properties.getString("formKey"));
    34. userTask.setAssignee(approver.getString("userName"));
    35. }
    36. ddProcess.addFlowElement(userTask);
    37. ddProcess.addFlowElement(connect(incoming.get(0), id));
    38. }
    39. return id;
    40. }

    3、效果如下:

  • 相关阅读:
    《C++语言程序设计》大作业(三个模块)
    推荐几款优秀的项目报表软件
    复习单片机:矩阵按键(内含1 矩阵按键介绍+2 硬件设计+3 软件设计+4原始代码+5 实验现象)
    flume的安装和配置
    String的intern()方法详解
    FCOS难点记录
    git使用
    真不戳,Java 协程终于来了
    win10使用VMware启动虚拟机如CentOS7,外部机器蓝屏重启
    MVC第三波书店缓存帮助类RedisHelper
  • 原文地址:https://blog.csdn.net/qq_40032778/article/details/134267168