学习

算法红皮书 2.4

优先队列 #

  • 有些情况下,不需要要求处理的元素全部有序,只要求每次都处理键值最大的元素,然后再收集更多的元素,然后再处理键值最大的元素
  • 需要一种数据结构,支持操作:删除最大元素和插入元素,这种数据类型叫做优先队列
  • 优先队列的基本表现形式:其一或两种操作都能在线性时间内完成
  • 基于二叉堆数据结构的优先队列,用数组保存元素并按照一定条件排序,以实现高效的删除最大元素和插入元素

API #

  • 抽象数据类型,最重要的操作是删除最大元素和插入元素 delMax()和insert()

  • 用“最大元素”代替“最大键值”或是“键值最大的元素”

  • 泛型优先队列的API ly-20241212142058095

  • 优先队列的调用示例 从N各输入中找到最大的M各元素所需成本 ly-20241212142058324

    • 优先队列的用例 pq里面最多放5个,当大于5个的时候,就从中剔除1个

      public class TopM
      {
      	public static void main(String[] args)
      	{
      		// 打印输入流中最大的M行
      		int M = Integer.parseint(args[0]);
      		MinPQ<Transaction> pq = new MinPQ<Transaction>(M+1);
      		while (StdIn.hasNextLine())
      		{
      			// 为下一行输入创建一个元素并放入优先队列中
      			pq.insert(new Transaction(StdIn.readLine()));
      			if (pq.size() > M)
      			  pq.delMin();
      			// 如果优先队列中存在M+1个元素则删除其中最小的元素
      		}
      		// 最大的M个元素都在优先队列中
      		Stack<Transaction> stack = new Stack<Transaction>();
      		while (!pq.isEmpty()) stack.push(pq.delMin());
      		for (Transaction t : stack) StdOut.println(t);
      	}
      }
      
    • 应用 ly-20241212142058429

      ...

zsx_flowable_design01

  • 模型设计完后,下面三个表有变化

    ly-20241212142116933

    • act_cio_model ly-20241212142117063
    • act_cio_model_module_rel ly-20241212142117162
    • act_ge_bytearray ly-20241212142117254
  • 部署之后,四个表有变化 ly-20241212142117340

    • act_cio_deployment 多了39条记录 ly-20241212142117428

      ly-20241212142117516

    • act_ge_bytearray 多了两条记录 ly-20241212142117610

    • act_re_deployment 多了一条记录 ly-20241212142117704

    • act_re_procdef 多了一条记录 ly-20241212142117795

  • 流程开始运行

    • 下面只写上主要的几个表
    • 送审时这个结点只能选一个 ly-20241212142117883
    • 流程运行时变量表 ly-20241212142117970

linux_韩老师_28-39

文件目录 #

  • 用来定位绝对路径或相对路径 cd ~ 用来定位家目录 cd .. 返回上一级 cd - 返回上一次目录

  • mkdir 用于创建目录 mkdir -p hello/l1/l2 多级目录创建

  • recursion 递归 rm -rf 要删除的目录 #递归删除

  • 使用cp进行复制,加上 -r 进行递归复制

  • rm 删除某个文件(带提示)

    • rm -f 删除文件(不带提示)
    • rm -rf 强制删除递归文件(夹)
  • mv 用来重命名(移动到同一目录下)、(或者移动文件)

  • 注意,下面的命令,是将hello移动到hello2下,并改名为a(而不是hello2下的a目录) mv Hello.java hello2/a

    • mv Hello.java hello2/a/ 移动到hello2下的a目录下(最后有一个斜杠)
  • 移动目录

    • mv hello2 hello1/AB 或者 mv hello2/ hello1/AB

      或者 mv hello2/ hello1/AB/

      会把整个hello2文件夹(包括hello2)移动到AB下

    • 同样是上面的指令,如果AB不存在,那么就会将hello2移动到hello1下,并将hello2文件夹,改名为AB

  • cat 指令

    • cat -p /etc/profile 浏览并显示文件
    • 管道命令 cat -p /etc/profile | more 把前面的结果再交给more处理 (输入enter查看下一行,空格查看下一页)
  • less指令

    ...

linux_韩老师_21-33

