flowable集成

This commit is contained in:
459816669@qq.com 2020-11-23 23:06:38 +08:00
parent f81581ea11
commit 3c1d31cdfc
8 changed files with 314 additions and 38 deletions

View File

@ -0,0 +1,104 @@
package com.snow.web.controller.flowable;
import com.google.common.collect.Lists;
import com.snow.common.annotation.Log;
import com.snow.common.core.domain.AjaxResult;
import com.snow.common.enums.BusinessType;
import com.snow.common.exception.BusinessException;
import com.snow.common.utils.StringUtils;
import com.snow.flowable.domain.CompleteTaskDTO;
import com.snow.flowable.domain.FileEntry;
import com.snow.flowable.domain.FinishTaskDTO;
import com.snow.flowable.service.impl.FlowableServiceImpl;
import com.snow.framework.util.ShiroUtils;
import com.snow.system.domain.SysOaLeave;
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.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;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
* @program: snow
* @description
* @author: 没用的阿吉
* @create: 2020-11-23 21:17
**/
@Controller
@RequestMapping("/flow")
public class FlowController {
private String prefix = "flow";
@Autowired
private ISysOaLeaveService sysOaLeaveService;
@Autowired
private FlowableServiceImpl flowableService;
/**
* 跳转流程编译器
* @return
*/
//@RequiresPermissions("modeler:flow:view")
@GetMapping("/toFinishTask")
public String toFinishTask(String businessKey,String taskId,ModelMap mmap)
{
Task task = flowableService.getTask(taskId);
HistoricProcessInstance historicProcessInstance= flowableService.getHistoricProcessInstanceById(task.getProcessInstanceId());
String processDefinitionKey = historicProcessInstance.getProcessDefinitionKey();
if(processDefinitionKey.equals("snow_oa_leave")){
SysOaLeave sysOaLeave=new SysOaLeave();
sysOaLeave.setLeaveNo(businessKey);
List<SysOaLeave> sysOaLeaves = sysOaLeaveService.selectSysOaLeaveList(sysOaLeave);
if(StringUtils.isEmpty(sysOaLeaves)){
throw new BusinessException("跳转请假申请页面异常");
}
mmap.put("sysOaLeave", sysOaLeaves.get(0));
mmap.put("taskId", taskId);
return "system/leave/finishTask";
}
return "";
}
/**
* 完成任务
*/
//@RequiresPermissions("system:leave:startLeaveProcess")
@Log(title = "完成审批", businessType = BusinessType.INSERT)
@PostMapping("/finishTask")
@ResponseBody
@Transactional(rollbackFor = Exception.class)
public AjaxResult finishTask(FinishTaskDTO finishTaskDTO)
{
SysUser sysUser = ShiroUtils.getSysUser();
List<FileEntry> files=Lists.newArrayList();
FileEntry fileEntry=new FileEntry();
fileEntry.setName("请假申请");
fileEntry.setUrl(finishTaskDTO.getSuggestionFileUrl());
files.add(fileEntry);
CompleteTaskDTO completeTaskDTO=new CompleteTaskDTO();
completeTaskDTO.setTaskId(finishTaskDTO.getTaskId());
completeTaskDTO.setUserId(String.valueOf(sysUser.getUserId()));
completeTaskDTO.setFiles(files);
completeTaskDTO.setComment(finishTaskDTO.getSuggestion());
Integer checkStatus = finishTaskDTO.getCheckStatus();
if(checkStatus==0){
completeTaskDTO.setIsPass(true);
}else {
completeTaskDTO.setIsPass(false);
}
flowableService.completeTask(completeTaskDTO);
return AjaxResult.success();
}
}

View File

