1111
This commit is contained in:
parent
005d15165f
commit
00e40fc162
|
@ -134,7 +134,6 @@ public class FlowController extends BaseController {
|
|||
SysUser sysUser = ShiroUtils.getSysUser();
|
||||
processInstanceDTO.setStartedUserId(String.valueOf(sysUser.getUserId()));
|
||||
PageModel<ProcessInstanceVO> historicProcessInstance = flowableService.getHistoricProcessInstance(processInstanceDTO);
|
||||
log.info(JSON.toJSONString(historicProcessInstance.getPagedRecords()));
|
||||
return getFlowDataTable(historicProcessInstance);
|
||||
}
|
||||
|
||||
|
@ -150,7 +149,7 @@ public class FlowController extends BaseController {
|
|||
//已审批的任务
|
||||
HistoricTaskInstanceDTO historicTaskInstanceDTO=new HistoricTaskInstanceDTO();
|
||||
historicTaskInstanceDTO.setProcessInstanceId(processInstanceId);
|
||||
List<HistoricTaskInstanceVO> historicTaskInstanceList= flowableService.getHistoricTaskInstanceNoPage(historicTaskInstanceDTO);
|
||||
List<HistoricTaskInstanceVO> historicTaskInstanceList= flowableTaskService.getHistoricTaskInstanceNoPage(historicTaskInstanceDTO);
|
||||
//获取业务数据
|
||||
AppForm appFrom = appFormService.getAppFrom(processInstanceId);
|
||||
modelMap.put("historicTaskInstanceList",historicTaskInstanceList);
|
||||
|
@ -165,11 +164,11 @@ public class FlowController extends BaseController {
|
|||
* 跳转我的已办
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("flow:process:getMyTakePartInProcess")
|
||||
@GetMapping("/toMyTakePartInProcess")
|
||||
@RequiresPermissions("flow:process:getMyTakePartInTask")
|
||||
@GetMapping("/toMyTakePartInTask")
|
||||
public String getMyTakePartInProcess() {
|
||||
|
||||
return prefix+"/myTakePartInProcess";
|
||||
return prefix+"/my-taked";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -177,16 +176,32 @@ public class FlowController extends BaseController {
|
|||
* @param historicTaskInstanceDTO
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("flow:process:getMyTakePartInProcess")
|
||||
@PostMapping("/getMyTakePartInProcess")
|
||||
@RequiresPermissions("flow:process:getMyTakePartInTask")
|
||||
@PostMapping("/getMyTakePartInTask")
|
||||
@ResponseBody
|
||||
public TableDataInfo getMyTakePartInProcess(HistoricTaskInstanceDTO historicTaskInstanceDTO){
|
||||
SysUser sysUser = ShiroUtils.getSysUser();
|
||||
historicTaskInstanceDTO.setUserId(String.valueOf(sysUser.getUserId()));
|
||||
PageModel<HistoricTaskInstanceVO> historicTaskInstance = flowableService.getHistoricTaskInstance(historicTaskInstanceDTO);
|
||||
PageModel<HistoricTaskInstanceVO> historicTaskInstance = flowableTaskService.getHistoricTaskInstance(historicTaskInstanceDTO);
|
||||
return getFlowDataTable(historicTaskInstance);
|
||||
}
|
||||
|
||||
@RequiresPermissions("flow:process:myTaskedDetail")
|
||||
@GetMapping("/getMyTaskedDetail")
|
||||
public String getMyTaskedDetail(String taskId,ModelMap modelMap){
|
||||
//获取任务实例
|
||||
HistoricTaskInstanceVO hisTask = flowableTaskService.getHisTask(taskId);
|
||||
//获取业务数据
|
||||
AppForm appFrom = appFormService.getAppFrom(hisTask.getProcessInstanceId());
|
||||
//获取流程实例
|
||||
ProcessInstanceVO processInstanceVo = flowableService.getProcessInstanceVoById(hisTask.getProcessInstanceId());
|
||||
modelMap.put("hisTask",hisTask);
|
||||
modelMap.put("appFrom",appFrom);
|
||||
modelMap.put("processInstance",processInstanceVo);
|
||||
modelMap.put("busVarUrl",appFrom.getBusVarUrl());
|
||||
modelMap.put("appId",ReflectUtil.getFieldValue(appFrom,"id"));
|
||||
return prefix+"/my-task-detail";
|
||||
}
|
||||
/**
|
||||
* 转办任务
|
||||
* @return
|
||||
|
|
|
@ -73,6 +73,14 @@ public class FlowModelerController extends BaseController
|
|||
return prefix + "/deployment";
|
||||
}
|
||||
|
||||
@RequiresPermissions("modeler:deployment:detail")
|
||||
@GetMapping("/getDeploymentDetail/{id}")
|
||||
public String getDeploymentDetail(@PathVariable("id")String id , ModelMap modelMap) {
|
||||
DeploymentVO deploymentDetailById = flowableService.getDeploymentDetailById(id);
|
||||
modelMap.put("deploymentVO",deploymentDetailById);
|
||||
return prefix + "/deployment-detail";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询发布实例列表
|
||||
*/
|
||||
|
|
|
@ -17,6 +17,7 @@ import com.snow.common.utils.ServletUtils;
|
|||
import com.snow.common.utils.StringUtils;
|
||||
import com.snow.flowable.domain.*;
|
||||
import com.snow.flowable.service.FlowableService;
|
||||
import com.snow.flowable.service.FlowableTaskService;
|
||||
import com.snow.framework.shiro.service.SysPasswordService;
|
||||
import com.snow.framework.util.ShiroUtils;
|
||||
import com.snow.system.domain.*;
|
||||
|
@ -63,6 +64,9 @@ public class SysIndexController extends BaseController
|
|||
@Autowired
|
||||
private FlowableService flowableService;
|
||||
|
||||
@Autowired
|
||||
private FlowableTaskService flowableTaskService;
|
||||
|
||||
@Autowired
|
||||
private SysDingtalkSyncLogServiceImpl sysDingtalkSyncLogService;
|
||||
|
||||
|
@ -178,7 +182,7 @@ public class SysIndexController extends BaseController
|
|||
historicTaskInstanceDTO.setPageNum(1);
|
||||
historicTaskInstanceDTO.setPageSize(5);
|
||||
historicTaskInstanceDTO.setUserId(String.valueOf(sysUser.getUserId()));
|
||||
PageModel<HistoricTaskInstanceVO> historicTaskInstance = flowableService.getHistoricTaskInstance(historicTaskInstanceDTO);
|
||||
PageModel<HistoricTaskInstanceVO> historicTaskInstance = flowableTaskService.getHistoricTaskInstance(historicTaskInstanceDTO);
|
||||
mmap.put("historicTaskInstanceList",historicTaskInstance.getPagedRecords());
|
||||
mmap.put("historicTaskInstanceSize",historicTaskInstance.getPagedRecords().size());
|
||||
return "main";
|
||||
|
|
|
@ -195,7 +195,7 @@ public class SysOaLeaveController extends BaseController
|
|||
historicTaskInstanceDTO.setBusinessKey(sysOaLeave.getLeaveNo());
|
||||
historicTaskInstanceDTO.setProcessInstanceId(sysOaLeave.getProcessInstanceId());
|
||||
historicTaskInstanceDTO.setProcessStatus(WorkRecordStatus.FINISHED);
|
||||
List<HistoricTaskInstanceVO> historicTaskInstanceList= flowableService.getHistoricTaskInstanceNoPage(historicTaskInstanceDTO);
|
||||
List<HistoricTaskInstanceVO> historicTaskInstanceList= flowableTaskService.getHistoricTaskInstanceNoPage(historicTaskInstanceDTO);
|
||||
String spendTime = DateUtil.formatBetween(sysOaLeave.getStartTime(), sysOaLeave.getEndTime(), BetweenFormater.Level.SECOND);
|
||||
sysOaLeave.setLeaveTime(spendTime);
|
||||
mmap.put("sysOaLeave", sysOaLeave);
|
||||
|
|
|
@ -6,9 +6,9 @@ spring:
|
|||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://localhost:3306/snow?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: root
|
||||
url: jdbc:mysql://rm-bp1j1554xv1qs04295o.mysql.rds.aliyuncs.com:3306/snow-dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
|
||||
username: cloud_root
|
||||
password: Jin!152377
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
|
|
|
@ -0,0 +1,110 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/html">
|
||||
<head>
|
||||
<th:block th:include="include :: header('我发起的流程详情')" />
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<input name="deploymentId" id="deploymentId" th:value="${deploymentVO.id}" type="hidden" >
|
||||
<div class="ibox float-e-margins">
|
||||
<h4 class="form-header h4">发布概况</h4>
|
||||
<div class="vertical-timeline-block" >
|
||||
<div class="row">
|
||||
<div class="col-xs-1 col-sm-1 "></div>
|
||||
<div class="col-xs-5 col-sm-5 ">
|
||||
<label class="control-label">流程分类:</label>
|
||||
<span class="form-control-static" th:text="${@dict.getLabel('flow_category',deploymentVO.category)}">
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-xs-5 col-sm-5 ">
|
||||
<label class="control-label">流程名称:</label>
|
||||
<span class="form-control-static" th:text="${deploymentVO.name}">
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-1 col-sm-1 "></div>
|
||||
<div class="col-xs-5 col-sm-5 ">
|
||||
<label class="control-label">发布key:</label>
|
||||
<span class="form-control-static" th:text="${deploymentVO.key}">
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-xs-5 col-sm-5 ">
|
||||
<label class="control-label">发布时间:</label>
|
||||
<span class="form-control-static" th:text="${#dates.format(deploymentVO.deploymentTime, 'yyyy-MM-dd hh:mm:ss')}">
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-1 col-sm-1 "></div>
|
||||
<div class="col-xs-5 col-sm-5 ">
|
||||
<label class="control-label">是否最新版本:</label>
|
||||
<span class="form-control-static" th:text="${deploymentVO.isNew}">
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="float-e-margins">
|
||||
<h4 class="form-header h4">流程定义表单</h4>
|
||||
<div class="vertical-timeline-block" >
|
||||
<div class="row">
|
||||
<div class="col-xs-1 col-sm-1 "></div>
|
||||
<div class="col-xs-10 col-sm-10 ">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>定义名称</th>
|
||||
<th>定义key</th>
|
||||
<th>版本</th>
|
||||
<th>定义描述</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="processDef,iterStat : ${deploymentVO.processDefVOList}">
|
||||
<td>[[${processDef.id}]]</td>
|
||||
<td>[[${processDef.name}]]</td>
|
||||
<td>[[${processDef.key}]]</td>
|
||||
<td>[[${processDef.version}]]</td>
|
||||
<td>[[${processDef.description}]]</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="float-e-margins">
|
||||
<h4 class="form-header h4">流程图</h4>
|
||||
|
||||
<div class="vertical-timeline-block" >
|
||||
<div class="row">
|
||||
<div class="col-xs-1 col-sm-1 "></div>
|
||||
<div class="col-xs-10 col-sm-10 ">
|
||||
<img class="imgcode" width="95%"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<script th:inline="javascript">
|
||||
|
||||
$(function () {
|
||||
var deploymentId= $("#deploymentId").val();
|
||||
var url ='/modeler/getFlowPicture?id='+deploymentId+'&resourceName=';
|
||||
$(".imgcode").attr("src", url);
|
||||
});
|
||||
|
||||
function getProcessDiagram() {
|
||||
var appId= $("#appId").val();
|
||||
var busVarUrl= $("#busVarUrl").val();
|
||||
$.modal.open('业务单', busVarUrl+"/"+appId);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -53,6 +53,7 @@
|
|||
var editFlag = [[${@permission.hasPermi('system:flow:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('system:flow:remove')}]];
|
||||
var flowCategoryDatas = [[${@dict.getType('flow_category')}]];
|
||||
var detailFlag = [[${@permission.hasPermi('modeler:deployment:detail')}]];
|
||||
var prefix = ctx + "modeler";
|
||||
$(function() {
|
||||
var options = {
|
||||
|
@ -61,6 +62,7 @@
|
|||
removeUrl: prefix + "/remove",
|
||||
exportUrl: prefix + "/export",
|
||||
importUrl: prefix + "/importData",
|
||||
detailUrl: prefix + "/getDeploymentDetail/{id}",
|
||||
importTemplateUrl: prefix + "/importTemplate",
|
||||
modalName: "流程发布实例",
|
||||
columns: [{
|
||||
|
@ -104,8 +106,8 @@
|
|||
|
||||
var getXmlUrl=prefix+'/getXml?id='+row.id+'&resourceName=';
|
||||
var actions = [];
|
||||
/* actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="previewXml(\'' + processDefinition.deploymentId + '\',\''+processDefinition.diagramResourceName+'\');"><i class="fa fa-edit"></i>流程图</a> ');*/
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="previewXml(\'' + row.id+ '\',);"><i class="fa fa-edit"></i>流程图</a> ');
|
||||
actions.push('<a class="btn btn-info btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-eye"></i>详情</a> ');
|
||||
/* actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="previewXml(\'' + row.id+ '\',);"><i class="fa fa-edit"></i>流程图</a> ');*/
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="'+getXmlUrl+'" target="_blank"><i class="fa fa-eye"></i>XML</a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||
return actions.join('');
|
||||
|
@ -120,7 +122,6 @@
|
|||
* @param tableId
|
||||
*/
|
||||
function previewXml(deploymentId) {
|
||||
console.log(JSON.stringify(deploymentId));
|
||||
var preViewUrl=prefix+'/getFlowPicture?id='+deploymentId+'&resourceName=';
|
||||
$.modal.openTab("预览流程图", preViewUrl);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
var prefixFlow = ctx + "flow";
|
||||
$(function() {
|
||||
var options = {
|
||||
url: prefixFlow + "/getMyTakePartInProcess",
|
||||
url: prefixFlow + "/getMyTakePartInTask",
|
||||
modalName: "我的已办",
|
||||
striped: true, //是否显示行间隔色
|
||||
showToggle: false,
|
||||
|
@ -62,7 +62,18 @@
|
|||
field: 'taskName',
|
||||
title: '任务名称'
|
||||
},
|
||||
|
||||
{
|
||||
field: 'isPass',
|
||||
title: '处理结果',
|
||||
formatter: function(value, row, index) {
|
||||
if(value=="true"){
|
||||
return '<span class="text-success">通过</span> ';
|
||||
}else if(value=="false"){
|
||||
return '<span class="text-danger" >驳回</span> ';
|
||||
}
|
||||
return '<span class="text-primary" >其他</span> ';
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'businessKey',
|
||||
title: '单号',
|
||||
|
@ -73,8 +84,12 @@
|
|||
|
||||
},
|
||||
{
|
||||
field: 'assignee',
|
||||
title: '任务完成人'
|
||||
field: 'startUserName',
|
||||
title: '流程发起人'
|
||||
},
|
||||
{
|
||||
field: 'startTime',
|
||||
title: '创建时间'
|
||||
},
|
||||
|
||||
{
|
||||
|
@ -85,13 +100,12 @@
|
|||
field: 'handleTaskTime',
|
||||
title: '任务耗时'
|
||||
},
|
||||
|
||||
{
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
formatter: function(value, row, index) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="fromDetailUrl(\''+row.fromDetailUrl+'\')"><i class="fa fa-eye"></i>详情</a> ');
|
||||
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="taskDetail(\'' + row.taskId + '\')"><i class="fa fa-eye"></i>详情</a> ');
|
||||
return actions.join('');
|
||||
}
|
||||
}]
|
||||
|
@ -100,10 +114,11 @@
|
|||
|
||||
});
|
||||
|
||||
function getProcessDiagram(processInstanceId) {
|
||||
var preViewUrl=prefix+'/getProcessDiagram?processInstanceId='+processInstanceId;
|
||||
$.modal.openTab("流程图", preViewUrl);
|
||||
function taskDetail(taskId) {
|
||||
var url=prefixFlow+'/getMyTaskedDetail?taskId='+taskId;
|
||||
$.modal.openTab("已办任务详情", url);
|
||||
}
|
||||
|
||||
function fromDetailUrl(url) {
|
||||
$.modal.openTab("详情", url);
|
||||
}
|
|
@ -0,0 +1,185 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/html">
|
||||
<head>
|
||||
<th:block th:include="include :: header('我发起的流程详情')" />
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-sequence-edit" >
|
||||
<input name="processInstanceId" id="processInstanceId" th:value="${processInstance.id}" type="hidden" >
|
||||
|
||||
<input name="busVarUrl" id="busVarUrl" th:value="${busVarUrl}" type="hidden" >
|
||||
<input name="appId" id="appId" th:value="${appId}" type="hidden" >
|
||||
<div class="ibox float-e-margins">
|
||||
<h4 class="form-header h4">流程概况</h4>
|
||||
<div class="vertical-timeline-block" >
|
||||
<div class="row">
|
||||
<div class="col-xs-4 col-sm-5 col-md-offset-1">
|
||||
<label class="col-sm-3 control-label">流程名称:</label>
|
||||
<div class="form-control-static" th:text="${processInstance.processDefinitionName}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4 col-sm-5">
|
||||
<label class="col-sm-3 control-label">流程状态:</label>
|
||||
<div class="form-control-static" th:if="${processInstance.isFinished==0}">
|
||||
<span class="badge badge-info">进行中</span>
|
||||
</div>
|
||||
<div class="form-control-static" th:if="${processInstance.isFinished==1}">
|
||||
<span class="badge badge-success">结束</span>
|
||||
</div>
|
||||
<div class="form-control-static" th:if="${processInstance.isFinished==2}">
|
||||
<span class="badge badge-warning">取消</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-4 col-sm-5 col-md-offset-1">
|
||||
<label class="col-sm-3 control-label">发起人:</label>
|
||||
<div class="form-control-static" th:text="${processInstance.startUserName}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4 col-sm-5">
|
||||
<label class="col-sm-3 control-label">流程已用时:</label>
|
||||
<div class="form-control-static" th:text="${processInstance.processSpendTime}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-4 col-sm-5 col-md-offset-1">
|
||||
<label class="col-sm-3 control-label">开始时间:</label>
|
||||
<div class="form-control-static" th:text="${#dates.format(processInstance.startTime, 'yyyy-MM-dd hh:mm:ss')}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4 col-sm-5">
|
||||
<label class="col-sm-3 control-label">结束时间:</label>
|
||||
<div class="form-control-static" th:text="${#dates.format(processInstance.endTime, 'yyyy-MM-dd hh:mm:ss')}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-4 col-sm-5 col-md-offset-1" th:if="${processInstance.isFinished==2}">
|
||||
<label class="col-sm-3 control-label">取消原因:</label>
|
||||
<div class="form-control-static" th:text="${processInstance.deleteReason}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-4 col-sm-5 col-md-offset-1">
|
||||
<label class="col-sm-3 control-label">业务单详情:</label>
|
||||
<div class="form-control-static" >
|
||||
<a href="javascript:void(0)" onclick="getProcessDiagram()">
|
||||
[[${processInstance.businessKey}]]
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ibox float-e-margins">
|
||||
<h4 class="form-header h4">流程图</h4>
|
||||
<div class="vertical-timeline-block" >
|
||||
<img class="imgcode" width="85%"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ibox float-e-margins form-horizontal">
|
||||
<h4 class="form-header h4">任务概况</h4>
|
||||
<div id="ibox-content">
|
||||
<div id="vertical-timeline" class="vertical-container light-timeline light-dark">
|
||||
<div class="vertical-timeline-block" >
|
||||
<div class="vertical-timeline-icon navy-bg">
|
||||
<i class="fa fa-hand-o-right"></i>
|
||||
</div>
|
||||
<div class="vertical-timeline-content ">
|
||||
<h2 th:text="${hisTask.taskName }"></h2>
|
||||
<br class="form-group">
|
||||
<div class="row">
|
||||
<div class="col-md-4" th:if="${hisTask.isStart} == ''">
|
||||
<label >审批结果:</label>
|
||||
<label th:switch="${hisTask.isPass}">
|
||||
<span class="btn-outline btn-danger" th:case="'false'">驳回</span>
|
||||
<span class="btn-outline btn-success" th:case="'true'">通过</span>
|
||||
<span class="btn-outline btn-info" th:case=" ''">待审核</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-md-4" th:if="${hisTask.assigneeName} != null">
|
||||
<label >审批人:</label>
|
||||
<span th:text="${hisTask.assigneeName}"></span>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4" th:if="${hisTask.handleTaskTime} != null">
|
||||
<label>任务历时:</label>
|
||||
<label>
|
||||
<span th:text="${hisTask.handleTaskTime}"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</br>
|
||||
<div class="row" >
|
||||
<div class="col-md-12">
|
||||
<label>可审批人:</label>
|
||||
<span th:each="userName:${hisTask.handleUserList}">
|
||||
<label th:if="${userName} ne ''">  
|
||||
<span th:text="${userName}"></span>
|
||||
</label>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</br>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<span class="vertical-date">
|
||||
<label>任务时间:</label> <small th:text="${#dates.format(hisTask.startTime, 'yyyy-MM-dd HH:mm:ss')}"></small>
|
||||
<label>~</label> <small th:text="${#dates.format(hisTask.completeTime, 'yyyy-MM-dd HH:mm:ss')}"></small>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</br>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div th:each="comment:${hisTask.commentList}">
|
||||
<label>审批意见:</label>
|
||||
<label th:if="${comment.fullMessage} ne ''">
|
||||
<span th:text="${comment.fullMessage}"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</br>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div th:each="attachment:${hisTask.attachmentList}">
|
||||
<label>附件:</label>
|
||||
<label th:if="${attachment.url} ne ''">
|
||||
<a th:href="${attachment.url}" target="_blank"><span th:text="${attachment.name}"></span></a>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<script th:inline="javascript">
|
||||
|
||||
$(function () {
|
||||
var processInstanceId= $("#processInstanceId").val();
|
||||
var url ="/modeler/getProcessDiagram?processInstanceId="+processInstanceId;
|
||||
$(".imgcode").attr("src", url);
|
||||
});
|
||||
|
||||
function getProcessDiagram() {
|
||||
var appId= $("#appId").val();
|
||||
var busVarUrl= $("#busVarUrl").val();
|
||||
$.modal.open('业务单', busVarUrl+"/"+appId);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -67,6 +67,10 @@
|
|||
return index+1;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'id',
|
||||
title: '实例id'
|
||||
},
|
||||
{
|
||||
field: 'processDefinitionName',
|
||||
title: '流程名称'
|
||||
|
@ -121,7 +125,7 @@
|
|||
if(isFinished==0) {
|
||||
actions.push('<a class="btn btn-warning btn-xs ' + cancelProcessInstanceFlag + '" href="javascript:void(0)" onclick="cancelProcessInstance(\'' + row.id + '\')"><i class="fa fa-delicious"></i>取消</a> ');
|
||||
}
|
||||
actions.push('<a class="btn btn-info btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="getProcessDiagram(\'' + row.id + '\')"><i class="fa fa-eye"></i>详情</a>');
|
||||
actions.push('<a class="btn btn-info btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="myStartProcessDetail(\'' + row.id + '\')"><i class="fa fa-eye"></i>详情</a>');
|
||||
return actions.join('');
|
||||
}
|
||||
}]
|
||||
|
@ -131,7 +135,7 @@
|
|||
|
||||
});
|
||||
|
||||
function getProcessDiagram(processInstanceId) {
|
||||
function myStartProcessDetail(processInstanceId) {
|
||||
var preViewUrl=prefixFlow+'/myStartProcessDetail?processInstanceId='+processInstanceId;
|
||||
$.modal.openTab("流程详情", preViewUrl);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,8 @@
|
|||
<label class="col-sm-3 control-label">附件:</label>
|
||||
<div class="form-control-static">
|
||||
<input type="hidden" name="fileUrl" id="fileKey" th:value="${appFrom.fileUrl}">
|
||||
<a id="fileName"></a>
|
||||
<a id="fileName"></a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<th:block th:include="include :: approvalpage" />
|
||||
|
@ -77,6 +78,9 @@
|
|||
$("#fileName").text(data.name);
|
||||
});
|
||||
|
||||
function preview(url) {
|
||||
window.open('http://47.98.36.102:8012/onlinePreview?url='+encodeURIComponent(Base64.encode(url)));
|
||||
}
|
||||
|
||||
$(".file-upload").each(function (i) {
|
||||
var val = $("input[name='" + this.id + "']").val();
|
||||
|
@ -89,6 +93,7 @@
|
|||
}).on('fileuploaded', function (event, data, previewId, index) {
|
||||
|
||||
files.push({"key": data.response.fileKey,"name": data.response.fileName, "url":data.response.url});
|
||||
console.log("===================>"+JSON.stringify(data));
|
||||
}).on('fileremoved', function (event, id, index) {
|
||||
$("input[name='" + event.currentTarget.id + "']").val('')
|
||||
})
|
||||
|
|
|
@ -94,6 +94,7 @@
|
|||
autoReplace: true
|
||||
}).on('fileuploaded', function (event, data, previewId, index) {
|
||||
files.push({"key": data.response.fileKey,"name": data.response.fileName, "url":data.response.url});
|
||||
console.log("===================>"+JSON.stringify(data));
|
||||
}).on('fileremoved', function (event, id, index) {
|
||||
$("input[name='" + event.currentTarget.id + "']").val('')
|
||||
})
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
<input type="hidden" name="fileUrl" id="filekey" th:field="*{fileUrl}">
|
||||
<div class="form-control-static">
|
||||
<a id="fileName"></a>
|
||||
<button id="preview">预览</button>
|
||||
</div>
|
||||
<div class="file-loading">
|
||||
<input class="form-control file-upload" id="fileUrl" name="file" type="file">
|
||||
|
@ -82,6 +83,17 @@
|
|||
}
|
||||
}
|
||||
|
||||
$(function() {
|
||||
var filekey=$("#fileKey").val()
|
||||
var data= $.common.getFileByKey(filekey);
|
||||
console.log(JSON.stringify(data))
|
||||
$("#preview").click(function () {
|
||||
preview(data.url);
|
||||
})
|
||||
});
|
||||
function preview(url) {
|
||||
window.open('http://47.98.36.102:8012/onlinePreview?url='+encodeURIComponent(Base64.encode(url)));
|
||||
}
|
||||
$(".file-upload").each(function (i) {
|
||||
var val = $("input[name='" + this.id + "']").val()
|
||||
$(this).fileinput({
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
<input type="hidden" name="fileUrl" id="fileKey" th:value="${sysOaLeave.fileUrl}">
|
||||
<div class="form-control-static">
|
||||
<a id="fileName"></a>
|
||||
<a th:onclick="preview(${appFrom.fileUrl})">预览</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -66,6 +67,9 @@
|
|||
$('#fileName').attr('href',"../../../common/download?fileKey="+filekey);
|
||||
$("#fileName").text(data.name);
|
||||
});
|
||||
function preview(url) {
|
||||
window.open('http://47.98.36.102:8012/onlinePreview?url='+encodeURIComponent(Base64.encode(url)));
|
||||
}
|
||||
|
||||
$(".file-upload").each(function (i) {
|
||||
var val = $("input[name='" + this.id + "']").val();
|
||||
|
|
|
@ -87,11 +87,12 @@
|
|||
$(this).fileinput({
|
||||
'uploadUrl': '/common/upload',
|
||||
initialPreviewAsData: true,
|
||||
allowedFileExtensions: ['jpg', 'gif', 'png',".docx","doc","ppt","pptx","xls","xlsx","vsd","rtf","wps","pdf","txt"],//接收的文件后缀
|
||||
allowedFileExtensions: ['jpg', 'gif', 'png',".docx","doc","ppt","pptx","xls","xlsx","vsd","rtf","wps","pdf","txt","zip"],//接收的文件后缀
|
||||
initialPreview: [val],
|
||||
maxFileCount: 1,
|
||||
autoReplace: true
|
||||
}).on('fileuploaded', function (event, data, previewId, index) {
|
||||
console.log("===================>"+JSON.stringify(data));
|
||||
files.push({"key": data.response.fileKey,"name": data.response.fileName, "url":data.response.url});
|
||||
// $("input[name='" + event.currentTarget.id + "']").val(data.response.url)
|
||||
}).on('fileremoved', function (event, id, index) {
|
||||
|
|
|
@ -5,6 +5,7 @@ import lombok.Data;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @program: snow
|
||||
|
@ -49,6 +50,11 @@ public class DeploymentVO implements Serializable {
|
|||
*/
|
||||
private int engineVersion;
|
||||
|
||||
/**
|
||||
* 是否是最新版本
|
||||
*/
|
||||
private Boolean isNew;
|
||||
|
||||
/**
|
||||
* xml
|
||||
*/
|
||||
|
@ -60,4 +66,8 @@ public class DeploymentVO implements Serializable {
|
|||
private String dgrmResourceName;
|
||||
|
||||
|
||||
/**
|
||||
* 流程定义
|
||||
*/
|
||||
private List<ProcessDefVO> processDefVOList;
|
||||
}
|
||||
|
|
|
@ -46,12 +46,6 @@ public class HistoricTaskInstanceVO extends TaskVO implements Serializable {
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private String assignee;
|
||||
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
|
@ -97,8 +91,6 @@ public class HistoricTaskInstanceVO extends TaskVO implements Serializable {
|
|||
|
||||
|
||||
|
||||
private String owner;
|
||||
|
||||
|
||||
private String fromDetailUrl;
|
||||
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
package com.snow.flowable.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class ProcessDefVO implements Serializable {
|
||||
private static final long serialVersionUID = -1084950842088533110L;
|
||||
|
||||
/**
|
||||
* 流程定义id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 流程定义名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 流程描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 流程定义key
|
||||
*/
|
||||
private String key;
|
||||
|
||||
/**
|
||||
* 当前版本
|
||||
*/
|
||||
private int version;
|
||||
|
||||
/**
|
||||
* 分类
|
||||
*/
|
||||
private String category;
|
||||
|
||||
/**
|
||||
* 流程发布id
|
||||
*/
|
||||
private String deploymentId;
|
||||
|
||||
|
||||
/**
|
||||
* xml
|
||||
*/
|
||||
private String resourceName;
|
||||
|
||||
|
||||
private Integer historyLevel;
|
||||
|
||||
private String diagramResourceName;
|
||||
|
||||
|
||||
|
||||
private boolean hasStartFormKey;
|
||||
|
||||
}
|
|
@ -131,18 +131,11 @@ public class ProcessInstanceVO implements Serializable {
|
|||
*/
|
||||
private Integer processInstanceStatus;
|
||||
|
||||
@Deprecated
|
||||
|
||||
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())&&StringUtils.isNotEmpty(t.getDeleteReason())){
|
||||
processInstanceVO.setIsFinished(2);
|
||||
}else if(StringUtils.isNotEmpty(t.getEndActivityId())){
|
||||
processInstanceVO.setIsFinished(1);
|
||||
}else {
|
||||
processInstanceVO.setIsFinished(0);
|
||||
}
|
||||
Map<String, Object> processVariables = t.getProcessVariables();
|
||||
processInstanceVO.setProcessVariables(processVariables);
|
||||
return processInstanceVO;
|
||||
|
|
|
@ -58,6 +58,12 @@ public interface FlowableService {
|
|||
*/
|
||||
PageModel<DeploymentVO> getDeploymentList(DeploymentQueryDTO deploymentQueryDTO);
|
||||
|
||||
/**
|
||||
* 查询发布详情
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
DeploymentVO getDeploymentDetailById(String id);
|
||||
/**
|
||||
* 删除发布
|
||||
* @param ids
|
||||
|
@ -135,12 +141,6 @@ public interface FlowableService {
|
|||
*/
|
||||
Task getTaskProcessInstanceById(String id);
|
||||
|
||||
/**
|
||||
* 获取历史任务
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
List<HistoricTaskInstanceVO> getHistoricTaskInstanceNoPage(HistoricTaskInstanceDTO historicTaskInstanceDTO);
|
||||
|
||||
/**
|
||||
* 动态获取流程节点审批信息
|
||||
|
@ -163,13 +163,7 @@ public interface FlowableService {
|
|||
*/
|
||||
PageModel<ProcessInstanceVO> getHistoricProcessInstance(ProcessInstanceDTO processInstanceDTO);
|
||||
|
||||
/**
|
||||
* 查询历史任务实例(分页)
|
||||
* 可查询我经办的
|
||||
* @param historicTaskInstanceDTO
|
||||
* @return
|
||||
*/
|
||||
PageModel<HistoricTaskInstanceVO> getHistoricTaskInstance(HistoricTaskInstanceDTO historicTaskInstanceDTO);
|
||||
|
||||
|
||||
/**
|
||||
* 获取流程图像,已执行节点和流程线高亮显示
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.snow.flowable.domain.*;
|
|||
import com.snow.system.domain.SysUser;
|
||||
import org.flowable.task.api.Task;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
|
@ -24,6 +25,22 @@ public interface FlowableTaskService {
|
|||
*/
|
||||
PageModel<TaskVO> findTasksByUserId(String userId, TaskBaseDTO taskBaseDTO);
|
||||
|
||||
/**
|
||||
* 查询历史任务实例(分页)
|
||||
* 可查询我经办的
|
||||
* @param historicTaskInstanceDTO
|
||||
* @return
|
||||
*/
|
||||
PageModel<HistoricTaskInstanceVO> getHistoricTaskInstance(HistoricTaskInstanceDTO historicTaskInstanceDTO);
|
||||
|
||||
/**
|
||||
* 获取历史任务
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
List<HistoricTaskInstanceVO> getHistoricTaskInstanceNoPage(HistoricTaskInstanceDTO historicTaskInstanceDTO);
|
||||
|
||||
|
||||
/**
|
||||
* 根据任务ID获取关联待办人待办组的人
|
||||
* @param taskId
|
||||
|
@ -50,7 +67,7 @@ public interface FlowableTaskService {
|
|||
* @param taskId 任务id
|
||||
* @return
|
||||
*/
|
||||
TaskVO getHisTask(String taskId);
|
||||
HistoricTaskInstanceVO getHisTask(String taskId);
|
||||
/**
|
||||
* 完成任务
|
||||
* @param finishTaskDTO
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.snow.flowable.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.BetweenFormater;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
|
@ -13,8 +13,8 @@ import com.google.common.collect.Maps;
|
|||
import com.google.common.collect.Sets;
|
||||
import com.snow.common.core.page.PageModel;
|
||||
import com.snow.common.core.text.Convert;
|
||||
import com.snow.common.enums.WorkRecordStatus;
|
||||
import com.snow.common.exception.BusinessException;
|
||||
import com.snow.common.utils.bean.BeanUtils;
|
||||
import com.snow.flowable.common.constants.FlowConstants;
|
||||
import com.snow.flowable.common.enums.FlowDefEnum;
|
||||
import com.snow.flowable.common.enums.FlowInstanceEnum;
|
||||
|
@ -29,8 +29,8 @@ import com.snow.system.domain.SysUser;
|
|||
import com.snow.system.service.impl.SysUserServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.flowable.bpmn.model.*;
|
||||
import org.flowable.bpmn.model.Process;
|
||||
import org.flowable.bpmn.model.*;
|
||||
import org.flowable.common.engine.api.delegate.event.FlowableEngineEvent;
|
||||
import org.flowable.common.engine.impl.identity.Authentication;
|
||||
import org.flowable.common.engine.impl.interceptor.CommandContext;
|
||||
|
@ -42,20 +42,18 @@ import org.flowable.engine.history.HistoricProcessInstanceQuery;
|
|||
import org.flowable.engine.impl.RepositoryServiceImpl;
|
||||
import org.flowable.engine.impl.persistence.entity.ProcessDefinitionEntity;
|
||||
import org.flowable.engine.impl.util.CommandContextUtil;
|
||||
import org.flowable.engine.repository.*;
|
||||
import org.flowable.engine.repository.Deployment;
|
||||
import org.flowable.engine.repository.DeploymentQuery;
|
||||
import org.flowable.engine.repository.ProcessDefinition;
|
||||
import org.flowable.engine.runtime.Execution;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.flowable.engine.task.Attachment;
|
||||
import org.flowable.engine.task.Comment;
|
||||
import org.flowable.image.ProcessDiagramGenerator;
|
||||
import org.flowable.task.api.DelegationState;
|
||||
import org.flowable.task.api.Task;
|
||||
import org.flowable.task.api.TaskQuery;
|
||||
import org.flowable.task.api.history.HistoricTaskInstance;
|
||||
import org.flowable.task.api.history.HistoricTaskInstanceQuery;
|
||||
import org.flowable.ui.modeler.domain.Model;
|
||||
import org.flowable.ui.modeler.service.ModelServiceImpl;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -70,8 +68,8 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
@ -228,7 +226,7 @@ public class FlowableServiceImpl implements FlowableService {
|
|||
List<Deployment> deployments = deploymentQuery.orderByDeploymenTime().desc().
|
||||
listPage(deploymentQueryDTO.getPageNum(), deploymentQueryDTO.getPageSize());
|
||||
|
||||
|
||||
//一次发布可以包含多个流程定义
|
||||
List<DeploymentVO> deploymentVoList = deployments.stream().map(t -> {
|
||||
// ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(t.getId()).singleResult();
|
||||
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(t.getId()).list().get(0);
|
||||
|
@ -247,6 +245,25 @@ public class FlowableServiceImpl implements FlowableService {
|
|||
return pageModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeploymentVO getDeploymentDetailById(String id) {
|
||||
DeploymentVO deploymentVO=new DeploymentVO();
|
||||
Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(id).singleResult();
|
||||
BeanUtil.copyProperties(deployment,deploymentVO);
|
||||
//一次发布可以包含多个流程定义
|
||||
List<ProcessDefinition> list = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).list();
|
||||
List<ProcessDefVO> processDefVOList=Lists.newArrayList();
|
||||
if(CollectionUtil.isNotEmpty(list)){
|
||||
list.forEach(t->{
|
||||
ProcessDefVO processDefVO=new ProcessDefVO();
|
||||
BeanUtils.copyProperties(t,processDefVO);
|
||||
processDefVOList.add(processDefVO);
|
||||
});
|
||||
}
|
||||
deploymentVO.setProcessDefVOList(processDefVOList);
|
||||
return deploymentVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDeployment(String ids) {
|
||||
List<String> idList = Arrays.asList(Convert.toStrArray(ids));
|
||||
|
@ -514,87 +531,6 @@ public class FlowableServiceImpl implements FlowableService {
|
|||
.singleResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HistoricTaskInstanceVO> getHistoricTaskInstanceNoPage(HistoricTaskInstanceDTO historicTaskInstanceDTO){
|
||||
String userId= historicTaskInstanceDTO.getUserId();
|
||||
HistoricTaskInstanceQuery historicTaskInstanceQuery = historyService.createHistoricTaskInstanceQuery();
|
||||
|
||||
if(!StringUtils.isEmpty(historicTaskInstanceDTO.getProcessInstanceId())){
|
||||
historicTaskInstanceQuery= historicTaskInstanceQuery.processInstanceId(historicTaskInstanceDTO.getProcessInstanceId());
|
||||
}
|
||||
|
||||
if(!StringUtils.isEmpty(historicTaskInstanceDTO.getTaskDefinitionKey())){
|
||||
historicTaskInstanceQuery.taskDefinitionKey(historicTaskInstanceDTO.getTaskDefinitionKey());
|
||||
}
|
||||
|
||||
if(!StringUtils.isEmpty(userId)){
|
||||
historicTaskInstanceQuery.taskAssignee(historicTaskInstanceDTO.getUserId());
|
||||
//historicTaskInstanceQuery.taskCandidateUser(userId);
|
||||
//historicTaskInstanceQuery.taskInvolvedUser(userId);
|
||||
}
|
||||
|
||||
if(!StringUtils.isEmpty(historicTaskInstanceDTO.getBusinessKey())){
|
||||
historicTaskInstanceQuery.processInstanceBusinessKey(historicTaskInstanceDTO.getBusinessKey());
|
||||
}
|
||||
|
||||
if(!StringUtils.isEmpty(historicTaskInstanceDTO.getProcessStatus())){
|
||||
WorkRecordStatus workRecordStatus=historicTaskInstanceDTO.getProcessStatus();
|
||||
if( workRecordStatus.equals(WorkRecordStatus.NO_FINISHED)){
|
||||
historicTaskInstanceQuery.unfinished();
|
||||
}else if(workRecordStatus.equals(WorkRecordStatus.FINISHED)){
|
||||
historicTaskInstanceQuery.finished();
|
||||
}
|
||||
}
|
||||
|
||||
historicTaskInstanceQuery.includeTaskLocalVariables().includeProcessVariables().includeIdentityLinks();
|
||||
List<HistoricTaskInstance> list = historicTaskInstanceQuery.orderByTaskCreateTime().asc().list();
|
||||
List<HistoricTaskInstanceVO> historicTaskInstanceVOS = HistoricTaskInstanceVO.warpList(list);
|
||||
setHistoricTaskInstanceVos(historicTaskInstanceVOS);
|
||||
return historicTaskInstanceVOS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理任务参数
|
||||
* @param list
|
||||
*/
|
||||
private void setHistoricTaskInstanceVos(List<HistoricTaskInstanceVO> list){
|
||||
|
||||
list.forEach(t -> {
|
||||
//保存待办人
|
||||
Set<SysUser> identityLinksForTask = flowableTaskService.getHistoricIdentityLinksForTask(t.getTaskId());
|
||||
Optional.ofNullable(identityLinksForTask).ifPresent(m->{
|
||||
List<String> userNameList = identityLinksForTask.stream().map(SysUser::getUserName).collect(Collectors.toList());
|
||||
t.setHandleUserList(userNameList);
|
||||
});
|
||||
|
||||
if (!StringUtils.isEmpty(t.getAssignee())&&com.snow.common.utils.StringUtils.isNumeric(t.getAssignee())) {
|
||||
SysUser sysUser = sysUserService.selectUserById(Long.parseLong(t.getAssignee()));
|
||||
t .setAssigneeName(sysUser.getUserName());
|
||||
}
|
||||
|
||||
Optional.ofNullable( t.getTaskLocalVariables()).ifPresent(u->{
|
||||
Object isPass =Optional.ofNullable(u.get(FlowConstants.IS_PASS)).orElse("");
|
||||
Object isStart =Optional.ofNullable(u.get(FlowConstants.IS_START)).orElse("");
|
||||
//处理审核条件
|
||||
t.setIsPass(String.valueOf(isPass));
|
||||
t.setIsStart(String.valueOf(isStart));
|
||||
});
|
||||
|
||||
List<Comment> comment = taskService.getTaskComments(t.getTaskId(), FlowConstants.OPINION);
|
||||
|
||||
List<Attachment> taskAttachments = taskService.getTaskAttachments(t.getTaskId());
|
||||
t.setCommentList(comment);
|
||||
t.setAttachmentList(taskAttachments);
|
||||
//计算任务历时
|
||||
if(!StringUtils.isEmpty(t.getCompleteTime())){
|
||||
String spendTime = DateUtil.formatBetween(DateUtil.between(t.getStartTime(), t.getCompleteTime(), DateUnit.SECOND));
|
||||
t.setHandleTaskTime(spendTime);
|
||||
}
|
||||
HistoricProcessInstance historicProcessInstance = getHistoricProcessInstanceById(t.getProcessInstanceId());
|
||||
t.setProcessName(historicProcessInstance.getProcessDefinitionName());
|
||||
t.setBusinessKey(historicProcessInstance.getBusinessKey());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 思路就是我们取出节点的表达式,然后用我们流程实例的变量来给他翻译出来即可
|
||||
|
@ -602,15 +538,11 @@ public class FlowableServiceImpl implements FlowableService {
|
|||
*/
|
||||
@Override
|
||||
public List<TaskVO> getDynamicFlowNodeInfo(String processInstanceId) {
|
||||
//获取历史变量表
|
||||
/* List<HistoricVariableInstance> historicVariableInstanceList = historyService.createHistoricVariableInstanceQuery()
|
||||
.processInstanceId(processInstanceId)
|
||||
.list();*/
|
||||
HistoricProcessInstance processInstance= getHistoricProcessInstanceById(processInstanceId);
|
||||
List<TaskVO> hisTaskVOList=Lists.newArrayList();
|
||||
HistoricTaskInstanceDTO historicTaskInstanceDTO=new HistoricTaskInstanceDTO();
|
||||
historicTaskInstanceDTO.setProcessInstanceId(processInstanceId);
|
||||
List<HistoricTaskInstanceVO> historicTaskInstance = getHistoricTaskInstanceNoPage(historicTaskInstanceDTO);
|
||||
List<HistoricTaskInstanceVO> historicTaskInstance = flowableTaskService.getHistoricTaskInstanceNoPage(historicTaskInstanceDTO);
|
||||
if(!CollectionUtils.isEmpty(historicTaskInstance)){
|
||||
hisTaskVOList = historicTaskInstance.stream().map(t -> {
|
||||
TaskVO taskVO = new TaskVO();
|
||||
|
@ -654,7 +586,9 @@ public class FlowableServiceImpl implements FlowableService {
|
|||
orderByProcessInstanceStartTime().
|
||||
desc().
|
||||
list();
|
||||
return ProcessInstanceVO.warpList(list);
|
||||
List<ProcessInstanceVO> processInstanceVOS = ProcessInstanceVO.warpList(list);
|
||||
processInstanceVOS.parallelStream().forEach(t->warpProcessInstanceVo(t));
|
||||
return processInstanceVOS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -670,7 +604,7 @@ public class FlowableServiceImpl implements FlowableService {
|
|||
desc().
|
||||
listPage(processInstanceDTO.getPageNum(), processInstanceDTO.getPageSize());
|
||||
List<ProcessInstanceVO> processInstanceVOS = ProcessInstanceVO.warpList(historicProcessInstances);
|
||||
setProcessInstanceVOs(processInstanceVOS);
|
||||
processInstanceVOS.forEach(t-> warpProcessInstanceVo(t));
|
||||
PageModel<ProcessInstanceVO> pageModel = new PageModel<> ();
|
||||
pageModel.setTotalCount((int)count);
|
||||
pageModel.setPagedRecords(processInstanceVOS);
|
||||
|
@ -679,7 +613,7 @@ public class FlowableServiceImpl implements FlowableService {
|
|||
|
||||
/**
|
||||
* 构建查询条件
|
||||
* @param processInstanceDTO
|
||||
* @param processInstanceDTO 传入的查询参数
|
||||
*/
|
||||
private HistoricProcessInstanceQuery buildHistoricProcessInstanceCondition(ProcessInstanceDTO processInstanceDTO){
|
||||
HistoricProcessInstanceQuery historicProcessInstanceQuery = historyService.createHistoricProcessInstanceQuery();
|
||||
|
@ -711,100 +645,6 @@ public class FlowableServiceImpl implements FlowableService {
|
|||
return historicProcessInstanceQuery;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 赋值ProcessInstanceVOs
|
||||
* @param processInstanceVOS
|
||||
*/
|
||||
private void setProcessInstanceVOs(List<ProcessInstanceVO> processInstanceVOS){
|
||||
processInstanceVOS.parallelStream().forEach(t-> warpProcessInstanceVo(t));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageModel<HistoricTaskInstanceVO> getHistoricTaskInstance(HistoricTaskInstanceDTO historicTaskInstanceDTO) {
|
||||
HistoricTaskInstanceQuery historicTaskInstanceQuery = historyService.createHistoricTaskInstanceQuery();
|
||||
|
||||
if(!StringUtils.isEmpty(historicTaskInstanceDTO.getProcessDefinitionName())){
|
||||
historicTaskInstanceQuery.processDefinitionName(historicTaskInstanceDTO.getProcessDefinitionName());
|
||||
}
|
||||
//只能判断null,不能判断""
|
||||
Optional.ofNullable(historicTaskInstanceDTO.getUserId()).ifPresent(
|
||||
userId-> {
|
||||
if(!StringUtils.isEmpty(historicTaskInstanceQuery.taskAssignee(userId))){
|
||||
historicTaskInstanceQuery.taskAssignee(userId);
|
||||
}
|
||||
}
|
||||
);
|
||||
if(!StringUtils.isEmpty(historicTaskInstanceDTO.getBusinessKeyLike())){
|
||||
historicTaskInstanceQuery.processInstanceBusinessKeyLike("%"+historicTaskInstanceDTO.getBusinessKeyLike()+"%");
|
||||
}
|
||||
if(!StringUtils.isEmpty(historicTaskInstanceDTO.getBusinessKey())){
|
||||
historicTaskInstanceQuery.processInstanceBusinessKey(historicTaskInstanceDTO.getBusinessKey());
|
||||
}
|
||||
Optional.ofNullable(historicTaskInstanceDTO.getTaskStatus()).ifPresent(m->{
|
||||
if(m.equals(WorkRecordStatus.NO_FINISHED)){
|
||||
historicTaskInstanceQuery.unfinished();
|
||||
}
|
||||
if(m.equals(WorkRecordStatus.FINISHED)){
|
||||
historicTaskInstanceQuery.finished();
|
||||
}
|
||||
});
|
||||
|
||||
Optional.ofNullable(historicTaskInstanceDTO.getProcessStatus()).ifPresent(m->{
|
||||
if(m.equals(WorkRecordStatus.NO_FINISHED)){
|
||||
historicTaskInstanceQuery.processUnfinished();
|
||||
}
|
||||
if(m.equals(WorkRecordStatus.FINISHED)){
|
||||
historicTaskInstanceQuery.processFinished();
|
||||
}
|
||||
});
|
||||
historicTaskInstanceQuery.includeIdentityLinks().includeProcessVariables().includeTaskLocalVariables();
|
||||
long count = historicTaskInstanceQuery.orderByHistoricTaskInstanceStartTime().
|
||||
desc().
|
||||
count();
|
||||
List<HistoricTaskInstance> historicTaskInstances = historicTaskInstanceQuery.orderByHistoricTaskInstanceStartTime().
|
||||
desc().
|
||||
listPage(historicTaskInstanceDTO.getPageNum(), historicTaskInstanceDTO.getPageSize());
|
||||
|
||||
|
||||
List<HistoricTaskInstanceVO> historicTaskInstanceVOS = historicTaskInstances.stream().map(t -> {
|
||||
HistoricTaskInstanceVO historicTaskInstanceVO = new HistoricTaskInstanceVO();
|
||||
BeanUtils.copyProperties(t, historicTaskInstanceVO);
|
||||
if (!StringUtils.isEmpty(t.getAssignee())) {
|
||||
SysUser sysUser = sysUserService.selectUserById(Long.parseLong(t.getAssignee()));
|
||||
historicTaskInstanceVO.setAssignee(sysUser.getUserName());
|
||||
}
|
||||
Map<String, Object> processVariables = t.getProcessVariables();
|
||||
String url= Optional.ofNullable(String.valueOf(processVariables.get(FlowConstants.BUS_VAR_URL))).orElse("");
|
||||
//设置返回详情页
|
||||
if(!StringUtils.isEmpty(url)){
|
||||
if(!StringUtils.isEmpty(processVariables.get("id")))
|
||||
historicTaskInstanceVO.setFromDetailUrl(url+"/"+processVariables.get("id"));
|
||||
}
|
||||
AppForm appForm=(AppForm)processVariables.get(FlowConstants.APP_FORM);
|
||||
historicTaskInstanceVO.setAppForm(appForm);
|
||||
historicTaskInstanceVO.setCompleteTime(t.getEndTime());
|
||||
//转办的时候会出现到历史记录里,但是任务还没完结???
|
||||
if(null!=t.getEndTime()){
|
||||
String spendTime = DateUtil.formatBetween(DateUtil.between(t.getCreateTime(), t.getEndTime(), DateUnit.SECOND));
|
||||
historicTaskInstanceVO.setHandleTaskTime(spendTime);
|
||||
}
|
||||
historicTaskInstanceVO.setTaskId(t.getId());
|
||||
historicTaskInstanceVO.setTaskName(t.getName());
|
||||
HistoricProcessInstance historicProcessInstance = getHistoricProcessInstanceById(t.getProcessInstanceId());
|
||||
historicTaskInstanceVO.setProcessName(historicProcessInstance.getProcessDefinitionName());
|
||||
historicTaskInstanceVO.setBusinessKey(historicProcessInstance.getBusinessKey());
|
||||
return historicTaskInstanceVO;
|
||||
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
PageModel<HistoricTaskInstanceVO> pageModel = new PageModel<> ();
|
||||
pageModel.setTotalCount((int)count);
|
||||
pageModel.setPagedRecords(historicTaskInstanceVOS);
|
||||
return pageModel;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取所有的任务节点
|
||||
* @param processInstance
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
package com.snow.flowable.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.BetweenFormater;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.snow.common.core.page.PageModel;
|
||||
import com.snow.common.enums.WorkRecordStatus;
|
||||
import com.snow.common.exception.BusinessException;
|
||||
import com.snow.common.utils.bean.BeanUtils;
|
||||
import com.snow.common.utils.bean.MyBeanUtils;
|
||||
import com.snow.flowable.common.constants.FlowConstants;
|
||||
import com.snow.flowable.common.skipTask.TaskSkipService;
|
||||
|
@ -17,23 +23,24 @@ import org.flowable.common.engine.impl.identity.Authentication;
|
|||
import org.flowable.engine.HistoryService;
|
||||
import org.flowable.engine.RuntimeService;
|
||||
import org.flowable.engine.TaskService;
|
||||
import org.flowable.engine.history.HistoricProcessInstance;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.flowable.engine.task.Attachment;
|
||||
import org.flowable.engine.task.Comment;
|
||||
import org.flowable.identitylink.api.IdentityLink;
|
||||
import org.flowable.identitylink.api.history.HistoricIdentityLink;
|
||||
import org.flowable.task.api.DelegationState;
|
||||
import org.flowable.task.api.Task;
|
||||
import org.flowable.task.api.TaskQuery;
|
||||
import org.flowable.task.api.history.HistoricTaskInstance;
|
||||
import org.flowable.task.api.history.HistoricTaskInstanceQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
@ -141,6 +148,156 @@ public class FlowableTaskServiceImpl implements FlowableTaskService {
|
|||
return pageModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageModel<HistoricTaskInstanceVO> getHistoricTaskInstance(HistoricTaskInstanceDTO historicTaskInstanceDTO) {
|
||||
|
||||
HistoricTaskInstanceQuery historicTaskInstanceQuery = buildHistoricTaskInstanceCondition(historicTaskInstanceDTO);
|
||||
long count = historicTaskInstanceQuery.orderByHistoricTaskInstanceEndTime().
|
||||
desc().
|
||||
count();
|
||||
List<HistoricTaskInstance> historicTaskInstances = historicTaskInstanceQuery.orderByHistoricTaskInstanceEndTime().
|
||||
desc().
|
||||
listPage(historicTaskInstanceDTO.getPageNum(), historicTaskInstanceDTO.getPageSize());
|
||||
|
||||
|
||||
List<HistoricTaskInstanceVO> historicTaskInstanceVOS = historicTaskInstances.stream().map(t -> {
|
||||
HistoricTaskInstanceVO historicTaskInstanceVO = new HistoricTaskInstanceVO();
|
||||
BeanUtils.copyProperties(t, historicTaskInstanceVO);
|
||||
Map<String, Object> processVariables = t.getProcessVariables();
|
||||
String url= Optional.ofNullable(String.valueOf(processVariables.get(FlowConstants.BUS_VAR_URL))).orElse("");
|
||||
//设置返回详情页
|
||||
if(ObjectUtil.isNotEmpty(url)&&ObjectUtil.isNotEmpty(processVariables.get("id"))){
|
||||
historicTaskInstanceVO.setFromDetailUrl(url+"/"+processVariables.get("id"));
|
||||
}
|
||||
|
||||
historicTaskInstanceVO.setCompleteTime(t.getEndTime());
|
||||
//转办的时候会出现到历史记录里,但是任务还没完结???
|
||||
if(ObjectUtil.isNotNull(t.getEndTime())){
|
||||
String spendTime= DateUtil.formatBetween(t.getCreateTime(), t.getEndTime(), BetweenFormater.Level.SECOND);
|
||||
historicTaskInstanceVO.setHandleTaskTime(spendTime);
|
||||
}
|
||||
historicTaskInstanceVO.setTaskId(t.getId());
|
||||
historicTaskInstanceVO.setTaskName(t.getName());
|
||||
historicTaskInstanceVO.setStartTime(t.getCreateTime());
|
||||
//审批结果
|
||||
Optional.ofNullable(historicTaskInstanceVO.getTaskLocalVariables()).ifPresent(u->{
|
||||
Object isPass =Optional.ofNullable(u.get(FlowConstants.IS_PASS)).orElse("");
|
||||
Object isStart =Optional.ofNullable(u.get(FlowConstants.IS_START)).orElse("");
|
||||
//处理审核条件
|
||||
historicTaskInstanceVO.setIsPass(String.valueOf(isPass));
|
||||
historicTaskInstanceVO.setIsStart(String.valueOf(isStart));
|
||||
});
|
||||
ProcessInstanceVO processInstanceVo = flowableService.getProcessInstanceVoById(t.getProcessInstanceId());
|
||||
historicTaskInstanceVO.setProcessName(processInstanceVo.getProcessDefinitionName());
|
||||
historicTaskInstanceVO.setBusinessKey(processInstanceVo.getBusinessKey());
|
||||
historicTaskInstanceVO.setStartUserId(processInstanceVo.getStartUserId());
|
||||
historicTaskInstanceVO.setStartUserName(processInstanceVo.getStartUserName());
|
||||
return historicTaskInstanceVO;
|
||||
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
PageModel<HistoricTaskInstanceVO> pageModel = new PageModel<> ();
|
||||
pageModel.setTotalCount((int)count);
|
||||
pageModel.setPagedRecords(historicTaskInstanceVOS);
|
||||
return pageModel;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<HistoricTaskInstanceVO> getHistoricTaskInstanceNoPage(HistoricTaskInstanceDTO historicTaskInstanceDTO){
|
||||
HistoricTaskInstanceQuery historicTaskInstanceQuery = buildHistoricTaskInstanceCondition(historicTaskInstanceDTO);
|
||||
List<HistoricTaskInstance> list = historicTaskInstanceQuery.orderByTaskCreateTime().asc().list();
|
||||
List<HistoricTaskInstanceVO> historicTaskInstanceVOS = HistoricTaskInstanceVO.warpList(list);
|
||||
historicTaskInstanceVOS.parallelStream().forEach(t -> warpTaskVoList(t));
|
||||
return historicTaskInstanceVOS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建历史任务查询条件
|
||||
* @param historicTaskInstanceDTO 传入的查询参数
|
||||
*/
|
||||
private HistoricTaskInstanceQuery buildHistoricTaskInstanceCondition(HistoricTaskInstanceDTO historicTaskInstanceDTO){
|
||||
HistoricTaskInstanceQuery historicTaskInstanceQuery = historyService.createHistoricTaskInstanceQuery();
|
||||
|
||||
if(ObjectUtil.isNotEmpty(historicTaskInstanceDTO.getProcessInstanceId())){
|
||||
historicTaskInstanceQuery.processInstanceId(historicTaskInstanceDTO.getProcessInstanceId());
|
||||
}
|
||||
if(ObjectUtil.isNotEmpty(historicTaskInstanceDTO.getProcessDefinitionName())){
|
||||
historicTaskInstanceQuery.processDefinitionName(historicTaskInstanceDTO.getProcessDefinitionName());
|
||||
}
|
||||
if(ObjectUtil.isNotEmpty(historicTaskInstanceDTO.getUserId())){
|
||||
historicTaskInstanceQuery.taskAssignee(historicTaskInstanceDTO.getUserId());
|
||||
}
|
||||
if(ObjectUtil.isNotEmpty(historicTaskInstanceDTO.getBusinessKeyLike())){
|
||||
historicTaskInstanceQuery.processInstanceBusinessKeyLike("%"+historicTaskInstanceDTO.getBusinessKeyLike()+"%");
|
||||
}
|
||||
if(ObjectUtil.isNotEmpty(historicTaskInstanceDTO.getBusinessKey())){
|
||||
historicTaskInstanceQuery.processInstanceBusinessKey(historicTaskInstanceDTO.getBusinessKey());
|
||||
}
|
||||
Optional.ofNullable(historicTaskInstanceDTO.getTaskStatus()).ifPresent(m->{
|
||||
if(m.equals(WorkRecordStatus.NO_FINISHED)){
|
||||
historicTaskInstanceQuery.unfinished();
|
||||
}
|
||||
if(m.equals(WorkRecordStatus.FINISHED)){
|
||||
historicTaskInstanceQuery.finished();
|
||||
}
|
||||
});
|
||||
|
||||
Optional.ofNullable(historicTaskInstanceDTO.getProcessStatus()).ifPresent(m->{
|
||||
if(m.equals(WorkRecordStatus.NO_FINISHED)){
|
||||
historicTaskInstanceQuery.processUnfinished();
|
||||
}
|
||||
if(m.equals(WorkRecordStatus.FINISHED)){
|
||||
historicTaskInstanceQuery.processFinished();
|
||||
}
|
||||
});
|
||||
historicTaskInstanceQuery.includeIdentityLinks()
|
||||
.includeProcessVariables()
|
||||
.includeTaskLocalVariables();
|
||||
return historicTaskInstanceQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* 组装任务返回参数
|
||||
* @param historicTaskInstanceVO
|
||||
*/
|
||||
private void warpTaskVoList(HistoricTaskInstanceVO historicTaskInstanceVO){
|
||||
//保存待办人
|
||||
Set<SysUser> identityLinksForTask = getHistoricIdentityLinksForTask(historicTaskInstanceVO.getTaskId());
|
||||
Optional.ofNullable(identityLinksForTask).ifPresent(m->{
|
||||
List<String> userNameList = identityLinksForTask.stream().map(SysUser::getUserName).collect(Collectors.toList());
|
||||
historicTaskInstanceVO.setHandleUserList(userNameList);
|
||||
});
|
||||
//办理人
|
||||
if (ObjectUtil.isNotEmpty(historicTaskInstanceVO.getAssignee())&&com.snow.common.utils.StringUtils.isNumeric(historicTaskInstanceVO.getAssignee())) {
|
||||
SysUser sysUser = sysUserService.selectUserById(Long.parseLong(historicTaskInstanceVO.getAssignee()));
|
||||
historicTaskInstanceVO.setAssigneeName(sysUser.getUserName());
|
||||
}
|
||||
//审批结果
|
||||
Optional.ofNullable(historicTaskInstanceVO.getTaskLocalVariables()).ifPresent(u->{
|
||||
Object isPass =Optional.ofNullable(u.get(FlowConstants.IS_PASS)).orElse("");
|
||||
Object isStart =Optional.ofNullable(u.get(FlowConstants.IS_START)).orElse("");
|
||||
//处理审核条件
|
||||
historicTaskInstanceVO.setIsPass(String.valueOf(isPass));
|
||||
historicTaskInstanceVO.setIsStart(String.valueOf(isStart));
|
||||
});
|
||||
//获取评论
|
||||
List<Comment> comment = taskService.getTaskComments(historicTaskInstanceVO.getTaskId(), FlowConstants.OPINION);
|
||||
//获取附件
|
||||
List<Attachment> taskAttachments = taskService.getTaskAttachments(historicTaskInstanceVO.getTaskId());
|
||||
historicTaskInstanceVO.setCommentList(comment);
|
||||
historicTaskInstanceVO.setAttachmentList(taskAttachments);
|
||||
//计算任务历时
|
||||
if(!StringUtils.isEmpty(historicTaskInstanceVO.getCompleteTime())){
|
||||
String spendTime = DateUtil.formatBetween(DateUtil.between(historicTaskInstanceVO.getStartTime(), historicTaskInstanceVO.getCompleteTime(), DateUnit.SECOND));
|
||||
historicTaskInstanceVO.setHandleTaskTime(spendTime);
|
||||
}
|
||||
HistoricProcessInstance historicProcessInstance = flowableService.getHistoricProcessInstanceById(historicTaskInstanceVO.getProcessInstanceId());
|
||||
historicTaskInstanceVO.setProcessName(historicProcessInstance.getProcessDefinitionName());
|
||||
historicTaskInstanceVO.setBusinessKey(historicProcessInstance.getBusinessKey());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Set<SysUser> getIdentityLinksForTask(String taskId, String type) {
|
||||
Set<SysUser> userList=new HashSet<>();
|
||||
|
@ -207,16 +364,24 @@ public class FlowableTaskServiceImpl implements FlowableTaskService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public TaskVO getHisTask(String taskId) {
|
||||
TaskVO taskVO=new TaskVO();
|
||||
public HistoricTaskInstanceVO getHisTask(String taskId) {
|
||||
HistoricTaskInstanceVO historicTaskInstanceVO=new HistoricTaskInstanceVO();
|
||||
HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery()
|
||||
.taskId(taskId)
|
||||
.includeIdentityLinks()
|
||||
.includeTaskLocalVariables()
|
||||
.includeProcessVariables()
|
||||
.singleResult();
|
||||
BeanUtil.copyProperties(historicTaskInstance,taskVO);
|
||||
return taskVO;
|
||||
BeanUtil.copyProperties(historicTaskInstance,historicTaskInstanceVO);
|
||||
historicTaskInstanceVO.setTaskId(historicTaskInstance.getId());
|
||||
historicTaskInstanceVO.setTaskName(historicTaskInstance.getName());
|
||||
//老的createTime底层换成了time getCreateTime
|
||||
historicTaskInstanceVO.setStartTime(historicTaskInstance.getTime());
|
||||
historicTaskInstanceVO.setCompleteTime(historicTaskInstance.getEndTime());
|
||||
historicTaskInstanceVO.setTaskLocalVariables(historicTaskInstance.getTaskLocalVariables());
|
||||
historicTaskInstanceVO.setProcessVariables(historicTaskInstance.getProcessVariables());
|
||||
warpTaskVoList(historicTaskInstanceVO);
|
||||
return historicTaskInstanceVO;
|
||||
}
|
||||
|
||||
|
||||
|
@ -238,18 +403,17 @@ public class FlowableTaskServiceImpl implements FlowableTaskService {
|
|||
|
||||
List<FileEntry> files = finishTaskDTO.getFiles();
|
||||
if(!CollectionUtils.isEmpty(files)){
|
||||
files.stream().forEach(t->
|
||||
taskService.createAttachment("url",task.getId(),task.getProcessInstanceId(),t.getName(),t.getKey(),t.getUrl())
|
||||
);
|
||||
files.forEach(t->{
|
||||
if(ObjectUtil.isNull(t.getKey())) return;
|
||||
taskService.createAttachment("url",task.getId(),task.getProcessInstanceId(),t.getName(),t.getKey(),t.getUrl());
|
||||
});
|
||||
}
|
||||
Map<String, Object> paramMap = BeanUtil.beanToMap(finishTaskDTO);
|
||||
paramMap.remove(FinishTaskDTO.COMMENT);
|
||||
paramMap.remove(FinishTaskDTO.FILES);
|
||||
if(!CollectionUtils.isEmpty(paramMap)){
|
||||
Set<Map.Entry<String, Object>> entries = paramMap.entrySet();
|
||||
entries.stream().forEach(t->
|
||||
runtimeService.setVariable(task.getExecutionId(),t.getKey(),t.getValue())
|
||||
);
|
||||
entries.forEach(t-> runtimeService.setVariable(task.getExecutionId(),t.getKey(),t.getValue()));
|
||||
}
|
||||
//修改业务数据的时候流程业务数据重新赋值
|
||||
if(finishTaskDTO.getIsUpdateBus()&&appFrom!=null){
|
||||
|
@ -257,7 +421,7 @@ public class FlowableTaskServiceImpl implements FlowableTaskService {
|
|||
runtimeService.setVariable(task.getExecutionId(),FlowConstants.APP_FORM,appFrom);
|
||||
}
|
||||
// owner不为空说明可能存在委托任务
|
||||
if (!StringUtils.isEmpty(task.getOwner())) {
|
||||
if (ObjectUtil.isNotNull(task.getOwner())) {
|
||||
DelegationState delegationState = task.getDelegationState();
|
||||
switch (delegationState) {
|
||||
//委派中
|
||||
|
|
|
@ -22,4 +22,9 @@ INSERT INTO `sys_message_template`( `template_code`, `template_name`, `template_
|
|||
|
||||
#2021-07-23
|
||||
INSERT INTO `sys_dict_data`( `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 3, '取消', '2', 'process_instance_status', NULL, 'warning', 'N', '0', 'admin', NOW(), '', NOW(), '取消');
|
||||
INSERT INTO `sys_menu`( `menu_name`, `parent_id`, `order_num`, `url`, `target`, `menu_type`, `visible`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`, `is_refresh`, `menu_source`) VALUES ('取消流程', 2043, 3, '#', 'menuItem', 'F', '0', 'cancelProcessInstance', '#', 'admin', NOW(), '', NULL, '', 1, 0);
|
||||
INSERT INTO `sys_menu`( `menu_name`, `parent_id`, `order_num`, `url`, `target`, `menu_type`, `visible`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`, `is_refresh`) VALUES ('取消流程', 2043, 3, '#', 'menuItem', 'F', '0', 'cancelProcessInstance', '#', 'admin', NOW(), '', NULL, '', 1);
|
||||
|
||||
UPDATE `sys_menu` SET `url` = '/flow/toMyTakePartInTask', `perms` = 'flow:process:getMyTakePartInTask' WHERE `menu_id` = 2044;
|
||||
|
||||
INSERT INTO `sys_menu`(`menu_name`, `parent_id`, `order_num`, `url`, `target`, `menu_type`, `visible`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`, `is_refresh`) VALUES (
|
||||
'我的已办详情', (select temp.* from( select menu_id from sys_menu where perms='flow:process:getMyTakePartInTask' ) as temp), 2, '#', 'menuItem', 'F', '0', 'flow:process:myTaskedDetail', '#', 'admin', NOW(), 'admin', NOW(), '', 1);
|
||||
|
|
Loading…
Reference in New Issue