用户管理 #

  • 使用ssh root@192.168.200.201进行服务器连接 ly-20241212142135612

  • xshell中 ctr+shift+r 用来重新连接

  • 用户解释图 ly-20241212142135812

  • 添加一个用户milan,会自动创建该用户的家目录milan

    • 当登录该用户时,会自动切换到家目录下 ly-20241212142135882
  • 指定家目录 ly-20241212142135954

  • 指定密码 ly-20241212142136024

  • 用milan登录,自动切换到/home/milan pwd:显示当前用户所在的目录

    ly-20241212142136094

  • 用户删除

    • 删除用户但保留家目录
      • 需要用超级管理员才能删除 ly-20241212142136163 使用su -u root切换到超级管理员
      • 先logout然后再删除 ly-20241212142136235
    • 删除用户及家目录 userdel -r milan
    • 建议保留家目录
  • 查询root用户信息

    • 使用id xx 查询 ly-20241212142136305
  • 切换用户 su - xx

    • 从权限高切换到权限低的用户不需要密码;反之需要 ly-20241212142136377
    • 使用logout(exit也行),从root用户回到jack
  • 查看当前用户 who am i ly-20241212142136445 即使切换了用户,返回的还是root(第一次登录时的用户) ly-20241212142136517

  • 用户组(角色)

    • 增加、删除组

      groupadd wudang
      groupdel wudang
      

      如果添加用户的时候没有指定组,那么会创建一个跟用户名一样的名字的组 ly-20241212142136586 id是1002,组为king

      ly-20241212142136655

    • 添加用户zwj,添加组wudang,并将zwj添加到wudang组里面

      groupadd wudang
      useradd -g wudang zwj
      

      ly-20241212142136719

      ...

官方的hello-world

简介 #

  • MyBatis-Plus (opens new window)(简称 MP)是一个 MyBatis (opens new window)的增强工具,在 MyBatis 的基础上只做增强不做改变,为简化开发、提高效率而生。

快速开始 #

  • 数据库的Schema脚本 resources/db/schema-mysql.sql

    DROP TABLE IF EXISTS user;
    
    CREATE TABLE user
    (
        id BIGINT(20) NOT NULL COMMENT '主键ID',
        name VARCHAR(30) NULL DEFAULT NULL COMMENT '姓名',
        age INT(11) NULL DEFAULT NULL COMMENT '年龄',
        email VARCHAR(50) NULL DEFAULT NULL COMMENT '邮箱',
        PRIMARY KEY (id)
    );
    
  • 数据库Data脚本 resources/db/data-mysql.sql

    DELETE FROM user;
    
    INSERT INTO user (id, name, age, email) VALUES
    (1, 'Jone', 18, 'test1@baomidou.com'),
    (2, 'Jack', 20, 'test2@baomidou.com'),
    (3, 'Tom', 28, 'test3@baomidou.com'),
    (4, 'Sandy', 21, 'test4@baomidou.com'),
    (5, 'Billie', 24, 'test5@baomidou.com');
    
  • 创建一个spring boot工程(使用maven)

    • 父工程

      <parent>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-parent</artifactId>
          <version>2.7.0</version>
          <relativePath/>
      </parent>
      
    • springboot 相关仓库及mybatis-plus、mysql、Lombok相关仓库引入

      
          <dependencies>
              <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter</artifactId>
              </dependency>
              <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-test</artifactId>
                  <scope>test</scope>
              </dependency>
              <dependency>
                  <groupId>com.baomidou</groupId>
                  <artifactId>mybatis-plus-boot-starter</artifactId>
                  <version>3.5.1</version>
              </dependency>
      
              <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-web</artifactId>
              </dependency>
              <dependency>
                  <groupId>com.h2database</groupId>
                  <artifactId>h2</artifactId>
                  <scope>runtime</scope>
              </dependency>
              <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
              <dependency>
                  <groupId>mysql</groupId>
                  <artifactId>mysql-connector-java</artifactId>
                  <version>8.0.29</version>
              </dependency>
              <!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
              <dependency>
                  <groupId>org.projectlombok</groupId>
                  <artifactId>lombok</artifactId>
                  <version>1.18.24</version>
                  <scope>provided</scope>
              </dependency>
      
          </dependencies>
      
    • 配置resources/application.yml文件

      ...

boge-03-其他

会签 #

  • 流程图绘制 ly-20241212142115466

    • 注意上面几个参数

      • 多实例类型用来判断串行并行
      • 基数(有几个用户处理)
      • 元素变量
      • 集合(集合变量)
      • 完成条件–这里填的是 ${nrOfCompletedInstances > 1 }
    • 在任务监听器 ly-20241212142115672

      package org.flowable.listener;
      
      import org.flowable.engine.ProcessEngine;
      import org.flowable.engine.ProcessEngines;
      import org.flowable.engine.TaskService;
      import org.flowable.engine.delegate.TaskListener;
      import org.flowable.task.api.Task;
      import org.flowable.task.service.delegate.DelegateTask;
      
      public class MultiInstanceTaskListener implements TaskListener {
      
          @Override
          public void notify(DelegateTask delegateTask) {
              System.out.println("处理aaaa");
              if(delegateTask.getEventName().equals("create")) {
                  System.out.println("任务id" + delegateTask.getId());
                  System.out.println("哪些人需要会签" + delegateTask.getVariable("persons"));
                  System.out.println("任务处理人" + delegateTask.getVariable("person"));
                  ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
                  TaskService taskService = engine.getTaskService();
                  Task task = taskService.createTaskQuery().taskId(delegateTask.getId()).singleResult();
                  task.setAssignee(delegateTask.getVariable("person").toString());
                  taskService.saveTask(task);
              }
          }
      }
      

