Commit aa25e164 by Java-曹文达

添加查看高亮流程图

parent 58127b81
......@@ -5,6 +5,7 @@ import com.bbd.bpm.result.Result;
import com.bbd.bpm.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
/**
* 用户功能模块管理
......@@ -102,6 +103,18 @@ public class UserWebController {
return "deployment/importDeployment";
}
/**
* @Author:cwd
* @Description:进入组织管理
* @Date: 2019/03/04 22:53
* @Param:
* @return
**/
@GetMapping(value = "toSee")
public String toSee(String taskId,String executionId,ModelMap modelMap){
modelMap.addAttribute("taskId",taskId);
modelMap.addAttribute("executionId",executionId);
return "deployment/deplyment";
}
}
package com.bbd.bpm.dto.request;
import java.io.Serializable;
/**
* Created by yanlj on 2017/10/19.
*/
public class SpecialRequest implements Serializable {
private String userToken;
private String taskId;
private String executionId;
private String processInstanceId;
private String procdefId;
public String getUserToken() {
return userToken;
}
public void setUserToken(String userToken) {
this.userToken = userToken;
}
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public String getExecutionId() {
return executionId;
}
public void setExecutionId(String executionId) {
this.executionId = executionId;
}
public String getProcessInstanceId() {
return processInstanceId;
}
public void setProcessInstanceId(String processInstanceId) {
this.processInstanceId = processInstanceId;
}
public String getProcdefId() {
return procdefId;
}
public void setProcdefId(String procdefId) {
this.procdefId = procdefId;
}
}
......@@ -18,6 +18,12 @@ public class QueryPiByUserIdBean {
private String processNodeName;
private String taskId;
private String executionId;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date startTime;
......@@ -91,4 +97,21 @@ public class QueryPiByUserIdBean {
public void setProcessNodeName(String processNodeName) {
this.processNodeName = processNodeName;
}
public String getExecutionId() {
return executionId;
}
public void setExecutionId(String executionId) {
this.executionId = executionId;
}
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
}
package com.bbd.bpm.service;
import com.bbd.bpm.dto.request.SpecialRequest;
import java.io.IOException;
/**
* Created by yanlj on 2017/9/1.
*/
public interface ActivitiService {
/**
* 带跟踪的图片
*
* @param request
* @return
*/
byte[] traceProcessImage(SpecialRequest request) throws IOException;
}
package com.bbd.bpm.serviceImpl;
import com.bbd.bpm.dto.request.SpecialRequest;
import com.bbd.bpm.service.ActivitiService;
import org.activiti.bpmn.model.BpmnModel;
import org.activiti.engine.*;
import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.activiti.engine.impl.context.Context;
import org.activiti.engine.runtime.Execution;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.activiti.image.ProcessDiagramGenerator;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
/**
* Created by yanlj on 2017/9/1.
*/
@Component("activitiService")
public class ActivitiServiceImpl implements ActivitiService {
@Autowired
private RepositoryService repositoryService;
@Autowired
private RuntimeService runtimeService;
@Autowired
private TaskService taskService;
@Autowired
private ProcessEngineConfiguration processEngineConfiguration;
@Autowired
private ProcessEngine processEngine;
@Override
public byte[] traceProcessImage(SpecialRequest request) throws IOException {
Execution execution = null;
if (StringUtils.isNotBlank(request.getExecutionId())) {
execution = runtimeService.createExecutionQuery().executionId(request.getExecutionId()).singleResult();//执行实例
}
if (execution == null) {
if (StringUtils.isNotBlank(request.getTaskId())) {
Task task = taskService.createTaskQuery().taskId(request.getTaskId()).singleResult();
if (task != null) {
execution = runtimeService.createExecutionQuery().executionId(task.getExecutionId()).singleResult();//执行实例
}
}
}
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(execution.getProcessInstanceId()).singleResult();
BpmnModel bpmnModel = repositoryService.getBpmnModel(processInstance.getProcessDefinitionId());
List<String> activeActivityIds = runtimeService.getActiveActivityIds(execution.getId());
// 使用spring注入引擎请使用下面的这行代码
processEngineConfiguration = processEngine.getProcessEngineConfiguration();
Context.setProcessEngineConfiguration((ProcessEngineConfigurationImpl) processEngineConfiguration);
ProcessDiagramGenerator diagramGenerator = processEngineConfiguration.getProcessDiagramGenerator();
InputStream imageStream = diagramGenerator.generateDiagram(
bpmnModel,
"png",
activeActivityIds,
new ArrayList<String>(),
"宋体",
"宋体",
null,
null,1.0);
byte[] bytes = IOUtils.toByteArray(imageStream);
return bytes;
}
}
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" th:href="@{/css/common/base.css}" />
<link rel="stylesheet" th:href="@{/css/common/page_new.css}" />
<link rel="stylesheet" th:href="@{/js/plugins/bootstrapselect/css/product_list.css}" />
<link rel="stylesheet" th:href="@{/css/layui.css}" media="all">
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
</head>
<style>
#goBack {
background: #fff no-repeat 5px center;
}
</style>
<body>
<div class="box">
<h2><span></span>流程查看<button id="goBack" onclick="javascript:history.go(-1)" style="margin-right: 100px">返回</button><button onclick="location.reload()">刷新</button></h2>
<img id="image">
</div>
<input type="hidden" id="taskId" th:value="${taskId}">
<input type="hidden" id="executionId" th:value="${executionId}">
</body>
</html>
<script src="/js/plugins/jquery.min.js"></script>
<script src="/js/plugins/layer/layer.js"></script>
<script src="/js/layui.js"></script>
<script type="text/javascript" src="/js/plugins/page_new.js"></script>
<script>
$(function () {
var taskId=$("#taskId").val()
var executionId=$("#executionId").val()
var url="http://localhost:8087/api/bpm/task/process/trace/current?executionId="+executionId+"&taskId="+taskId
$("#image").attr("src",url)
})
</script>
......@@ -144,7 +144,7 @@
var total = data.total;
data = data.list;
var content = '';
content += '<thead><tr><th>流程实例Id</th><th>流程名称</th><th style="width: 8%">业务密钥</th><th>当前审批人</th><th style="width: 8%">审批节点名称</th><th style="width: 8%">审批开始时间</th><th style="width: 8%">审批结束时间</th></tr></thead>';
content += '<thead><tr><th>流程实例Id</th><th>流程名称</th><th style="width: 8%">业务密钥</th><th>当前审批人</th><th style="width: 8%">审批节点名称</th><th style="width: 8%">审批开始时间</th><th style="width: 8%">审批结束时间</th><th style="width: 8%">操作</th></tr></thead>';
if(data!=null){
for (var i in data) {
if(data[i].endTime==null){
......@@ -158,6 +158,11 @@
content += '<td class="product_name" style="width: 5%;">'+data[i].processNodeName+'</td>';
content += '<td class="product_name" style="width: 5%;">'+data[i].startTime+'</td>';
content += '<td class="product_name" style="width: 5%;">'+data[i].endTime+'</td>';
if(data[i].name=='已审批完成'){
content += '<td class="cao_zuo" disabled><span style="width: 16%">完成</span>';
}else {
content += '<td class="cao_zuo"><span style="width: 16%" onclick="toActivityDetail('+data[i].taskId+',\''+data[i].executionId+'\')">查看</span>';
}
content += '</tr></tbody>';
}
$('#pages').text(pages);
......@@ -202,6 +207,13 @@
},'json')
flushHtml(null,taskStatus);
}
/*查看流程 */
function toActivityDetail(taskId,executionId) {
location.href="/web/bpm/user/toSee?taskId="+taskId+"&executionId="+executionId
}
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment