Commit 236c0f62 by weiguanying

flowable工作流引擎预研

parents
# Build and Release Folders
bin-debug/
bin-release/
[Oo]bj/
[Bb]in/
# Other files and folders
.settings/
# Executables
*.swf
*.air
*.ipa
*.apk
# Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties`
# should NOT be excluded as they contain compiler settings and other important
# information for Eclipse / Flash Builder.
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile default="true" name="Default" enabled="true" />
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="flowable" />
</profile>
</annotationProcessing>
</component>
<component name="JavacSettings">
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
<module name="flowable" options="-parameters" />
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
This diff is collapsed. Click to expand it.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.11</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>flowable</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>flowable</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>8</java.version>
<maven.test.skip>true</maven.test.skip>
<maven.javadoc.skip>true</maven.javadoc.skip>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!--工作流引擎依赖-->
<!-- <dependency>-->
<!-- <groupId>org.flowable</groupId>-->
<!-- <artifactId>flowable-engine</artifactId>-->
<!-- <version>6.3.0</version>-->
<!-- </dependency>-->
<!--mysql数据库依赖-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.32</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.flowable/flowable-spring-boot-starter -->
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-spring-boot-starter</artifactId>
<version>6.7.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!--docker-maven-plugin插件打包-->
</plugins>
</build>
</project>
package com.example.flowable;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class FlowableApplication {
public static void main(String[] args) {
SpringApplication.run(FlowableApplication.class, args);
}
}
package com.example.flowable;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.JavaDelegate;
import org.springframework.stereotype.Component;
/**
* Flowable工作流业务规则服务--信用卡准发规则
*
*/
@Component
public class ServiceTask1 implements JavaDelegate{
@Override
public void execute(DelegateExecution delegateExecution) {
if("no".equals(delegateExecution.getVariable("credit"))){
delegateExecution.setVariable("grantCard","no");
System.out.println("信用差,信用卡不予发放");
}else{
delegateExecution.setVariable("grantCard","yes");
System.out.println("信用好,进入工资判断");
}
if("no".equals(delegateExecution.getVariable("work"))){
delegateExecution.setVariable("grantCard","no");
System.out.println("无工作,信用卡不予发放");
}else{
delegateExecution.setVariable("grantCard","yes");
System.out.println("有工作,进入工资判断");
}
}
}
package com.example.flowable;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.JavaDelegate;
import org.springframework.stereotype.Component;
/**
* Flowable工作流业务规则服务--信用卡准发规则
*
*/
@Component
public class ServiceTask2 implements JavaDelegate{
@Override
public void execute(DelegateExecution delegateExecution) {
delegateExecution.setVariable("grantCard","yes");
double salary = (double) delegateExecution.getVariable("salary");
if(salary <= 2000.00){
delegateExecution.setVariable("grantCard","no");
System.out.println("工资太低,信用卡不予发放");
} else if (salary > 2000.00 && salary <= 5000.00){
System.out.println("工资大于2000,信用卡额度为3000.00");
}
else if (salary > 5000.00 && salary <= 8000.00){
System.out.println("工资大于2000,信用卡额度为5000.00");
}
else if (salary > 8000.00 && salary <= 15000.00){
System.out.println("工资大于2000,信用卡额度为30000.00");
}
else if (salary > 15000.00 && salary <= 30000.00){
System.out.println("工资大于2000,信用卡额度为50000.00");
}
else if (salary > 30000.00 ){
System.out.println("工资大于2000,信用卡额度为80000.00");
}
}
}
package com.example.flowable.config;
import org.flowable.spring.SpringProcessEngineConfiguration;
import org.flowable.spring.boot.EngineConfigurationConfigurer;
import org.springframework.context.annotation.Configuration;
/**
* date: 2022/07/16
* desc: flowable配置----为放置生成的流程图中中文乱码
*/
@Configuration
public class FlowableConfig implements EngineConfigurationConfigurer<SpringProcessEngineConfiguration> {
@Override
public void configure(SpringProcessEngineConfiguration engineConfiguration) {
engineConfiguration.setActivityFontName("宋体");
engineConfiguration.setLabelFontName("宋体");
engineConfiguration.setAnnotationFontName("宋体");
}
}
\ No newline at end of file
package com.example.flowable.controller;
import org.flowable.engine.*;
import org.flowable.engine.runtime.ProcessInstance;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
@RestController
@RequestMapping(value = "demo")
public class CreditCardController {
@Autowired
private RuntimeService runtimeService;
@Autowired
private TaskService taskService;
@Autowired
private RepositoryService repositoryService;
@Autowired
private ProcessEngine processEngine;
/**
* 添加报信用卡申请流程
*/
@RequestMapping(value = "add", method = RequestMethod.GET)
public String addExpense(@RequestParam(value = "work") String work,
@RequestParam(value = "credit") String credit,
@RequestParam(value = "salary") double salary,
@RequestParam(value = "creditcard") String creditcard
) {
//启动流程并传入启动流程id
HashMap<String, Object> map = new HashMap<>();
map.put("work", work);
map.put("credit", credit);
map.put("salary", salary);
map.put("creditcard", creditcard);
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("CreditCard", map);
return "提交成功.流程Id为:" + processInstance.getId();
}
}
\ No newline at end of file
package com.example.flowable.controller;
import org.flowable.bpmn.model.BpmnModel;
import org.flowable.engine.*;
import org.flowable.engine.runtime.Execution;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.image.ProcessDiagramGenerator;
import org.flowable.task.api.Task;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@RestController
@RequestMapping(value = "expense")
public class ExpenseController {
@Autowired
private RuntimeService runtimeService;
@Autowired
private TaskService taskService;
@Autowired
private RepositoryService repositoryService;
@Autowired
private ProcessEngine processEngine;
/**
* 添加报销
*
* @param userId 用户Id
* @param money 报销金额
* @param descption 描述
*/
@RequestMapping(value = "add", method = RequestMethod.GET)
public String addExpense(@RequestParam(value = "userId") String userId,
@RequestParam(value = "money") String money,
@RequestParam(value = "descption") String descption) {
//启动流程
HashMap<String, Object> map = new HashMap<>();
map.put("taskUser", userId);
map.put("money", money);
map.put("descption", descption);
//Expense是我们绘制流程图时自己所填写的key
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("Expense", map);
return "提交成功.流程Id为:" + processInstance.getId();
}
/**
* 获取审批管理列表
*/
@RequestMapping(value = "/list")
public Object list(String userId) {
List<Task> tasks = taskService.createTaskQuery().taskAssignee(userId).orderByTaskCreateTime().desc().list();
for (Task task : tasks) {
System.out.println(task.toString());
}
return tasks.toArray().toString();
}
/**
* 批准
*
* @param taskId 任务ID
*/
@RequestMapping(value = "apply")
public String apply(String taskId) {
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
if (task == null) {
throw new RuntimeException("流程不存在");
}
//通过审核
HashMap<String, Object> map = new HashMap<>();
map.put("outcome", "通过");
taskService.complete(taskId, map);
return "processed ok!";
}
/**
* 拒绝
*/
@RequestMapping(value = "reject")
public String reject(String taskId) {
HashMap<String, Object> map = new HashMap<>();
map.put("outcome", "驳回");
taskService.complete(taskId, map);
return "reject";
}
/**
* 生成流程图
*
* @param processId 任务ID
*/
@RequestMapping(value = "processDiagram")
public void genProcessDiagram(HttpServletResponse httpServletResponse, String processId) throws Exception {
ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(processId).singleResult();
//流程走完的不显示图
if (pi == null) {
return;
}
Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult();
//使用流程实例ID,查询正在执行的执行对象表,返回流程实例对象
String InstanceId = task.getProcessInstanceId();
List<Execution> executions = runtimeService
.createExecutionQuery()
.processInstanceId(InstanceId)
.list();
//得到正在执行的Activity的Id
List<String> activityIds = new ArrayList<>();
List<String> flows = new ArrayList<>();
for (Execution exe : executions) {
List<String> ids = runtimeService.getActiveActivityIds(exe.getId());
activityIds.addAll(ids);
}
//获取流程图
BpmnModel bpmnModel = repositoryService.getBpmnModel(pi.getProcessDefinitionId());
ProcessEngineConfiguration engconf = processEngine.getProcessEngineConfiguration();
ProcessDiagramGenerator diagramGenerator = engconf.getProcessDiagramGenerator();
InputStream in = diagramGenerator.generateDiagram(bpmnModel, "png", activityIds, flows,
engconf.getActivityFontName(), engconf.getLabelFontName(),
engconf.getAnnotationFontName(), engconf.getClassLoader(), 1.0, true);
OutputStream out = null;
byte[] buf = new byte[1024];
int legth = 0;
try {
out = httpServletResponse.getOutputStream();
while ((legth = in.read(buf)) != -1) {
out.write(buf, 0, legth);
}
} finally {
if (in != null) {
in.close();
}
if (out != null) {
out.close();
}
}
}
}
\ No newline at end of file
package com.example.flowable.taskHandler;
import org.flowable.engine.delegate.TaskListener;
import org.flowable.task.service.delegate.DelegateTask;
public class BossTaskHandler implements TaskListener {
@Override
public void notify(DelegateTask delegateTask) {
delegateTask.setAssignee("老板");
}
}
package com.example.flowable.taskHandler;
import org.flowable.engine.delegate.TaskListener;
import org.flowable.task.service.delegate.DelegateTask;
public class ManagerTaskHandler implements TaskListener {
@Override
public void notify(DelegateTask delegateTask) {
delegateTask.setAssignee("经理");
}
}
spring.application.name=flowable
server.port=8081
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/flowable?autoReconnect=true&useUnicode=true&characterEncoding=utf-8&&zeroDateTimeBehavior=CONVERT_TO_NULL&&serverTimezone=GMT%2B8&&nullCatalogMeansCurrent=true
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#flowable.async-executor-activate=true
<?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="CreditCard" name="creditcard" isExecutable="true">
<documentation>信用卡申请规则扭转</documentation>
<startEvent id="startEvent1" flowable:formFieldValidation="true"></startEvent>
<exclusiveGateway id="sid-0EAC9C81-F059-4262-9877-F3A0BA3A1A3D" name="信用卡发放准入规则网关"></exclusiveGateway>
<sequenceFlow id="sid-BA8E0A27-19CC-4799-841C-D561E02C58CC" sourceRef="startEvent1" targetRef="sid-0EAC9C81-F059-4262-9877-F3A0BA3A1A3D"></sequenceFlow>
<serviceTask id="sid-27B8A747-45B9-48CF-8A13-AB1A06D68F7D" name="征信判断服务" flowable:class="com.example.flowable.ServiceTask1"></serviceTask>
<endEvent id="sid-FF25E057-8353-4897-82E8-E6AA566D1519" name="不发卡"></endEvent>
<serviceTask id="sid-8CE39D16-B2C1-46C1-BD48-BD20B529EFFC" name="信用卡金额判断服务" flowable:class="com.example.flowable.ServiceTask2"></serviceTask>
<endEvent id="sid-F23C964D-129B-4B5D-89A2-61A490CDCCAC" name="发信用卡"></endEvent>
<sequenceFlow id="sid-320CC5D6-D191-4E85-8035-6F45618E9166" name="有工作" sourceRef="sid-0EAC9C81-F059-4262-9877-F3A0BA3A1A3D" targetRef="sid-27B8A747-45B9-48CF-8A13-AB1A06D68F7D">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${work=='yes'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="sid-C5FE683F-33FE-4869-8898-F212CFC5D94C" name="无工作" sourceRef="sid-0EAC9C81-F059-4262-9877-F3A0BA3A1A3D" targetRef="sid-FF25E057-8353-4897-82E8-E6AA566D1519">
<documentation>如果申请人既没房也没车,同时学历为本科以上,并且月薪少于2000,同时之前没有信用卡的,那么不通过</documentation>
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${work=='no'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="sid-99143761-DC5A-42FA-980C-083205108F9F" name="征信不通过" sourceRef="sid-27B8A747-45B9-48CF-8A13-AB1A06D68F7D" targetRef="sid-FF25E057-8353-4897-82E8-E6AA566D1519">
<documentation>没房也没车大专以下月薪少于5000不通过</documentation>
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${credit=='no'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="sid-44D3689F-796E-47FD-B732-D89A02343ACA" name="工资低于2000" sourceRef="sid-8CE39D16-B2C1-46C1-BD48-BD20B529EFFC" targetRef="sid-FF25E057-8353-4897-82E8-E6AA566D1519">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${salary<=2000}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="sid-0040323B-4A7C-433A-959F-0C3D134981F9" name="征信通过" sourceRef="sid-27B8A747-45B9-48CF-8A13-AB1A06D68F7D" targetRef="sid-8CE39D16-B2C1-46C1-BD48-BD20B529EFFC">
<documentation>没房也没车大专以下月薪少于5000不通过</documentation>
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${credit=='yes'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="sid-A9DAC90F-9BC5-4EF1-B815-B73E04158A77" name="工资大于2000" sourceRef="sid-8CE39D16-B2C1-46C1-BD48-BD20B529EFFC" targetRef="sid-F23C964D-129B-4B5D-89A2-61A490CDCCAC">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${salary>2000 and grantCard=='yes'}]]></conditionExpression>
</sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_CreditCard">
<bpmndi:BPMNPlane bpmnElement="CreditCard" id="BPMNPlane_CreditCard">
<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-0EAC9C81-F059-4262-9877-F3A0BA3A1A3D" id="BPMNShape_sid-0EAC9C81-F059-4262-9877-F3A0BA3A1A3D">
<omgdc:Bounds height="40.0" width="40.0" x="255.0" y="150.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-27B8A747-45B9-48CF-8A13-AB1A06D68F7D" id="BPMNShape_sid-27B8A747-45B9-48CF-8A13-AB1A06D68F7D">
<omgdc:Bounds height="80.0" width="100.0" x="450.0" y="130.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-FF25E057-8353-4897-82E8-E6AA566D1519" id="BPMNShape_sid-FF25E057-8353-4897-82E8-E6AA566D1519">
<omgdc:Bounds height="28.0" width="28.0" x="360.0" y="270.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-8CE39D16-B2C1-46C1-BD48-BD20B529EFFC" id="BPMNShape_sid-8CE39D16-B2C1-46C1-BD48-BD20B529EFFC">
<omgdc:Bounds height="80.0" width="100.0" x="645.0" y="130.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-F23C964D-129B-4B5D-89A2-61A490CDCCAC" id="BPMNShape_sid-F23C964D-129B-4B5D-89A2-61A490CDCCAC">
<omgdc:Bounds height="28.0" width="28.0" x="840.0" y="156.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="sid-BA8E0A27-19CC-4799-841C-D561E02C58CC" id="BPMNEdge_sid-BA8E0A27-19CC-4799-841C-D561E02C58CC" flowable:sourceDockerX="15.0" flowable:sourceDockerY="15.0" flowable:targetDockerX="20.5" flowable:targetDockerY="20.5">
<omgdi:waypoint x="129.94999695909908" y="178.0"></omgdi:waypoint>
<omgdi:waypoint x="192.5" y="178.0"></omgdi:waypoint>
<omgdi:waypoint x="192.5" y="170.5"></omgdi:waypoint>
<omgdi:waypoint x="255.5" y="170.5"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-320CC5D6-D191-4E85-8035-6F45618E9166" id="BPMNEdge_sid-320CC5D6-D191-4E85-8035-6F45618E9166" flowable:sourceDockerX="20.5" flowable:sourceDockerY="20.5" flowable:targetDockerX="50.0" flowable:targetDockerY="40.0">
<omgdi:waypoint x="294.48805220881326" y="170.45758928571425"></omgdi:waypoint>
<omgdi:waypoint x="450.0" y="170.11124721603562"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-0040323B-4A7C-433A-959F-0C3D134981F9" id="BPMNEdge_sid-0040323B-4A7C-433A-959F-0C3D134981F9" flowable:sourceDockerX="50.0" flowable:sourceDockerY="40.0" flowable:targetDockerX="50.0" flowable:targetDockerY="40.0">
<omgdi:waypoint x="549.9499999999803" y="170.0"></omgdi:waypoint>
<omgdi:waypoint x="645.0" y="170.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-99143761-DC5A-42FA-980C-083205108F9F" id="BPMNEdge_sid-99143761-DC5A-42FA-980C-083205108F9F" flowable:sourceDockerX="50.0" flowable:sourceDockerY="79.0" flowable:targetDockerX="14.0" flowable:targetDockerY="14.0">
<omgdi:waypoint x="500.0" y="209.95000000000002"></omgdi:waypoint>
<omgdi:waypoint x="500.0" y="232.0"></omgdi:waypoint>
<omgdi:waypoint x="374.0" y="232.0"></omgdi:waypoint>
<omgdi:waypoint x="374.0" y="270.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-44D3689F-796E-47FD-B732-D89A02343ACA" id="BPMNEdge_sid-44D3689F-796E-47FD-B732-D89A02343ACA" flowable:sourceDockerX="50.0" flowable:sourceDockerY="40.0" flowable:targetDockerX="14.0" flowable:targetDockerY="14.0">
<omgdi:waypoint x="695.0" y="209.95000000000002"></omgdi:waypoint>
<omgdi:waypoint x="695.0" y="284.0"></omgdi:waypoint>
<omgdi:waypoint x="387.9499192832599" y="284.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-A9DAC90F-9BC5-4EF1-B815-B73E04158A77" id="BPMNEdge_sid-A9DAC90F-9BC5-4EF1-B815-B73E04158A77" flowable:sourceDockerX="50.0" flowable:sourceDockerY="40.0" flowable:targetDockerX="14.0" flowable:targetDockerY="14.0">
<omgdi:waypoint x="744.9499999999605" y="170.0"></omgdi:waypoint>
<omgdi:waypoint x="840.0" y="170.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-C5FE683F-33FE-4869-8898-F212CFC5D94C" id="BPMNEdge_sid-C5FE683F-33FE-4869-8898-F212CFC5D94C" flowable:sourceDockerX="20.5" flowable:sourceDockerY="20.5" flowable:targetDockerX="14.0" flowable:targetDockerY="14.0">
<omgdi:waypoint x="275.5" y="189.44165933098594"></omgdi:waypoint>
<omgdi:waypoint x="275.5" y="284.0"></omgdi:waypoint>
<omgdi:waypoint x="360.0" y="284.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
\ No newline at end of file
log4j.rootLogger=DEBUG, CA
log4j.appender.CA=org.apache.log4j.ConsoleAppender
log4j.appender.CA.layout=org.apache.log4j.PatternLayout
log4j.appender.CA.layout.ConversionPattern= %d{hh:mm:ss,SSS} [%t] %-5p %c %x - %m%n
\ No newline at end of file
<?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: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">
<process id="Expense" name="ExpenseProcess" isExecutable="true">
<documentation>报销流程</documentation>
<startEvent id="start" name="开始"></startEvent>
<userTask id="fillTask" name="出差报销" flowable:assignee="${taskUser}">
<extensionElements>
<modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler">
<![CDATA[false]]></modeler:initiator-can-complete>
</extensionElements>
</userTask>
<exclusiveGateway id="judgeTask"></exclusiveGateway>
<userTask id="directorTak" name="经理审批">
<extensionElements>
<flowable:taskListener event="create"
class="com.example.flowable.taskHandler.ManagerTaskHandler"></flowable:taskListener>
</extensionElements>
</userTask>
<userTask id="bossTask" name="老板审批">
<extensionElements>
<flowable:taskListener event="create"
class="com.example.flowable.taskHandler.BossTaskHandler"></flowable:taskListener>
</extensionElements>
</userTask>
<endEvent id="end" name="结束"></endEvent>
<sequenceFlow id="directorNotPassFlow" name="驳回" sourceRef="directorTak" targetRef="fillTask">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${outcome=='驳回'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="bossNotPassFlow" name="驳回" sourceRef="bossTask" targetRef="fillTask">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${outcome=='驳回'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow1" sourceRef="start" targetRef="fillTask"></sequenceFlow>
<sequenceFlow id="flow2" sourceRef="fillTask" targetRef="judgeTask"></sequenceFlow>
<sequenceFlow id="judgeMore" name="大于500元" sourceRef="judgeTask" targetRef="bossTask">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${money > 500}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="bossPassFlow" name="通过" sourceRef="bossTask" targetRef="end">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${outcome=='通过'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="directorPassFlow" name="通过" sourceRef="directorTak" targetRef="end">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${outcome=='通过'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="judgeLess" name="小于500元" sourceRef="judgeTask" targetRef="directorTak">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${money <= 500}]]></conditionExpression>
</sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_Expense">
<bpmndi:BPMNPlane bpmnElement="Expense" id="BPMNPlane_Expense">
<bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start">
<omgdc:Bounds height="30.0" width="30.0" x="285.0" y="135.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="fillTask" id="BPMNShape_fillTask">
<omgdc:Bounds height="80.0" width="100.0" x="405.0" y="110.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="judgeTask" id="BPMNShape_judgeTask">
<omgdc:Bounds height="40.0" width="40.0" x="585.0" y="130.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="directorTak" id="BPMNShape_directorTak">
<omgdc:Bounds height="80.0" width="100.0" x="735.0" y="110.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="bossTask" id="BPMNShape_bossTask">
<omgdc:Bounds height="80.0" width="100.0" x="555.0" y="255.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="end" id="BPMNShape_end">
<omgdc:Bounds height="28.0" width="28.0" x="771.0" y="281.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
<omgdi:waypoint x="315.0" y="150.0"></omgdi:waypoint>
<omgdi:waypoint x="405.0" y="150.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
<omgdi:waypoint x="505.0" y="150.16611295681062"></omgdi:waypoint>
<omgdi:waypoint x="585.4333333333333" y="150.43333333333334"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="judgeLess" id="BPMNEdge_judgeLess">
<omgdi:waypoint x="624.5530726256983" y="150.44692737430168"></omgdi:waypoint>
<omgdi:waypoint x="735.0" y="150.1392757660167"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="directorNotPassFlow" id="BPMNEdge_directorNotPassFlow">
<omgdi:waypoint x="785.0" y="110.0"></omgdi:waypoint>
<omgdi:waypoint x="785.0" y="37.0"></omgdi:waypoint>
<omgdi:waypoint x="455.0" y="37.0"></omgdi:waypoint>
<omgdi:waypoint x="455.0" y="110.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="bossPassFlow" id="BPMNEdge_bossPassFlow">
<omgdi:waypoint x="655.0" y="295.0"></omgdi:waypoint>
<omgdi:waypoint x="771.0" y="295.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="judgeMore" id="BPMNEdge_judgeMore">
<omgdi:waypoint x="605.4340277777778" y="169.56597222222223"></omgdi:waypoint>
<omgdi:waypoint x="605.1384083044983" y="255.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="directorPassFlow" id="BPMNEdge_directorPassFlow">
<omgdi:waypoint x="785.0" y="190.0"></omgdi:waypoint>
<omgdi:waypoint x="785.0" y="281.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="bossNotPassFlow" id="BPMNEdge_bossNotPassFlow">
<omgdi:waypoint x="555.0" y="295.0"></omgdi:waypoint>
<omgdi:waypoint x="455.0" y="295.0"></omgdi:waypoint>
<omgdi:waypoint x="455.0" y="190.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
\ No newline at end of file
package com.example.flowable;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class FlowableApplicationTests {
@Test
void contextLoads() {
}
}
package com.example.flowable.junit;
import org.flowable.engine.*;
import org.flowable.engine.history.HistoricActivityInstance;
import org.flowable.engine.impl.cfg.StandaloneProcessEngineConfiguration;
import org.flowable.engine.repository.Deployment;
import org.flowable.engine.repository.ProcessDefinition;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.task.api.Task;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class FlowableTest {
ProcessEngineConfiguration configuration = null;
@BeforeEach
public void before() {
/**
* 获取流程引擎对象,会在对应数据库下建立相关工作流表,如果已存在,则不会再创建
*/
configuration = new StandaloneProcessEngineConfiguration();
// 配置相关数据库的连接信息
configuration.setJdbcDriver("com.mysql.cj.jdbc.Driver");
configuration.setJdbcUsername("root");
configuration.setJdbcPassword("123456");
configuration.setJdbcUrl("jdbc:mysql://localhost:3306/flowable?serverTimeZone=UTC&nullCatalogMeansCurrent=true");
// 如果数据库中的表结构不存在就新建
configuration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
}
/**
* 工作流流程部署
*/
@Test
public void deploy() {
// 构建processEngine对象
ProcessEngine processEngine = configuration.buildProcessEngine();
// 获取RepositoryService
RepositoryService repositoryService = processEngine.getRepositoryService();
Deployment deployment = repositoryService
.createDeployment()
.addClasspathResource("creditcard.bpmn20.xml")
.name("creditcard")
.deploy();
System.out.println("deployment.getId() = " + deployment.getId());
System.out.println("deployment.getName() = " + deployment.getName());
}
/**
* 查询流程定义的信息
*/
@Test
public void testDeployQuery() {
ProcessEngine processEngine = configuration.buildProcessEngine();
RepositoryService repositoryService = processEngine.getRepositoryService();
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId("2501").singleResult();
System.out.println("processDefinition.getDeploymentId() = " + processDefinition.getDeploymentId());
System.out.println("processDefinition.getName() = " + processDefinition.getName());
System.out.println("processDefinition.getDescription() = " + processDefinition.getDescription());
System.out.println("processDefinition.getId() = " + processDefinition.getId());
}
/**
* 查询已部署流程定义的信息
*/
@Test
public void testDeleteDeploy() {
ProcessEngine processEngine = configuration.buildProcessEngine();
RepositoryService repositoryService = processEngine.getRepositoryService();
// 通过流程id删除部署的流程,如果部署的流程启动了就不允许删除了
//repositoryService.deleteDeployment("1");
// true 参数魏级联删除,通过流程id删除部署的流程,如果部署的流程启动了,则关联流程会被一并删除
repositoryService.deleteDeployment("1", true);
}
/**
* 启动流程实例
*/
@Test
public void testRunProcess() {
ProcessEngine processEngine = configuration.buildProcessEngine();
// 需要通过RuntimeService来启动流程实例
RuntimeService runtimeService = processEngine.getRuntimeService();
// 模拟前端表单提交的流程变量信息
Map<String, Object> varivale = new HashMap<>();
varivale.put("employee", "张三");
varivale.put("nrOfHolidays", "3");
varivale.put("description", "工作累了,出去玩玩");
// 通过流程请求key启动流程实例 pbpmn20.xml文件里process id="holidayRequest"
ProcessInstance holidayRequest = runtimeService.startProcessInstanceByKey("holidayRequest", varivale);
// 通过流程请求id启动流程实例 flowable.act_re_procdef 的 DEPLOYMENT_ID_ 即部署id
// runtimeService.startProcessInstanceById("2501");
System.out.println("holidayRequest.getActivityId() = " + holidayRequest.getActivityId());
System.out.println("holidayRequest.getProcessDefinitionId() = " + holidayRequest.getProcessDefinitionId());
System.out.println("holidayRequest.getDescription() = " + holidayRequest.getDescription());
System.out.println("holidayRequest.getId() = " + holidayRequest.getId());
}
/**
* 查询测试任务
*/
@Test
public void testQueryTask() {
ProcessEngine processEngine = configuration.buildProcessEngine();
TaskService taskService = processEngine.getTaskService();
List<Task> list = taskService.createTaskQuery()
.processDefinitionKey("holidayRequest")
.taskAssignee("zhangsan")
.list();
for (Task task : list) {
System.out.println("task.getAssignee() = " + task.getAssignee());
System.out.println("task.getProcessDefinitionId() = " + task.getProcessDefinitionId());
System.out.println("task.getDescription() = " + task.getDescription());
System.out.println("task.getId() = " + task.getId());
}
}
/**
* 完成当前工作流任务--审批或者拒绝等
*/
@Test
public void testCompleteTask() {
ProcessEngine processEngine = configuration.buildProcessEngine();
TaskService taskService = processEngine.getTaskService();
List<Task> task = taskService.createTaskQuery()
.processDefinitionKey("holidayRequest")
.taskAssignee("zhangsan")
.list();
// 创建工作流中的流程变量,模拟实现任务审批表单数据
Map<String, Object> map = new HashMap<>();
map.put("approved", false);
// 完成任务
for (Task task1 : task) {
taskService.complete(task1.getId(), map);
}
}
/**
* 获取流程任务的历史数据 act_re_procdef
*/
@Test
public void testGetHistory() {
ProcessEngine processEngine = configuration.buildProcessEngine();
HistoryService historyService = processEngine.getHistoryService();
List<HistoricActivityInstance> list = historyService.createHistoricActivityInstanceQuery()
.processDefinitionId("holidayRequest:3:10003")
.finished() // 查询的历史记录的状态已经完成
.orderByHistoricActivityInstanceEndTime().asc() // 制定排序字段与方式
.list();
for (HistoricActivityInstance history : list) {
System.out.println(history.getActivityName() + " : " + history.getAssignee() + "--" + history.getActivityId() + ":" + history.getDurationInMillis());
}
}
@Test
public void testCompleteTask1() {
ProcessEngine processEngine = configuration.buildProcessEngine();
TaskService taskService = processEngine.getTaskService();
List<Task> task = taskService.createTaskQuery()
.processDefinitionKey("CreditCard")
.list();
// 创建工作流中的流程变量,模拟实现任务审批表单数据
Map<String, Object> map = new HashMap<>();
map.put("approved", false);
// 完成任务
for (Task task1 : task) {
taskService.complete(task1.getId(), map);
}
}
}
<?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: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">
<process id="Expense1" name="ExpenseProcess" isExecutable="true">
<documentation>报销流程</documentation>
<startEvent id="start" name="开始"></startEvent>
<userTask id="fillTask" name="出差报销" flowable:assignee="${taskUser}">
<extensionElements>
<modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler">
<![CDATA[false]]></modeler:initiator-can-complete>
</extensionElements>
</userTask>
<exclusiveGateway id="judgeTask"></exclusiveGateway>
<userTask id="directorTak" name="经理审批">
<extensionElements>
<flowable:taskListener event="create"
class="com.example.flowable.taskHandler.ManagerTaskHandler"></flowable:taskListener>
</extensionElements>
</userTask>
<userTask id="bossTask" name="老板审批">
<extensionElements>
<flowable:taskListener event="create"
class="com.example.flowable.taskHandler.BossTaskHandler"></flowable:taskListener>
</extensionElements>
</userTask>
<endEvent id="end" name="结束"></endEvent>
<sequenceFlow id="directorNotPassFlow" name="驳回" sourceRef="directorTak" targetRef="fillTask">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${outcome=='驳回'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="bossNotPassFlow" name="驳回" sourceRef="bossTask" targetRef="fillTask">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${outcome=='驳回'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow1" sourceRef="start" targetRef="fillTask"></sequenceFlow>
<sequenceFlow id="flow2" sourceRef="fillTask" targetRef="judgeTask"></sequenceFlow>
<sequenceFlow id="judgeMore" name="大于500元" sourceRef="judgeTask" targetRef="bossTask">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${money > 500}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="bossPassFlow" name="通过" sourceRef="bossTask" targetRef="end">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${outcome=='通过'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="directorPassFlow" name="通过" sourceRef="directorTak" targetRef="end">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${outcome=='通过'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="judgeLess" name="小于500元" sourceRef="judgeTask" targetRef="directorTak">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${money <= 500}]]></conditionExpression>
</sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_Expense">
<bpmndi:BPMNPlane bpmnElement="Expense" id="BPMNPlane_Expense">
<bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start">
<omgdc:Bounds height="30.0" width="30.0" x="285.0" y="135.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="fillTask" id="BPMNShape_fillTask">
<omgdc:Bounds height="80.0" width="100.0" x="405.0" y="110.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="judgeTask" id="BPMNShape_judgeTask">
<omgdc:Bounds height="40.0" width="40.0" x="585.0" y="130.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="directorTak" id="BPMNShape_directorTak">
<omgdc:Bounds height="80.0" width="100.0" x="735.0" y="110.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="bossTask" id="BPMNShape_bossTask">
<omgdc:Bounds height="80.0" width="100.0" x="555.0" y="255.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="end" id="BPMNShape_end">
<omgdc:Bounds height="28.0" width="28.0" x="771.0" y="281.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
<omgdi:waypoint x="315.0" y="150.0"></omgdi:waypoint>
<omgdi:waypoint x="405.0" y="150.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
<omgdi:waypoint x="505.0" y="150.16611295681062"></omgdi:waypoint>
<omgdi:waypoint x="585.4333333333333" y="150.43333333333334"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="judgeLess" id="BPMNEdge_judgeLess">
<omgdi:waypoint x="624.5530726256983" y="150.44692737430168"></omgdi:waypoint>
<omgdi:waypoint x="735.0" y="150.1392757660167"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="directorNotPassFlow" id="BPMNEdge_directorNotPassFlow">
<omgdi:waypoint x="785.0" y="110.0"></omgdi:waypoint>
<omgdi:waypoint x="785.0" y="37.0"></omgdi:waypoint>
<omgdi:waypoint x="455.0" y="37.0"></omgdi:waypoint>
<omgdi:waypoint x="455.0" y="110.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="bossPassFlow" id="BPMNEdge_bossPassFlow">
<omgdi:waypoint x="655.0" y="295.0"></omgdi:waypoint>
<omgdi:waypoint x="771.0" y="295.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="judgeMore" id="BPMNEdge_judgeMore">
<omgdi:waypoint x="605.4340277777778" y="169.56597222222223"></omgdi:waypoint>
<omgdi:waypoint x="605.1384083044983" y="255.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="directorPassFlow" id="BPMNEdge_directorPassFlow">
<omgdi:waypoint x="785.0" y="190.0"></omgdi:waypoint>
<omgdi:waypoint x="785.0" y="281.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="bossNotPassFlow" id="BPMNEdge_bossNotPassFlow">
<omgdi:waypoint x="555.0" y="295.0"></omgdi:waypoint>
<omgdi:waypoint x="455.0" y="295.0"></omgdi:waypoint>
<omgdi:waypoint x="455.0" y="190.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
\ No newline at end of file
spring.application.name=flowable
server.port=8081
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/flowable?autoReconnect=true&useUnicode=true&characterEncoding=utf-8&&zeroDateTimeBehavior=CONVERT_TO_NULL&&serverTimezone=GMT%2B8&&nullCatalogMeansCurrent=true
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#flowable.async-executor-activate=true
<?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="CreditCard" name="creditcard" isExecutable="true">
<documentation>信用卡申请规则扭转</documentation>
<startEvent id="startEvent1" flowable:formFieldValidation="true"></startEvent>
<exclusiveGateway id="sid-0EAC9C81-F059-4262-9877-F3A0BA3A1A3D" name="信用卡发放准入规则网关"></exclusiveGateway>
<sequenceFlow id="sid-BA8E0A27-19CC-4799-841C-D561E02C58CC" sourceRef="startEvent1" targetRef="sid-0EAC9C81-F059-4262-9877-F3A0BA3A1A3D"></sequenceFlow>
<serviceTask id="sid-27B8A747-45B9-48CF-8A13-AB1A06D68F7D" name="征信判断服务" flowable:class="com.example.flowable.ServiceTask1"></serviceTask>
<endEvent id="sid-FF25E057-8353-4897-82E8-E6AA566D1519" name="不发卡"></endEvent>
<serviceTask id="sid-8CE39D16-B2C1-46C1-BD48-BD20B529EFFC" name="信用卡金额判断服务" flowable:class="com.example.flowable.ServiceTask2"></serviceTask>
<endEvent id="sid-F23C964D-129B-4B5D-89A2-61A490CDCCAC" name="发信用卡"></endEvent>
<sequenceFlow id="sid-320CC5D6-D191-4E85-8035-6F45618E9166" name="有工作" sourceRef="sid-0EAC9C81-F059-4262-9877-F3A0BA3A1A3D" targetRef="sid-27B8A747-45B9-48CF-8A13-AB1A06D68F7D">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${work=='yes'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="sid-C5FE683F-33FE-4869-8898-F212CFC5D94C" name="无工作" sourceRef="sid-0EAC9C81-F059-4262-9877-F3A0BA3A1A3D" targetRef="sid-FF25E057-8353-4897-82E8-E6AA566D1519">
<documentation>如果申请人既没房也没车,同时学历为本科以上,并且月薪少于2000,同时之前没有信用卡的,那么不通过</documentation>
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${work=='no'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="sid-99143761-DC5A-42FA-980C-083205108F9F" name="征信不通过" sourceRef="sid-27B8A747-45B9-48CF-8A13-AB1A06D68F7D" targetRef="sid-FF25E057-8353-4897-82E8-E6AA566D1519">
<documentation>没房也没车大专以下月薪少于5000不通过</documentation>
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${credit=='no'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="sid-44D3689F-796E-47FD-B732-D89A02343ACA" name="工资低于2000" sourceRef="sid-8CE39D16-B2C1-46C1-BD48-BD20B529EFFC" targetRef="sid-FF25E057-8353-4897-82E8-E6AA566D1519">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${salary<=2000}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="sid-0040323B-4A7C-433A-959F-0C3D134981F9" name="征信通过" sourceRef="sid-27B8A747-45B9-48CF-8A13-AB1A06D68F7D" targetRef="sid-8CE39D16-B2C1-46C1-BD48-BD20B529EFFC">
<documentation>没房也没车大专以下月薪少于5000不通过</documentation>
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${credit=='yes'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="sid-A9DAC90F-9BC5-4EF1-B815-B73E04158A77" name="工资大于2000" sourceRef="sid-8CE39D16-B2C1-46C1-BD48-BD20B529EFFC" targetRef="sid-F23C964D-129B-4B5D-89A2-61A490CDCCAC">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${salary>2000 and grantCard=='yes'}]]></conditionExpression>
</sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_CreditCard">
<bpmndi:BPMNPlane bpmnElement="CreditCard" id="BPMNPlane_CreditCard">
<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-0EAC9C81-F059-4262-9877-F3A0BA3A1A3D" id="BPMNShape_sid-0EAC9C81-F059-4262-9877-F3A0BA3A1A3D">
<omgdc:Bounds height="40.0" width="40.0" x="255.0" y="150.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-27B8A747-45B9-48CF-8A13-AB1A06D68F7D" id="BPMNShape_sid-27B8A747-45B9-48CF-8A13-AB1A06D68F7D">
<omgdc:Bounds height="80.0" width="100.0" x="450.0" y="130.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-FF25E057-8353-4897-82E8-E6AA566D1519" id="BPMNShape_sid-FF25E057-8353-4897-82E8-E6AA566D1519">
<omgdc:Bounds height="28.0" width="28.0" x="360.0" y="270.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-8CE39D16-B2C1-46C1-BD48-BD20B529EFFC" id="BPMNShape_sid-8CE39D16-B2C1-46C1-BD48-BD20B529EFFC">
<omgdc:Bounds height="80.0" width="100.0" x="645.0" y="130.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-F23C964D-129B-4B5D-89A2-61A490CDCCAC" id="BPMNShape_sid-F23C964D-129B-4B5D-89A2-61A490CDCCAC">
<omgdc:Bounds height="28.0" width="28.0" x="840.0" y="156.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="sid-BA8E0A27-19CC-4799-841C-D561E02C58CC" id="BPMNEdge_sid-BA8E0A27-19CC-4799-841C-D561E02C58CC" flowable:sourceDockerX="15.0" flowable:sourceDockerY="15.0" flowable:targetDockerX="20.5" flowable:targetDockerY="20.5">
<omgdi:waypoint x="129.94999695909908" y="178.0"></omgdi:waypoint>
<omgdi:waypoint x="192.5" y="178.0"></omgdi:waypoint>
<omgdi:waypoint x="192.5" y="170.5"></omgdi:waypoint>
<omgdi:waypoint x="255.5" y="170.5"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-320CC5D6-D191-4E85-8035-6F45618E9166" id="BPMNEdge_sid-320CC5D6-D191-4E85-8035-6F45618E9166" flowable:sourceDockerX="20.5" flowable:sourceDockerY="20.5" flowable:targetDockerX="50.0" flowable:targetDockerY="40.0">
<omgdi:waypoint x="294.48805220881326" y="170.45758928571425"></omgdi:waypoint>
<omgdi:waypoint x="450.0" y="170.11124721603562"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-0040323B-4A7C-433A-959F-0C3D134981F9" id="BPMNEdge_sid-0040323B-4A7C-433A-959F-0C3D134981F9" flowable:sourceDockerX="50.0" flowable:sourceDockerY="40.0" flowable:targetDockerX="50.0" flowable:targetDockerY="40.0">
<omgdi:waypoint x="549.9499999999803" y="170.0"></omgdi:waypoint>
<omgdi:waypoint x="645.0" y="170.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-99143761-DC5A-42FA-980C-083205108F9F" id="BPMNEdge_sid-99143761-DC5A-42FA-980C-083205108F9F" flowable:sourceDockerX="50.0" flowable:sourceDockerY="79.0" flowable:targetDockerX="14.0" flowable:targetDockerY="14.0">
<omgdi:waypoint x="500.0" y="209.95000000000002"></omgdi:waypoint>
<omgdi:waypoint x="500.0" y="232.0"></omgdi:waypoint>
<omgdi:waypoint x="374.0" y="232.0"></omgdi:waypoint>
<omgdi:waypoint x="374.0" y="270.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-44D3689F-796E-47FD-B732-D89A02343ACA" id="BPMNEdge_sid-44D3689F-796E-47FD-B732-D89A02343ACA" flowable:sourceDockerX="50.0" flowable:sourceDockerY="40.0" flowable:targetDockerX="14.0" flowable:targetDockerY="14.0">
<omgdi:waypoint x="695.0" y="209.95000000000002"></omgdi:waypoint>
<omgdi:waypoint x="695.0" y="284.0"></omgdi:waypoint>
<omgdi:waypoint x="387.9499192832599" y="284.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-A9DAC90F-9BC5-4EF1-B815-B73E04158A77" id="BPMNEdge_sid-A9DAC90F-9BC5-4EF1-B815-B73E04158A77" flowable:sourceDockerX="50.0" flowable:sourceDockerY="40.0" flowable:targetDockerX="14.0" flowable:targetDockerY="14.0">
<omgdi:waypoint x="744.9499999999605" y="170.0"></omgdi:waypoint>
<omgdi:waypoint x="840.0" y="170.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-C5FE683F-33FE-4869-8898-F212CFC5D94C" id="BPMNEdge_sid-C5FE683F-33FE-4869-8898-F212CFC5D94C" flowable:sourceDockerX="20.5" flowable:sourceDockerY="20.5" flowable:targetDockerX="14.0" flowable:targetDockerY="14.0">
<omgdi:waypoint x="275.5" y="189.44165933098594"></omgdi:waypoint>
<omgdi:waypoint x="275.5" y="284.0"></omgdi:waypoint>
<omgdi:waypoint x="360.0" y="284.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
\ No newline at end of file
<?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="demo" name="demo" isExecutable="true">
<documentation>demo</documentation>
<startEvent id="startEvent1" flowable:formFieldValidation="true"></startEvent>
<serviceTask id="sid-88EA1C36-FEAE-4361-B729-0BD8A70DE59A" flowable:class="com.example.flowable.MyServiceTask"></serviceTask>
<serviceTask id="sid-39B59FB3-20A5-48D5-B1C6-E75EE0A3E4B8" flowable:class="com.example.flowable.MyServiceTask2"></serviceTask>
<serviceTask id="sid-D0C785ED-3A44-4D30-B18A-885381835170" flowable:class="com.example.flowable.MyServiceTask3"></serviceTask>
<endEvent id="sid-A0846D42-E6C2-4922-BE07-D9F70C295286"></endEvent>
<sequenceFlow id="sid-BDF0D3DE-AED6-45D9-95DD-CB0D295EAC23" name="通过" sourceRef="startEvent1" targetRef="sid-88EA1C36-FEAE-4361-B729-0BD8A70DE59A">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${outcome=='通过'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="sid-C639D6A8-1D89-45A0-B985-51B307424D51" name="通过3" sourceRef="sid-D0C785ED-3A44-4D30-B18A-885381835170" targetRef="sid-A0846D42-E6C2-4922-BE07-D9F70C295286">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${end2=='通过'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="sid-27338A14-7ACE-4207-BB16-993526FECBFA" name="通过2" sourceRef="sid-39B59FB3-20A5-48D5-B1C6-E75EE0A3E4B8" targetRef="sid-A0846D42-E6C2-4922-BE07-D9F70C295286">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${end1=='通过'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="sid-DEBA4A42-0169-45F0-B641-398BBD8731BE" name="通过4" sourceRef="sid-88EA1C36-FEAE-4361-B729-0BD8A70DE59A" targetRef="sid-39B59FB3-20A5-48D5-B1C6-E75EE0A3E4B8">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${end4=='通过'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="sid-C32D6D4D-DEEE-457B-A24C-0DDF57FB182F" name="不通过3" sourceRef="sid-88EA1C36-FEAE-4361-B729-0BD8A70DE59A" targetRef="sid-D0C785ED-3A44-4D30-B18A-885381835170">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${end3=='不通过'}]]></conditionExpression>
</sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_demo">
<bpmndi:BPMNPlane bpmnElement="demo" id="BPMNPlane_demo">
<bpmndi:BPMNShape bpmnElement="startEvent1" id="BPMNShape_startEvent1">
<omgdc:Bounds height="30.0" width="30.0" x="90.0" y="150.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-88EA1C36-FEAE-4361-B729-0BD8A70DE59A" id="BPMNShape_sid-88EA1C36-FEAE-4361-B729-0BD8A70DE59A">
<omgdc:Bounds height="80.0" width="100.0" x="285.0" y="125.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-39B59FB3-20A5-48D5-B1C6-E75EE0A3E4B8" id="BPMNShape_sid-39B59FB3-20A5-48D5-B1C6-E75EE0A3E4B8">
<omgdc:Bounds height="80.0" width="100.0" x="465.0" y="30.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-D0C785ED-3A44-4D30-B18A-885381835170" id="BPMNShape_sid-D0C785ED-3A44-4D30-B18A-885381835170">
<omgdc:Bounds height="80.0" width="100.0" x="480.0" y="255.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-A0846D42-E6C2-4922-BE07-D9F70C295286" id="BPMNShape_sid-A0846D42-E6C2-4922-BE07-D9F70C295286">
<omgdc:Bounds height="28.0" width="28.0" x="750.0" y="120.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="sid-BDF0D3DE-AED6-45D9-95DD-CB0D295EAC23" id="BPMNEdge_sid-BDF0D3DE-AED6-45D9-95DD-CB0D295EAC23" flowable:sourceDockerX="15.0" flowable:sourceDockerY="15.0" flowable:targetDockerX="50.0" flowable:targetDockerY="40.0">
<omgdi:waypoint x="119.94999965443563" y="165.0"></omgdi:waypoint>
<omgdi:waypoint x="285.0" y="165.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-C32D6D4D-DEEE-457B-A24C-0DDF57FB182F" id="BPMNEdge_sid-C32D6D4D-DEEE-457B-A24C-0DDF57FB182F" flowable:sourceDockerX="50.0" flowable:sourceDockerY="40.0" flowable:targetDockerX="50.0" flowable:targetDockerY="40.0">
<omgdi:waypoint x="335.0" y="204.95"></omgdi:waypoint>
<omgdi:waypoint x="335.0" y="295.0"></omgdi:waypoint>
<omgdi:waypoint x="480.0" y="295.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-27338A14-7ACE-4207-BB16-993526FECBFA" id="BPMNEdge_sid-27338A14-7ACE-4207-BB16-993526FECBFA" flowable:sourceDockerX="99.0" flowable:sourceDockerY="40.0" flowable:targetDockerX="14.0" flowable:targetDockerY="14.0">
<omgdi:waypoint x="564.95" y="70.0"></omgdi:waypoint>
<omgdi:waypoint x="642.5" y="70.0"></omgdi:waypoint>
<omgdi:waypoint x="642.5" y="134.0"></omgdi:waypoint>
<omgdi:waypoint x="750.0" y="134.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-DEBA4A42-0169-45F0-B641-398BBD8731BE" id="BPMNEdge_sid-DEBA4A42-0169-45F0-B641-398BBD8731BE" flowable:sourceDockerX="50.0" flowable:sourceDockerY="40.0" flowable:targetDockerX="10.0" flowable:targetDockerY="38.0">
<omgdi:waypoint x="384.94999999997884" y="165.0"></omgdi:waypoint>
<omgdi:waypoint x="418.0" y="165.0"></omgdi:waypoint>
<omgdi:waypoint x="415.0" y="68.0"></omgdi:waypoint>
<omgdi:waypoint x="465.0" y="68.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-C639D6A8-1D89-45A0-B985-51B307424D51" id="BPMNEdge_sid-C639D6A8-1D89-45A0-B985-51B307424D51" flowable:sourceDockerX="99.0" flowable:sourceDockerY="40.0" flowable:targetDockerX="4.0" flowable:targetDockerY="23.0">
<omgdi:waypoint x="579.95" y="294.13142857142856"></omgdi:waypoint>
<omgdi:waypoint x="750.0443289528545" y="146.39360860582016"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
\ No newline at end of file
log4j.rootLogger=DEBUG, CA
log4j.appender.CA=org.apache.log4j.ConsoleAppender
log4j.appender.CA.layout=org.apache.log4j.PatternLayout
log4j.appender.CA.layout.ConversionPattern= %d{hh:mm:ss,SSS} [%t] %-5p %c %x - %m%n
\ No newline at end of file
<?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: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">
<process id="Expense" name="ExpenseProcess" isExecutable="true">
<documentation>报销流程</documentation>
<startEvent id="start" name="开始"></startEvent>
<userTask id="fillTask" name="出差报销" flowable:assignee="${taskUser}">
<extensionElements>
<modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler">
<![CDATA[false]]></modeler:initiator-can-complete>
</extensionElements>
</userTask>
<exclusiveGateway id="judgeTask"></exclusiveGateway>
<userTask id="directorTak" name="经理审批">
<extensionElements>
<flowable:taskListener event="create"
class="com.example.flowable.taskHandler.ManagerTaskHandler"></flowable:taskListener>
</extensionElements>
</userTask>
<userTask id="bossTask" name="老板审批">
<extensionElements>
<flowable:taskListener event="create"
class="com.example.flowable.taskHandler.BossTaskHandler"></flowable:taskListener>
</extensionElements>
</userTask>
<endEvent id="end" name="结束"></endEvent>
<sequenceFlow id="directorNotPassFlow" name="驳回" sourceRef="directorTak" targetRef="fillTask">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${outcome=='驳回'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="bossNotPassFlow" name="驳回" sourceRef="bossTask" targetRef="fillTask">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${outcome=='驳回'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow1" sourceRef="start" targetRef="fillTask"></sequenceFlow>
<sequenceFlow id="flow2" sourceRef="fillTask" targetRef="judgeTask"></sequenceFlow>
<sequenceFlow id="judgeMore" name="大于500元" sourceRef="judgeTask" targetRef="bossTask">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${money > 500}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="bossPassFlow" name="通过" sourceRef="bossTask" targetRef="end">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${outcome=='通过'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="directorPassFlow" name="通过" sourceRef="directorTak" targetRef="end">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${outcome=='通过'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="judgeLess" name="小于500元" sourceRef="judgeTask" targetRef="directorTak">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${money <= 500}]]></conditionExpression>
</sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_Expense">
<bpmndi:BPMNPlane bpmnElement="Expense" id="BPMNPlane_Expense">
<bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start">
<omgdc:Bounds height="30.0" width="30.0" x="285.0" y="135.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="fillTask" id="BPMNShape_fillTask">
<omgdc:Bounds height="80.0" width="100.0" x="405.0" y="110.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="judgeTask" id="BPMNShape_judgeTask">
<omgdc:Bounds height="40.0" width="40.0" x="585.0" y="130.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="directorTak" id="BPMNShape_directorTak">
<omgdc:Bounds height="80.0" width="100.0" x="735.0" y="110.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="bossTask" id="BPMNShape_bossTask">
<omgdc:Bounds height="80.0" width="100.0" x="555.0" y="255.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="end" id="BPMNShape_end">
<omgdc:Bounds height="28.0" width="28.0" x="771.0" y="281.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
<omgdi:waypoint x="315.0" y="150.0"></omgdi:waypoint>
<omgdi:waypoint x="405.0" y="150.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
<omgdi:waypoint x="505.0" y="150.16611295681062"></omgdi:waypoint>
<omgdi:waypoint x="585.4333333333333" y="150.43333333333334"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="judgeLess" id="BPMNEdge_judgeLess">
<omgdi:waypoint x="624.5530726256983" y="150.44692737430168"></omgdi:waypoint>
<omgdi:waypoint x="735.0" y="150.1392757660167"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="directorNotPassFlow" id="BPMNEdge_directorNotPassFlow">
<omgdi:waypoint x="785.0" y="110.0"></omgdi:waypoint>
<omgdi:waypoint x="785.0" y="37.0"></omgdi:waypoint>
<omgdi:waypoint x="455.0" y="37.0"></omgdi:waypoint>
<omgdi:waypoint x="455.0" y="110.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="bossPassFlow" id="BPMNEdge_bossPassFlow">
<omgdi:waypoint x="655.0" y="295.0"></omgdi:waypoint>
<omgdi:waypoint x="771.0" y="295.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="judgeMore" id="BPMNEdge_judgeMore">
<omgdi:waypoint x="605.4340277777778" y="169.56597222222223"></omgdi:waypoint>
<omgdi:waypoint x="605.1384083044983" y="255.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="directorPassFlow" id="BPMNEdge_directorPassFlow">
<omgdi:waypoint x="785.0" y="190.0"></omgdi:waypoint>
<omgdi:waypoint x="785.0" y="281.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="bossNotPassFlow" id="BPMNEdge_bossNotPassFlow">
<omgdi:waypoint x="555.0" y="295.0"></omgdi:waypoint>
<omgdi:waypoint x="455.0" y="295.0"></omgdi:waypoint>
<omgdi:waypoint x="455.0" y="190.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
\ No newline at end of file
artifactId=flowable
groupId=com.example
version=0.0.1-SNAPSHOT
com\example\flowable\config\FlowableConfig.class
com\example\flowable\controller\ExpenseController.class
com\example\flowable\controller\TestFlowable.class
com\example\flowable\taskHandler\ManagerTaskHandler.class
com\example\flowable\FlowableApplication.class
com\example\flowable\taskHandler\BossTaskHandler.class
D:\javacompany\flowable-master\src\main\java\com\example\flowable\config\FlowableConfig.java
D:\javacompany\flowable-master\src\main\java\com\example\flowable\controller\TestFlowable.java
D:\javacompany\flowable-master\src\main\java\com\example\flowable\controller\ExpenseController.java
D:\javacompany\flowable-master\src\main\java\com\example\flowable\taskHandler\BossTaskHandler.java
D:\javacompany\flowable-master\src\main\java\com\example\flowable\taskHandler\ManagerTaskHandler.java
D:\javacompany\flowable-master\src\main\java\com\example\flowable\FlowableApplication.java
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment