spring整合activiti前端设计器,spring4.1、activiti5.22.0
先下载activiti5.22.0
解压libs下面的activiti-modeler-5.22.0-sources.jar
将三个文件复制到工程中
解压activiti-explorer,将web-info下面的stencilset.json文件放在项目source下面
复制web下面的diagram-viewer,editor-app,modeler.html,到项目web中
项目中新建spring-activi.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
<!-- 数据源 -->
<property name="dataSource" ref="dataSource" />
<!-- 配置事务管理器,统一事务 -->
<property name="transactionManager" ref="transactionManager" />
<!-- 设置建表策略 -->
<property name="databaseSchemaUpdate" value="true" />
<property name="activityFontName" value="宋体" />
<property name="labelFontName" value="宋体" />
<property name="annotationFontName" value="宋体"/>
</bean>
<bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
<property name="processEngineConfiguration" ref="processEngineConfiguration" />
</bean>
<!--
bean id repositoryService
RepositoryServicie repositoryService = processEngine.getRepositoryService();
-->
<bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
<bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService" />
<bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" />
<bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService" />
<bean id="formService" factory-bean="processEngine" factory-method="getFormService" />
<bean id="managementService" factory-bean="processEngine" factory-method="getManagementService" />
</beans>
在pom文件中引入
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring-boot-starter-basic</artifactId>
<version>5.22.0</version>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-modeler</artifactId>
<version>5.22.0</version>
</dependency>
修改editor-app下app-cfg.js文件,将内容修改为你的项目名,整合到此为止
部署流程
public String deploy(@PathVariable("modelId") String modelId) {
try {
Model modelData = repositoryService.getModel(modelId);
ObjectNode modelNode = (ObjectNode) new ObjectMapper().readTree(repositoryService.getModelEditorSource(modelData.getId()));
byte[] bpmnBytes = null;
BpmnModel model = new BpmnJsonConverter().convertToBpmnModel(modelNode);
bpmnBytes = new BpmnXMLConverter().convertToXML(model);
String processName = modelData.getName() + ".bpmn20.xml";
Deployment deployment = repositoryService.createDeployment().name(modelData.getName()).addString(processName, new String(bpmnBytes)).deploy();
List<Deployment> list=repositoryService.createDeploymentQuery().list();
for (Deployment t : list) {
if(!t.getId().equals(deployment.getId()) && t.getName().equals(deployment.getName()))
repositoryService.deleteDeployment(t.getId());
}
} catch (Exception e) {
e.printStackTrace();
return "部署失败";
}
return "部署成功";
}
启动流程
扫描二维码关注公众号,回复:
5745315 查看本文章
![](/qrcode.jpg)
runtimeService.startProcessInstanceByKey("cdv");
审核流程
如果有代理人的话,需要先解决委托
if (task.getOwner() != null && !task.getOwner().equals("null")) {
if(i==0)
if(task.getAssignee().equals(currentUserId)){
flag=true;
TSUser entity = super.getEntity(TSUser.class, task.getAssignee());
if(null!=entity)
remark="("+entity.getRealName()+"代处理)"+remark;
}
DelegationState delegationState = task.getDelegationState();
if (delegationState.toString().equals("PENDING")) {
taskService.resolveTask( uniqueResult.get(i).get("id_").toString());
}
}
个人任务
Authentication.setAuthenticatedUserId(currentUserId); // 添加批注时候的审核人,通常应该从session获取
taskService.addComment(uniqueResult.get(0).get("id_").toString(), proid, remark);
taskService.complete( uniqueResult.get(0).get("id_").toString(), map);
会签节点
public void completeTask(String taskId, String instanceId, String passflag, String remark) {
List<Task> tasks = taskService.createTaskQuery().taskName("评比组审核").processInstanceId(instanceId).list();
int count = 0;
int totalCount = 0;
int nopassCount=0;
for (Task tmp : tasks) {
String tmpCount = taskService.getVariable(tmp.getId(), "passCount") + "";// 获取通过记录数,这里不能使用nrOfCompletedInstances,因为与我们业务无关
String tmpTotal = taskService.getVariable(tmp.getId(), "totalCount") + "";// 获取记录总数
if (!tmpCount.equals("null") && !tmpCount.trim().equals("")) {
count = Integer.parseInt(tmpCount);
}
if (!tmpTotal.equals("null") && !tmpTotal.trim().equals("") && !tmpTotal.equals("0")) {
totalCount = Integer.parseInt(tmpTotal);
}else
totalCount++;
}
if (passflag.equals("no")) {// 选择通过则+1
nopassCount=1;
remark += "(一票否决)";
}else
count++;
taskService.addComment(taskId, instanceId, remark);
Map<String, Object> vars = new HashMap<String, Object>();
// 变量回写记录
vars.put("passCount", count);
vars.put("nopassCount",nopassCount);
vars.put("totalCount", totalCount);
taskService.complete(taskId, vars);
}
流程图查看
public void genericImageByWfKey(HttpServletRequest request, HttpServletResponse response, String key) {
ProcessDefinition pd = repositoryService.createProcessDefinitionQuery().processDefinitionKey(key)
.latestVersion().singleResult();
BpmnModel bm = repositoryService.getBpmnModel(pd.getId());
ProcessDiagramGenerator processDiagramGenerator = processEngineConfiguration.getProcessDiagramGenerator();
ProcessDiagramGenerator diagramGenerator = processEngineConfiguration.getProcessDiagramGenerator();
InputStream imageStream = diagramGenerator.generateDiagram(bm, "png", new ArrayList<>(), new ArrayList<>(),
"宋体", "宋体", null, null, 1.0);
try {
byte[] b = new byte[1024];
int len;
ServletOutputStream outputStream = response.getOutputStream();
while ((len = imageStream.read(b, 0, 1024)) != -1) {
outputStream.write(b, 0, len);
}
} catch (Exception e) {
}
}
流程图跟踪
html
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.*,org.apache.commons.lang3.StringUtils,org.apache.commons.lang3.ObjectUtils" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- -->
<script type="text/javascript">
var ctx = '<%=request.getContextPath() %>';
</script>
<link href="imageLink/jquery.qtip.min.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="imageLink/jquery-1.8.3.js">
</script>
<script type="text/javascript" src="/imageLink/layer.min.js">
</script>
<script src="imageLink/jquery-ui-1.9.2.min.js" type="text/javascript"></script>
<script src="imageLink/jquery.qtip.pack.js" type="text/javascript"></script>
<script src="imageLink/jquery.outerhtml.js" type="text/javascript"></script>
<script type="text/javascript">
function graphTrace() {
var imageUrl = "activitiInmage.do?queryProPlan&ProcessInstanceId=${proid}";
$.getJSON('activitiInmage.do?processTip&pid=${proid}', function(infos) {
if(!infos){
var html= "<div id='workflowTraceDialog'><img src='" + imageUrl + "' style='position:absolute; left:0px; top:0px;' />";
$("body").append(html);
return;
}
var positionHtml = "";
// 生成图片
var varsArray = new Array();
$.each(infos, function(i, v) {
var $positionDiv = $('<div/>', {
'class': 'activity-attr'
}).css({
position: 'absolute',
left: (v.x - 1),
top: (v.y - 1),
width: (v.width - 2),
height: (v.height - 2),
backgroundColor: 'black',
opacity: 0,
zIndex: $.fn.qtip.zindex - 1
});
// 节点边框
var $border = $('<div/>', {
'class': 'activity-attr-border'
}).css({
position: 'absolute',
left: (v.x - 1),
top: (v.y - 1),
width: (v.width - 4),
height: (v.height - 3),
zIndex: $.fn.qtip.zindex - 2
});
positionHtml += $positionDiv.outerHTML() + $border.outerHTML();
varsArray[varsArray.length] = v.vars;
});
var html= "<div id='workflowTraceDialog'><img src='" + imageUrl + "' style='position:absolute; left:0px; top:0px;' />" +
"<div id='processImageBorder'>" +
positionHtml +
"</div>" +
"</div>";
$("body").append(html);
$('#workflowTraceDialog .activity-attr').each(function(i, v) {
$(this).data('vars', varsArray[i]);
});
$('.activity-attr').qtip({
content: function() {
var vars = $(this).data('vars');
var tipContent = "<table class='need-border'>";
var i=0;
$.each(vars, function(varKey, varValue) {
// if(i==0){
// i++;
// var url="http://www.baidu.com/";
// tipContent += "<tr><td class='label'>" + varKey + "</td><td><a href="+url+" target='_blank' style='color:blue;text-decoration:none;'>" + varValue + "</a><td/></tr>";
// return true;
// }
if (varValue) {
tipContent += "<tr><td class='label'>" + varKey + "</td><td>" + varValue + "<td/></tr>";
}
});
tipContent += "</table>";
return tipContent;
},
position: {
at: 'bottom left',
adjust: {
x: 3
}
}
// ,
// hide: {
// delay: 1000,
// //event: 'mouseleave',
// fixed: true,
// effect: function() {
// $(this).slideUp();
// }
// }
});
});
}
$(function() {
graphTrace();
});
</script>
</head>
<body>
</body>
</html>
后台
package com.wantwe.activiti.controller;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.activiti.bpmn.model.BpmnModel;
import org.activiti.engine.HistoryService;
import org.activiti.engine.ManagementService;
import org.activiti.engine.ProcessEngineConfiguration;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.delegate.Expression;
import org.activiti.engine.history.HistoricActivityInstance;
import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.impl.RepositoryServiceImpl;
import org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior;
import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.activiti.engine.impl.context.Context;
import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;
import org.activiti.engine.impl.pvm.PvmTransition;
import org.activiti.engine.impl.pvm.delegate.ActivityBehavior;
import org.activiti.engine.impl.pvm.process.ActivityImpl;
import org.activiti.engine.impl.task.TaskDefinition;
import org.activiti.engine.runtime.Execution;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.image.ProcessDiagramGenerator;
import org.activiti.spring.ProcessEngineFactoryBean;
import org.apache.commons.beanutils.PropertyUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping("/activitiInmage")
public class ActivitiImage {
@Autowired
RepositoryService repositoryService;
@Autowired
ManagementService managementService;
@Autowired
protected RuntimeService runtimeService;
@Autowired
ProcessEngineConfiguration processEngineConfiguration;
@Autowired
ProcessEngineFactoryBean processEngine;
@Autowired
HistoryService historyService;
@Autowired
TaskService taskService;
@RequestMapping(params="goImage")
public String goImage(String proid,HttpServletRequest req){
req.setAttribute("proid", proid);
return "collection/activiti/runningPic";
}
@RequestMapping(params="queryProPlan")
public void queryProPlan(HttpServletRequest request,HttpServletResponse response) throws IOException{
String processInstanceId = request.getParameter("ProcessInstanceId");
//获取历史流程实例
HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
//获取流程图
BpmnModel bpmnModel = repositoryService.getBpmnModel(processInstance.getProcessDefinitionId());
processEngineConfiguration = processEngine.getProcessEngineConfiguration();
Context.setProcessEngineConfiguration((ProcessEngineConfigurationImpl) processEngineConfiguration);
ProcessDiagramGenerator diagramGenerator = processEngineConfiguration.getProcessDiagramGenerator();
ProcessDefinitionEntity definitionEntity = (ProcessDefinitionEntity)repositoryService.getProcessDefinition(processInstance.getProcessDefinitionId());
List<HistoricActivityInstance> highLightedActivitList = historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstanceId).list();
//高亮环节id集合
List<String> highLightedActivitis = new ArrayList<String>();
//高亮线路id集合
List<String> highLightedFlows = getHighLightedFlows(definitionEntity,highLightedActivitList);
for(HistoricActivityInstance tempActivity : highLightedActivitList){
String activityId = tempActivity.getActivityId();
highLightedActivitis.add(activityId);
}
//中文显示的是口口口,设置字体就好了
InputStream imageStream = diagramGenerator.generateDiagram(bpmnModel, "png", highLightedActivitis,highLightedFlows,"宋体","宋体",null,null, 1.0);
//单独返回流程图,不高亮显示
// InputStream imageStream = diagramGenerator.generatePngDiagram(bpmnModel);
// 输出资源内容到相应对象
byte[] b = new byte[1024];
int len;
while ((len = imageStream.read(b, 0, 1024)) != -1) {
response.getOutputStream().write(b, 0, len);
}
}
/**
* 获取需要高亮的线
* @param processDefinitionEntity
* @param historicActivityInstances
* @return
*/
private List<String> getHighLightedFlows(
ProcessDefinitionEntity processDefinitionEntity,
List<HistoricActivityInstance> historicActivityInstances) {
List<String> highFlows = new ArrayList<String>();// 用以保存高亮的线flowId
for (int i = 0; i < historicActivityInstances.size() - 1; i++) {// 对历史流程节点进行遍历
ActivityImpl activityImpl = processDefinitionEntity
.findActivity(historicActivityInstances.get(i)
.getActivityId());// 得到节点定义的详细信息
List<ActivityImpl> sameStartTimeNodes = new ArrayList<ActivityImpl>();// 用以保存后需开始时间相同的节点
ActivityImpl sameActivityImpl1 = processDefinitionEntity
.findActivity(historicActivityInstances.get(i + 1)
.getActivityId());
// 将后面第一个节点放在时间相同节点的集合里
sameStartTimeNodes.add(sameActivityImpl1);
for (int j = i + 1; j < historicActivityInstances.size() - 1; j++) {
HistoricActivityInstance activityImpl1 = historicActivityInstances
.get(j);// 后续第一个节点
HistoricActivityInstance activityImpl2 = historicActivityInstances
.get(j + 1);// 后续第二个节点
if (activityImpl1.getStartTime().equals(
activityImpl2.getStartTime())) {
// 如果第一个节点和第二个节点开始时间相同保存
ActivityImpl sameActivityImpl2 = processDefinitionEntity
.findActivity(activityImpl2.getActivityId());
sameStartTimeNodes.add(sameActivityImpl2);
} else {
// 有不相同跳出循环
break;
}
}
List<PvmTransition> pvmTransitions = activityImpl
.getOutgoingTransitions();// 取出节点的所有出去的线
for (PvmTransition pvmTransition : pvmTransitions) {
// 对所有的线进行遍历
ActivityImpl pvmActivityImpl = (ActivityImpl) pvmTransition
.getDestination();
// 如果取出的线的目标节点存在时间相同的节点里,保存该线的id,进行高亮显示
if (sameStartTimeNodes.contains(pvmActivityImpl)) {
highFlows.add(pvmTransition.getId());
}
}
}
return highFlows;
}
@RequestMapping(params = "processTip")
@ResponseBody
public List<Map<String, Object>> traceProcess(@RequestParam("pid") String processInstanceId) throws Exception {
List<Map<String, Object>> activityInfos = traceProcess2(processInstanceId);
return activityInfos;
}
public List<Map<String, Object>> traceProcess2(String processInstanceId) throws Exception {
Execution execution = runtimeService.createExecutionQuery().executionId(processInstanceId).singleResult();//执行实例
if(null == execution)return null;
Object property = PropertyUtils.getProperty(execution, "activityId");
String activityId = "";
if (property != null) {
activityId = property.toString();
}
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId)
.singleResult();
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService)
.getDeployedProcessDefinition(processInstance.getProcessDefinitionId());
List<ActivityImpl> activitiList = processDefinition.getActivities();//获得当前任务的所有节点
List<Map<String, Object>> activityInfos = new ArrayList<Map<String, Object>>();
for (ActivityImpl activity : activitiList) {
boolean currentActiviti = false;
String id = activity.getId();
// 当前节点
if (id.equals(activityId)) {
currentActiviti = true;
}
Map<String, Object> activityImageInfo = packageSingleActivitiInfo(activity, currentActiviti);
activityInfos.add(activityImageInfo);
}
return activityInfos;
}
/**
* 封装输出信息,包括:当前节点的X、Y坐标、变量信息、任务类型、任务描述
*
* @param activity
* @param processInstance
* @param currentActiviti
* @return
*/
private Map<String, Object> packageSingleActivitiInfo(ActivityImpl activity,
boolean currentActiviti) throws Exception {
Map<String, Object> vars = new HashMap<String, Object>();
Map<String, Object> activityInfo = new HashMap<String, Object>();
activityInfo.put("currentActiviti", currentActiviti);
setPosition(activity, activityInfo);
setWidthAndHeight(activity, activityInfo);
Map<String, Object> properties = activity.getProperties();
vars.put("任务类型", WorkflowUtils.parseToZhType(properties.get("type").toString()));
ActivityBehavior activityBehavior = activity.getActivityBehavior();
if (activityBehavior instanceof UserTaskActivityBehavior) {
UserTaskActivityBehavior userTaskActivityBehavior = (UserTaskActivityBehavior) activityBehavior;
TaskDefinition taskDefinition = userTaskActivityBehavior.getTaskDefinition();
Set<Expression> candidateGroupIdExpressions = taskDefinition.getCandidateGroupIdExpressions();
}
vars.put("节点说明", properties.get("documentation"));
String description = activity.getProcessDefinition().getDescription();
vars.put("描述", description);
activityInfo.put("vars", vars);
return activityInfo;
}
/**
* 设置宽度、高度属性
*
* @param activity
* @param activityInfo
*/
private void setWidthAndHeight(ActivityImpl activity, Map<String, Object> activityInfo) {
activityInfo.put("width", activity.getWidth());
activityInfo.put("height", activity.getHeight());
}
/**
* 设置坐标位置
*
* @param activity
* @param activityInfo
*/
private void setPosition(ActivityImpl activity, Map<String, Object> activityInfo) {
activityInfo.put("x", activity.getX());
activityInfo.put("y", activity.getY());
}
}
流程图文字描述
public Map<String, Object> getWordInfo(String modelId) throws Exception {
String id = (String) super.getSession().createSQLQuery("select id_ from ACT_RE_MODEL where key_ = '"+modelId+"'").uniqueResult();
BpmnJsonConverter jsonConverter = new BpmnJsonConverter();
byte[] modelEditorSource = repositoryService.getModelEditorSource(id);
JsonNode editorNode = new ObjectMapper().readTree(modelEditorSource);
BpmnModel bpmnModel = jsonConverter.convertToBpmnModel(editorNode);
Map<String, Object> mainMap = new HashMap<>();
if (bpmnModel != null) {
int index = 1;
Collection<FlowElement> flowElements = bpmnModel.getMainProcess().getFlowElements();
{
List<Map<String, Object>> list = new ArrayList<>();
for (Object e : flowElements) {
Map<String, Object> map = new HashMap<>();
if (e instanceof StartEvent) {
map.put("index", index);
map.put("clr", "");
map.put("name", ((StartEvent) e).getName());
mainMap.put("StartEvent", map);
++index;
}
if (e instanceof UserTask) {
boolean isEnd = false;
map.put("index", index);
map.put("name", ((UserTask) e).getName());
String clr="";
if(StringUtil.isNotEmpty(((UserTask) e).getAssignee()))
clr= (String) super.getSession().createSQLQuery("select realname from t_s_base_user where id = '"+((UserTask) e).getAssignee()+"'").uniqueResult();
map.put("clr", StringUtil.isNotEmpty(clr)?clr:((UserTask) e).getAssignee());
map.put("id", ((UserTask) e).getId());
// List<SequenceFlow> outgoingFlows = ((UserTask) e).getOutgoingFlows();
// for (SequenceFlow sequenceFlow : outgoingFlows)
// if (isEnd = ("end".equals(sequenceFlow.getTargetRef()))) {
// map.put("isEnd", isEnd);
// break;
// }
list.add(map);
++index;
}
}
mainMap.put("userTask", list);
}
List<Map<String, Object>> object = (List<Map<String, Object>>) mainMap.get("userTask");
for (Object e : flowElements) {
Map<String, Object> map = new HashMap<>();
if (e instanceof EndEvent) {
map.put("index", index);
map.put("clr", "");
map.put("name", ((EndEvent) e).getName());
mainMap.put("EndEvent", map);
}
// System.out.println("flowelement id:" + e.getId() + " name:" +
// e.getName() + " class:" + e.getClass().toString());
}
List<ExclusiveGateway> listExclus=new ArrayList<>();
for (Object e : flowElements) {
if (e instanceof ExclusiveGateway) {
listExclus.add((ExclusiveGateway) e);
}
}
boolean flag = false;
for (Map<String, Object> mapTemp : object) {
flag = false;
List<Map<String, Object>> list = new ArrayList<>();
for (Object e : flowElements) {
if (e instanceof SequenceFlow) {
if (StringUtil.isEmpty(((FlowElement) e).getId()))continue;
String source = ((SequenceFlow) e).getSourceRef();
String taget = ((SequenceFlow) e).getTargetRef();
if (source.equals(mapTemp.get("id"))) {
for (ExclusiveGateway excl : listExclus) {
if(taget.equals(excl.getId())){
for (Object e2 : flowElements) {
if (e2 instanceof SequenceFlow) {
if (StringUtil.isEmpty(((FlowElement) e2).getId()))continue;
String source2 = ((SequenceFlow) e2).getSourceRef();
String taget2 = ((SequenceFlow) e2).getTargetRef();
if(source2.equals(excl.getId())){
for (Map<String, Object> mapTemp2 : object) {
if (taget2.equals(mapTemp2.get("id"))
|| taget2.equals("end")) {
if (flag && taget2.equals("end"))
continue;
Map<String, Object> map = new HashMap<>();
flag = taget2.equals("end");
if (source.equals("sqrcl"))
map.put("name", "同意".equals(((SequenceFlow) e2).getName()) ? "重新申请" : "取消申请");
else
map.put("name", ((SequenceFlow) e2).getName());
map.put("index", !taget2.equals("end") ? (mapTemp2.get("index").toString()+"."+mapTemp2.get("name").toString()) : index+".结束");
list.add(map);
continue;
}
}
}
}
}
mapTemp.put("flow", list);
}
}
}
}
}
}
}
return mainMap;
}
流程图审批信息
SELECT H1.ACT_NAME_ JDMC,
(
CASE
WHEN H1.ASSIGNEE_ IS NULL and H1.ACT_NAME_='开始'
THEN
(SELECT NVL(Tsu.Realname,H3.start_user_id_)
FROM ACT_HI_PROCINST H3
LEFT JOIN T_S_BASE_USER TSU
ON H3.start_user_id_ =TSU.ID
WHERE H3.PROC_INST_ID_ = H1.PROC_INST_ID_
)
ELSE NVL(
(SELECT REALNAME FROM T_S_BASE_USER WHERE ID = H1.ASSIGNEE_
),H1.ASSIGNEE_)
END) JDCLR,
(
CASE
WHEN H1.ASSIGNEE_ IS NULL and H1.ACT_NAME_='开始'
THEN
(SELECT H3.start_user_id_
FROM ACT_HI_PROCINST H3
WHERE H3.PROC_INST_ID_ = H1.PROC_INST_ID_
)
ELSE
H1.ASSIGNEE_
END) JDCLRId,
NVL(
(SELECT REALNAME FROM T_S_BASE_USER WHERE ID = hh.owner_
),hh.owner_) dlrname,
hh.owner_ dlrid,
H2.MESSAGE_ CLXX,
TO_CHAR( H1.START_TIME_,'YYYY-MM-DD hh24:mi:ss') KSSJ,
TO_CHAR( H1.END_TIME_,'YYYY-MM-DD hh24:mi:ss') JSSJ
FROM ACT_HI_ACTINST H1
LEFT JOIN ACT_HI_COMMENT H2
ON H1.TASK_ID_ =H2.TASK_ID_
left join ACT_HI_TASKINST hh
on h1.TASK_ID_=hh.id_
WHERE H1.PROC_INST_ID_=:proId
AND H1.ACT_NAME_ IS NOT NULL
ORDER BY H1.Start_Time_,H1.ID_ ASC