boge-02-flowable进阶_6

任务回退-串行回退 #

  • 流程图绘制 ly-20241212142114607

  • xml

    <?xml version="1.0" encoding="UTF-8"?>
    <definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:flowable="http://flowable.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.flowable.org/processdef" exporter="Flowable Open Source Modeler" exporterVersion="6.7.2">
      <process id="reback-key" name="回退处理" isExecutable="true">
        <documentation>reback-desc</documentation>
        <startEvent id="startEvent1" flowable:formFieldValidation="true"></startEvent>
        <userTask id="sid-D380E41A-48EE-4C08-AD01-1D509C512543" name="用户1" flowable:assignee="user1" flowable:formFieldValidation="true">
          <extensionElements>
            <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>
          </extensionElements>
        </userTask>
        <sequenceFlow id="sid-E2423FC5-F954-43D3-B57C-8460057CB7D6" sourceRef="startEvent1" targetRef="sid-D380E41A-48EE-4C08-AD01-1D509C512543"></sequenceFlow>
        <userTask id="sid-AF50E3D0-2014-4308-A717-D76586837D70" name="用户2" flowable:assignee="user2" flowable:formFieldValidation="true">
          <extensionElements>
            <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>
          </extensionElements>
        </userTask>
        <sequenceFlow id="sid-7C8750DC-E1C1-4AB2-B18C-2C103B61A5E5" sourceRef="sid-D380E41A-48EE-4C08-AD01-1D509C512543" targetRef="sid-AF50E3D0-2014-4308-A717-D76586837D70"></sequenceFlow>
        <userTask id="sid-F4CE7565-5977-4B9C-A603-AB3B817B8C8C" name="用户3" flowable:assignee="user3" flowable:formFieldValidation="true">
          <extensionElements>
            <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>
          </extensionElements>
        </userTask>
        <sequenceFlow id="sid-F91582FE-D110-48C9-9407-605E503E42B2" sourceRef="sid-AF50E3D0-2014-4308-A717-D76586837D70" targetRef="sid-F4CE7565-5977-4B9C-A603-AB3B817B8C8C"></sequenceFlow>
        <userTask id="sid-727C1235-F9C1-4CC5-BC6C-E56ABCA105B0" name="用户4" flowable:assignee="user4" flowable:formFieldValidation="true">
          <extensionElements>
            <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>
          </extensionElements>
        </userTask>
        <sequenceFlow id="sid-6D998C20-2A97-44B5-92D0-118E5CB05795" sourceRef="sid-F4CE7565-5977-4B9C-A603-AB3B817B8C8C" targetRef="sid-727C1235-F9C1-4CC5-BC6C-E56ABCA105B0"></sequenceFlow>
        <endEvent id="sid-6E5F5037-1979-4150-8408-D0BFD0315BCA"></endEvent>
        <sequenceFlow id="sid-3ECF3E34-6C07-4AE6-997B-583BF8868AC8" sourceRef="sid-727C1235-F9C1-4CC5-BC6C-E56ABCA105B0" targetRef="sid-6E5F5037-1979-4150-8408-D0BFD0315BCA"></sequenceFlow>
      </process>
      <bpmndi:BPMNDiagram id="BPMNDiagram_reback-key">
        <bpmndi:BPMNPlane bpmnElement="reback-key" id="BPMNPlane_reback-key">
          <bpmndi:BPMNShape bpmnElement="startEvent1" id="BPMNShape_startEvent1">
            <omgdc:Bounds height="30.0" width="30.0" x="100.0" y="163.0"></omgdc:Bounds>
          </bpmndi:BPMNShape>
          <bpmndi:BPMNShape bpmnElement="sid-D380E41A-48EE-4C08-AD01-1D509C512543" id="BPMNShape_sid-D380E41A-48EE-4C08-AD01-1D509C512543">
            <omgdc:Bounds height="80.0" width="100.0" x="165.0" y="135.0"></omgdc:Bounds>
          </bpmndi:BPMNShape>
          <bpmndi:BPMNShape bpmnElement="sid-AF50E3D0-2014-4308-A717-D76586837D70" id="BPMNShape_sid-AF50E3D0-2014-4308-A717-D76586837D70">
            <omgdc:Bounds height="80.0" width="100.0" x="320.0" y="138.0"></omgdc:Bounds>
          </bpmndi:BPMNShape>
          <bpmndi:BPMNShape bpmnElement="sid-F4CE7565-5977-4B9C-A603-AB3B817B8C8C" id="BPMNShape_sid-F4CE7565-5977-4B9C-A603-AB3B817B8C8C">
            <omgdc:Bounds height="80.0" width="100.0" x="465.0" y="138.0"></omgdc:Bounds>
          </bpmndi:BPMNShape>
          <bpmndi:BPMNShape bpmnElement="sid-727C1235-F9C1-4CC5-BC6C-E56ABCA105B0" id="BPMNShape_sid-727C1235-F9C1-4CC5-BC6C-E56ABCA105B0">
            <omgdc:Bounds height="80.0" width="100.0" x="610.0" y="138.0"></omgdc:Bounds>
          </bpmndi:BPMNShape>
          <bpmndi:BPMNShape bpmnElement="sid-6E5F5037-1979-4150-8408-D0BFD0315BCA" id="BPMNShape_sid-6E5F5037-1979-4150-8408-D0BFD0315BCA">
            <omgdc:Bounds height="28.0" width="28.0" x="755.0" y="164.0"></omgdc:Bounds>
          </bpmndi:BPMNShape>
          <bpmndi:BPMNEdge bpmnElement="sid-6D998C20-2A97-44B5-92D0-118E5CB05795" id="BPMNEdge_sid-6D998C20-2A97-44B5-92D0-118E5CB05795" flowable:sourceDockerX="50.0" flowable:sourceDockerY="40.0" flowable:targetDockerX="50.0" flowable:targetDockerY="40.0">
            <omgdi:waypoint x="564.9499999999907" y="178.0"></omgdi:waypoint>
            <omgdi:waypoint x="609.9999999999807" y="178.0"></omgdi:waypoint>
          </bpmndi:BPMNEdge>
          <bpmndi:BPMNEdge bpmnElement="sid-7C8750DC-E1C1-4AB2-B18C-2C103B61A5E5" id="BPMNEdge_sid-7C8750DC-E1C1-4AB2-B18C-2C103B61A5E5" flowable:sourceDockerX="50.0" flowable:sourceDockerY="40.0" flowable:targetDockerX="50.0" flowable:targetDockerY="40.0">
            <omgdi:waypoint x="264.9499999999882" y="175.0"></omgdi:waypoint>
            <omgdi:waypoint x="292.5" y="175.0"></omgdi:waypoint>
            <omgdi:waypoint x="292.5" y="178.0"></omgdi:waypoint>
            <omgdi:waypoint x="319.9999999999603" y="178.0"></omgdi:waypoint>
          </bpmndi:BPMNEdge>
          <bpmndi:BPMNEdge bpmnElement="sid-3ECF3E34-6C07-4AE6-997B-583BF8868AC8" id="BPMNEdge_sid-3ECF3E34-6C07-4AE6-997B-583BF8868AC8" flowable:sourceDockerX="50.0" flowable:sourceDockerY="40.0" flowable:targetDockerX="14.0" flowable:targetDockerY="14.0">
            <omgdi:waypoint x="709.9499999999999" y="178.0"></omgdi:waypoint>
            <omgdi:waypoint x="755.0" y="178.0"></omgdi:waypoint>
          </bpmndi:BPMNEdge>
          <bpmndi:BPMNEdge bpmnElement="sid-E2423FC5-F954-43D3-B57C-8460057CB7D6" id="BPMNEdge_sid-E2423FC5-F954-43D3-B57C-8460057CB7D6" flowable:sourceDockerX="15.0" flowable:sourceDockerY="15.0" flowable:targetDockerX="50.0" flowable:targetDockerY="40.0">
            <omgdi:waypoint x="129.94340692927761" y="177.55019845363262"></omgdi:waypoint>
            <omgdi:waypoint x="164.99999999999906" y="176.4985"></omgdi:waypoint>
          </bpmndi:BPMNEdge>
          <bpmndi:BPMNEdge bpmnElement="sid-F91582FE-D110-48C9-9407-605E503E42B2" id="BPMNEdge_sid-F91582FE-D110-48C9-9407-605E503E42B2" flowable:sourceDockerX="50.0" flowable:sourceDockerY="40.0" flowable:targetDockerX="50.0" flowable:targetDockerY="40.0">
            <omgdi:waypoint x="419.94999999999067" y="178.0"></omgdi:waypoint>
            <omgdi:waypoint x="464.9999999999807" y="178.0"></omgdi:waypoint>
          </bpmndi:BPMNEdge>
        </bpmndi:BPMNPlane>
      </bpmndi:BPMNDiagram>
    </definitions>
    
  • 部署并运行

    ...