@ -3,14 +3,17 @@ package com.snow.web.controller.system;
import java.util.List; import java.util.List;
import com.snow.common.constant.SequenceContants; import com.snow.common.constant.SequenceContants;
import com.snow.common.utils.StringUtils;
import com.snow.flowable.domain.CompleteTaskDTO; import com.snow.flowable.domain.CompleteTaskDTO;
import com.snow.flowable.domain.StartProcessDTO; import com.snow.flowable.domain.StartProcessDTO;
import com.snow.flowable.service.impl.FlowableServiceImpl; import com.snow.flowable.service.impl.FlowableServiceImpl;
import com.snow.framework.util.ShiroUtils; import com.snow.framework.util.ShiroUtils;
import com.snow.system.domain.SysUser; import com.snow.system.domain.SysUser;
import com.snow.system.service.ISysSequenceService; import com.snow.system.service.ISysSequenceService;
import com.snow.system.service.impl.SysOaLeaveServiceImpl;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.flowable.engine.runtime.ProcessInstance; import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.task.api.Task;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -50,6 +53,7 @@ public class SysOaLeaveController extends BaseController
@Autowired @Autowired
private ISysSequenceService sequenceService; private ISysSequenceService sequenceService;
@RequiresPermissions("system:leave:view") @RequiresPermissions("system:leave:view")
@GetMapping() @GetMapping()
public String leave() public String leave()
@ -114,23 +118,29 @@ public class SysOaLeaveController extends BaseController
/** /**
* 发起审批 * 完成任务
*/ */
@RequiresPermissions("system:leave:startLeaveProcess") //@RequiresPermissions("system:leave:startLeaveProcess")
@Log(title = "发起审批", businessType = BusinessType.INSERT) @Log(title = "发起审批", businessType = BusinessType.INSERT)
@PostMapping("/startLeaveProcess") @PostMapping("/finishTask")
@ResponseBody @ResponseBody
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public AjaxResult startLeaveProcess(Integer id) public AjaxResult startLeaveProcess(String businessKey)
{ {
SysOaLeave sysOaLeave = sysOaLeaveService.selectSysOaLeaveById(id); SysOaLeave sysOaLeave=new SysOaLeave();
sysOaLeave.setLeaveNo(businessKey);
List<SysOaLeave> sysOaLeaves = sysOaLeaveService.selectSysOaLeaveList(sysOaLeave);
if(StringUtils.isEmpty(sysOaLeaves)){
return AjaxResult.error("该业务参数不存在");
}
SysUser sysUser = ShiroUtils.getSysUser(); SysUser sysUser = ShiroUtils.getSysUser();
CompleteTaskDTO CompleteTaskDTO=new CompleteTaskDTO(); CompleteTaskDTO CompleteTaskDTO=new CompleteTaskDTO();
CompleteTaskDTO.setUserId(String.valueOf(sysUser.getUserId())); CompleteTaskDTO.setUserId(String.valueOf(sysUser.getUserId()));
flowableService.completeTask(CompleteTaskDTO); flowableService.completeTask(CompleteTaskDTO);
sysOaLeave.setProcessStatus(1); sysOaLeave.setProcessStatus(1);
sysOaLeave.setCreateBy(sysUser.getUserName()); sysOaLeave.setCreateBy(sysUser.getUserName());
sysOaLeave.setApplyPerson(String.valueOf(sysUser.getUserId()));
int i = sysOaLeaveService.updateSysOaLeave(sysOaLeave); int i = sysOaLeaveService.updateSysOaLeave(sysOaLeave);
return toAjax(i); return toAjax(i);
} }
@ -162,9 +172,11 @@ public class SysOaLeaveController extends BaseController
startProcessDTO.setProcessDefinitionKey("snow_oa_leave"); startProcessDTO.setProcessDefinitionKey("snow_oa_leave");
startProcessDTO.setStartUserId(String.valueOf(sysUser.getUserId())); startProcessDTO.setStartUserId(String.valueOf(sysUser.getUserId()));
ProcessInstance processInstance = flowableService.startProcessInstanceByKey(startProcessDTO); ProcessInstance processInstance = flowableService.startProcessInstanceByKey(startProcessDTO);
CompleteTaskDTO CompleteTaskDTO=new CompleteTaskDTO(); CompleteTaskDTO completeTaskDTO=new CompleteTaskDTO();
CompleteTaskDTO.setUserId(String.valueOf(sysUser.getUserId())); completeTaskDTO.setUserId(String.valueOf(sysUser.getUserId()));
flowableService.completeTask(CompleteTaskDTO); Task task= flowableService.getTaskProcessInstanceById(processInstance.getProcessInstanceId());
completeTaskDTO.setTaskId(task.getId());
flowableService.completeTask(completeTaskDTO);
sysOaLeave.setProcessStatus(1); sysOaLeave.setProcessStatus(1);
sysOaLeave.setCreateBy(sysUser.getUserName()); sysOaLeave.setCreateBy(sysUser.getUserName());
BeanUtils.copyProperties(sysOaLeave,oldSysOaLeave); BeanUtils.copyProperties(sysOaLeave,oldSysOaLeave);

