|
|
@ -32,12 +32,15 @@ import org.flowable.bpmn.model.Process;
|
|
|
|
import org.flowable.bpmn.model.*;
|
|
|
|
import org.flowable.bpmn.model.*;
|
|
|
|
import org.flowable.common.engine.api.FlowableException;
|
|
|
|
import org.flowable.common.engine.api.FlowableException;
|
|
|
|
import org.flowable.common.engine.api.FlowableObjectNotFoundException;
|
|
|
|
import org.flowable.common.engine.api.FlowableObjectNotFoundException;
|
|
|
|
|
|
|
|
import org.flowable.common.engine.api.query.QueryProperty;
|
|
|
|
import org.flowable.common.engine.impl.identity.Authentication;
|
|
|
|
import org.flowable.common.engine.impl.identity.Authentication;
|
|
|
|
import org.flowable.engine.ProcessEngineConfiguration;
|
|
|
|
import org.flowable.engine.ProcessEngineConfiguration;
|
|
|
|
import org.flowable.engine.history.HistoricActivityInstance;
|
|
|
|
import org.flowable.engine.history.HistoricActivityInstance;
|
|
|
|
import org.flowable.engine.history.HistoricProcessInstance;
|
|
|
|
import org.flowable.engine.history.HistoricProcessInstance;
|
|
|
|
import org.flowable.engine.history.HistoricProcessInstanceQuery;
|
|
|
|
import org.flowable.engine.history.HistoricProcessInstanceQuery;
|
|
|
|
|
|
|
|
import org.flowable.engine.impl.ActivityInstanceQueryProperty;
|
|
|
|
import org.flowable.engine.repository.ProcessDefinition;
|
|
|
|
import org.flowable.engine.repository.ProcessDefinition;
|
|
|
|
|
|
|
|
import org.flowable.engine.runtime.ActivityInstance;
|
|
|
|
import org.flowable.engine.runtime.Execution;
|
|
|
|
import org.flowable.engine.runtime.Execution;
|
|
|
|
import org.flowable.engine.runtime.ProcessInstance;
|
|
|
|
import org.flowable.engine.runtime.ProcessInstance;
|
|
|
|
import org.flowable.engine.task.Comment;
|
|
|
|
import org.flowable.engine.task.Comment;
|
|
|
@ -57,6 +60,7 @@ import java.util.*;
|
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
import java.util.function.Function;
|
|
|
|
import java.util.function.Function;
|
|
|
|
import java.util.function.Predicate;
|
|
|
|
import java.util.function.Predicate;
|
|
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @author XuanXuan
|
|
|
|
* @author XuanXuan
|
|
|
@ -109,7 +113,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void taskReject(FlowTaskVo flowTaskVo) {
|
|
|
|
public void taskReject(FlowTaskVo flowTaskVo) {
|
|
|
|
if (taskService.createTaskQuery().taskId(flowTaskVo.getTaskId()).singleResult().isSuspended()) {
|
|
|
|
if (taskService.createTaskQuery().taskId(flowTaskVo.getTaskId()).singleResult().isSuspended()) {
|
|
|
|
throw new CustomException("任务处于挂起状态");
|
|
|
|
throw new CustomException("任务处于挂起状态!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 当前任务 task
|
|
|
|
// 当前任务 task
|
|
|
|
Task task = taskService.createTaskQuery().taskId(flowTaskVo.getTaskId()).singleResult();
|
|
|
|
Task task = taskService.createTaskQuery().taskId(flowTaskVo.getTaskId()).singleResult();
|
|
|
@ -288,9 +292,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
// 设置回退意见
|
|
|
|
// 设置回退意见
|
|
|
|
for (String currentTaskId : currentTaskIds) {
|
|
|
|
currentTaskIds.forEach(currentTaskId -> taskService.addComment(currentTaskId, task.getProcessInstanceId(), FlowComment.REBACK.getType(), flowTaskVo.getComment()));
|
|
|
|
taskService.addComment(currentTaskId, task.getProcessInstanceId(), FlowComment.REBACK.getType(), flowTaskVo.getComment());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
// 1 对 1 或 多 对 1 情况,currentIds 当前要跳转的节点列表(1或多),targetKey 跳转到的节点(1)
|
|
|
|
// 1 对 1 或 多 对 1 情况,currentIds 当前要跳转的节点列表(1或多),targetKey 跳转到的节点(1)
|
|
|
@ -583,6 +585,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|
|
|
flowTask.setTaskDefKey(task.getTaskDefinitionKey());
|
|
|
|
flowTask.setTaskDefKey(task.getTaskDefinitionKey());
|
|
|
|
flowTask.setCreateTime(task.getCreateTime());
|
|
|
|
flowTask.setCreateTime(task.getCreateTime());
|
|
|
|
flowTask.setProcDefId(task.getProcessDefinitionId());
|
|
|
|
flowTask.setProcDefId(task.getProcessDefinitionId());
|
|
|
|
|
|
|
|
flowTask.setExecutionId(task.getExecutionId());
|
|
|
|
flowTask.setTaskName(task.getName());
|
|
|
|
flowTask.setTaskName(task.getName());
|
|
|
|
// 流程定义信息
|
|
|
|
// 流程定义信息
|
|
|
|
ProcessDefinition pd = repositoryService.createProcessDefinitionQuery()
|
|
|
|
ProcessDefinition pd = repositoryService.createProcessDefinitionQuery()
|
|
|
@ -818,22 +821,39 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 获取流程执行过程
|
|
|
|
* 获取流程执行过程
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param procInsId
|
|
|
|
* @param procInsId 流程实例id
|
|
|
|
* @return
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public AjaxResult getFlowViewer(String procInsId) {
|
|
|
|
public AjaxResult getFlowViewer(String procInsId, String executionId) {
|
|
|
|
List<FlowViewerDto> flowViewerList = new ArrayList<>();
|
|
|
|
List<FlowViewerDto> flowViewerList = new ArrayList<>();
|
|
|
|
FlowViewerDto flowViewerDto;
|
|
|
|
FlowViewerDto flowViewerDto;
|
|
|
|
// 获得活动的节点
|
|
|
|
// 获取任务开始节点(临时处理方式)
|
|
|
|
List<HistoricActivityInstance> hisActIns = historyService.createHistoricActivityInstanceQuery()
|
|
|
|
List<HistoricActivityInstance> startNodeList = historyService.createHistoricActivityInstanceQuery()
|
|
|
|
.processInstanceId(procInsId)
|
|
|
|
.processInstanceId(procInsId)
|
|
|
|
.orderByHistoricActivityInstanceStartTime()
|
|
|
|
.orderByHistoricActivityInstanceStartTime()
|
|
|
|
|
|
|
|
.asc().listPage(0,3);
|
|
|
|
|
|
|
|
for (HistoricActivityInstance startInstance : startNodeList) {
|
|
|
|
|
|
|
|
if (!"sequenceFlow".equals(startInstance.getActivityType())) {
|
|
|
|
|
|
|
|
flowViewerDto = new FlowViewerDto();
|
|
|
|
|
|
|
|
if (!"sequenceFlow".equals(startInstance.getActivityType())) {
|
|
|
|
|
|
|
|
flowViewerDto.setKey(startInstance.getActivityId());
|
|
|
|
|
|
|
|
// 根据流程节点处理时间校验改节点是否已完成
|
|
|
|
|
|
|
|
flowViewerDto.setCompleted(!Objects.isNull(startInstance.getEndTime()));
|
|
|
|
|
|
|
|
flowViewerList.add(flowViewerDto);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 历史节点
|
|
|
|
|
|
|
|
List<HistoricActivityInstance> hisActIns = historyService.createHistoricActivityInstanceQuery()
|
|
|
|
|
|
|
|
.executionId(executionId)
|
|
|
|
|
|
|
|
.orderByHistoricActivityInstanceStartTime()
|
|
|
|
.asc().list();
|
|
|
|
.asc().list();
|
|
|
|
for (HistoricActivityInstance activityInstance : hisActIns) {
|
|
|
|
for (HistoricActivityInstance activityInstance : hisActIns) {
|
|
|
|
if (!"sequenceFlow".equals(activityInstance.getActivityType())) {
|
|
|
|
if (!"sequenceFlow".equals(activityInstance.getActivityType())) {
|
|
|
|
flowViewerDto = new FlowViewerDto();
|
|
|
|
flowViewerDto = new FlowViewerDto();
|
|
|
|
flowViewerDto.setKey(activityInstance.getActivityId());
|
|
|
|
flowViewerDto.setKey(activityInstance.getActivityId());
|
|
|
|
|
|
|
|
// 根据流程节点处理时间校验改节点是否已完成
|
|
|
|
flowViewerDto.setCompleted(!Objects.isNull(activityInstance.getEndTime()));
|
|
|
|
flowViewerDto.setCompleted(!Objects.isNull(activityInstance.getEndTime()));
|
|
|
|
flowViewerList.add(flowViewerDto);
|
|
|
|
flowViewerList.add(flowViewerDto);
|
|
|
|
}
|
|
|
|
}
|
|
|
|