boge-02-flowable进阶_5

网关 #

ly-20241212142112823

排他网关 #

会按照所有出口顺序流定义的顺序对它们进行计算,选择第一个条件计算为true的顺序流(当没有设置条件时,认为顺序流为true)继续流程

ly-20241212142113034

  • 排他网关的绘制 ly-20241212142113127 xml文件

    <?xml version="1.0" encoding="UTF-8"?>
    <definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:flowable="http://flowable.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.flowable.org/processdef" exporter="Flowable Open Source Modeler" exporterVersion="6.7.2">
      <process id="holiday-exclusive" name="请假流程-排他网关" isExecutable="true">
        <startEvent id="startEvent1" flowable:formFieldValidation="true"></startEvent>
        <userTask id="sid-3D5ED4D4-97F5-4FFD-B160-F00566ECC55E" name="创建请假单" flowable:assignee="zhangsan" flowable:formFieldValidation="true">
          <extensionElements>
            <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>
          </extensionElements>
        </userTask>
        <sequenceFlow id="sid-33A73370-751D-413F-9306-39DEAA674DB6" sourceRef="startEvent1" targetRef="sid-3D5ED4D4-97F5-4FFD-B160-F00566ECC55E"></sequenceFlow>
        <exclusiveGateway id="sid-5B2117E6-D341-49F2-85B2-336CA836C7D8"></exclusiveGateway>
        <sequenceFlow id="sid-D1B1F6E0-EA7F-4FF7-AD0C-5D43DBCEBFD2" sourceRef="sid-3D5ED4D4-97F5-4FFD-B160-F00566ECC55E" targetRef="sid-5B2117E6-D341-49F2-85B2-336CA836C7D8"></sequenceFlow>
        <userTask id="sid-08A6CB64-C9BB-4342-852D-444A75315BDE" name="总经理审批" flowable:assignee="wangwu" flowable:formFieldValidation="true">
          <extensionElements>
            <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>
          </extensionElements>
        </userTask>
        <userTask id="sid-EA98D0C3-E41D-4DEB-8933-91A1B7301ABE" name="部门经理审批" flowable:assignee="lisi" flowable:formFieldValidation="true">
          <extensionElements>
            <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>
          </extensionElements>
        </userTask>
        <userTask id="sid-24F73F7F-EB61-484F-A494-686E194D0118" name="人事审批" flowable:assignee="zhaoliu" flowable:formFieldValidation="true">
          <extensionElements>
            <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>
          </extensionElements>
        </userTask>
        <sequenceFlow id="sid-8BA0B88C-BA4F-446D-B5E7-6BF0830B1DC8" sourceRef="sid-EA98D0C3-E41D-4DEB-8933-91A1B7301ABE" targetRef="sid-24F73F7F-EB61-484F-A494-686E194D0118"></sequenceFlow>
        <sequenceFlow id="sid-E748F81F-B0B2-4C34-B993-FBAA2BCD0995" sourceRef="sid-08A6CB64-C9BB-4342-852D-444A75315BDE" targetRef="sid-24F73F7F-EB61-484F-A494-686E194D0118"></sequenceFlow>
        <sequenceFlow id="sid-928C6C6F-57F1-40F2-BE0F-1A9FF3E6E9E4" sourceRef="sid-5B2117E6-D341-49F2-85B2-336CA836C7D8" targetRef="sid-08A6CB64-C9BB-4342-852D-444A75315BDE">
          <conditionExpression xsi:type="tFormalExpression"><![CDATA[${num>3}]]></conditionExpression>
        </sequenceFlow>
        <sequenceFlow id="sid-4DB25720-11C8-401E-BB4C-83BB25510B2E" sourceRef="sid-5B2117E6-D341-49F2-85B2-336CA836C7D8" targetRef="sid-EA98D0C3-E41D-4DEB-8933-91A1B7301ABE">
          <conditionExpression xsi:type="tFormalExpression"><![CDATA[${num<3}]]></conditionExpression>
        </sequenceFlow>
      </process>
      <bpmndi:BPMNDiagram id="BPMNDiagram_holiday-exclusive">
        <bpmndi:BPMNPlane bpmnElement="holiday-exclusive" id="BPMNPlane_holiday-exclusive">
          <bpmndi:BPMNShape bpmnElement="startEvent1" id="BPMNShape_startEvent1">
            <omgdc:Bounds height="30.0" width="30.0" x="30.0" y="163.0"></omgdc:Bounds>
          </bpmndi:BPMNShape>
          <bpmndi:BPMNShape bpmnElement="sid-3D5ED4D4-97F5-4FFD-B160-F00566ECC55E" id="BPMNShape_sid-3D5ED4D4-97F5-4FFD-B160-F00566ECC55E">
            <omgdc:Bounds height="80.0" width="100.0" x="150.0" y="135.0"></omgdc:Bounds>
          </bpmndi:BPMNShape>
          <bpmndi:BPMNShape bpmnElement="sid-5B2117E6-D341-49F2-85B2-336CA836C7D8" id="BPMNShape_sid-5B2117E6-D341-49F2-85B2-336CA836C7D8">
            <omgdc:Bounds height="40.0" width="40.0" x="315.0" y="155.0"></omgdc:Bounds>
          </bpmndi:BPMNShape>
          <bpmndi:BPMNShape bpmnElement="sid-08A6CB64-C9BB-4342-852D-444A75315BDE" id="BPMNShape_sid-08A6CB64-C9BB-4342-852D-444A75315BDE">
            <omgdc:Bounds height="80.0" width="100.0" x="420.0" y="225.0"></omgdc:Bounds>
          </bpmndi:BPMNShape>
          <bpmndi:BPMNShape bpmnElement="sid-EA98D0C3-E41D-4DEB-8933-91A1B7301ABE" id="BPMNShape_sid-EA98D0C3-E41D-4DEB-8933-91A1B7301ABE">
            <omgdc:Bounds height="80.0" width="100.0" x="405.0" y="30.0"></omgdc:Bounds>
          </bpmndi:BPMNShape>
          <bpmndi:BPMNShape bpmnElement="sid-24F73F7F-EB61-484F-A494-686E194D0118" id="BPMNShape_sid-24F73F7F-EB61-484F-A494-686E194D0118">
            <omgdc:Bounds height="80.0" width="100.0" x="630.0" y="225.0"></omgdc:Bounds>
          </bpmndi:BPMNShape>
          <bpmndi:BPMNEdge bpmnElement="sid-8BA0B88C-BA4F-446D-B5E7-6BF0830B1DC8" id="BPMNEdge_sid-8BA0B88C-BA4F-446D-B5E7-6BF0830B1DC8" flowable:sourceDockerX="50.0" flowable:sourceDockerY="40.0" flowable:targetDockerX="50.0" flowable:targetDockerY="40.0">
            <omgdi:waypoint x="504.95000000000005" y="70.0"></omgdi:waypoint>
            <omgdi:waypoint x="680.0" y="70.0"></omgdi:waypoint>
            <omgdi:waypoint x="680.0" y="225.0"></omgdi:waypoint>
          </bpmndi:BPMNEdge>
          <bpmndi:BPMNEdge bpmnElement="sid-4DB25720-11C8-401E-BB4C-83BB25510B2E" id="BPMNEdge_sid-4DB25720-11C8-401E-BB4C-83BB25510B2E" flowable:sourceDockerX="20.5" flowable:sourceDockerY="20.5" flowable:targetDockerX="50.0" flowable:targetDockerY="40.0">
            <omgdi:waypoint x="335.5" y="155.5"></omgdi:waypoint>
            <omgdi:waypoint x="335.5" y="70.0"></omgdi:waypoint>
            <omgdi:waypoint x="404.99999999996083" y="70.0"></omgdi:waypoint>
          </bpmndi:BPMNEdge>
          <bpmndi:BPMNEdge bpmnElement="sid-33A73370-751D-413F-9306-39DEAA674DB6" id="BPMNEdge_sid-33A73370-751D-413F-9306-39DEAA674DB6" flowable:sourceDockerX="15.0" flowable:sourceDockerY="15.0" flowable:targetDockerX="50.0" flowable:targetDockerY="40.0">
            <omgdi:waypoint x="59.94725673598754" y="177.70973069236373"></omgdi:waypoint>
            <omgdi:waypoint x="150.0" y="175.96677419354836"></omgdi:waypoint>
          </bpmndi:BPMNEdge>
          <bpmndi:BPMNEdge bpmnElement="sid-D1B1F6E0-EA7F-4FF7-AD0C-5D43DBCEBFD2" id="BPMNEdge_sid-D1B1F6E0-EA7F-4FF7-AD0C-5D43DBCEBFD2" flowable:sourceDockerX="50.0" flowable:sourceDockerY="40.0" flowable:targetDockerX="20.5" flowable:targetDockerY="20.5">
            <omgdi:waypoint x="249.95000000000002" y="175.18431734317343"></omgdi:waypoint>
            <omgdi:waypoint x="315.42592592592536" y="175.42592592592592"></omgdi:waypoint>
          </bpmndi:BPMNEdge>
          <bpmndi:BPMNEdge bpmnElement="sid-E748F81F-B0B2-4C34-B993-FBAA2BCD0995" id="BPMNEdge_sid-E748F81F-B0B2-4C34-B993-FBAA2BCD0995" flowable:sourceDockerX="50.0" flowable:sourceDockerY="40.0" flowable:targetDockerX="50.0" flowable:targetDockerY="40.0">
            <omgdi:waypoint x="519.95" y="265.0"></omgdi:waypoint>
            <omgdi:waypoint x="629.9999999998776" y="265.0"></omgdi:waypoint>
          </bpmndi:BPMNEdge>
          <bpmndi:BPMNEdge bpmnElement="sid-928C6C6F-57F1-40F2-BE0F-1A9FF3E6E9E4" id="BPMNEdge_sid-928C6C6F-57F1-40F2-BE0F-1A9FF3E6E9E4" flowable:sourceDockerX="20.5" flowable:sourceDockerY="20.5" flowable:targetDockerX="50.0" flowable:targetDockerY="40.0">
            <omgdi:waypoint x="335.5" y="194.43942522321433"></omgdi:waypoint>
            <omgdi:waypoint x="335.5" y="265.0"></omgdi:waypoint>
            <omgdi:waypoint x="420.0" y="265.0"></omgdi:waypoint>
          </bpmndi:BPMNEdge>
        </bpmndi:BPMNPlane>
      </bpmndi:BPMNDiagram>
    </definitions>
    
  • 部署

    ...