View File

@ -113,7 +113,7 @@
var capitalStatusDatas = [[${@dict.getType('capital_status')}]]; var capitalStatusDatas = [[${@dict.getType('capital_status')}]];
var billTypeDatas = [[${@dict.getType('bill_type')}]]; var billTypeDatas = [[${@dict.getType('bill_type')}]];
var prefix = ctx + "modeler"; var prefix = ctx + "modeler";
var prefixFlow = ctx + "flow";
$(function() { $(function() {
var options = { var options = {
url: prefix + "/findTasksByUserId", url: prefix + "/findTasksByUserId",
@ -146,7 +146,7 @@
}, },
{ {
field: 'startUserId', field: 'startUserName',
title: '流程发起人' title: '流程发起人'
}, },
{ {
@ -163,14 +163,25 @@
align: 'center', align: 'center',
formatter: function(value, row, index) { formatter: function(value, row, index) {
var actions = []; var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>处理</a> '); 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="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></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(''); return actions.join('');
} }
}] }]
}; };
$.table.init(options); $.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>
</body> </body>
</html> </html>

View File

@ -25,7 +25,7 @@
<label class="col-sm-3 control-label">开始时间:</label> <label class="col-sm-3 control-label">开始时间:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<div class="input-group date"> <div class="input-group date">
<input name="startTime" th:value="${#dates.format(sysOaLeave.startTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text"> <input name="startTime" th:value="${#dates.format(sysOaLeave.startTime, 'yyyy-MM-dd HH:mm:ss')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span> <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div> </div>
</div> </div>
@ -34,32 +34,11 @@
<label class="col-sm-3 control-label">结束时间:</label> <label class="col-sm-3 control-label">结束时间:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<div class="input-group date"> <div class="input-group date">
<input name="endTime" th:value="${#dates.format(sysOaLeave.endTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text"> <input name="endTime" th:value="${#dates.format(sysOaLeave.endTime, 'yyyy-MM-dd HH:mm:ss')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span> <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div> </div>
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-sm-3 control-label">流程状态:</label>
<div class="col-sm-8">
<select name="processStatus" class="form-control m-b" th:with="type=${@dict.getType('process_status')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{processInstanceId}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">流程实例ID</label>
<div class="col-sm-8">
<input name="processInstanceId" th:field="*{processInstanceId}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">申请人:</label>
<div class="col-sm-8">
<input name="applyPerson" th:field="*{applyPerson}" class="form-control" type="text">
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">附件:</label> <label class="col-sm-3 control-label">附件:</label>
<div class="col-sm-8"> <div class="col-sm-8">

View File

