Activiti7工作流+SpringBoot
<div id="cnblogs_post_body" class="blogpost-body cnblogs-markdown"><div id="content_views" class="markdown_views prism-atom-one-dark"> <!-- flowchart 箭头图标 勿删 --> <svg xmlns="http://www.w3.org/2000/svg" style="display: none;"> <path stroke-linecap="round" d="M5,0 0,2.5 5,5z" id="raphael-marker-block" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);"></path> </svg> <p></p><div class="toc"><h3><a name="t0"></a>文章目录</h3><ul><ul><li><a href="#_Activiti_1" rel="nofollow" target="_self">一. Activiti相关概念</a></li><ul><li><a href="#1_Activiti_2" rel="nofollow" target="_self">1. Activiti介绍</a></li><li><a href="#2__4" rel="nofollow" target="_self">2. 核心类</a></li><ul><li><a href="#21_ProcessEngine_5" rel="nofollow" target="_self">2.1 ProcessEngine</a></li><li><a href="#22_Service_8" rel="nofollow" target="_self">2.2 服务(Service)类</a></li><ul><li><a href="#221_TaskService_10" rel="nofollow" target="_self">2.2.1 TaskService</a></li><li><a href="#222_RepositoryService_12" rel="nofollow" target="_self">2.2.2 RepositoryService</a></li><li><a href="#223_RuntimeService_14" rel="nofollow" target="_self">2.2.3 RuntimeService</a></li><li><a href="#223_HistoryService_16" rel="nofollow" target="_self">2.2.3 HistoryService</a></li></ul><li><a href="#23_CommandContextIntercepterCommandExecutor_20" rel="nofollow" target="_self">2.3 CommandContextIntercepter或CommandExecutor</a></li><li><a href="#24__23" rel="nofollow" target="_self">2.4 核心业务对象</a></li></ul><li><a href="#3_Context_26" rel="nofollow" target="_self">3. 上下文组件(Context)</a></li><ul><li><a href="#31_CommandContext_29" rel="nofollow" target="_self">3.1 CommandContext</a></li><li><a href="#32_ProcessEngineConfigurationImpl_32" rel="nofollow" target="_self">3.2 ProcessEngineConfigurationImpl</a></li><li><a href="#33_ExecutionContext_35" rel="nofollow" target="_self">3.3 ExecutionContext</a></li><li><a href="#4__38" rel="nofollow" target="_self">4. 持久化组件</a></li><li><a href="#5_EventListener_41" rel="nofollow" target="_self">5. Event-Listener组件</a></li><li><a href="#6_Cache_44" rel="nofollow" target="_self">6. Cache组件</a></li><li><a href="#7__46" rel="nofollow" target="_self">7. 异步执行组件</a></li><li><a href="#8_PVMProcess_Virtal_Machine_49" rel="nofollow" target="_self">8. PVM:Process Virtal Machine</a></li></ul></ul><li><a href="#_Eclipse_59" rel="nofollow" target="_self">二. Eclipse插件安装:</a></li><li><a href="#__69" rel="nofollow" target="_self">三. 项目搭建</a></li><ul><li><a href="#1_Spring_Boot_72" rel="nofollow" target="_self">1. 新建Spring Boot工程</a></li><li><a href="#2_Activiti_77" rel="nofollow" target="_self">2. 引入Activiti相关依赖</a></li><li><a href="#3__132" rel="nofollow" target="_self">3. 创建流程图</a></li><li><a href="#4__137" rel="nofollow" target="_self">4. 启动工程</a></li><li><a href="#5__141" rel="nofollow" target="_self">5. 修改配置</a></li><ul><li><a href="#51_MySQL_144" rel="nofollow" target="_self">5.1 添加MySQL依赖</a></li><li><a href="#52__152" rel="nofollow" target="_self">5.2 修改数据库</a></li><li><a href="#53_Activiti_169" rel="nofollow" target="_self">5.3 Activiti相关配置</a></li><li><a href="#54_applicationyml_183" rel="nofollow" target="_self">5.4 附上application.yml完整配置:</a></li><li><a href="#55__226" rel="nofollow" target="_self">5.5 启动工程</a></li></ul><li><a href="#6__234" rel="nofollow" target="_self">6. 编写实例</a></li><ul><li><a href="#61_ThymeleafThymeleafapplicationyml_237" rel="nofollow" target="_self">6.1 引入Thymeleaf依赖,(前端使用Thymeleaf的配置已经在application.yml中)</a></li><li><a href="#62_Controller_246" rel="nofollow" target="_self">6.2 创建Controller控制器</a></li><li><a href="#63__286" rel="nofollow" target="_self">6.3 流程跟踪与流程图展示</a></li><li><a href="#64_DemoController_517" rel="nofollow" target="_self">6.4 附上DemoController完整代码</a></li></ul><li><a href="#7__1032" rel="nofollow" target="_self">7. 效果</a></li></ul></ul></ul></div><p></p> <h2><a name="t1"></a><a id="_Activiti_1" target="_blank"></a>一. Activiti相关概念</h2> <h3><a name="t2"></a><a id="1_Activiti_2" target="_blank"></a>1. Activiti介绍</h3> <p> Activiti是基于Apache许可的开源BPM平台,创始人Tom Baeyens原是JBPM架构师,可以理解为与JBPM出自同一祖师爷。它提供了Eclipse插件,开发可以通过插件直接绘制业务流程图。基于Spring,ibatis等框架,并在此之上构建了非常清晰的开发框架。是由Alfresco软件发布的业务流程管理(BPM)框架,它是覆盖了业务流程管理、工作流、服务协作等领域的一个开源的、灵活的、易扩展的可执行流程语言框架。 本文基于Activiti7的Activiti Core,基于Spring Boot做简单学习总结。(Activiti最新版本向微服务这边靠齐了,并分Activiti Core与Activiti Cloud两块,Activiti Cloud还没研究)</p> <h3><a name="t3"></a><a id="2__4" target="_blank"></a>2. 核心类</h3> <h4><a id="21_ProcessEngine_5" target="_blank"></a>2.1 ProcessEngine</h4> <p> 流程引擎的抽象,可以通过此类获取需要的所有服务。</p> <h4><a id="22_Service_8" target="_blank"></a>2.2 服务(Service)类</h4> <p> 通过ProcessEngine获取,Activiti将不同生命周期的服务封装在不同Service中,包括定义、部署、运行。通过服务类可获取相关生命周期中的服务信息。</p> <h5><a id="221_TaskService_10" target="_blank"></a>2.2.1 TaskService</h5> <p> 流程运行过程中,每个任务节点的相关操作接口,如complete,delete,delegate等。</p> <h5><a id="222_RepositoryService_12" target="_blank"></a>2.2.2 RepositoryService</h5> <p> 流程定义和部署相关的存储服务。</p> <h5><a id="223_RuntimeService_14" target="_blank"></a>2.2.3 RuntimeService</h5> <p> 流程运行时相关的服务,如根据流程好启动流程实例startProcessInstanceByKey。</p> <h5><a id="223_HistoryService_16" target="_blank"></a>2.2.3 HistoryService</h5> <p> 历史记录相关服务接口。</p> <h4><a id="23_CommandContextIntercepterCommandExecutor_20" target="_blank"></a>2.3 CommandContextIntercepter或CommandExecutor</h4> <p> Activiti使用命令模式作为基础开发模式,如Service中调用的各个方法都对应相应的命令对象。Service将请求委托给命令对象,命令对象来命令接受者,接受者接收后执行并返回结果。而CommandContextIntercepter的作用是拦截所有命令,并在命令前后执行一些公共方法。</p> <h4><a id="24__23" target="_blank"></a>2.4 核心业务对象</h4> <p> org.activiti.engine.impl.persistence.entity包下的类,包括Task,ProcessInstance,Execution等。会根据不同职责实现相应接口的方法(如需要持久化则继承PersistentObject接口),与传统的实体类不同。</p> <h3><a name="t4"></a><a id="3_Context_26" target="_blank"></a>3. 上下文组件(Context)</h3> <p> 用来保存生命周期比较长,全局性的信息,类似Application,主要包括如下三类。</p> <h4><a id="31_CommandContext_29" target="_blank"></a>3.1 CommandContext</h4> <p> 命令上下文,保存每个命令必要的资源,如持久化需要的session。</p> <h4><a id="32_ProcessEngineConfigurationImpl_32" target="_blank"></a>3.2 ProcessEngineConfigurationImpl</h4> <p> 流程引擎相关配置信息,整个引擎全局的配置信息,如数据源DataSource等。该对象为单例,在流程引擎创建的时候初始化。</p> <h4><a id="33_ExecutionContext_35" target="_blank"></a>3.3 ExecutionContext</h4> <p> 持有ExecutionEntity对象。</p> <h4><a id="4__38" target="_blank"></a>4. 持久化组件</h4> <p> Activiti使用ibatis作OR映射,并在此基础上增加设计了自己的持久化框架。在流程引擎创建时初始化。顶层接口Session、SessionFactory。Session有两个实现类:DbSqlSession,负责sql表达式的执行。AbstractManager负责对象的持久化操作。SessionFactory有两个实现类:DbSqlSessionFactory负责DbSqlSession相关操作,GenericManagerFactory负责AbstractManager相关操作。</p> <h4><a id="5_EventListener_41" target="_blank"></a>5. Event-Listener组件</h4> <p> Activiti允许客户代码介入流程执行,提供了事件监听组件。监听的事件类型可以分为TaskListener、JavaDelegate、Expression、ExecutionListener。ProcessEngineConfigurationImpl持有DelegateInterceptor的某个实例,方便调用handleInvocation。</p> <h4><a id="6_Cache_44" target="_blank"></a>6. Cache组件</h4> <p> DbSqlSession中有cache的实现,Activiti基于List和Map来做缓存。如查询时先查缓存,没有则直接查询并放入缓存。</p> <h4><a id="7__46" target="_blank"></a>7. 异步执行组件</h4> <p> Activiti可以执行任务,JobExecutor为启核心类,JobExecutor包含三个主要属性:JobAcquisitionThread,BlockingQueue,ThreadPoolExecutor。方法ProcessEngines在引擎启动时调用JobExecutor.start,JobAcquisitionThread 线程即开始工作,其run方法不断循环执行AcquiredJobs中的job,执行一次后线程等待一定时间直到超时或者JobExecutor.jobWasAdded方法,因为有新任务而被调用。</p> <h4><a id="8_PVMProcess_Virtal_Machine_49" target="_blank"></a>8. PVM:Process Virtal Machine</h4> <p> 流程虚拟机API暴露了流程虚拟机的POJO核心,流程虚拟机API描述了一个工作流流程必备的组件,这些组件包括:<br> PvmProcessDefinition:流程的定义,形象点说就是用户画的那个图。静态含义。<br> PvmProcessInstance:流程实例,用户发起的某个PvmProcessDefinition的一个实例,动态含义。<br> PvmActivity:流程中的一个节点<br> PvmTransition:衔接各个节点之间的路径,形象点说就是图中各个节点之间的连接线。<br> PvmEvent:流程执行过程中触发的事件</p> <h2><a name="t5"></a><a id="_Eclipse_59" target="_blank"></a>二. Eclipse插件安装:</h2> <p> 我的Eclipse版本如下:<br> <img src="https://img2018.cnblogs.com/blog/1112483/201906/1112483-20190626110131343-1047502570.png" alt="在这里插入图片描述"><br> 下载离线安装包(在线安装始终失败,应该出于网络限制),地址:<a href="http://www.activiti.org/designer/archived/activiti-designer-5.18.0.zip" rel="nofollow" target="_blank">http://www.activiti.org/designer/archived/activiti-designer-5.18.0.zip</a><br> 离线安装包安装安装依然提示相关包找不到,于是下载另外三个依赖包(org.eclipse.emf.transaction_1.4.0.v20100331-1738.jar、org.eclipse.emf.validation_1.7.0.201306111341.jar、org.eclipse.emf.workspace_1.5.1.v20120328-0001.jar,在Maven仓库可以找到),放到Eclipse的plugin目录下,继续安装,如下:<br> <img src="https://img2018.cnblogs.com/blog/1112483/201906/1112483-20190626110158364-983684233.png" alt="在这里插入图片描述"><br> 确定后勾选相关选项,完成安装,重启Eclipse,New->Other<br> <img src="https://img2018.cnblogs.com/blog/1112483/201906/1112483-20190626110244219-1364544030.png" alt="在这里插入图片描述"><br> 出现以上标志,则安装完成。</p> <h2><a name="t6"></a><a id="__69" target="_blank"></a>三. 项目搭建</h2> <h3><a name="t7"></a><a id="1_Spring_Boot_72" target="_blank"></a>1. 新建Spring Boot工程</h3> <p> (我的Eclipse已经安装Spring Boot插件)<br> <img src="https://img2018.cnblogs.com/blog/1112483/201906/1112483-20190626110314109-104551633.png" alt="我的Eclipse已经安装Spring Boot插件"><br> 然后Next->Next…->Finish即可,然后改application.properties为application.yml(个人习惯)<br> <img src="https://img2018.cnblogs.com/blog/1112483/201906/1112483-20190626110348756-854783255.png" alt="在这里插入图片描述"></p> <h3><a name="t8"></a><a id="2_Activiti_77" target="_blank"></a>2. 引入Activiti相关依赖</h3> <p> 在pom属性中定义版本号,并添加Activiti相关依赖:</p> <pre class="prettyprint"><code class="has-numbering hljs xml" onclick="mdcp.signin(event)"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">activiti-dependencies.version</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>7.0.56<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">activiti-dependencies.version</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <div class="hljs-button signin" data-title="登录后复制"></div></code><ul class="pre-numbering" style=""></ul></pre> <pre class="prettyprint"><code class="has-numbering hljs xml" onclick="mdcp.signin(event)"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">dependencyManagement</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">dependencies</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">dependency</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">groupId</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>org.activiti.dependencies<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">groupId</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">artifactId</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>activiti-dependencies<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">artifactId</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">version</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>${activiti-dependencies.version}<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">version</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">scope</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>import<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">scope</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">type</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>pom<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">type</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">dependency</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">dependencies</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">dependencyManagement</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <div class="hljs-button signin" data-title="登录后复制"></div></code></pre> <pre class="prettyprint"><code class="has-numbering hljs xml" onclick="mdcp.signin(event)"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">dependency</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">groupId</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>org.activiti<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">groupId</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">artifactId</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>activiti-spring-boot-starter<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">artifactId</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">dependency</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <div class="hljs-button signin" data-title="登录后复制"></div></code></pre> <p> 由于Activiti默认使用H2数据库,所以需添加H2数据库支持(这里使用此SpringBoot版本默认1.4.197):</p> <pre class="prettyprint"><code class="has-numbering hljs xml" onclick="mdcp.signin(event)"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">dependency</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">groupId</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>com.h2database<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">groupId</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">artifactId</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>h2<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">artifactId</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">dependency</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <div class="hljs-button signin" data-title="登录后复制"></div></code></pre> <p> 出现错误:Missing artifact org.activiti:activiti-spring-boot-starter:jar:7.0.56</p> <p><img src="https://img2018.cnblogs.com/blog/1112483/201906/1112483-20190626110742455-616743863.png" alt="在这里插入图片描述"><br> 添加私服仓库地址:</p> <pre class="prettyprint"><code class="has-numbering hljs xml" onclick="mdcp.signin(event)"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">repositories</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">repository</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">id</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>alfresco<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">id</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">name</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>Activiti Releases<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">name</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">url</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>https://artifacts.alfresco.com/nexus/content/repositories/activiti-releases/<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">url</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">releases</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">enabled</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>true<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">enabled</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">releases</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">repository</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">repositories</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <div class="hljs-button signin" data-title="登录后复制"></div></code></pre> <p><img src="https://img2018.cnblogs.com/blog/1112483/201906/1112483-20190626110831701-698561633.png" alt="在这里插入图片描述"><br> 错误消失。</p> <h3><a name="t9"></a><a id="3__132" target="_blank"></a>3. 创建流程图</h3> <p> 在此版本Activiti+SpringBoot,默认加载/processes/目录下流程,于是在resources下新建processes目录,并在目录下new->Other,如下:<br> <img src="https://img2018.cnblogs.com/blog/1112483/201906/1112483-20190626110902874-420469193.png" alt="在这里插入图片描述"><br> 使用Activiti图编辑工具打开,创建如下流程(创建过程在此不介绍,就是右侧工具栏的运用):<br> <img src="https://img2018.cnblogs.com/blog/1112483/201906/1112483-20190626110933537-57820665.png" alt="在这里插入图片描述"></p> <h3><a name="t10"></a><a id="4__137" target="_blank"></a>4. 启动工程</h3> <p> 看日志:<br> <img src="https://img2018.cnblogs.com/blog/1112483/201906/1112483-20190626111000355-395540222.png" alt="在这里插入图片描述"><br> 从日志中可以看出,流程引擎已经默认创建,并可以看到使用的默认数据源是H2的数据源,我们创建的流程也已经部署。</p> <h3><a name="t11"></a><a id="5__141" target="_blank"></a>5. 修改配置</h3> <p> 在正常使用中,一般系统会有自己的数据库,而不会采用默认内存的H2数据库,这里以MySQL为例。修改application.yml。</p> <h4><a id="51_MySQL_144" target="_blank"></a>5.1 添加MySQL依赖</h4> <pre class="prettyprint"><code class="has-numbering hljs xml" onclick="mdcp.signin(event)"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><!--使用mysql数据库,导入mysql驱动--></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">dependency</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">groupId</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>mysql<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">groupId</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">artifactId</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>mysql-connector-java<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">artifactId</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">dependency</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <div class="hljs-button signin" data-title="登录后复制"></div></code></pre> <h4><a id="52__152" target="_blank"></a>5.2 修改数据库</h4> <pre class="prettyprint"><code class="has-numbering hljs yaml" onclick="mdcp.signin(event)"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr">spring:</span></span></span></span> <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">##数据库连接信息</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> datasource:</span></span></span></span> <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"># 数据源配置</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> url:</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr">jdbc:mysql://127.0.0.1:3306/activity?useUnicode=true&characterEncoding=utf-8&useSSL=false</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> username:</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">root</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> password:</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">root</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> driver-class-name:</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">com.mysql.jdbc.Driver</span></span></span></span> <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"># SQLException: XAER_INVAL: Invalid arguments (or unsupported command)问题</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> xa:</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> properties:</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> pinGlobalTxToPhysicalConnection:</span></span></span></span> <span class="hljs-literal"><span class="hljs-literal"><span class="hljs-literal"><span class="hljs-literal">true</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> useServerPrepStmts:</span></span></span></span> <span class="hljs-literal"><span class="hljs-literal"><span class="hljs-literal"><span class="hljs-literal">true</span></span></span></span> <div class="hljs-button signin" data-title="登录后复制"></div></code></pre> <h4><a id="53_Activiti_169" target="_blank"></a>5.3 Activiti相关配置</h4> <pre class="prettyprint"><code class="has-numbering hljs yaml" onclick="mdcp.signin(event)"> <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"># 参考配置https://www.cnblogs.com/liaojie970/p/8857710.html</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> activiti:</span></span></span></span> <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"># 自动建表</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> database-schema:</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">ACTIVITI</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> database-schema-update:</span></span></span></span> <span class="hljs-literal"><span class="hljs-literal"><span class="hljs-literal"><span class="hljs-literal">true</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> history-level:</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">full</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> db-history-used:</span></span></span></span> <span class="hljs-literal"><span class="hljs-literal"><span class="hljs-literal"><span class="hljs-literal">true</span></span></span></span> <div class="hljs-button signin" data-title="登录后复制"></div></code></pre> <p> 注意:<br> database-schema-update表示启动时检查数据库表,不存在则创建<br> history-level表示哪种情况下使用历史表,这里配置为full表示全部记录历史,方便绘制流程图<br> db-history-used为true表示使用历史表,如果不配置,则工程启动后可以检查数据库,只建立了17张表,历史表没有建立,则流程图及运行节点无法展示(暂未找到可行方式)</p> <h4><a id="54_applicationyml_183" target="_blank"></a>5.4 附上application.yml完整配置:</h4> <pre class="prettyprint"><code class="has-numbering hljs yaml" onclick="mdcp.signin(event)"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"># 服务配置</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr">server:</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> display-name:</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">actdemo</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> port:</span></span></span></span> <span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">8085</span></span></span></span>
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"># Spring相关配置</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr">spring:</span></span></span></span> <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">##数据库连接信息</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> datasource:</span></span></span></span> <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"># 数据源配置</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> url:</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr">jdbc:mysql://127.0.0.1:3306/activity?useUnicode=true&characterEncoding=utf-8&useSSL=false</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> username:</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">root</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> password:</span></span></span></span> <span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">888</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> driver-class-name:</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">com.mysql.jdbc.Driver</span></span></span></span>
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"># SQLException: XAER_INVAL: Invalid arguments (or unsupported command)问题</span></span></span></span>
<span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> xa:</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> properties:</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> pinGlobalTxToPhysicalConnection:</span></span></span></span> <span class="hljs-literal"><span class="hljs-literal"><span class="hljs-literal"><span class="hljs-literal">true</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> useServerPrepStmts:</span></span></span></span> <span class="hljs-literal"><span class="hljs-literal"><span class="hljs-literal"><span class="hljs-literal">true</span></span></span></span>
<span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> thymeleaf:</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> mode:</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">HTML</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> encoding:</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">utf-8</span></span></span></span> <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"># 禁用缓存</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> cache:</span></span></span></span> <span class="hljs-literal"><span class="hljs-literal"><span class="hljs-literal"><span class="hljs-literal">false</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> application:</span></span></span></span> <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"># 注册应用名</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> name:</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">actdemo</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> mvc:</span></span></span></span> <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"># 静态资源路径</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> static-path-pattern:</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">/static/**</span></span></span></span> <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"># 参考配置https://www.cnblogs.com/liaojie970/p/8857710.html</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> activiti:</span></span></span></span> <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"># 自动建表</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> database-schema:</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">ACTIVITI</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> database-schema-update:</span></span></span></span> <span class="hljs-literal"><span class="hljs-literal"><span class="hljs-literal"><span class="hljs-literal">true</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> history-level:</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">full</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> db-history-used:</span></span></span></span> <span class="hljs-literal"><span class="hljs-literal"><span class="hljs-literal"><span class="hljs-literal">true</span></span></span></span>
<div class="hljs-button signin" data-title="登录后复制"></div></code></pre> <h4><a id="55__226" target="_blank"></a>5.5 启动工程</h4> <p> 观察日志,流程引擎已成功加载,并已使用MySQL数据库,如下:<br> <img src="https://img2018.cnblogs.com/blog/1112483/201906/1112483-20190626111027600-189586793.png" alt="在这里插入图片描述"><br> 再看数据库,已经创建25张表(老版本的Activiti创建表有手动执行SQL和通过调用流程引擎创建两种方式,该版本与SpringBoot整合后,启动默认创建需要的表):<br> <img src="https://img2018.cnblogs.com/blog/1112483/201906/1112483-20190626111053746-247799132.png" alt="在这里插入图片描述"><br> 注意:<br> 原SpringBoot工程使用版本2.1.1.RELEASE,启动始终失败,各种错误,后改为2.0.4.RELEASE版本,则启动正常。</p> <h3><a name="t12"></a><a id="6__234" target="_blank"></a>6. 编写实例</h3> <p> 本例子使用Thymeleaf做前端页面展示(SpringBoot推荐使用),并创建控制器Controller调用工作流接口与前端交互。</p> <h4><a id="61_ThymeleafThymeleafapplicationyml_237" target="_blank"></a>6.1 引入Thymeleaf依赖,(前端使用Thymeleaf的配置已经在application.yml中)</h4> <pre class="prettyprint"><code class="has-numbering hljs xml" onclick="mdcp.signin(event)"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><!-- Thymeleaf依赖 --></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">dependency</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">groupId</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>org.springframework.boot<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">groupId</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">artifactId</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>spring-boot-starter-thymeleaf<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">artifactId</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">dependency</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <div class="hljs-button signin" data-title="登录后复制"></div></code></pre> <h4><a id="62_Controller_246" target="_blank"></a>6.2 创建Controller控制器</h4> <p> 创建启动流程方法,主要代码如下</p> <pre class="prettyprint"><code class="has-numbering hljs dart" onclick="mdcp.signin(event)"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown">/** </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * <p>启动请假流程</p></span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @return String 流程实例ID</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @author FRH</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @time 2018年12月10日上午11:03:36</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @version 1.0</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> */</span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta">@RequestMapping</span></span></span></span>(value=<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"/start"</span></span></span></span>) <span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta">@ResponseBody</span></span></span></span> public <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span> start() { <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// xml中定义的ID</span></span></span></span> <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span> instanceKey = <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"leaveProcess"</span></span></span></span>; logger.info(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"开启请假流程..."</span></span></span></span>);
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 设置流程参数,开启流程</span></span></span></span> <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">Map</span></span></span></span><<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span>,<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">Object</span></span></span></span>> map = <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">new</span></span></span></span> HashMap<<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span>,<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">Object</span></span></span></span>>();
map.put(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"jobNumber"</span></span></span></span>,<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"A1001"</span></span></span></span>);
map.put(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"busData"</span></span></span></span>,<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"bus data"</span></span></span></span>);
ProcessInstance instance = runtimeService.startProcessInstanceByKey(instanceKey, map);<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">//使用流程定义的key启动流程实例,key对应helloworld.bpmn文件中id的属性值,使用key值启动,默认是按照最新版本的流程定义启动</span></span></span></span>
logger.info(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"启动流程实例成功:{}"</span></span></span></span>, instance);
logger.info(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"流程实例ID:{}"</span></span></span></span>, instance.getId());
logger.info(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"流程定义ID:{}"</span></span></span></span>, instance.getProcessDefinitionId());
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">//验证是否启动成功</span></span></span></span>
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">//通过查询正在运行的流程实例来判断</span></span></span></span>
ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery();
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">//根据流程实例ID来查询</span></span></span></span>
<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">List</span></span></span></span><ProcessInstance> runningList = processInstanceQuery.processInstanceId(instance.getProcessInstanceId()).list();
logger.info(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"根据流程ID查询条数:{}"</span></span></span></span>, runningList.size());
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 返回流程ID</span></span></span></span>
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span> instance.getId();
}
<div class="hljs-button signin" data-title="登录后复制"></div></code></pre> <h4><a id="63__286" target="_blank"></a>6.3 流程跟踪与流程图展示</h4> <p> Activiti流程图展示,使用流程图生成器,本例生成的流程图在页面使用如下方式展示即可:</p> <pre class="prettyprint"><code class="has-numbering hljs xml" onclick="mdcp.signin(event)"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">embed</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"> </span></span></span><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr">src</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">=</span></span></span><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string">"/demo/showImg?instanceId=5070fd58-f859-11e8-a359-484d7ec5762d"</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"> </span></span></span><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr">style</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">=</span></span></span><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string">"display:block;width:1000px;height:450px"</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"> /></span></span></span></span> <div class="hljs-button signin" data-title="登录后复制"></div></code></pre> <p> 引入相关工具包,版本使用默认版本7.0.65</p> <pre class="prettyprint"><code class="has-numbering hljs xml" onclick="mdcp.signin(event)"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><!-- Activiti生成流程图 --></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">dependency</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">groupId</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>org.activiti<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">groupId</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">artifactId</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>activiti-image-generator<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">artifactId</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">dependency</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <div class="hljs-button signin" data-title="登录后复制"></div></code></pre> <p> 调用输出流程图</p> <pre class="prettyprint"><code class="has-numbering hljs java" onclick="mdcp.signin(event)"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/** * <p>查看当前流程图</p> * </span></span></span><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag">@param</span></span></span></span></span></span></span><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"> instanceId 流程实例 * </span></span></span><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag">@param</span></span></span></span></span></span></span><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"> response void 响应 * </span></span></span><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag">@author</span></span></span></span></span></span></span><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"> FRH * </span></span></span><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag">@time</span></span></span></span></span></span></span><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"> 2018年12月10日上午11:14:12 * </span></span></span><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag">@version</span></span></span></span></span></span></span><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"> 1.0 */</span></span></span></span> <span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta">@ResponseBody</span></span></span></span> <span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta">@RequestMapping</span></span></span></span>(value=<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"/showImg"</span></span></span></span>) <span class="hljs-function"><span class="hljs-keyword"><span class="hljs-function"><span class="hljs-keyword"><span class="hljs-function"><span class="hljs-keyword"><span class="hljs-function"><span class="hljs-keyword">public</span></span></span></span></span></span></span><span class="hljs-function"><span class="hljs-function"><span class="hljs-function"> </span></span></span><span class="hljs-keyword"><span class="hljs-function"><span class="hljs-keyword"><span class="hljs-function"><span class="hljs-keyword"><span class="hljs-function"><span class="hljs-keyword">void</span></span></span></span></span></span></span><span class="hljs-function"><span class="hljs-function"><span class="hljs-function"> </span></span></span><span class="hljs-title"><span class="hljs-function"><span class="hljs-title"><span class="hljs-function"><span class="hljs-title"><span class="hljs-function"><span class="hljs-title">showImg</span></span></span></span></span></span></span><span class="hljs-params"><span class="hljs-function"><span class="hljs-params"><span class="hljs-function"><span class="hljs-params"><span class="hljs-function"><span class="hljs-params">(String instanceId, HttpServletResponse response)</span></span></span></span></span></span></span><span class="hljs-function"><span class="hljs-function"><span class="hljs-function"> </span></span></span></span>{ <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/* * 参数校验 */</span></span></span></span> logger.info(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"查看完整流程图!流程实例ID:{}"</span></span></span></span>, instanceId); <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">if</span></span></span></span>(StringUtils.isBlank(instanceId)) <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span>;
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/* * 获取流程实例
*/</span></span></span></span>
HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(instanceId).singleResult();
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">if</span></span></span></span>(processInstance == <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">null</span></span></span></span>) {
logger.error(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"流程实例ID:{}没查询到流程实例!"</span></span></span></span>, instanceId);
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span>;
}
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 根据流程对象获取流程对象模型</span></span></span></span>
BpmnModel bpmnModel = repositoryService.getBpmnModel(processInstance.getProcessDefinitionId());
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/*
* 查看已执行的节点集合
* 获取流程历史中已执行节点,并按照节点在流程中执行先后顺序排序
*/</span></span></span></span>
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 构造历史流程查询</span></span></span></span>
HistoricActivityInstanceQuery historyInstanceQuery = historyService.createHistoricActivityInstanceQuery().processInstanceId(instanceId);
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 查询历史节点</span></span></span></span>
List<HistoricActivityInstance> historicActivityInstanceList = historyInstanceQuery.orderByHistoricActivityInstanceStartTime().asc().list();
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">if</span></span></span></span>(historicActivityInstanceList == <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">null</span></span></span></span> || historicActivityInstanceList.size() == <span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">0</span></span></span></span>) {
logger.info(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"流程实例ID:{}没有历史节点信息!"</span></span></span></span>, instanceId);
outputImg(response, bpmnModel, <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">null</span></span></span></span>, <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">null</span></span></span></span>);
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span>;
}
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 已执行的节点ID集合(将historicActivityInstanceList中元素的activityId字段取出封装到executedActivityIdList)</span></span></span></span>
List<String> executedActivityIdList = historicActivityInstanceList.stream().map(item -> item.getActivityId()).collect(Collectors.toList());
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/*
* 获取流程走过的线
*/</span></span></span></span>
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 获取流程定义</span></span></span></span>
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(processInstance.getProcessDefinitionId());
List<String> flowIds = ActivitiUtils.getHighLightedFlows(bpmnModel, processDefinition, historicActivityInstanceList);
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/*
* 输出图像,并设置高亮
*/</span></span></span></span>
outputImg(response, bpmnModel, flowIds, executedActivityIdList);
}
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/**
* <p>输出图像</p>
* </span></span></span><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag">@param</span></span></span></span></span></span></span><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"> response 响应实体
* </span></span></span><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag">@param</span></span></span></span></span></span></span><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"> bpmnModel 图像对象
* </span></span></span><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag">@param</span></span></span></span></span></span></span><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"> flowIds 已执行的线集合
* </span></span></span><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag">@param</span></span></span></span></span></span></span><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"> executedActivityIdList void 已执行的节点ID集合
* </span></span></span><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag">@author</span></span></span></span></span></span></span><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"> FRH
* </span></span></span><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag">@time</span></span></span></span></span></span></span><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"> 2018年12月10日上午11:23:01
* </span></span></span><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag">@version</span></span></span></span></span></span></span><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"> 1.0
*/</span></span></span></span>
<span class="hljs-function"><span class="hljs-keyword"><span class="hljs-function"><span class="hljs-keyword"><span class="hljs-function"><span class="hljs-keyword"><span class="hljs-function"><span class="hljs-keyword">private</span></span></span></span></span></span></span><span class="hljs-function"><span class="hljs-function"><span class="hljs-function"> </span></span></span><span class="hljs-keyword"><span class="hljs-function"><span class="hljs-keyword"><span class="hljs-function"><span class="hljs-keyword"><span class="hljs-function"><span class="hljs-keyword">void</span></span></span></span></span></span></span><span class="hljs-function"><span class="hljs-function"><span class="hljs-function"> </span></span></span><span class="hljs-title"><span class="hljs-function"><span class="hljs-title"><span class="hljs-function"><span class="hljs-title"><span class="hljs-function"><span class="hljs-title">outputImg</span></span></span></span></span></span></span><span class="hljs-params"><span class="hljs-function"><span class="hljs-params"><span class="hljs-function"><span class="hljs-params"><span class="hljs-function"><span class="hljs-params">(HttpServletResponse response, BpmnModel bpmnModel, List<String> flowIds, List<String> executedActivityIdList)</span></span></span></span></span></span></span><span class="hljs-function"><span class="hljs-function"><span class="hljs-function"> </span></span></span></span>{
InputStream imageStream = <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">null</span></span></span></span>;
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">try</span></span></span></span> {
imageStream = processDiagramGenerator.generateDiagram(bpmnModel, executedActivityIdList, flowIds, <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"宋体"</span></span></span></span>, <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"微软雅黑"</span></span></span></span>, <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"黑体"</span></span></span></span>, <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">true</span></span></span></span>, <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"png"</span></span></span></span>);
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 输出资源内容到相应对象</span></span></span></span>
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">byte</span></span></span></span>[] b = <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">new</span></span></span></span> <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">byte</span></span></span></span>[<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">1024</span></span></span></span>];
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">int</span></span></span></span> len;
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">while</span></span></span></span> ((len = imageStream.read(b, <span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">0</span></span></span></span>, <span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">1024</span></span></span></span>)) != -<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">1</span></span></span></span>) {
response.getOutputStream().write(b, <span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">0</span></span></span></span>, len);
}
response.getOutputStream().flush();
}<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">catch</span></span></span></span>(Exception e) {
logger.error(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"流程图输出异常!"</span></span></span></span>, e);
} <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">finally</span></span></span></span> { <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 流关闭</span></span></span></span>
StreamUtils.closeInputStream(imageStream);
}
}
<div class="hljs-button signin" data-title="登录后复制"></div></code></pre> <p> 流程图工具类ActivitiUtils</p> <pre class="prettyprint"><code class="has-numbering hljs java" onclick="mdcp.signin(event)"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">package</span></span></span></span> com.mypro.activiti.utils;
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> java.util.ArrayList; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> java.util.List;
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> org.activiti.bpmn.model.BpmnModel; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> org.activiti.bpmn.model.FlowNode; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> org.activiti.bpmn.model.SequenceFlow; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> org.activiti.engine.history.HistoricActivityInstance; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/**
<p>Activiti工作流工具类</p>
</span></span></span><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag">@author</span></span></span></span></span></span></span><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"> FRH
</span></span></span><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag">@time</span></span></span></span></span></span></span><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"> 2018年12月10日上午11:26:02
</span></span></span><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag">@version</span></span></span></span></span></span></span><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"> 1.0 */</span></span></span></span> <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">public</span></span></span></span> <span class="hljs-class"><span class="hljs-keyword"><span class="hljs-class"><span class="hljs-keyword"><span class="hljs-class"><span class="hljs-keyword"><span class="hljs-class"><span class="hljs-keyword">class</span></span></span></span></span></span></span><span class="hljs-class"><span class="hljs-class"><span class="hljs-class"> </span></span></span><span class="hljs-title"><span class="hljs-class"><span class="hljs-title"><span class="hljs-class"><span class="hljs-title"><span class="hljs-class"><span class="hljs-title">ActivitiUtils</span></span></span></span></span></span></span><span class="hljs-class"><span class="hljs-class"><span class="hljs-class"> </span></span></span></span>{
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/**
<p>获取流程走过的线</p>
</span></span></span><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag">@param</span></span></span></span></span></span></span><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"> bpmnModel 流程对象模型
</span></span></span><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag">@param</span></span></span></span></span></span></span><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"> processDefinitionEntity 流程定义对象
</span></span></span><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag">@param</span></span></span></span></span></span></span><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"> historicActivityInstances 历史流程已经执行的节点,并已经按执行的先后顺序排序
</span></span></span><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag">@return</span></span></span></span></span></span></span><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"> List<String> 流程走过的线
</span></span></span><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag">@author</span></span></span></span></span></span></span><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"> FRH
</span></span></span><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag">@time</span></span></span></span></span></span></span><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"> 2018年12月10日上午11:26:19
</span></span></span><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag">@version</span></span></span></span></span></span></span><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"> 1.0 */</span></span></span></span> <span class="hljs-function"><span class="hljs-keyword"><span class="hljs-function"><span class="hljs-keyword"><span class="hljs-function"><span class="hljs-keyword"><span class="hljs-function"><span class="hljs-keyword">public</span></span></span></span></span></span></span><span class="hljs-function"><span class="hljs-function"><span class="hljs-function"> </span></span></span><span class="hljs-keyword"><span class="hljs-function"><span class="hljs-keyword"><span class="hljs-function"><span class="hljs-keyword"><span class="hljs-function"><span class="hljs-keyword">static</span></span></span></span></span></span></span><span class="hljs-function"><span class="hljs-function"><span class="hljs-function"> List<String> </span></span></span><span class="hljs-title"><span class="hljs-function"><span class="hljs-title"><span class="hljs-function"><span class="hljs-title"><span class="hljs-function"><span class="hljs-title">getHighLightedFlows</span></span></span></span></span></span></span><span class="hljs-params"><span class="hljs-function"><span class="hljs-params"><span class="hljs-function"><span class="hljs-params"><span class="hljs-function"><span class="hljs-params">(BpmnModel bpmnModel, ProcessDefinitionEntity processDefinitionEntity, List<HistoricActivityInstance> historicActivityInstances)</span></span></span></span></span></span></span><span class="hljs-function"><span class="hljs-function"><span class="hljs-function"> </span></span></span></span>{ <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 用以保存高亮的线flowId</span></span></span></span> List<String> highFlows = <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">new</span></span></span></span> ArrayList<String>(); <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">if</span></span></span></span>(historicActivityInstances == <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">null</span></span></span></span> || historicActivityInstances.size() == <span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">0</span></span></span></span>) <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span> highFlows;
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 遍历历史节点</span></span></span></span> <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">for</span></span></span></span> (<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">int</span></span></span></span> i = <span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">0</span></span></span></span>; i < historicActivityInstances.size() - <span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">1</span></span></span></span>; i++) { <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 取出已执行的节点</span></span></span></span> HistoricActivityInstance activityImpl_ = historicActivityInstances.get(i);
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 用以保存后续开始时间相同的节点</span></span></span></span>
List<FlowNode> sameStartTimeNodes = <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">new</span></span></span></span> ArrayList<FlowNode>();
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 获取下一个节点(用于连线)</span></span></span></span>
FlowNode sameActivityImpl = getNextFlowNode(bpmnModel, historicActivityInstances, i, activityImpl_);
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// FlowNode sameActivityImpl = (FlowNode) bpmnModel.getMainProcess().getFlowElement(historicActivityInstances.get(i + 1).getActivityId());</span></span></span></span>
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 将后面第一个节点放在时间相同节点的集合里</span></span></span></span> <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">if</span></span></span></span>(sameActivityImpl != <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">null</span></span></span></span>) sameStartTimeNodes.add(sameActivityImpl);
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 循环后面节点,看是否有与此后继节点开始时间相同的节点,有则添加到后继节点集合</span></span></span></span>
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">for</span></span></span></span> (<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">int</span></span></span></span> j = i + <span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">1</span></span></span></span>; j < historicActivityInstances.size() - <span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">1</span></span></span></span>; j++) {
HistoricActivityInstance activityImpl1 = historicActivityInstances.get(j);<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 后续第一个节点</span></span></span></span>
HistoricActivityInstance activityImpl2 = historicActivityInstances.get(j + <span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">1</span></span></span></span>);<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 后续第二个节点</span></span></span></span>
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">if</span></span></span></span> (activityImpl1.getStartTime().getTime() != activityImpl2.getStartTime().getTime()) <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">break</span></span></span></span>;
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 如果第一个节点和第二个节点开始时间相同保存</span></span></span></span>
FlowNode sameActivityImpl2 = (FlowNode) bpmnModel.getMainProcess().getFlowElement(activityImpl2.getActivityId());
sameStartTimeNodes.add(sameActivityImpl2);
}
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 得到节点定义的详细信息</span></span></span></span>
FlowNode activityImpl = (FlowNode) bpmnModel.getMainProcess().getFlowElement(historicActivityInstances.get(i).getActivityId());
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 取出节点的所有出去的线,对所有的线进行遍历</span></span></span></span>
List<SequenceFlow> pvmTransitions = activityImpl.getOutgoingFlows();
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">for</span></span></span></span> (SequenceFlow pvmTransition : pvmTransitions) {
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 获取节点</span></span></span></span>
FlowNode pvmActivityImpl = (FlowNode) bpmnModel.getMainProcess().getFlowElement(pvmTransition.getTargetRef());
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 不是后继节点</span></span></span></span>
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">if</span></span></span></span>(!sameStartTimeNodes.contains(pvmActivityImpl)) <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">continue</span></span></span></span>;
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 如果取出的线的目标节点存在时间相同的节点里,保存该线的id,进行高亮显示</span></span></span></span>
highFlows.add(pvmTransition.getId());
}
}
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">//返回高亮的线</span></span></span></span>
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span> highFlows;
}
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/**
* <p>获取下一个节点信息</p>
* </span></span></span><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag">@param</span></span></span></span></span></span></span><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"> bpmnModel 流程模型
* </span></span></span><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag">@param</span></span></span></span></span></span></span><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"> historicActivityInstances 历史节点
* </span></span></span><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag">@param</span></span></span></span></span></span></span><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"> i 当前已经遍历到的历史节点索引(找下一个节点从此节点后)
* </span></span></span><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag">@param</span></span></span></span></span></span></span><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"> activityImpl_ 当前遍历到的历史节点实例
* </span></span></span><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag">@return</span></span></span></span></span></span></span><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"> FlowNode 下一个节点信息
* </span></span></span><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag">@author</span></span></span></span></span></span></span><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"> FRH
* </span></span></span><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag">@time</span></span></span></span></span></span></span><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"> 2018年12月10日上午11:26:55
* </span></span></span><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag"><span class="hljs-comment"><span class="hljs-doctag">@version</span></span></span></span></span></span></span><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"> 1.0
*/</span></span></span></span>
<span class="hljs-function"><span class="hljs-keyword"><span class="hljs-function"><span class="hljs-keyword"><span class="hljs-function"><span class="hljs-keyword"><span class="hljs-function"><span class="hljs-keyword">private</span></span></span></span></span></span></span><span class="hljs-function"><span class="hljs-function"><span class="hljs-function"> </span></span></span><span class="hljs-keyword"><span class="hljs-function"><span class="hljs-keyword"><span class="hljs-function"><span class="hljs-keyword"><span class="hljs-function"><span class="hljs-keyword">static</span></span></span></span></span></span></span><span class="hljs-function"><span class="hljs-function"><span class="hljs-function"> FlowNode </span></span></span><span class="hljs-title"><span class="hljs-function"><span class="hljs-title"><span class="hljs-function"><span class="hljs-title"><span class="hljs-function"><span class="hljs-title">getNextFlowNode</span></span></span></span></span></span></span><span class="hljs-params"><span class="hljs-function"><span class="hljs-params"><span class="hljs-function"><span class="hljs-params"><span class="hljs-function"><span class="hljs-params">(BpmnModel bpmnModel, List<HistoricActivityInstance> historicActivityInstances, </span></span></span></span></span></span><span class="hljs-keyword"><span class="hljs-function"><span class="hljs-params"><span class="hljs-keyword"><span class="hljs-function"><span class="hljs-params"><span class="hljs-keyword"><span class="hljs-function"><span class="hljs-params"><span class="hljs-keyword">int</span></span></span></span></span></span></span></span></span></span><span class="hljs-function"><span class="hljs-params"><span class="hljs-function"><span class="hljs-params"><span class="hljs-function"><span class="hljs-params"> i, HistoricActivityInstance activityImpl_)</span></span></span></span></span></span></span><span class="hljs-function"><span class="hljs-function"><span class="hljs-function"> </span></span></span></span>{
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 保存后一个节点</span></span></span></span>
FlowNode sameActivityImpl = <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">null</span></span></span></span>;
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 如果当前节点不是用户任务节点,则取排序的下一个节点为后续节点</span></span></span></span>
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">if</span></span></span></span>(!<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"userTask"</span></span></span></span>.equals(activityImpl_.getActivityType())) {
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 是最后一个节点,没有下一个节点</span></span></span></span>
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">if</span></span></span></span>(i == historicActivityInstances.size()) <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span> sameActivityImpl;
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 不是最后一个节点,取下一个节点为后继节点</span></span></span></span>
sameActivityImpl = (FlowNode) bpmnModel.getMainProcess().getFlowElement(historicActivityInstances.get(i + <span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">1</span></span></span></span>).getActivityId());<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 找到紧跟在后面的一个节点</span></span></span></span>
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 返回</span></span></span></span>
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span> sameActivityImpl;
}
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 遍历后续节点,获取当前节点后续节点</span></span></span></span>
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">for</span></span></span></span> (<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">int</span></span></span></span> k = i + <span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">1</span></span></span></span>; k <= historicActivityInstances.size() - <span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">1</span></span></span></span>; k++) {
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 后续节点</span></span></span></span>
HistoricActivityInstance activityImp2_ = historicActivityInstances.get(k);
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 都是userTask,且主节点与后续节点的开始时间相同,说明不是真实的后继节点</span></span></span></span>
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">if</span></span></span></span>(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"userTask"</span></span></span></span>.equals(activityImp2_.getActivityType()) && activityImpl_.getStartTime().getTime() == activityImp2_.getStartTime().getTime()) <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">continue</span></span></span></span>;
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 找到紧跟在后面的一个节点</span></span></span></span>
sameActivityImpl = (FlowNode) bpmnModel.getMainProcess().getFlowElement(historicActivityInstances.get(k).getActivityId());
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">break</span></span></span></span>;
}
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span> sameActivityImpl;
}
}
<div class="hljs-button signin" data-title="登录后复制"></div></code></pre> <h4><a id="64_DemoController_517" target="_blank"></a>6.4 附上DemoController完整代码</h4> <pre class="prettyprint"><code class="has-numbering hljs dart" onclick="mdcp.signin(event)">package com.mypro.activiti.controller;
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> java.io.InputStream; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> java.util.ArrayList; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> java.util.Date; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> java.util.HashMap; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> java.util.<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">List</span></span></span></span>; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> java.util.<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">Map</span></span></span></span>; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> java.util.stream.Collectors;
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> javax.servlet.http.HttpServletRequest; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> javax.servlet.http.HttpServletResponse;
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> org.activiti.bpmn.model.BpmnModel; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> org.activiti.engine.HistoryService; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> org.activiti.engine.RepositoryService; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> org.activiti.engine.RuntimeService; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> org.activiti.engine.TaskService; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> org.activiti.engine.history.HistoricActivityInstance; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> org.activiti.engine.history.HistoricActivityInstanceQuery; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> org.activiti.engine.history.HistoricProcessInstance; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> org.activiti.engine.impl.RepositoryServiceImpl; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> org.activiti.engine.runtime.ProcessInstance; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> org.activiti.engine.runtime.ProcessInstanceQuery; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> org.activiti.engine.task.Task; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> org.activiti.image.ProcessDiagramGenerator; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> org.apache.commons.lang3.StringUtils; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> org.slf4j.Logger; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> org.slf4j.LoggerFactory; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> org.springframework.beans.<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">factory</span></span></span></span>.annotation.Autowired; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> org.springframework.stereotype.Controller; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> org.springframework.web.bind.annotation.RequestMapping; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> org.springframework.web.bind.annotation.ResponseBody;
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> com.mypro.activiti.utils.ActivitiUtils; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">import</span></span></span></span> com.mypro.activiti.utils.StreamUtils;
<span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown">/**
- </span></span></span></span></span></span><span class="xml"><span class="hljs-tag"><span class="hljs-comment"><span class="markdown"><span class="xml"><span class="hljs-tag"><span class="hljs-comment"><span class="markdown"><span class="xml"><span class="hljs-tag"><span class="hljs-comment"><span class="markdown"><span class="xml"><span class="hljs-tag"><</span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-name"><span class="hljs-comment"><span class="markdown"><span class="xml"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-comment"><span class="markdown"><span class="xml"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-comment"><span class="markdown"><span class="xml"><span class="hljs-tag"><span class="hljs-name">p</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="xml"><span class="hljs-tag"><span class="hljs-comment"><span class="markdown"><span class="xml"><span class="hljs-tag"><span class="hljs-comment"><span class="markdown"><span class="xml"><span class="hljs-tag">></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown">Activiti控制器</span></span></span></span></span></span><span class="xml"><span class="hljs-tag"><span class="hljs-comment"><span class="markdown"><span class="xml"><span class="hljs-tag"><span class="hljs-comment"><span class="markdown"><span class="xml"><span class="hljs-tag"><span class="hljs-comment"><span class="markdown"><span class="xml"><span class="hljs-tag"></</span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-name"><span class="hljs-comment"><span class="markdown"><span class="xml"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-comment"><span class="markdown"><span class="xml"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-comment"><span class="markdown"><span class="xml"><span class="hljs-tag"><span class="hljs-name">p</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="xml"><span class="hljs-tag"><span class="hljs-comment"><span class="markdown"><span class="xml"><span class="hljs-tag"><span class="hljs-comment"><span class="markdown"><span class="xml"><span class="hljs-tag">></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown">
- @author FRH
- @time 2018年12月10日上午9:30:18
- @version 1.0 */</span></span></span></span></span></span></span></span> <span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta">@Controller</span></span></span></span> <span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta">@RequestMapping</span></span></span></span>(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"/demo"</span></span></span></span>) public <span class="hljs-class"><span class="hljs-keyword"><span class="hljs-class"><span class="hljs-keyword"><span class="hljs-class"><span class="hljs-keyword"><span class="hljs-class"><span class="hljs-keyword">class</span></span></span></span></span></span></span><span class="hljs-class"><span class="hljs-class"><span class="hljs-class"> </span></span></span><span class="hljs-title"><span class="hljs-class"><span class="hljs-title"><span class="hljs-class"><span class="hljs-title"><span class="hljs-class"><span class="hljs-title">DemoController</span></span></span></span></span></span></span><span class="hljs-class"><span class="hljs-class"><span class="hljs-class"> </span></span></span></span>{
private <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">static</span></span></span></span> <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">final</span></span></span></span> Logger logger = LoggerFactory.getLogger(DemoController.<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">class</span></span></span></span>);
<span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown">/</span></span></span></span></span></span><span class="hljs-emphasis"><span class="hljs-comment"><span class="markdown"><span class="hljs-emphasis"><span class="hljs-comment"><span class="markdown"><span class="hljs-emphasis"><span class="hljs-comment"><span class="markdown"><span class="hljs-emphasis">** 流程定义和部署相关的存储服务 *</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown">/</span></span></span></span></span></span></span></span><span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta">@Autowired</span></span></span></span>
private RepositoryService repositoryService;
<span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown">/</span></span></span></span></span></span><span class="hljs-emphasis"><span class="hljs-comment"><span class="markdown"><span class="hljs-emphasis"><span class="hljs-comment"><span class="markdown"><span class="hljs-emphasis"><span class="hljs-comment"><span class="markdown"><span class="hljs-emphasis">** 流程运行时相关的服务 *</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown">/</span></span></span></span></span></span></span></span>
<span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta">@Autowired</span></span></span></span>
private RuntimeService runtimeService;
<span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown">/</span></span></span></span></span></span><span class="hljs-emphasis"><span class="hljs-comment"><span class="markdown"><span class="hljs-emphasis"><span class="hljs-comment"><span class="markdown"><span class="hljs-emphasis"><span class="hljs-comment"><span class="markdown"><span class="hljs-emphasis">** 节点任务相关操作接口 *</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown">/</span></span></span></span></span></span></span></span>
<span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta">@Autowired</span></span></span></span>
private TaskService taskService;
<span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown">/</span></span></span></span></span></span><span class="hljs-emphasis"><span class="hljs-comment"><span class="markdown"><span class="hljs-emphasis"><span class="hljs-comment"><span class="markdown"><span class="hljs-emphasis"><span class="hljs-comment"><span class="markdown"><span class="hljs-emphasis">** 流程图生成器 *</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown">/</span></span></span></span></span></span></span></span>
<span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta">@Autowired</span></span></span></span>
private ProcessDiagramGenerator processDiagramGenerator;
<span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown">/</span></span></span></span></span></span><span class="hljs-emphasis"><span class="hljs-comment"><span class="markdown"><span class="hljs-emphasis"><span class="hljs-comment"><span class="markdown"><span class="hljs-emphasis"><span class="hljs-comment"><span class="markdown"><span class="hljs-emphasis">** 历史记录相关服务接口 *</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown">/</span></span></span></span></span></span></span></span>
<span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta">@Autowired</span></span></span></span>
private HistoryService historyService;
<span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown">/**
</span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * <p>跳转到测试主页面</p></span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @return String 测试主页面</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @author FRH</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @time 2018年12月10日上午11:12:28</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @version 1.0</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> */</span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta">@RequestMapping</span></span></span></span>(value=<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"/toIndex.html"</span></span></span></span>) public <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span> toTestPage() { <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"/index"</span></span></span></span>; }
<span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown">/**
</span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * <p>跳转到上级审核页面</p></span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @return String 上级审核页面</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @author FRH</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @time 2018年12月5日下午2:31:42</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @version 1.0</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> */</span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta">@RequestMapping</span></span></span></span>(value=<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"/toLeave"</span></span></span></span>) public <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span> employeeLeave() { <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"/employeeLeave"</span></span></span></span>; }
<span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown">/**
</span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * <p>启动请假流程(流程key即xml中定义的ID为leaveProcess)</p></span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @return String 启动的流程ID</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @author FRH</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @time 2018年12月10日上午11:12:50</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @version 1.0</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> /</span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta">@RequestMapping</span></span></span></span>(value=<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"/start"</span></span></span></span>) <span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta">@ResponseBody</span></span></span></span> public <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span> start() { <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/ * xml中定义的ID */</span></span></span></span> <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span> instanceKey = <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"leaveProcess"</span></span></span></span>; logger.info(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"开启请假流程..."</span></span></span></span>);
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/* * 设置流程参数,开启流程
*/</span></span></span></span>
<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">Map</span></span></span></span><<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span>,<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">Object</span></span></span></span>> map = <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">new</span></span></span></span> HashMap<<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span>,<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">Object</span></span></span></span>>();
map.put(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"jobNumber"</span></span></span></span>,<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"A1001"</span></span></span></span>);
map.put(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"busData"</span></span></span></span>,<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"bus data"</span></span></span></span>);
ProcessInstance instance = runtimeService.startProcessInstanceByKey(instanceKey, map);<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">//使用流程定义的key启动流程实例,key对应helloworld.bpmn文件中id的属性值,使用key值启动,默认是按照最新版本的流程定义启动</span></span></span></span>
logger.info(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"启动流程实例成功:{}"</span></span></span></span>, instance);
logger.info(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"流程实例ID:{}"</span></span></span></span>, instance.getId());
logger.info(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"流程定义ID:{}"</span></span></span></span>, instance.getProcessDefinitionId());
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/*
* 验证是否启动成功
*/</span></span></span></span>
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">//通过查询正在运行的流程实例来判断</span></span></span></span>
ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery();
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">//根据流程实例ID来查询</span></span></span></span>
<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">List</span></span></span></span><ProcessInstance> runningList = processInstanceQuery.processInstanceId(instance.getProcessInstanceId()).list();
logger.info(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"根据流程ID查询条数:{}"</span></span></span></span>, runningList.size());
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/*
* 返回流程ID
*/</span></span></span></span>
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span> instance.getId();
}
<span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown">/**
</span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * <p>查看当前流程图</p></span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @param instanceId 流程实例</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @param response void 响应</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @author FRH</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @time 2018年12月10日上午11:14:12</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @version 1.0</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> /</span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta">@ResponseBody</span></span></span></span> <span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta">@RequestMapping</span></span></span></span>(value=<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"/showImg"</span></span></span></span>) public <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">void</span></span></span></span> showImg(<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span> instanceId, HttpServletResponse response) { <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/ * 参数校验 */</span></span></span></span> logger.info(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"查看完整流程图!流程实例ID:{}"</span></span></span></span>, instanceId); <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">if</span></span></span></span>(StringUtils.isBlank(instanceId)) <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span>;
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/* * 获取流程实例
*/</span></span></span></span>
HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(instanceId).singleResult();
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">if</span></span></span></span>(processInstance == <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">null</span></span></span></span>) {
logger.error(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"流程实例ID:{}没查询到流程实例!"</span></span></span></span>, instanceId);
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span>;
}
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 根据流程对象获取流程对象模型</span></span></span></span>
BpmnModel bpmnModel = repositoryService.getBpmnModel(processInstance.getProcessDefinitionId());
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/*
* 查看已执行的节点集合
* 获取流程历史中已执行节点,并按照节点在流程中执行先后顺序排序
*/</span></span></span></span>
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 构造历史流程查询</span></span></span></span>
HistoricActivityInstanceQuery historyInstanceQuery = historyService.createHistoricActivityInstanceQuery().processInstanceId(instanceId);
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 查询历史节点</span></span></span></span>
<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">List</span></span></span></span><HistoricActivityInstance> historicActivityInstanceList = historyInstanceQuery.orderByHistoricActivityInstanceStartTime().asc().list();
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">if</span></span></span></span>(historicActivityInstanceList == <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">null</span></span></span></span> || historicActivityInstanceList.size() == <span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">0</span></span></span></span>) {
logger.info(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"流程实例ID:{}没有历史节点信息!"</span></span></span></span>, instanceId);
outputImg(response, bpmnModel, <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">null</span></span></span></span>, <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">null</span></span></span></span>);
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span>;
}
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 已执行的节点ID集合(将historicActivityInstanceList中元素的activityId字段取出封装到executedActivityIdList)</span></span></span></span>
<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">List</span></span></span></span><<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span>> executedActivityIdList = historicActivityInstanceList.stream().map(item -> item.getActivityId()).collect(Collectors.toList());
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/*
* 获取流程走过的线
*/</span></span></span></span>
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 获取流程定义</span></span></span></span>
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(processInstance.getProcessDefinitionId());
<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">List</span></span></span></span><<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span>> flowIds = ActivitiUtils.getHighLightedFlows(bpmnModel, processDefinition, historicActivityInstanceList);
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/*
* 输出图像,并设置高亮
*/</span></span></span></span>
outputImg(response, bpmnModel, flowIds, executedActivityIdList);
}
<span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown">/**
</span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * <p>员工提交申请</p></span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @param request 请求</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @return String 申请受理结果</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @author FRH</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @time 2018年12月10日上午11:15:09</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @version 1.0</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> /</span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta">@RequestMapping</span></span></span></span>(value=<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"/employeeApply"</span></span></span></span>) <span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta">@ResponseBody</span></span></span></span> public <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span> employeeApply(HttpServletRequest request){ <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/ * 获取请求参数 */</span></span></span></span> <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span> taskId = request.getParameter(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"taskId"</span></span></span></span>); <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 任务ID</span></span></span></span> <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span> jobNumber = request.getParameter(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"jobNumber"</span></span></span></span>); <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 工号</span></span></span></span> <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span> leaveDays = request.getParameter(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"leaveDays"</span></span></span></span>); <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 请假天数</span></span></span></span> <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span> leaveReason = request.getParameter(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"leaveReason"</span></span></span></span>); <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 请假原因</span></span></span></span>
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/* * 查询任务
*/</span></span></span></span>
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">if</span></span></span></span>(task == <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">null</span></span></span></span>) {
logger.info(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"任务ID:{}查询到任务为空!"</span></span></span></span>, taskId);
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"fail"</span></span></span></span>;
}
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/*
* 参数传递并提交申请
*/</span></span></span></span>
<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">Map</span></span></span></span><<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span>, <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">Object</span></span></span></span>> map = <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">new</span></span></span></span> HashMap<<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span>, <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">Object</span></span></span></span>>();
map.put(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"days"</span></span></span></span>, leaveDays);
map.put(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"date"</span></span></span></span>, <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">new</span></span></span></span> Date());
map.put(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"reason"</span></span></span></span>, leaveReason);
map.put(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"jobNumber"</span></span></span></span>, jobNumber);
taskService.complete(task.getId(), map);
logger.info(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"执行【员工申请】环节,流程推动到【上级审核】环节"</span></span></span></span>);
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/*
* 返回成功
*/</span></span></span></span>
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"success"</span></span></span></span>;
}
<span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown">/**
</span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * <p>跳转到上级审核页面</p></span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @return String 页面</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @author FRH</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @time 2018年12月5日下午2:31:42</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @version 1.0</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> /</span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta">@RequestMapping</span></span></span></span>(value=<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"/viewTask"</span></span></span></span>) public <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span> toHigherAudit(<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span> taskId, HttpServletRequest request) { <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/ * 获取参数 */</span></span></span></span> logger.info(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"跳转到任务详情页面,任务ID:{}"</span></span></span></span>, taskId); <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">if</span></span></span></span>(StringUtils.isBlank(taskId)) <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"/higherAudit"</span></span></span></span>;
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/* * 查看任务详细信息
*/</span></span></span></span>
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">if</span></span></span></span>(task == <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">null</span></span></span></span>) {
logger.info(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"任务ID:{}不存在!"</span></span></span></span>, taskId);
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"/higherAudit"</span></span></span></span>;
}
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/*
* 完成任务
*/</span></span></span></span>
<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">Map</span></span></span></span><<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span>, <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">Object</span></span></span></span>> paramMap = taskService.getVariables(taskId);
request.setAttribute(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"task"</span></span></span></span>, task);
request.setAttribute(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"paramMap"</span></span></span></span>, paramMap);
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"higherAudit"</span></span></span></span>;
}
<span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown">/**
</span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * <p>跳转到部门经理审核页面</p></span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @param taskId 任务ID</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @param request 请求</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @return String 响应页面</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @author FRH</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @time 2018年12月6日上午9:54:34</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @version 1.0</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> /</span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta">@RequestMapping</span></span></span></span>(value=<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"/viewTaskManager"</span></span></span></span>) public <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span> viewTaskManager(<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span> taskId, HttpServletRequest request) { <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/ * 获取参数 */</span></span></span></span> logger.info(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"跳转到任务详情页面,任务ID:{}"</span></span></span></span>, taskId); <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">if</span></span></span></span>(StringUtils.isBlank(taskId)) <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"/manageAudit"</span></span></span></span>;
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/* * 查看任务详细信息
*/</span></span></span></span>
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">if</span></span></span></span>(task == <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">null</span></span></span></span>) {
logger.info(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"任务ID:{}不存在!"</span></span></span></span>, taskId);
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"/manageAudit"</span></span></span></span>;
}
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/*
* 完成任务
*/</span></span></span></span>
<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">Map</span></span></span></span><<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span>, <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">Object</span></span></span></span>> paramMap = taskService.getVariables(taskId);
request.setAttribute(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"task"</span></span></span></span>, task);
request.setAttribute(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"paramMap"</span></span></span></span>, paramMap);
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"manageAudit"</span></span></span></span>;
}
<span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown">/**
</span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * <p>上级审核</p></span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @param request 请求</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @return String 受理结果</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @author FRH</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @time 2018年12月10日上午11:19:44</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @version 1.0</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> /</span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta">@ResponseBody</span></span></span></span> <span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta">@RequestMapping</span></span></span></span>(value=<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"/higherLevelAudit"</span></span></span></span>) public <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span> higherLevelAudit(HttpServletRequest request) { <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/ * 获取请求参数 */</span></span></span></span> <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span> taskId = request.getParameter(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"taskId"</span></span></span></span>); <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span> higherLevelOpinion = request.getParameter(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"sug"</span></span></span></span>); <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span> auditStr = request.getParameter(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"audit"</span></span></span></span>); logger.info(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"上级审核任务ID:{}"</span></span></span></span>, taskId); <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">if</span></span></span></span>(StringUtils.isBlank(taskId)) <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"fail"</span></span></span></span>;
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/* * 查找任务
*/</span></span></span></span>
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">if</span></span></span></span>(task == <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">null</span></span></span></span>) {
logger.info(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"审核任务ID:{}查询到任务为空!"</span></span></span></span>, taskId);
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"fail"</span></span></span></span>;
}
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/*
* 设置局部变量参数,完成任务
*/</span></span></span></span>
<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">Map</span></span></span></span><<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span>, <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">Object</span></span></span></span>> map = <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">new</span></span></span></span> HashMap<<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span>, <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">Object</span></span></span></span>>();
map.put(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"audit"</span></span></span></span>, <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"1"</span></span></span></span>.equals(auditStr) ? <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">false</span></span></span></span> : <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">true</span></span></span></span>);
map.put(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"higherLevelOpinion"</span></span></span></span>, higherLevelOpinion);
taskService.complete(taskId, map);
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"success"</span></span></span></span>;
}
<span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown">/**
</span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * <p>部门经理审核</p></span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @param request 请求</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @return String 受理结果</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @author FRH</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @time 2018年12月10日上午11:20:44</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @version 1.0</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> /</span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta">@ResponseBody</span></span></span></span> <span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta">@RequestMapping</span></span></span></span>(value=<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"/divisionManagerAudit"</span></span></span></span>) public <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span> divisionManagerAudit(HttpServletRequest request) { <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/ * 获取请求参数 */</span></span></span></span> <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span> taskId = request.getParameter(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"taskId"</span></span></span></span>); <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span> opinion = request.getParameter(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"sug"</span></span></span></span>); <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span> auditStr = request.getParameter(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"audit"</span></span></span></span>); logger.info(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"上级审核任务ID:{}"</span></span></span></span>, taskId); <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">if</span></span></span></span>(StringUtils.isBlank(taskId)) <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"fail"</span></span></span></span>;
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/* * 查找任务
*/</span></span></span></span>
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">if</span></span></span></span>(task == <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">null</span></span></span></span>) {
logger.info(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"审核任务ID:{}查询到任务为空!"</span></span></span></span>, taskId);
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"fail"</span></span></span></span>;
}
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/*
* 设置局部变量参数,完成任务
*/</span></span></span></span>
<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">Map</span></span></span></span><<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span>, <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">Object</span></span></span></span>> map = <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">new</span></span></span></span> HashMap<<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span>, <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">Object</span></span></span></span>>();
map.put(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"audit"</span></span></span></span>, <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"1"</span></span></span></span>.equals(auditStr) ? <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">false</span></span></span></span> : <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">true</span></span></span></span>);
map.put(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"managerOpinion"</span></span></span></span>, opinion);
taskService.complete(taskId, map);
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"success"</span></span></span></span>;
}
<span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown">/**
</span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * <p>查看任务</p></span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @param request 请求</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @return String 任务展示页面</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @author FRH</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @time 2018年12月10日上午11:21:33</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @version 1.0</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> /</span></span></span></span></span></span></span></span></span></span></span></span> <span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta">@RequestMapping</span></span></span></span>(value=<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"/toShowTask"</span></span></span></span>) public <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span> toShowTask(HttpServletRequest request) { <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/ * 获取请求参数 */</span></span></span></span> <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">List</span></span></span></span><Task> taskList = taskService.createTaskQuery().list(); <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">if</span></span></span></span>(taskList == <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">null</span></span></span></span> || taskList.size() == <span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">0</span></span></span></span>) { logger.info(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"查询任务列表为空!"</span></span></span></span>); <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"/task"</span></span></span></span>; }
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/* * 查询所有任务,并封装
*/</span></span></span></span>
<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">List</span></span></span></span><<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">Map</span></span></span></span><<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span>, <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span>>> resultList = <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">new</span></span></span></span> ArrayList<<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">Map</span></span></span></span><<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span>, <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span>>>();
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">for</span></span></span></span>(Task task : taskList) {
<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">Map</span></span></span></span><<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span>, <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span>> map = <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">new</span></span></span></span> HashMap<<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span>, <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span>>();
map.put(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"taskId"</span></span></span></span>, task.getId());
map.put(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"name"</span></span></span></span>, task.getName());
map.put(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"createTime"</span></span></span></span>, task.getCreateTime().toString());
map.put(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"assignee"</span></span></span></span>, task.getAssignee());
map.put(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"instanceId"</span></span></span></span>, task.getProcessInstanceId());
map.put(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"executionId"</span></span></span></span>, task.getExecutionId());
map.put(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"definitionId"</span></span></span></span>, task.getProcessDefinitionId());
resultList.add(map);
}
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">/*
* 返回结果
*/</span></span></span></span>
logger.info(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"返回集合:{}"</span></span></span></span>, resultList.toString());
request.setAttribute(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"resultList"</span></span></span></span>, resultList);
<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span> <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"/task"</span></span></span></span>;
}
<span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown">/**
</span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * <p>输出图像</p></span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @param response 响应实体</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @param bpmnModel 图像对象</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @param flowIds 已执行的线集合</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @param executedActivityIdList void 已执行的节点ID集合</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @author FRH</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @time 2018年12月10日上午11:23:01</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @version 1.0</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> */</span></span></span></span></span></span></span></span></span></span></span></span> private <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">void</span></span></span></span> outputImg(HttpServletResponse response, BpmnModel bpmnModel, <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">List</span></span></span></span><<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span>> flowIds, <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">List</span></span></span></span><<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span>> executedActivityIdList) { InputStream imageStream = <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">null</span></span></span></span>; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">try</span></span></span></span> { imageStream = processDiagramGenerator.generateDiagram(bpmnModel, executedActivityIdList, flowIds, <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"宋体"</span></span></span></span>, <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"微软雅黑"</span></span></span></span>, <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"黑体"</span></span></span></span>, <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">true</span></span></span></span>, <span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"png"</span></span></span></span>); <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 输出资源内容到相应对象</span></span></span></span> byte[] b = <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">new</span></span></span></span> byte[<span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">1024</span></span></span></span>]; <span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">int</span></span></span></span> len; <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">while</span></span></span></span> ((len = imageStream.read(b, <span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">0</span></span></span></span>, <span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">1024</span></span></span></span>)) != <span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">-1</span></span></span></span>) { response.getOutputStream().write(b, <span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">0</span></span></span></span>, len); } response.getOutputStream().flush(); }<span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">catch</span></span></span></span>(Exception e) { logger.error(<span class="hljs-string"><span class="hljs-string"><span class="hljs-string"><span class="hljs-string">"流程图输出异常!"</span></span></span></span>, e); } <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">finally</span></span></span></span> { <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment">// 流关闭</span></span></span></span> StreamUtils.closeInputStream(imageStream); } }
<span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown">/**
</span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * <p>判断流程是否完成</p></span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @param processInstanceId 流程实例ID</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @return boolean 已完成-true,未完成-false</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @author FRH</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @time 2018年12月10日上午11:23:26</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> * @version 1.0</span></span></span></span></span></span></span></span></span></span><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"><span class="hljs-comment"><span class="markdown"> </span></span></span></span></span></span><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"><span class="hljs-comment"><span class="markdown"><span class="hljs-code"> */</span></span></span></span></span></span></span></span></span></span></span></span> public boolean isFinished(<span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in"><span class="hljs-built_in">String</span></span></span></span> processInstanceId) { <span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword"><span class="hljs-keyword">return</span></span></span></span> historyService.createHistoricProcessInstanceQuery().finished().processInstanceId(processInstanceId).count() > <span class="hljs-number"><span class="hljs-number"><span class="hljs-number"><span class="hljs-number">0</span></span></span></span>; }
}
<div class="hljs-button signin" data-title="登录后复制"></div></code></pre> <h3><a name="t13"></a><a id="7__1032" target="_blank"></a>7. 效果</h3> <p><img src="https://img2018.cnblogs.com/blog/1112483/201906/1112483-20190626111139571-719573601.png" alt="在这里插入图片描述"><br> 看出Activiti默认使用Spring的security,添加配置,关闭安全认证,如下:</p> <pre class="prettyprint"><code class="has-numbering hljs yaml" onclick="mdcp.signin(event)"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"># 关闭activiti登录验证</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr">security:</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> basic:</span></span></span></span> <span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"><span class="hljs-attr"> enabled:</span></span></span></span> <span class="hljs-literal"><span class="hljs-literal"><span class="hljs-literal"><span class="hljs-literal">false</span></span></span></span> <div class="hljs-button signin" data-title="登录后复制"></div></code></pre> <p> 重启后继续访问,可正常进入首页(如还是无法进入首页,请添加@EnableAutoConfiguration(exclude = {org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class}),或者从pom.xml中移除Security包):<br> <img src="https://img2018.cnblogs.com/blog/1112483/201906/1112483-20190626111244307-926259817.png" alt="在这里插入图片描述"><br> 点击我要请假后,得到流程实例ID,再查看流程图,如下:</p> <p><img src="https://img2018.cnblogs.com/blog/1112483/201906/1112483-20190626111314213-1149328716.png" alt="在这里插入图片描述"></p> <p> 附上首页/index.html代码,其它页面相比比较简单:</p> <pre class="prettyprint"><code class="has-numbering hljs xml" onclick="mdcp.signin(event)"><span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta"><span class="hljs-meta"><!DOCTYPE html></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">html</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"> </span></span></span><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr">xmlns</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">=</span></span></span><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string">"http://www.w3.org/1999/xhtml"</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"> </span></span></span><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr">xmlns:th</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">=</span></span></span><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string">"http://www.thymeleaf.org"</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">head</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">meta</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"> </span></span></span><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr">http-equiv</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">=</span></span></span><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string">"Content-Type"</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"> </span></span></span><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr">content</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">=</span></span></span><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string">"text/html; charset=UTF-8"</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">meta</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"> </span></span></span><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr">name</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">=</span></span></span><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string">"viewport"</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"> </span></span></span><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr">content</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">=</span></span></span><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string">"width=device-width, initial-scale=1"</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">title</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>首页<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">title</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">script</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"> </span></span></span><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr">th:src</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">=</span></span></span><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string">"@{/static/jquery.min.js}"</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span><span class="undefined"></span><span class="hljs-tag"><span class="undefined"></span><span class="hljs-tag"><span class="undefined"></span><span class="hljs-tag"><span class="undefined"></span><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">script</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">script</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"> </span></span></span><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr">type</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">=</span></span></span><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string">"text/javascript"</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"><span class="javascript"> $(</span></span></span><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword">function</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">(</span></span></span></span></span></span><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span>)</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">{ </span></span></span><span class="hljs-comment"><span class="javascript"><span class="hljs-comment"><span class="javascript"><span class="hljs-comment"><span class="javascript"><span class="hljs-comment">// 点击菜单</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> $(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">".show-page"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">).bind(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">"click"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">, </span></span></span><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword">function</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">(</span></span></span></span></span></span><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span>)</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">{ $(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">".main-body"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">).html(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">""</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">); $(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">".result-div"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">).html(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">""</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">); </span></span></span><span class="hljs-keyword"><span class="javascript"><span class="hljs-keyword"><span class="javascript"><span class="hljs-keyword"><span class="javascript"><span class="hljs-keyword">var</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> url = $(</span></span></span><span class="hljs-keyword"><span class="javascript"><span class="hljs-keyword"><span class="javascript"><span class="hljs-keyword"><span class="javascript"><span class="hljs-keyword">this</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">).attr(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">"url"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">);
$.ajax({ </span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">async</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-literal"><span class="javascript"><span class="hljs-literal"><span class="javascript"><span class="hljs-literal"><span class="javascript"><span class="hljs-literal">false</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">cache</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-literal"><span class="javascript"><span class="hljs-literal"><span class="javascript"><span class="hljs-literal"><span class="javascript"><span class="hljs-literal">false</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">type</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">'POST'</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">url</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : url,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">dataType</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">"html"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">error</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword">function</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">(</span></span></span></span></span></span><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span>) </span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">{
alert(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">'请求失败'</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">);
},
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">success</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword">function</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">(</span></span></span></span></span></span><span class="hljs-params"><span class="javascript"><span class="hljs-function"><span class="hljs-params"><span class="javascript"><span class="hljs-function"><span class="hljs-params"><span class="javascript"><span class="hljs-function"><span class="hljs-params">data</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">) </span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">{
$(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">".result-div"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">).html(data);
}
});
});
</span></span></span><span class="hljs-comment"><span class="javascript"><span class="hljs-comment"><span class="javascript"><span class="hljs-comment"><span class="javascript"><span class="hljs-comment">// 点击我要请假,开启流程</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">
$(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">".show-instance"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">).bind(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">"click"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">, </span></span></span><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword">function</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">(</span></span></span></span></span></span><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span>)</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">{
$(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">".main-body"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">).html(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">""</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">);
$(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">".result-div"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">).html(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">""</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">);
</span></span></span><span class="hljs-keyword"><span class="javascript"><span class="hljs-keyword"><span class="javascript"><span class="hljs-keyword"><span class="javascript"><span class="hljs-keyword">var</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> url = $(</span></span></span><span class="hljs-keyword"><span class="javascript"><span class="hljs-keyword"><span class="javascript"><span class="hljs-keyword"><span class="javascript"><span class="hljs-keyword">this</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">).attr(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">"url"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">);
$.ajax({
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">async</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-literal"><span class="javascript"><span class="hljs-literal"><span class="javascript"><span class="hljs-literal"><span class="javascript"><span class="hljs-literal">false</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">cache</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-literal"><span class="javascript"><span class="hljs-literal"><span class="javascript"><span class="hljs-literal"><span class="javascript"><span class="hljs-literal">false</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">type</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">'POST'</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">url</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : url,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">dataType</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">"html"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">error</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword">function</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">(</span></span></span></span></span></span><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span>) </span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">{
alert(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">'请求失败'</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">);
},
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">success</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword">function</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">(</span></span></span></span></span></span><span class="hljs-params"><span class="javascript"><span class="hljs-function"><span class="hljs-params"><span class="javascript"><span class="hljs-function"><span class="hljs-params"><span class="javascript"><span class="hljs-function"><span class="hljs-params">data</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">) </span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">{
$(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">"input[name='instanceId']"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">).val(data);
}
});
});
</span></span></span><span class="hljs-comment"><span class="javascript"><span class="hljs-comment"><span class="javascript"><span class="hljs-comment"><span class="javascript"><span class="hljs-comment">// 绑定查看流程图</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">
$(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">".show-img"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">).bind(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">"click"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">, </span></span></span><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword">function</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">(</span></span></span></span></span></span><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span>)</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">{
</span></span></span><span class="hljs-keyword"><span class="javascript"><span class="hljs-keyword"><span class="javascript"><span class="hljs-keyword"><span class="javascript"><span class="hljs-keyword">var</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> instanceId = $(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">"input[name='instanceId']"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">).val();
</span></span></span><span class="hljs-keyword"><span class="javascript"><span class="hljs-keyword"><span class="javascript"><span class="hljs-keyword"><span class="javascript"><span class="hljs-keyword">if</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">(instanceId == </span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">""</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">) {
alert(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">"暂无流程!"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">);
</span></span></span><span class="hljs-keyword"><span class="javascript"><span class="hljs-keyword"><span class="javascript"><span class="hljs-keyword"><span class="javascript"><span class="hljs-keyword">return</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">;
}
</span></span></span><span class="hljs-keyword"><span class="javascript"><span class="hljs-keyword"><span class="javascript"><span class="hljs-keyword"><span class="javascript"><span class="hljs-keyword">var</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> imgHtml = </span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">'<embed src="/demo/showImg?instanceId='</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> + instanceId + </span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">'" style="display:block;width:1000px;height:450px" />'</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">;
$(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">".result-div"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">).html(imgHtml);
});
</span></span></span><span class="hljs-comment"><span class="javascript"><span class="hljs-comment"><span class="javascript"><span class="hljs-comment"><span class="javascript"><span class="hljs-comment">// 查看任务</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">
$(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">".show-task"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">).bind(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">"click"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">, </span></span></span><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword">function</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">(</span></span></span></span></span></span><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span>)</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">{
$.ajax({
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">async</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-literal"><span class="javascript"><span class="hljs-literal"><span class="javascript"><span class="hljs-literal"><span class="javascript"><span class="hljs-literal">false</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">cache</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-literal"><span class="javascript"><span class="hljs-literal"><span class="javascript"><span class="hljs-literal"><span class="javascript"><span class="hljs-literal">false</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">type</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">'POST'</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">url</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">"/demo/toShowTask"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">data</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : {</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">"aaabbbccc"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">:</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">"aa"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">},
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">dataType</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">"html"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">error</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword">function</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">(</span></span></span></span></span></span><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span>) </span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">{
alert(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">'请求失败'</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">);
},
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">success</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword">function</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">(</span></span></span></span></span></span><span class="hljs-params"><span class="javascript"><span class="hljs-function"><span class="hljs-params"><span class="javascript"><span class="hljs-function"><span class="hljs-params"><span class="javascript"><span class="hljs-function"><span class="hljs-params">data</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">) </span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">{
$(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">".result-div"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">).html(data);
}
});
});
});
</span></span></span><span class="hljs-comment"><span class="javascript"><span class="hljs-comment"><span class="javascript"><span class="hljs-comment"><span class="javascript"><span class="hljs-comment">/**
* 员工提交申请
*/</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">
</span></span></span><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword">function</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"> </span></span></span></span></span></span><span class="hljs-title"><span class="javascript"><span class="hljs-function"><span class="hljs-title"><span class="javascript"><span class="hljs-function"><span class="hljs-title"><span class="javascript"><span class="hljs-function"><span class="hljs-title">toLeave</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">(</span></span></span></span></span></span><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span>) </span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">{
$.ajax({
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">async</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-literal"><span class="javascript"><span class="hljs-literal"><span class="javascript"><span class="hljs-literal"><span class="javascript"><span class="hljs-literal">false</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">cache</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-literal"><span class="javascript"><span class="hljs-literal"><span class="javascript"><span class="hljs-literal"><span class="javascript"><span class="hljs-literal">false</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">type</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">'POST'</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">url</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">"/demo/employeeApply"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">dataType</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">: </span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">"text"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">data</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">: $(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">".employee-leave"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">).serialize(),
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">error</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword">function</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">(</span></span></span></span></span></span><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span>) </span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">{
alert(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">'请求失败'</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">);
},
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">success</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword">function</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">(</span></span></span></span></span></span><span class="hljs-params"><span class="javascript"><span class="hljs-function"><span class="hljs-params"><span class="javascript"><span class="hljs-function"><span class="hljs-params"><span class="javascript"><span class="hljs-function"><span class="hljs-params">data</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">) </span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">{
alert(data);
}
});
}
</span></span></span><span class="hljs-comment"><span class="javascript"><span class="hljs-comment"><span class="javascript"><span class="hljs-comment"><span class="javascript"><span class="hljs-comment">/**
* 上级审核
*/</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">
</span></span></span><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword">function</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"> </span></span></span></span></span></span><span class="hljs-title"><span class="javascript"><span class="hljs-function"><span class="hljs-title"><span class="javascript"><span class="hljs-function"><span class="hljs-title"><span class="javascript"><span class="hljs-function"><span class="hljs-title">higherAudit</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">(</span></span></span></span></span></span><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span>) </span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">{
$.ajax({
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">async</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-literal"><span class="javascript"><span class="hljs-literal"><span class="javascript"><span class="hljs-literal"><span class="javascript"><span class="hljs-literal">false</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">cache</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-literal"><span class="javascript"><span class="hljs-literal"><span class="javascript"><span class="hljs-literal"><span class="javascript"><span class="hljs-literal">false</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">type</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">'POST'</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">url</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">"/demo/higherLevelAudit"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">dataType</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">: </span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">"text"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">data</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">: $(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">".higher-audit"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">).serialize(),
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">error</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword">function</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">(</span></span></span></span></span></span><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span>) </span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">{
alert(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">'请求失败'</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">);
},
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">success</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword">function</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">(</span></span></span></span></span></span><span class="hljs-params"><span class="javascript"><span class="hljs-function"><span class="hljs-params"><span class="javascript"><span class="hljs-function"><span class="hljs-params"><span class="javascript"><span class="hljs-function"><span class="hljs-params">data</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">) </span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">{
alert(data);
}
});
}
</span></span></span><span class="hljs-comment"><span class="javascript"><span class="hljs-comment"><span class="javascript"><span class="hljs-comment"><span class="javascript"><span class="hljs-comment">/**
* 部门经理审核
*/</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">
</span></span></span><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword">function</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"> </span></span></span></span></span></span><span class="hljs-title"><span class="javascript"><span class="hljs-function"><span class="hljs-title"><span class="javascript"><span class="hljs-function"><span class="hljs-title"><span class="javascript"><span class="hljs-function"><span class="hljs-title">managerAudit</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">(</span></span></span></span></span></span><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span>) </span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">{
$.ajax({
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">async</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-literal"><span class="javascript"><span class="hljs-literal"><span class="javascript"><span class="hljs-literal"><span class="javascript"><span class="hljs-literal">false</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">cache</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-literal"><span class="javascript"><span class="hljs-literal"><span class="javascript"><span class="hljs-literal"><span class="javascript"><span class="hljs-literal">false</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">type</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">'POST'</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">url</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">"/demo/divisionManagerAudit"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">dataType</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">: </span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">"text"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">data</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">: $(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">".manager-audit"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">).serialize(),
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">error</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword">function</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">(</span></span></span></span></span></span><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span>) </span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">{
alert(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">'请求失败'</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">);
},
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">success</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword">function</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">(</span></span></span></span></span></span><span class="hljs-params"><span class="javascript"><span class="hljs-function"><span class="hljs-params"><span class="javascript"><span class="hljs-function"><span class="hljs-params"><span class="javascript"><span class="hljs-function"><span class="hljs-params">data</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">) </span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">{
alert(data);
}
});
}
</span></span></span><span class="hljs-comment"><span class="javascript"><span class="hljs-comment"><span class="javascript"><span class="hljs-comment"><span class="javascript"><span class="hljs-comment">/**
* 上级审核
*/</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">
</span></span></span><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword">function</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"> </span></span></span></span></span></span><span class="hljs-title"><span class="javascript"><span class="hljs-function"><span class="hljs-title"><span class="javascript"><span class="hljs-function"><span class="hljs-title"><span class="javascript"><span class="hljs-function"><span class="hljs-title">viewTask</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">(</span></span></span></span></span></span><span class="hljs-params"><span class="javascript"><span class="hljs-function"><span class="hljs-params"><span class="javascript"><span class="hljs-function"><span class="hljs-params"><span class="javascript"><span class="hljs-function"><span class="hljs-params">taskId, name</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">) </span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">{
</span></span></span><span class="hljs-keyword"><span class="javascript"><span class="hljs-keyword"><span class="javascript"><span class="hljs-keyword"><span class="javascript"><span class="hljs-keyword">var</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> url = </span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">"/demo/viewTask"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">;
</span></span></span><span class="hljs-keyword"><span class="javascript"><span class="hljs-keyword"><span class="javascript"><span class="hljs-keyword"><span class="javascript"><span class="hljs-keyword">if</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">(name != </span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">"上级审核"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">) {
url = </span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">"/demo/viewTaskManager"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">;
}
$.ajax({
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">async</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-literal"><span class="javascript"><span class="hljs-literal"><span class="javascript"><span class="hljs-literal"><span class="javascript"><span class="hljs-literal">false</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">cache</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-literal"><span class="javascript"><span class="hljs-literal"><span class="javascript"><span class="hljs-literal"><span class="javascript"><span class="hljs-literal">false</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">type</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">'POST'</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">url</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : url,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">data</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : {</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">"taskId"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : taskId},
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">dataType</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">"html"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">,
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">error</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword">function</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">(</span></span></span></span></span></span><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span><span class="javascript"><span class="hljs-function"><span class="hljs-params"></span>) </span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">{
alert(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">'请求失败'</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">);
},
</span></span></span><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr"><span class="javascript"><span class="hljs-attr">success</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript"> : </span></span></span><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword"><span class="javascript"><span class="hljs-function"><span class="hljs-keyword">function</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">(</span></span></span></span></span></span><span class="hljs-params"><span class="javascript"><span class="hljs-function"><span class="hljs-params"><span class="javascript"><span class="hljs-function"><span class="hljs-params"><span class="javascript"><span class="hljs-function"><span class="hljs-params">data</span></span></span></span></span></span></span></span></span></span><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function"><span class="javascript"><span class="hljs-function">) </span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">{
$(</span></span></span><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string"><span class="javascript"><span class="hljs-string">".result-div"</span></span></span></span></span></span></span><span class="javascript"><span class="javascript"><span class="javascript">).html(data);
}
});
}
</span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">script</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>
<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">head</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">body</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><!-- 菜单栏 --></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">div</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"> </span></span></span><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr">class</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">=</span></span></span><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string">"main-menu"</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">button</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"> </span></span></span><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr">class</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">=</span></span></span><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string">"show-instance"</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"> </span></span></span><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr">url</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">=</span></span></span><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string">"/demo/start"</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>我要请假<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">button</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">button</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"> </span></span></span><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr">class</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">=</span></span></span><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string">"show-page"</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"> </span></span></span><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr">url</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">=</span></span></span><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string">"/demo/toLeave"</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>开始填单<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">button</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">button</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"> </span></span></span><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr">class</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">=</span></span></span><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string">"show-img"</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>查看流程图<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">button</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">button</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"> </span></span></span><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr">class</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">=</span></span></span><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string">"show-task"</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>查看任务<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">button</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">div</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">br</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">/></span></span></span></span> 流程实例ID:<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">input</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"> </span></span></span><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr">type</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">=</span></span></span><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string">"text"</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"> </span></span></span><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr">name</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">=</span></span></span><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string">"instanceId"</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">/></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">br</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">/></span></span></span></span> <span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><!-- 操作栏 --></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">div</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"> </span></span></span><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr">class</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">=</span></span></span><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string">"main-body"</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>
<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">div</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">br</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">/></span></span></span></span>
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><!-- 结果栏 --></span></span></span></span>
<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">div</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"> </span></span></span><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr">class</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">=</span></span></span><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string">"result-div"</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>
<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">embed</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"> </span></span></span><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr">src</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">=</span></span></span><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string">"/demo/showImg?instanceId=5070fd58-f859-11e8-a359-484d7ec5762d"</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"> </span></span></span><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr"><span class="hljs-tag"><span class="hljs-attr">style</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">=</span></span></span><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string"><span class="hljs-tag"><span class="hljs-string">"display:block;width:1000px;height:450px"</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"> /></span></span></span></span>
<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">br</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>
<span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><span class="hljs-comment"><!-- <img src="/static/leave-process.png"/> --></span></span></span></span>
<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">div</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>
<span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">body</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span> <span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag"></</span></span></span><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name"><span class="hljs-tag"><span class="hljs-name">html</span></span></span></span></span></span></span><span class="hljs-tag"><span class="hljs-tag"><span class="hljs-tag">></span></span></span></span>
<div class="hljs-button signin" data-title="登录后复制"></div></code></pre>
</div>
原文地址:https://blog.csdn.net/qq_40451631/article/details/84937251
</div>
以上是 Activiti7工作流+SpringBoot 的全部内容, 来源链接: utcz.com/z/509558.html