boge-02-flowable进阶_4

候选人 #

  • 流程图设计

    • 总体 ly-20241212142111000
    • 具体 ly-20241212142111216
  • 部署并启动流程

    
        @Test
        public void deploy(){
            ProcessEngine processEngine= ProcessEngines.getDefaultProcessEngine();
            RepositoryService repositoryService = processEngine.getRepositoryService();
            Deployment deploy = repositoryService.createDeployment().name("ly画的请假流程-候选人")
                    .addClasspathResource("请假流程-候选人.bpmn20.xml")
                    .deploy();
    
        }
        @Test
        public void runProcess(){
            //设置候选人
            Map<String,Object> variables=new HashMap<>();
            variables.put("candidate1","张三");
            variables.put("candidate2","李四");
            variables.put("candidate3","王五");
            ProcessEngine engine=ProcessEngines.getDefaultProcessEngine();
            //获取流程运行服务
            RuntimeService runtimeService = engine.getRuntimeService();
            //运行流程
            ProcessInstance processInstance = runtimeService.startProcessInstanceById(
                    "holiday-candidate:1:4",variables);
            System.out.println("processInstance--"+processInstance);
        }
    
  • 查看数据库表数据

    • 处理人为空 ly-20241212142111312
    • 变量 ly-20241212142111408
    • 图解 ly-20241212142111504
  • 实际,作为登录用户如果是张三/李四或者王五,那它可以查看它自己是候选人的任务

    ...