@ -0,0 +1,104 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('完成任务')" />
<th:block th:include="include :: jsonview-css" />
<th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m-t" id="signupForm">
<div class="row">
<div class="col-sm-offset-0 col-sm-10">
<button type="button" class="btn btn-sm btn-primary" onclick="submitCheckHandler()"><i class="fa fa-check"></i>通 过</button>&nbsp;
<button type="button" class="btn btn-sm btn-danger" onclick="submitHandler()"><i class="fa fa-remove"></i>驳 回</button>&nbsp;
<button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
</div>
</div>
<input class="form-control" type="hidden" name="taskId" th:value="*{taskId}"/>
<h4 class="form-header h4">请假信息</h4>
<div class="form-group">
<label class="col-sm-3 control-label">标题:</label>
<div class="form-control-static" th:text="${sysOaLeave.name}">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">请假理由:</label>
<div class="form-control-static"><pre id="reason"></pre></div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">开始时间:</label>
<div class="form-control-static" th:text="${#dates.format(sysOaLeave.startTime, 'yyyy-MM-dd hh:mm:ss')}">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">结束时间:</label>
<div class="form-control-static" th:text="${#dates.format(sysOaLeave.endTime, 'yyyy-MM-dd HH:mm:ss')}">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">申请人:</label>
<div class="form-control-static" th:text="${sysOaLeave.applyPerson}">
</div>
</div>
<h4 class="form-header h4">填写信息</h4>
<div class="form-group">
<label class="col-sm-3 control-label">审批意见:</label>
<div class="col-sm-8">
<textarea name="suggestion" class="form-control"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">审批附件:</label>
<div class="col-sm-8">
<input type="hidden" name="suggestionFileUrl" >
<div class="file-loading">
<input class="form-control file-upload" id="suggestionFileUrl" name="file" type="file">
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: jsonview-js" />
<th:block th:include="include :: bootstrap-fileinput-js"/>
<script th:inline="javascript">
$(function() {
var reason = [[${sysOaLeave.reason}]];
if ($.common.isNotEmpty(reason) && reason.length < 2000) {
$("#reason").JSONView(reason);
} else {
$("#reason").text(reason);
}
});
$(".file-upload").each(function (i) {
var val = $("input[name='" + this.id + "']").val();
$(this).fileinput({
'uploadUrl': '/common/upload',
initialPreviewAsData: true,
initialPreview: [val],
maxFileCount: 1,
autoReplace: true
}).on('fileuploaded', function (event, data, previewId, index) {
$("input[name='" + event.currentTarget.id + "']").val(data.response.url)
}).on('fileremoved', function (event, id, index) {
$("input[name='" + event.currentTarget.id + "']").val('')
})
$(this).fileinput('_initFileActions');
});
function submitCheckHandler() {
if ($.validate.form()) {
var data = $("#signupForm").serializeArray();
data.push({"name": "checkStatus", "value": 0});
$.operate.saveTab("/flow/finishTask", data);
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,31 @@
package com.snow.flowable.domain;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @program: snow
* @description
* @author: 没用的阿吉
* @create: 2020-11-23 22:13
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class FinishTaskDTO implements Serializable {
private String taskId;
private String suggestion;
private String suggestionFileUrl;
/**
* 0通过1--驳回
*/
private Integer checkStatus;
}

View File

@ -1,6 +1,7 @@
package com.snow.flowable.service; package com.snow.flowable.service;
import com.snow.flowable.domain.*; import com.snow.flowable.domain.*;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.runtime.ProcessInstance; import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.task.api.Task; import org.flowable.task.api.Task;
@ -74,4 +75,20 @@ public interface FlowableService {
* @param processId * @param processId
*/ */
void getProcessDiagram(HttpServletResponse httpServletResponse, String processId); void getProcessDiagram(HttpServletResponse httpServletResponse, String processId);
/**
* 获取流程实例
* @param id
* @return
*/
ProcessInstance getProcessInstanceById(String id);
/**
* 获取历史流程实例
* @param id
* @return
*/
HistoricProcessInstance getHistoricProcessInstanceById(String id);
Task getTaskProcessInstanceById(String id);
} }

View File

@ -7,7 +7,9 @@ import com.snow.common.exception.BusinessException;
import com.snow.flowable.domain.*; import com.snow.flowable.domain.*;
import com.snow.flowable.service.FlowableService; import com.snow.flowable.service.FlowableService;
import com.snow.system.domain.SysRole; import com.snow.system.domain.SysRole;
import com.snow.system.domain.SysUser;
import com.snow.system.service.ISysRoleService; import com.snow.system.service.ISysRoleService;
import com.snow.system.service.impl.SysUserServiceImpl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.flowable.bpmn.model.BpmnModel; import org.flowable.bpmn.model.BpmnModel;
@ -67,6 +69,9 @@ public class FlowableServiceImpl implements FlowableService {
@Autowired @Autowired
private ProcessEngine processEngine; private ProcessEngine processEngine;
@Autowired
private SysUserServiceImpl sysUserService;
@Override @Override
public List<DeploymentVO> getDeploymentList(DeploymentQueryDTO deploymentQueryDTO) { public List<DeploymentVO> getDeploymentList(DeploymentQueryDTO deploymentQueryDTO) {
@ -225,7 +230,10 @@ public class FlowableServiceImpl implements FlowableService {
taskVO.setOwner(t.getOwner()); taskVO.setOwner(t.getOwner());
HistoricProcessInstance historicProcessInstance = getHistoricProcessInstanceById(t.getProcessInstanceId()); HistoricProcessInstance historicProcessInstance = getHistoricProcessInstanceById(t.getProcessInstanceId());
taskVO.setProcessDefinitionName(historicProcessInstance.getProcessDefinitionName()); taskVO.setProcessDefinitionName(historicProcessInstance.getProcessDefinitionName());
taskVO.setStartUserId(historicProcessInstance.getStartUserId()); String startUserId = historicProcessInstance.getStartUserId();
SysUser sysUser = sysUserService.selectUserById(Long.parseLong(startUserId));
taskVO.setStartUserId(startUserId);
taskVO.setStartUserName(sysUser.getUserName());
taskVO.setBusinessKey(historicProcessInstance.getBusinessKey()); taskVO.setBusinessKey(historicProcessInstance.getBusinessKey());
taskVO.setStartTime(historicProcessInstance.getStartTime()); taskVO.setStartTime(historicProcessInstance.getStartTime());
return taskVO; return taskVO;
@ -242,7 +250,7 @@ public class FlowableServiceImpl implements FlowableService {
log.info("完成任务时该任务ID:%不存在",completeTaskDTO.getTaskId()); log.info("完成任务时该任务ID:%不存在",completeTaskDTO.getTaskId());
throw new BusinessException(String.format("该任务ID:%不存在",completeTaskDTO.getTaskId())); throw new BusinessException(String.format("该任务ID:%不存在",completeTaskDTO.getTaskId()));
} }
if(StringUtils.isEmpty(completeTaskDTO.getComment())){ if(!StringUtils.isEmpty(completeTaskDTO.getComment())){
taskService.addComment(task.getId(),task.getProcessInstanceId(),completeTaskDTO.getComment()); taskService.addComment(task.getId(),task.getProcessInstanceId(),completeTaskDTO.getComment());
} }
List<FileEntry> files = completeTaskDTO.getFiles(); List<FileEntry> files = completeTaskDTO.getFiles();
@ -252,7 +260,7 @@ public class FlowableServiceImpl implements FlowableService {
); );
} }
runtimeService.setVariable(task.getExecutionId(),CompleteTaskDTO.IS_PASS,completeTaskDTO.getIsPass()); runtimeService.setVariable(task.getExecutionId(),CompleteTaskDTO.IS_PASS,completeTaskDTO.getIsPass());
Map<String, Object> paramMap = completeTaskDTO.getParamMap(); Map<String, Object> paramMap = StringUtils.isEmpty(completeTaskDTO.getParamMap())?Maps.newHashMap():completeTaskDTO.getParamMap();
if(!CollectionUtils.isEmpty(paramMap)){ if(!CollectionUtils.isEmpty(paramMap)){
Set<Map.Entry<String, Object>> entries = paramMap.entrySet(); Set<Map.Entry<String, Object>> entries = paramMap.entrySet();
entries.stream().forEach(t-> entries.stream().forEach(t->
@ -260,6 +268,7 @@ public class FlowableServiceImpl implements FlowableService {
); );
} }
paramMap.put(CompleteTaskDTO.IS_PASS,completeTaskDTO.getIsPass()); paramMap.put(CompleteTaskDTO.IS_PASS,completeTaskDTO.getIsPass());
taskService.claim(task.getId(),completeTaskDTO.getUserId());
taskService.complete(task.getId(),paramMap,true); taskService.complete(task.getId(),paramMap,true);
} }
@ -321,15 +330,24 @@ public class FlowableServiceImpl implements FlowableService {
.processInstanceId(processInstanceId).count() > 0; .processInstanceId(processInstanceId).count() > 0;
} }
@Override
public ProcessInstance getProcessInstanceById(String id){ public ProcessInstance getProcessInstanceById(String id){
return runtimeService.createProcessInstanceQuery() return runtimeService.createProcessInstanceQuery()
.processInstanceId(id) .processInstanceId(id)
.singleResult(); .singleResult();
} }
@Override
public HistoricProcessInstance getHistoricProcessInstanceById(String id){ public HistoricProcessInstance getHistoricProcessInstanceById(String id){
return historyService.createHistoricProcessInstanceQuery() return historyService.createHistoricProcessInstanceQuery()
.processInstanceId(id) .processInstanceId(id)
.singleResult(); .singleResult();
} }
@Override
public Task getTaskProcessInstanceById(String id){
return taskService.createTaskQuery()
.processInstanceId(id)
.singleResult();
}
} }