flowable集成
This commit is contained in:
parent
9a31268153
commit
11422c57bf
|
@ -1,14 +1,13 @@
|
|||
package com.snow.web.controller.flowable;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.snow.common.annotation.Log;
|
||||
import com.snow.common.core.controller.BaseController;
|
||||
import com.snow.common.core.domain.AjaxResult;
|
||||
import com.snow.common.core.page.TableDataInfo;
|
||||
import com.snow.common.enums.BusinessType;
|
||||
import com.snow.common.exception.BusinessException;
|
||||
import com.snow.common.utils.StringUtils;
|
||||
import com.snow.flowable.domain.*;
|
||||
import com.snow.flowable.domain.ProcessInstanceDTO;
|
||||
import com.snow.flowable.domain.ProcessInstanceVO;
|
||||
import com.snow.flowable.domain.TaskVO;
|
||||
import com.snow.flowable.service.impl.FlowableServiceImpl;
|
||||
import com.snow.framework.util.ShiroUtils;
|
||||
import com.snow.system.domain.SysOaLeave;
|
||||
|
@ -16,10 +15,8 @@ import com.snow.system.domain.SysUser;
|
|||
import com.snow.system.service.ISysOaLeaveService;
|
||||
import org.flowable.engine.history.HistoricProcessInstance;
|
||||
import org.flowable.task.api.Task;
|
||||
import org.flowable.task.api.history.HistoricTaskInstance;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
|
|
@ -149,13 +149,6 @@ flowable:
|
|||
password: test
|
||||
|
||||
log4j:
|
||||
rootLogger: ERROR, CA
|
||||
|
||||
# ConsoleAppender
|
||||
appender:
|
||||
CA: org.apache.log4j.ConsoleAppender
|
||||
|
||||
|
||||
#custom
|
||||
logger:
|
||||
org:
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
log4j.rootLogger=DEBUG, CA
|
||||
|
||||
# ConsoleAppender
|
||||
log4j.appender.CA=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.CA.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.CA.layout.ConversionPattern= %d{hh:mm:ss,SSS} [%t] %-5p %c %x - %m%n
|
||||
|
||||
#custom
|
||||
log4j.logger.org.flowable.task.service.impl.persistence.entity=DEBUG
|
|
@ -9,6 +9,7 @@
|
|||
<link href="../static/css/font-awesome.min.css" th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
|
||||
<link href="../static/css/main/animate.min.css" th:href="@{/css/main/animate.min.css}" rel="stylesheet"/>
|
||||
<link href="../static/css/main/style.min862f.css" th:href="@{/css/main/style.min862f.css}" rel="stylesheet"/>
|
||||
<th:block th:include="include :: header('请假单列表')" />
|
||||
</head>
|
||||
|
||||
<body class="gray-bg">
|
||||
|
@ -87,6 +88,26 @@
|
|||
</div>
|
||||
<div class="ibox-content">
|
||||
<div class="row">
|
||||
<!-- <div class="col-sm-12 search-collapse">
|
||||
<form id="formId">
|
||||
<div class="select-list">
|
||||
<ul>
|
||||
<li>
|
||||
<label>流程名称:</label>
|
||||
<input type="text" name="processDefinitionName"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>单号:</label>
|
||||
<input type="text" name="businessKey"/>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
|
||||
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</form>
|
||||
</div>-->
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-table1"></table>
|
||||
</div>
|
||||
|
@ -108,12 +129,33 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-table"></table>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 search-collapse">
|
||||
<form id="formIds">
|
||||
<div class="select-list">
|
||||
<ul>
|
||||
<li>
|
||||
<label>节点名称:</label>
|
||||
<input type="text" name="taskName"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>单号:</label>
|
||||
<input type="text" name="businessKey"/>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
|
||||
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@ -134,6 +176,7 @@
|
|||
$(function() {
|
||||
var options = {
|
||||
id: "bootstrap-table1",
|
||||
formId:"formIds",
|
||||
url: prefix + "/findTasksByUserId",
|
||||
createUrl: prefix + "/add",
|
||||
updateUrl: prefix + "/edit/{id}",
|
||||
|
@ -141,98 +184,42 @@
|
|||
exportUrl: prefix + "/export",
|
||||
importUrl: prefix + "/importData",
|
||||
importTemplateUrl: prefix + "/importTemplate",
|
||||
striped: true, //是否显示行间隔色
|
||||
showToggle: false,
|
||||
loadingFontSize:20,
|
||||
showRefresh: false, // 是否显示刷新按钮
|
||||
showColumns: false, // 是否显示隐藏某列下拉框
|
||||
showToggle: false,
|
||||
showSearch: false, // 是否显示检索信息
|
||||
rowStyle:rowStyle,//通过自定义函数设置行样式
|
||||
modalName: "我的待办",
|
||||
columns: [{
|
||||
checkbox: false
|
||||
},
|
||||
{
|
||||
field: 'processDefinitionName',
|
||||
title: '流程名称'
|
||||
},
|
||||
{
|
||||
field: 'businessKey',
|
||||
title: '单号'
|
||||
|
||||
},
|
||||
{
|
||||
field: 'processDefinitionKey',
|
||||
title: '流程key'
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
field: 'name',
|
||||
title: '任务名称'
|
||||
},
|
||||
|
||||
{
|
||||
field: 'startUserName',
|
||||
title: '流程发起人'
|
||||
},
|
||||
{
|
||||
field: 'startTime',
|
||||
title: '流程创建时间'
|
||||
},
|
||||
{
|
||||
field: 'endTime',
|
||||
title: '流程结束时间'
|
||||
},
|
||||
|
||||
{
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
formatter: function(value, row, index) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="cancelTask(\'' + row.businessKey + '\',\''+row.taskId+'\')"><i class="fa fa-edit"></i>处理</a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="getProcessDiagram(\'' + row.processInstanceId + '\')"><i class="fa fa-eye"></i>获取流程图</a>');
|
||||
return actions.join('');
|
||||
}
|
||||
}]
|
||||
};
|
||||
$.table.init(options);
|
||||
});
|
||||
|
||||
function cancelTask(businessKey,taskId) {
|
||||
console.log(JSON.stringify(taskId));
|
||||
var preViewUrl=prefixFlow+'/toFinishTask?businessKey='+businessKey+'&taskId='+taskId;
|
||||
$.modal.openTab("审批", preViewUrl);
|
||||
}
|
||||
function getProcessDiagram(processInstanceId) {
|
||||
|
||||
var preViewUrl=prefix+'/getProcessDiagram?processInstanceId='+processInstanceId;
|
||||
$.modal.openTab("流程图", preViewUrl);
|
||||
}
|
||||
</script>
|
||||
<script th:inline="javascript">
|
||||
var editFlag = [[${@permission.hasPermi('system:flow:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('system:flow:remove')}]];
|
||||
var prefix = ctx + "modeler";
|
||||
var prefixFlow = ctx + "flow";
|
||||
$(function() {
|
||||
var options = {
|
||||
url: prefixFlow + "/getMyHistoricProcessInstance",
|
||||
modalName: "我的待办",
|
||||
columns: [{
|
||||
checkbox: false
|
||||
title: '序号',
|
||||
formatter: function (value, row, index) {
|
||||
return index+1;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'taskId',
|
||||
title: 'taskId',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'processDefinitionName',
|
||||
title: '流程名称'
|
||||
},
|
||||
{
|
||||
field: 'taskName',
|
||||
title: '任务名称'
|
||||
},
|
||||
{
|
||||
field: 'businessKey',
|
||||
title: '单号'
|
||||
|
||||
},
|
||||
{
|
||||
field: 'taskName',
|
||||
title: '审批节点'
|
||||
|
||||
},
|
||||
|
||||
/* {
|
||||
field: 'name',
|
||||
title: '任务名称'
|
||||
},*/
|
||||
|
||||
{
|
||||
field: 'startUserName',
|
||||
title: '流程发起人'
|
||||
|
@ -252,7 +239,7 @@
|
|||
formatter: function(value, row, index) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="cancelTask(\'' + row.businessKey + '\',\''+row.taskId+'\')"><i class="fa fa-edit"></i>处理</a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="getProcessDiagram(\'' + row.processInstanceId + '\')"><i class="fa fa-eye"></i>获取流程图</a>');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="getProcessDiagram(\'' + row.processInstanceId + '\')"><i class="fa fa-eye"></i>流程图</a>');
|
||||
return actions.join('');
|
||||
}
|
||||
}]
|
||||
|
@ -271,5 +258,84 @@
|
|||
$.modal.openTab("流程图", preViewUrl);
|
||||
}
|
||||
</script>
|
||||
<script th:inline="javascript">
|
||||
var removeFlag = [[${@permission.hasPermi('system:flow:remove')}]];
|
||||
var prefix = ctx + "modeler";
|
||||
var prefixFlow = ctx + "flow";
|
||||
$(function() {
|
||||
var options = {
|
||||
url: prefixFlow + "/getMyHistoricProcessInstance",
|
||||
modalName: "我的待办",
|
||||
striped: true, //是否显示行间隔色
|
||||
showToggle: false,
|
||||
loadingFontSize:20,
|
||||
showRefresh: false, // 是否显示刷新按钮
|
||||
showColumns: false, // 是否显示隐藏某列下拉框
|
||||
showToggle: false,
|
||||
showSearch: false, // 是否显示检索信息
|
||||
rowStyle:rowStyle,//通过自定义函数设置行样式
|
||||
columns: [
|
||||
{
|
||||
title: '序号',
|
||||
formatter: function (value, row, index) {
|
||||
return index+1;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'processDefinitionName',
|
||||
title: '流程名称'
|
||||
},
|
||||
|
||||
{
|
||||
field: 'businessKey',
|
||||
title: '单号'
|
||||
|
||||
},
|
||||
{
|
||||
field: 'startUserId',
|
||||
title: '流程发起人'
|
||||
},
|
||||
{
|
||||
field: 'isFinished',
|
||||
title: '流程状态'
|
||||
},
|
||||
|
||||
{
|
||||
field: 'startTime',
|
||||
title: '流程创建时间'
|
||||
},
|
||||
{
|
||||
field: 'endTime',
|
||||
title: '流程结束时间'
|
||||
},
|
||||
|
||||
{
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
formatter: function(value, row, index) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="getProcessDiagram(\'' + row.id + '\')"><i class="fa fa-eye"></i>流程图</a>');
|
||||
return actions.join('');
|
||||
}
|
||||
}]
|
||||
};
|
||||
$.table.init(options);
|
||||
});
|
||||
|
||||
function getProcessDiagram(processInstanceId) {
|
||||
|
||||
var preViewUrl=prefix+'/getProcessDiagram?processInstanceId='+processInstanceId;
|
||||
$.modal.openTab("流程图", preViewUrl);
|
||||
}
|
||||
function rowStyle(row, index) {
|
||||
var classes = [ 'success', 'info', 'warning', 'danger'];
|
||||
if (index % 2 === 0 && index / 2 < classes.length) {
|
||||
return {
|
||||
classes: classes[index / 2]
|
||||
};
|
||||
}
|
||||
return {};
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,15 +1,22 @@
|
|||
package com.snow.flowable.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.snow.common.utils.StringUtils;
|
||||
import com.snow.common.utils.bean.BeanUtils;
|
||||
import com.snow.common.utils.spring.SpringUtils;
|
||||
import com.snow.system.service.impl.SysConfigServiceImpl;
|
||||
import com.snow.system.service.impl.SysUserServiceImpl;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.flowable.engine.history.HistoricProcessInstance;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author qimingjin
|
||||
|
@ -23,21 +30,36 @@ import java.util.Set;
|
|||
@NoArgsConstructor
|
||||
public class ProcessInstanceVO implements Serializable {
|
||||
|
||||
|
||||
private String id;
|
||||
/**
|
||||
* 流程定义ID
|
||||
*/
|
||||
public String processDefinitionId;
|
||||
|
||||
/**
|
||||
* 流程定义名称
|
||||
*/
|
||||
public String processDefinitionName;
|
||||
|
||||
/**
|
||||
* 流程定义key
|
||||
*/
|
||||
public String processDefinitionKey;
|
||||
|
||||
|
||||
/**
|
||||
* 流程版本号
|
||||
*/
|
||||
public Integer processDefinitionVersion;
|
||||
|
||||
/**
|
||||
* 发布ID
|
||||
*/
|
||||
public String deploymentId;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
public Date startTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
public Date endTime;
|
||||
|
||||
|
@ -46,14 +68,17 @@ public class ProcessInstanceVO implements Serializable {
|
|||
public String startUserId;
|
||||
|
||||
public String startActivityId;
|
||||
|
||||
/**
|
||||
* 删除理由
|
||||
*/
|
||||
public String deleteReason;
|
||||
|
||||
/**
|
||||
* 父流程ID
|
||||
*/
|
||||
public String superProcessInstanceId;
|
||||
|
||||
public String tenantId;
|
||||
|
||||
public String name;
|
||||
|
||||
public String description;
|
||||
|
||||
|
@ -61,22 +86,31 @@ public class ProcessInstanceVO implements Serializable {
|
|||
|
||||
public String callbackType;
|
||||
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 业务参数
|
||||
*/
|
||||
public String businessKey;
|
||||
/**
|
||||
* 是否结束(0--进行中,1--结束)
|
||||
*/
|
||||
public Integer isFinished;
|
||||
|
||||
public boolean finished;
|
||||
|
||||
public boolean unfinished;
|
||||
|
||||
public boolean deleted;
|
||||
|
||||
public boolean notDeleted;
|
||||
|
||||
|
||||
public String processDefinitionCategory;
|
||||
|
||||
|
||||
|
||||
public static List<ProcessInstanceVO> warpList(List<HistoricProcessInstance> historicProcessInstanceList){
|
||||
return historicProcessInstanceList.stream().map(t->{
|
||||
ProcessInstanceVO processInstanceVO=new ProcessInstanceVO();
|
||||
BeanUtils.copyProperties(t,processInstanceVO);
|
||||
if(StringUtils.isEmpty(t.getEndActivityId())){
|
||||
processInstanceVO.setIsFinished(0);
|
||||
}else {
|
||||
processInstanceVO.setIsFinished(1);
|
||||
}
|
||||
return processInstanceVO;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -472,8 +472,8 @@ public class FlowableServiceImpl implements FlowableService {
|
|||
orderByProcessInstanceStartTime().
|
||||
desc().
|
||||
listPage(processInstanceDTO.getFirstResult(), processInstanceDTO.getMaxResults());
|
||||
List<ProcessInstanceVO> processInstanceVOS = com.snow.common.utils.bean.BeanUtils.transformList(historicProcessInstances, ProcessInstanceVO.class);
|
||||
return processInstanceVOS;
|
||||
//List<ProcessInstanceVO> processInstanceVOS = com.snow.common.utils.bean.BeanUtils.transformList(historicProcessInstances, ProcessInstanceVO.class);
|
||||
return ProcessInstanceVO.warpList(historicProcessInstances);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue