flowable简单应用--中原霸者的性格诊断系统

1.pom文件html

<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.knife</groupId>
  <artifactId>testspringbootflowable</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>testspringbootflowable</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <version>2.0.1.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
             <version>2.0.1.RELEASE</version>
        </dependency>
        <!--flowable工做流依赖-->
        <dependency>
            <groupId>org.flowable</groupId>
            <artifactId>flowable-spring-boot-starter</artifactId>
            <version>6.3.0</version>
        </dependency>
        <!--mysql依赖-->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.45</version>
        </dependency>
  </dependencies>
</project>

2.application.yml前端

###################  项目启动端口  ###################
server:
  port: 8080

###################  spring配置  ###################
spring:
  profiles:
    active: dev
##########################################################
###################  开发环境的profile  ###################
##########################################################
  datasource:
    url: jdbc:mysql://127.0.0.1:3306/flowable-spring-boot
    username: root
    password: root
  thymeleaf:
    cache: false

3.SanControllerjava

package com.knife.testspringbootflowable;


import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import javax.servlet.http.HttpServletResponse;

import org.flowable.bpmn.model.BpmnModel;
import org.flowable.engine.ProcessEngine;
import org.flowable.engine.ProcessEngineConfiguration;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
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.ResponseBody;

@Controller
@RequestMapping(value = "san")
public class SanController {

	
	@RequestMapping(value = "index")
	public String index() {
		return "index.html";
	}
	
	@Autowired
	private RuntimeService runtimeService;
	@Autowired
	private TaskService taskService;
	@Autowired
	private RepositoryService repositoryService;
	@Autowired
	private ProcessEngine processEngine;
	
	/**
	 * 添加报销
	 * @param userId    用户Id
	 * 
	 */
	@RequestMapping(value = "add")
	@ResponseBody
	public String addExpense(String userId,String bpmn) {
		// 启动流程
		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("taskUser", userId);
		ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(bpmn, map);
		return processInstance.getId();
	}

	/**
	 * 批准
	 *
	 * @param taskId 任务ID
	 */
	@RequestMapping(value = "/select")
	@ResponseBody
	public String apply(String userId,Integer option) {
		List<Task> tasks = taskService.createTaskQuery().taskAssignee(userId).orderByTaskCreateTime().desc().list();
		String result = "";
		for (Task task : tasks) {
			System.out.println(task.toString());
			result= task.getId();
		}
		Task task = taskService.createTaskQuery().taskId(result).singleResult();
		if (task == null) {
			throw new RuntimeException("流程不存在");
		}
		// 经过审核
		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("option",option);
		taskService.complete(result, map);
		return "processed ok!";
	}

	/**
	 * 生成流程图
	 *
	 * @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<String>();
		List<String> flows = new ArrayList<String>();
		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);
		drawpng(httpServletResponse,in);
	}
	
	private void drawpng(HttpServletResponse httpServletResponse,InputStream in ) throws IOException {
		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();
			}
		}
	}
}

4.bpmn配置mysql

<?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="mySanProcess" name="My San process"
		isExecutable="true">
		<startEvent id="startevent1" name="Start"></startEvent>
		<sequenceFlow id="flow1" sourceRef="startevent1" targetRef="usertask4"></sequenceFlow>
		
		<userTask id="usertask4" name="是好好先生嗎"  flowable:assignee="${taskUser}"></userTask>
		<sequenceFlow id="flow2" sourceRef="usertask4" targetRef="exclusivegateway1"></sequenceFlow>
		<exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"  flowable:assignee="${taskUser}"></exclusiveGateway>
		<sequenceFlow id="flow3" sourceRef="exclusivegateway1" targetRef="usertask5">
			<conditionExpression xsi:type="tFormalExpression"><![CDATA[${option=='0'}]]></conditionExpression>
		</sequenceFlow>
		<sequenceFlow id="flow4" sourceRef="exclusivegateway1" targetRef="usertask6">
			<conditionExpression xsi:type="tFormalExpression"><![CDATA[${option=='1'}]]></conditionExpression>
		</sequenceFlow>
		
		<userTask id="usertask5" name="曾欺騙他人嗎"  flowable:assignee="${taskUser}"></userTask>
		<sequenceFlow id="flow6" sourceRef="usertask5" targetRef="exclusivegateway3"></sequenceFlow>
		<exclusiveGateway id="exclusivegateway3" name="Exclusive Gateway"  flowable:assignee="${taskUser}"></exclusiveGateway>
		<sequenceFlow id="flow17" sourceRef="exclusivegateway3" targetRef="usertask14">
			<conditionExpression xsi:type="tFormalExpression"><![CDATA[${option=='1'}]]></conditionExpression>
		</sequenceFlow>
		<sequenceFlow id="flow28" sourceRef="exclusivegateway3" targetRef="usertask21">
			<conditionExpression xsi:type="tFormalExpression"><![CDATA[${option=='0'}]]></conditionExpression>
		</sequenceFlow>
		
		
		<userTask id="usertask6" name="是八面玲瓏的人嗎"  flowable:assignee="${taskUser}"></userTask>
		<sequenceFlow id="flow51" sourceRef="usertask6" targetRef="exclusivegateway13"></sequenceFlow>
		<exclusiveGateway id="exclusivegateway13" name="Exclusive Gateway"  flowable:assignee="${taskUser}"></exclusiveGateway>
		<sequenceFlow id="flow52" sourceRef="exclusivegateway13" targetRef="usertask9">
			<conditionExpression xsi:type="tFormalExpression"><![CDATA[${option=='1'}]]></conditionExpression>
		</sequenceFlow>
		<sequenceFlow id="flow53" sourceRef="exclusivegateway13" targetRef="usertask24">
			<conditionExpression xsi:type="tFormalExpression"><![CDATA[${option=='0'}]]></conditionExpression>
		</sequenceFlow>
		
		
		<userTask id="usertask9" name="講人情義利嗎"  flowable:assignee="${taskUser}"></userTask>
		<sequenceFlow id="flow10" sourceRef="usertask9" targetRef="exclusivegateway4"></sequenceFlow>
		<exclusiveGateway id="exclusivegateway4" name="Exclusive Gateway"  flowable:assignee="${taskUser}"></exclusiveGateway>
		<sequenceFlow id="flow11" sourceRef="exclusivegateway4" targetRef="usertask10">
			<conditionExpression xsi:type="tFormalExpression"><![CDATA[${option=='1'}]]></conditionExpression>
		</sequenceFlow>
		<sequenceFlow id="flow41" sourceRef="exclusivegateway4" targetRef="usertask22">
			<conditionExpression xsi:type="tFormalExpression"><![CDATA[${option=='0'}]]></conditionExpression>
		</sequenceFlow>
		
		<userTask id="usertask10" name="依賴他人嗎"  flowable:assignee="${taskUser}"></userTask>
		<sequenceFlow id="flow12" sourceRef="usertask10" targetRef="exclusivegateway5"></sequenceFlow>
		<exclusiveGateway id="exclusivegateway5" name="Exclusive Gateway"  flowable:assignee="${taskUser}"></exclusiveGateway>
		<sequenceFlow id="flow13" sourceRef="exclusivegateway5" targetRef="usertask11">
			<conditionExpression xsi:type="tFormalExpression"><![CDATA[${option=='1'}]]></conditionExpression>
		</sequenceFlow>
		<sequenceFlow id="flow39" sourceRef="exclusivegateway5" targetRef="usertask23">
			<conditionExpression xsi:type="tFormalExpression"><![CDATA[${option=='0'}]]></conditionExpression>
		</sequenceFlow>
		
		
		<userTask id="usertask11" name="有決斷力嗎"  flowable:assignee="${taskUser}"></userTask>
		<sequenceFlow id="flow14" sourceRef="usertask11" targetRef="exclusivegateway6"></sequenceFlow>
		<exclusiveGateway id="exclusivegateway6" name="Exclusive Gateway"  flowable:assignee="${taskUser}"></exclusiveGateway>
		<sequenceFlow id="flow15" sourceRef="exclusivegateway6" targetRef="usertask12">
			<conditionExpression xsi:type="tFormalExpression"><![CDATA[${option=='1'}]]></conditionExpression>
		</sequenceFlow>
		<sequenceFlow id="flow16" sourceRef="exclusivegateway6" targetRef="usertask13">
			<conditionExpression xsi:type="tFormalExpression"><![CDATA[${option=='0'}]]></conditionExpression>
		</sequenceFlow>
		
		
		<userTask id="usertask15" name="對小事耿耿於懷"  flowable:assignee="${taskUser}"></userTask>
		<sequenceFlow id="flow20" sourceRef="usertask15" targetRef="exclusivegateway8"></sequenceFlow>
		<exclusiveGateway id="exclusivegateway8" name="Exclusive Gateway"  flowable:assignee="${taskUser}"></exclusiveGateway>
		<sequenceFlow id="flow21" sourceRef="exclusivegateway8" targetRef="usertask16">
			<conditionExpression xsi:type="tFormalExpression"><![CDATA[${option=='0'}]]></conditionExpression>
		</sequenceFlow>
		<sequenceFlow id="flow22" sourceRef="exclusivegateway8" targetRef="usertask17">
			<conditionExpression xsi:type="tFormalExpression"><![CDATA[${option=='1'}]]></conditionExpression>
		</sequenceFlow>
		
		<userTask id="usertask18" name="打架從沒輸過"  flowable:assignee="${taskUser}"></userTask>
		<sequenceFlow id="flow24" sourceRef="usertask18" targetRef="exclusivegateway9"></sequenceFlow>
		<exclusiveGateway id="exclusivegateway9" name="Exclusive Gateway"  flowable:assignee="${taskUser}"></exclusiveGateway>
		<sequenceFlow id="flow25" sourceRef="exclusivegateway9" targetRef="usertask19">
			<conditionExpression xsi:type="tFormalExpression"><![CDATA[${option=='0'}]]></conditionExpression>
		</sequenceFlow>
		<sequenceFlow id="flow26" sourceRef="exclusivegateway9" targetRef="usertask20">
			<conditionExpression xsi:type="tFormalExpression"><![CDATA[${option=='1'}]]></conditionExpression>
		</sequenceFlow>
		
		<userTask id="usertask14" name="想要的必定要获得"  flowable:assignee="${taskUser}"></userTask>
		<sequenceFlow id="flow18" sourceRef="usertask14" targetRef="exclusivegateway7"></sequenceFlow>
		<exclusiveGateway id="exclusivegateway7" name="Exclusive Gateway"  flowable:assignee="${taskUser}"></exclusiveGateway>
		<sequenceFlow id="flow19" sourceRef="exclusivegateway7" targetRef="usertask15">
			<conditionExpression xsi:type="tFormalExpression"><![CDATA[${option=='1'}]]></conditionExpression>
		</sequenceFlow>
		<sequenceFlow id="flow57" sourceRef="exclusivegateway7" targetRef="usertask23">
			<conditionExpression xsi:type="tFormalExpression"><![CDATA[${option=='0'}]]></conditionExpression>
		</sequenceFlow>
		
		<userTask id="usertask21" name="喜歡存錢嗎"  flowable:assignee="${taskUser}"></userTask>
		<sequenceFlow id="flow29" sourceRef="usertask21" targetRef="exclusivegateway10"></sequenceFlow>
		<exclusiveGateway id="exclusivegateway10" name="Exclusive Gateway"  flowable:assignee="${taskUser}"></exclusiveGateway>
		<sequenceFlow id="flow30" sourceRef="exclusivegateway10" targetRef="usertask22">
			<conditionExpression xsi:type="tFormalExpression"><![CDATA[${option=='0'}]]></conditionExpression>
		</sequenceFlow>
		<sequenceFlow id="flow35" sourceRef="exclusivegateway10" targetRef="usertask9">
			<conditionExpression xsi:type="tFormalExpression"><![CDATA[${option=='1'}]]></conditionExpression>
		</sequenceFlow>
		
		
		<userTask id="usertask23" name="容易興奮嗎"  flowable:assignee="${taskUser}"></userTask>
		<sequenceFlow id="flow36" sourceRef="usertask23" targetRef="exclusivegateway12"></sequenceFlow>
		<exclusiveGateway id="exclusivegateway12" name="Exclusive Gateway"  flowable:assignee="${taskUser}"></exclusiveGateway>
		<sequenceFlow id="flow37" sourceRef="exclusivegateway12" targetRef="usertask18">
			<conditionExpression xsi:type="tFormalExpression"><![CDATA[${option=='0'}]]></conditionExpression>
		</sequenceFlow>
		<sequenceFlow id="flow38" sourceRef="exclusivegateway12" targetRef="usertask15">
			<conditionExpression xsi:type="tFormalExpression"><![CDATA[${option=='1'}]]></conditionExpression>
		</sequenceFlow>
		
		<userTask id="usertask22" name="有耐心嗎"  flowable:assignee="${taskUser}"></userTask>
		<sequenceFlow id="flow31" sourceRef="usertask22" targetRef="exclusivegateway11"></sequenceFlow>
		<exclusiveGateway id="exclusivegateway11" name="Exclusive Gateway"  flowable:assignee="${taskUser}"></exclusiveGateway>
		<sequenceFlow id="flow32" sourceRef="exclusivegateway11" targetRef="usertask23">
			<conditionExpression xsi:type="tFormalExpression"><![CDATA[${option=='0'}]]></conditionExpression>
		</sequenceFlow>
		<sequenceFlow id="flow40" sourceRef="exclusivegateway11" targetRef="usertask14">
			<conditionExpression xsi:type="tFormalExpression"><![CDATA[${option=='1'}]]></conditionExpression>
		</sequenceFlow>
		
		<userTask id="usertask24" name="討厭麻煩"  flowable:assignee="${taskUser}"></userTask>
		<sequenceFlow id="flow54" sourceRef="usertask24" targetRef="exclusivegateway14"></sequenceFlow>
		<exclusiveGateway id="exclusivegateway14" name="Exclusive Gateway"  flowable:assignee="${taskUser}"></exclusiveGateway>
		<sequenceFlow id="flow55" sourceRef="exclusivegateway14" targetRef="usertask9">
			<conditionExpression xsi:type="tFormalExpression"><![CDATA[${option=='0'}]]></conditionExpression>
		</sequenceFlow>
		<sequenceFlow id="flow56" sourceRef="exclusivegateway14" targetRef="usertask21">
			<conditionExpression xsi:type="tFormalExpression"><![CDATA[${option=='1'}]]></conditionExpression>
		</sequenceFlow>
		
		
		<userTask id="usertask16" name="曹操"  flowable:assignee="${taskUser}"></userTask>
		<userTask id="usertask17" name="袁紹"  flowable:assignee="${taskUser}"></userTask>
		<userTask id="usertask19" name="孫權"  flowable:assignee="${taskUser}"></userTask>
		<userTask id="usertask20" name="馬騰"  flowable:assignee="${taskUser}"></userTask>
		<userTask id="usertask12" name="劉備"  flowable:assignee="${taskUser}"></userTask>
		<userTask id="usertask13" name="劉璋"  flowable:assignee="${taskUser}"></userTask>
		
				
		<endEvent id="endevent1" name="End"></endEvent>
		<endEvent id="endevent2" name="End"></endEvent>
		<sequenceFlow id="flow44" sourceRef="usertask16"
			targetRef="endevent2"></sequenceFlow>
		<endEvent id="endevent3" name="End"></endEvent>
		<sequenceFlow id="flow45" sourceRef="usertask17"
			targetRef="endevent3"></sequenceFlow>
		<endEvent id="endevent4" name="End"></endEvent>
		<sequenceFlow id="flow46" sourceRef="usertask17"
			targetRef="endevent4"></sequenceFlow>
		<endEvent id="endevent5" name="End"></endEvent>
		<sequenceFlow id="flow47" sourceRef="usertask20"
			targetRef="endevent5"></sequenceFlow>
		<endEvent id="endevent6" name="End"></endEvent>
		<sequenceFlow id="flow48" sourceRef="usertask19"
			targetRef="endevent6"></sequenceFlow>
		<endEvent id="endevent7" name="End"></endEvent>
		<sequenceFlow id="flow49" sourceRef="usertask13"
			targetRef="endevent7"></sequenceFlow>
		<endEvent id="endevent8" name="End"></endEvent>
		<sequenceFlow id="flow50" sourceRef="usertask12"
			targetRef="endevent8"></sequenceFlow>
		
	</process>
	<bpmndi:BPMNDiagram id="BPMNDiagram_myProcess">
		<bpmndi:BPMNPlane bpmnElement="myProcess"
			id="BPMNPlane_myProcess">
			<bpmndi:BPMNShape bpmnElement="startevent1"
				id="BPMNShape_startevent1">
				<omgdc:Bounds height="71.0" width="71.0" x="11.0"
					y="190.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="usertask4"
				id="BPMNShape_usertask4">
				<omgdc:Bounds height="55.0" width="105.0" x="100.0"
					y="199.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="exclusivegateway1"
				id="BPMNShape_exclusivegateway1">
				<omgdc:Bounds height="40.0" width="40.0" x="229.0"
					y="205.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="usertask5"
				id="BPMNShape_usertask5">
				<omgdc:Bounds height="55.0" width="105.0" x="197.0"
					y="340.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="usertask6"
				id="BPMNShape_usertask6">
				<omgdc:Bounds height="55.0" width="105.0" x="125.0"
					y="60.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="exclusivegateway3"
				id="BPMNShape_exclusivegateway3">
				<omgdc:Bounds height="40.0" width="40.0" x="347.0"
					y="348.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="usertask9"
				id="BPMNShape_usertask9">
				<omgdc:Bounds height="55.0" width="105.0" x="380.0"
					y="60.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="exclusivegateway4"
				id="BPMNShape_exclusivegateway4">
				<omgdc:Bounds height="40.0" width="40.0" x="518.0"
					y="67.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="usertask10"
				id="BPMNShape_usertask10">
				<omgdc:Bounds height="55.0" width="105.0" x="582.0"
					y="60.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="exclusivegateway5"
				id="BPMNShape_exclusivegateway5">
				<omgdc:Bounds height="40.0" width="40.0" x="720.0"
					y="67.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="usertask11"
				id="BPMNShape_usertask11">
				<omgdc:Bounds height="55.0" width="105.0" x="790.0"
					y="60.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="exclusivegateway6"
				id="BPMNShape_exclusivegateway6">
				<omgdc:Bounds height="40.0" width="40.0" x="920.0"
					y="67.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="usertask12"
				id="BPMNShape_usertask12">
				<omgdc:Bounds height="55.0" width="105.0" x="1013.0"
					y="60.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="usertask13"
				id="BPMNShape_usertask13">
				<omgdc:Bounds height="55.0" width="105.0" x="1013.0"
					y="136.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="usertask14"
				id="BPMNShape_usertask14">
				<omgdc:Bounds height="55.0" width="105.0" x="486.0"
					y="340.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="exclusivegateway7"
				id="BPMNShape_exclusivegateway7">
				<omgdc:Bounds height="40.0" width="40.0" x="688.0"
					y="348.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="usertask15"
				id="BPMNShape_usertask15">
				<omgdc:Bounds height="55.0" width="105.0" x="790.0"
					y="340.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="exclusivegateway8"
				id="BPMNShape_exclusivegateway8">
				<omgdc:Bounds height="40.0" width="40.0" x="920.0"
					y="347.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="usertask16"
				id="BPMNShape_usertask16">
				<omgdc:Bounds height="55.0" width="105.0" x="1013.0"
					y="387.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="usertask17"
				id="BPMNShape_usertask17">
				<omgdc:Bounds height="55.0" width="105.0" x="1013.0"
					y="320.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="usertask18"
				id="BPMNShape_usertask18">
				<omgdc:Bounds height="55.0" width="105.0" x="819.0"
					y="171.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="exclusivegateway9"
				id="BPMNShape_exclusivegateway9">
				<omgdc:Bounds height="40.0" width="40.0" x="950.0"
					y="218.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="usertask19"
				id="BPMNShape_usertask19">
				<omgdc:Bounds height="55.0" width="105.0" x="1013.0"
					y="198.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="usertask20"
				id="BPMNShape_usertask20">
				<omgdc:Bounds height="55.0" width="105.0" x="1013.0"
					y="260.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="usertask21"
				id="BPMNShape_usertask21">
				<omgdc:Bounds height="55.0" width="105.0" x="453.0"
					y="260.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="exclusivegateway10"
				id="BPMNShape_exclusivegateway10">
				<omgdc:Bounds height="40.0" width="40.0" x="471.0"
					y="178.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="usertask22"
				id="BPMNShape_usertask22">
				<omgdc:Bounds height="55.0" width="105.0" x="558.0"
					y="171.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="exclusivegateway11"
				id="BPMNShape_exclusivegateway11">
				<omgdc:Bounds height="40.0" width="40.0" x="646.0"
					y="273.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="usertask23"
				id="BPMNShape_usertask23">
				<omgdc:Bounds height="55.0" width="105.0" x="686.0"
					y="171.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="exclusivegateway12"
				id="BPMNShape_exclusivegateway12">
				<omgdc:Bounds height="40.0" width="40.0" x="771.0"
					y="273.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="endevent1"
				id="BPMNShape_endevent1">
				<omgdc:Bounds height="35.0" width="35.0" x="1163.0"
					y="397.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="endevent2"
				id="BPMNShape_endevent2">
				<omgdc:Bounds height="35.0" width="35.0" x="1163.0"
					y="397.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="endevent3"
				id="BPMNShape_endevent3">
				<omgdc:Bounds height="35.0" width="35.0" x="1163.0"
					y="330.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="endevent4"
				id="BPMNShape_endevent4">
				<omgdc:Bounds height="35.0" width="35.0" x="1163.0"
					y="330.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="endevent5"
				id="BPMNShape_endevent5">
				<omgdc:Bounds height="35.0" width="35.0" x="1163.0"
					y="270.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="endevent6"
				id="BPMNShape_endevent6">
				<omgdc:Bounds height="35.0" width="35.0" x="1163.0"
					y="208.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="endevent7"
				id="BPMNShape_endevent7">
				<omgdc:Bounds height="35.0" width="35.0" x="1163.0"
					y="146.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="endevent8"
				id="BPMNShape_endevent8">
				<omgdc:Bounds height="35.0" width="35.0" x="1163.0"
					y="70.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="exclusivegateway13"
				id="BPMNShape_exclusivegateway13">
				<omgdc:Bounds height="40.0" width="40.0" x="275.0"
					y="68.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="usertask24"
				id="BPMNShape_usertask24">
				<omgdc:Bounds height="55.0" width="105.0" x="284.0"
					y="198.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNShape bpmnElement="exclusivegateway14"
				id="BPMNShape_exclusivegateway14">
				<omgdc:Bounds height="40.0" width="40.0" x="420.0"
					y="206.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
			<bpmndi:BPMNEdge bpmnElement="flow1"
				id="BPMNEdge_flow1">
				<omgdi:waypoint x="82.0" y="225.0"></omgdi:waypoint>
				<omgdi:waypoint x="100.0" y="226.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow2"
				id="BPMNEdge_flow2">
				<omgdi:waypoint x="205.0" y="226.0"></omgdi:waypoint>
				<omgdi:waypoint x="229.0" y="225.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow3"
				id="BPMNEdge_flow3">
				<omgdi:waypoint x="249.0" y="245.0"></omgdi:waypoint>
				<omgdi:waypoint x="249.0" y="340.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow4"
				id="BPMNEdge_flow4">
				<omgdi:waypoint x="249.0" y="205.0"></omgdi:waypoint>
				<omgdi:waypoint x="177.0" y="115.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow6"
				id="BPMNEdge_flow6">
				<omgdi:waypoint x="302.0" y="367.0"></omgdi:waypoint>
				<omgdi:waypoint x="347.0" y="368.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow10"
				id="BPMNEdge_flow10">
				<omgdi:waypoint x="485.0" y="87.0"></omgdi:waypoint>
				<omgdi:waypoint x="518.0" y="87.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow11"
				id="BPMNEdge_flow11">
				<omgdi:waypoint x="558.0" y="87.0"></omgdi:waypoint>
				<omgdi:waypoint x="582.0" y="87.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow12"
				id="BPMNEdge_flow12">
				<omgdi:waypoint x="687.0" y="87.0"></omgdi:waypoint>
				<omgdi:waypoint x="720.0" y="87.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow13"
				id="BPMNEdge_flow13">
				<omgdi:waypoint x="760.0" y="87.0"></omgdi:waypoint>
				<omgdi:waypoint x="790.0" y="87.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow14"
				id="BPMNEdge_flow14">
				<omgdi:waypoint x="895.0" y="87.0"></omgdi:waypoint>
				<omgdi:waypoint x="920.0" y="87.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow15"
				id="BPMNEdge_flow15">
				<omgdi:waypoint x="960.0" y="87.0"></omgdi:waypoint>
				<omgdi:waypoint x="1013.0" y="87.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow16"
				id="BPMNEdge_flow16">
				<omgdi:waypoint x="940.0" y="107.0"></omgdi:waypoint>
				<omgdi:waypoint x="1065.0" y="136.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow17"
				id="BPMNEdge_flow17">
				<omgdi:waypoint x="387.0" y="368.0"></omgdi:waypoint>
				<omgdi:waypoint x="486.0" y="367.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow18"
				id="BPMNEdge_flow18">
				<omgdi:waypoint x="591.0" y="367.0"></omgdi:waypoint>
				<omgdi:waypoint x="688.0" y="368.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow19"
				id="BPMNEdge_flow19">
				<omgdi:waypoint x="728.0" y="368.0"></omgdi:waypoint>
				<omgdi:waypoint x="790.0" y="367.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow20"
				id="BPMNEdge_flow20">
				<omgdi:waypoint x="895.0" y="367.0"></omgdi:waypoint>
				<omgdi:waypoint x="920.0" y="367.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow21"
				id="BPMNEdge_flow21">
				<omgdi:waypoint x="960.0" y="367.0"></omgdi:waypoint>
				<omgdi:waypoint x="1065.0" y="387.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow22"
				id="BPMNEdge_flow22">
				<omgdi:waypoint x="960.0" y="367.0"></omgdi:waypoint>
				<omgdi:waypoint x="1013.0" y="347.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow24"
				id="BPMNEdge_flow24">
				<omgdi:waypoint x="924.0" y="198.0"></omgdi:waypoint>
				<omgdi:waypoint x="970.0" y="218.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow25"
				id="BPMNEdge_flow25">
				<omgdi:waypoint x="990.0" y="238.0"></omgdi:waypoint>
				<omgdi:waypoint x="1013.0" y="225.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow26"
				id="BPMNEdge_flow26">
				<omgdi:waypoint x="990.0" y="238.0"></omgdi:waypoint>
				<omgdi:waypoint x="1065.0" y="260.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow28"
				id="BPMNEdge_flow28">
				<omgdi:waypoint x="367.0" y="348.0"></omgdi:waypoint>
				<omgdi:waypoint x="505.0" y="315.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow29"
				id="BPMNEdge_flow29">
				<omgdi:waypoint x="505.0" y="260.0"></omgdi:waypoint>
				<omgdi:waypoint x="491.0" y="218.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow30"
				id="BPMNEdge_flow30">
				<omgdi:waypoint x="511.0" y="198.0"></omgdi:waypoint>
				<omgdi:waypoint x="558.0" y="198.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow31"
				id="BPMNEdge_flow31">
				<omgdi:waypoint x="610.0" y="226.0"></omgdi:waypoint>
				<omgdi:waypoint x="666.0" y="273.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow32"
				id="BPMNEdge_flow32">
				<omgdi:waypoint x="666.0" y="273.0"></omgdi:waypoint>
				<omgdi:waypoint x="738.0" y="226.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow35"
				id="BPMNEdge_flow35">
				<omgdi:waypoint x="491.0" y="178.0"></omgdi:waypoint>
				<omgdi:waypoint x="432.0" y="115.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow36"
				id="BPMNEdge_flow36">
				<omgdi:waypoint x="738.0" y="226.0"></omgdi:waypoint>
				<omgdi:waypoint x="791.0" y="273.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow37"
				id="BPMNEdge_flow37">
				<omgdi:waypoint x="791.0" y="273.0"></omgdi:waypoint>
				<omgdi:waypoint x="871.0" y="226.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow38"
				id="BPMNEdge_flow38">
				<omgdi:waypoint x="791.0" y="313.0"></omgdi:waypoint>
				<omgdi:waypoint x="761.0" y="367.0"></omgdi:waypoint>
				<omgdi:waypoint x="790.0" y="367.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow39"
				id="BPMNEdge_flow39">
				<omgdi:waypoint x="740.0" y="107.0"></omgdi:waypoint>
				<omgdi:waypoint x="738.0" y="171.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow40"
				id="BPMNEdge_flow40">
				<omgdi:waypoint x="666.0" y="313.0"></omgdi:waypoint>
				<omgdi:waypoint x="538.0" y="340.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow41"
				id="BPMNEdge_flow41">
				<omgdi:waypoint x="538.0" y="107.0"></omgdi:waypoint>
				<omgdi:waypoint x="610.0" y="171.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow44"
				id="BPMNEdge_flow44">
				<omgdi:waypoint x="1118.0" y="414.0"></omgdi:waypoint>
				<omgdi:waypoint x="1163.0" y="414.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow45"
				id="BPMNEdge_flow45">
				<omgdi:waypoint x="1118.0" y="347.0"></omgdi:waypoint>
				<omgdi:waypoint x="1163.0" y="347.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow46"
				id="BPMNEdge_flow46">
				<omgdi:waypoint x="1118.0" y="347.0"></omgdi:waypoint>
				<omgdi:waypoint x="1163.0" y="347.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow47"
				id="BPMNEdge_flow47">
				<omgdi:waypoint x="1118.0" y="287.0"></omgdi:waypoint>
				<omgdi:waypoint x="1163.0" y="287.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow48"
				id="BPMNEdge_flow48">
				<omgdi:waypoint x="1118.0" y="225.0"></omgdi:waypoint>
				<omgdi:waypoint x="1163.0" y="225.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow49"
				id="BPMNEdge_flow49">
				<omgdi:waypoint x="1118.0" y="163.0"></omgdi:waypoint>
				<omgdi:waypoint x="1163.0" y="163.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow50"
				id="BPMNEdge_flow50">
				<omgdi:waypoint x="1118.0" y="87.0"></omgdi:waypoint>
				<omgdi:waypoint x="1163.0" y="87.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow51"
				id="BPMNEdge_flow51">
				<omgdi:waypoint x="230.0" y="87.0"></omgdi:waypoint>
				<omgdi:waypoint x="275.0" y="88.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow52"
				id="BPMNEdge_flow52">
				<omgdi:waypoint x="315.0" y="88.0"></omgdi:waypoint>
				<omgdi:waypoint x="380.0" y="87.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow53"
				id="BPMNEdge_flow53">
				<omgdi:waypoint x="295.0" y="108.0"></omgdi:waypoint>
				<omgdi:waypoint x="336.0" y="198.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow54"
				id="BPMNEdge_flow54">
				<omgdi:waypoint x="389.0" y="225.0"></omgdi:waypoint>
				<omgdi:waypoint x="420.0" y="226.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow55"
				id="BPMNEdge_flow55">
				<omgdi:waypoint x="440.0" y="206.0"></omgdi:waypoint>
				<omgdi:waypoint x="432.0" y="115.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow56"
				id="BPMNEdge_flow56">
				<omgdi:waypoint x="440.0" y="246.0"></omgdi:waypoint>
				<omgdi:waypoint x="440.0" y="287.0"></omgdi:waypoint>
				<omgdi:waypoint x="453.0" y="287.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
			<bpmndi:BPMNEdge bpmnElement="flow57"
				id="BPMNEdge_flow57">
				<omgdi:waypoint x="708.0" y="348.0"></omgdi:waypoint>
				<omgdi:waypoint x="738.0" y="226.0"></omgdi:waypoint>
			</bpmndi:BPMNEdge>
		</bpmndi:BPMNPlane>
	</bpmndi:BPMNDiagram>
</definitions>

5.前端页面jquery

<div id="imgdiv">
<img src="http://localhost:8080/san/processDiagram?processId=60014" />
</div>
<div style="width:100%;text-align:center;margin-top:100px;">
	id:<input id="userid" type="text" />
	<button onclick="add()">begin</button>
</div>
<div style="width:100%;text-align:center;margin-top:50px;">
	<button onclick="select(1)">yes</button>
	<button  onclick="select(0)">no</button>
</div>
<script src="../jquery.js">
</script>
<script>
	var __id;

	function add(){
		$.ajax({
			url:"../san/add",
			data:{
				userId:$("#userid").val(),
				bpmn:"mySanProcess"
			},
			success:function(msg){
				console.log(msg);
				__id=msg;
				change();
			}
		})
	}
	
	function select(option){
		$.ajax({
			url:"../san/select",
			data:{
				userId:$("#userid").val(),
				option:option
			},
			success:function(msg){
				console.log(msg);
				//__id=msg;
				change();
			}
		})
	}
	
	function change(){
		$("#imgdiv").empty();
		$("#imgdiv").append("<img src=\"http://localhost:8080/san/processDiagram?processId="+__id+"&random="+Math.random()+"\" />");
	}
</script>

6.最终效果web