boge-02-flowable进阶_3

任务分配-uel表达式 #

通过变量指定来进行分配

  • 首先绘制流程图(定义) ly-20241212142108250

    • 变量处理 ly-20241212142108471 ly-20241212142108572
  • 之后将xml文件导出

    <?xml version="1.0" encoding="UTF-8"?>
    <definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:flowable="http://flowable.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.flowable.org/processdef" exporter="Flowable Open Source Modeler" exporterVersion="6.7.2">
      <process id="holiday-new" name="新请假流程" isExecutable="true">
        <documentation>new-description</documentation>
        <startEvent id="startEvent1" flowable:formFieldValidation="true"></startEvent>
        <userTask id="sid-8D901410-5BD7-4EED-B988-5E40D12298C7" name="创建请假流程" flowable:assignee="${assignee0}" flowable:formFieldValidation="true">
          <extensionElements>
            <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>
          </extensionElements>
        </userTask>
        <userTask id="sid-5EB8F68B-7876-42AF-98E1-FCA27F99D8CE" name="审批请假流程" flowable:assignee="${assignee1}" flowable:formFieldValidation="true">
          <extensionElements>
            <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>
          </extensionElements>
        </userTask>
        <sequenceFlow id="sid-631EFFB0-795A-4777-B49E-CF7D015BFF15" sourceRef="sid-8D901410-5BD7-4EED-B988-5E40D12298C7" targetRef="sid-5EB8F68B-7876-42AF-98E1-FCA27F99D8CE"></sequenceFlow>
        <endEvent id="sid-15CAD0D3-7F8B-404C-9346-A8D2A456D47B"></endEvent>
        <sequenceFlow id="sid-001CA567-6169-4F8A-A0E5-010721D52508" sourceRef="sid-5EB8F68B-7876-42AF-98E1-FCA27F99D8CE" targetRef="sid-15CAD0D3-7F8B-404C-9346-A8D2A456D47B"></sequenceFlow>
        <sequenceFlow id="sid-0A4A52F2-ECF6-44B2-AA41-F926AA7F5932" sourceRef="startEvent1" targetRef="sid-8D901410-5BD7-4EED-B988-5E40D12298C7"></sequenceFlow>
      </process>
      <bpmndi:BPMNDiagram id="BPMNDiagram_holiday-new">
        <bpmndi:BPMNPlane bpmnElement="holiday-new" id="BPMNPlane_holiday-new">
          <bpmndi:BPMNShape bpmnElement="startEvent1" id="BPMNShape_startEvent1">
            <omgdc:Bounds height="30.0" width="30.0" x="100.0" y="145.0"></omgdc:Bounds>
          </bpmndi:BPMNShape>
          <bpmndi:BPMNShape bpmnElement="sid-8D901410-5BD7-4EED-B988-5E40D12298C7" id="BPMNShape_sid-8D901410-5BD7-4EED-B988-5E40D12298C7">
            <omgdc:Bounds height="80.0" width="100.0" x="225.0" y="120.0"></omgdc:Bounds>
          </bpmndi:BPMNShape>
          <bpmndi:BPMNShape bpmnElement="sid-5EB8F68B-7876-42AF-98E1-FCA27F99D8CE" id="BPMNShape_sid-5EB8F68B-7876-42AF-98E1-FCA27F99D8CE">
            <omgdc:Bounds height="80.0" width="100.0" x="370.0" y="120.0"></omgdc:Bounds>
          </bpmndi:BPMNShape>
          <bpmndi:BPMNShape bpmnElement="sid-15CAD0D3-7F8B-404C-9346-A8D2A456D47B" id="BPMNShape_sid-15CAD0D3-7F8B-404C-9346-A8D2A456D47B">
            <omgdc:Bounds height="28.0" width="28.0" x="555.0" y="146.0"></omgdc:Bounds>
          </bpmndi:BPMNShape>
          <bpmndi:BPMNEdge bpmnElement="sid-001CA567-6169-4F8A-A0E5-010721D52508" id="BPMNEdge_sid-001CA567-6169-4F8A-A0E5-010721D52508" flowable:sourceDockerX="50.0" flowable:sourceDockerY="40.0" flowable:targetDockerX="14.0" flowable:targetDockerY="14.0">
            <omgdi:waypoint x="469.94999999997356" y="160.0"></omgdi:waypoint>
            <omgdi:waypoint x="555.0" y="160.0"></omgdi:waypoint>
          </bpmndi:BPMNEdge>
          <bpmndi:BPMNEdge bpmnElement="sid-0A4A52F2-ECF6-44B2-AA41-F926AA7F5932" id="BPMNEdge_sid-0A4A52F2-ECF6-44B2-AA41-F926AA7F5932" flowable:sourceDockerX="15.0" flowable:sourceDockerY="15.0" flowable:targetDockerX="50.0" flowable:targetDockerY="40.0">
            <omgdi:waypoint x="129.94999928606217" y="160.0"></omgdi:waypoint>
            <omgdi:waypoint x="224.99999999995185" y="160.0"></omgdi:waypoint>
          </bpmndi:BPMNEdge>
          <bpmndi:BPMNEdge bpmnElement="sid-631EFFB0-795A-4777-B49E-CF7D015BFF15" id="BPMNEdge_sid-631EFFB0-795A-4777-B49E-CF7D015BFF15" flowable:sourceDockerX="50.0" flowable:sourceDockerY="40.0" flowable:targetDockerX="50.0" flowable:targetDockerY="40.0">
            <omgdi:waypoint x="324.9499999999907" y="160.0"></omgdi:waypoint>
            <omgdi:waypoint x="369.9999999999807" y="160.0"></omgdi:waypoint>
          </bpmndi:BPMNEdge>
        </bpmndi:BPMNPlane>
      </bpmndi:BPMNDiagram>
    </definitions>
    
  • 流程定义的部署

    ...