包头待催办bug修复
This commit is contained in:
parent
b227642843
commit
4b8950b696
@ -44,9 +44,12 @@ import org.flowable.engine.history.HistoricActivityInstance;
|
||||
import org.flowable.engine.history.HistoricProcessInstance;
|
||||
import org.flowable.engine.history.HistoricProcessInstanceQuery;
|
||||
import org.flowable.engine.repository.ProcessDefinition;
|
||||
import org.flowable.engine.runtime.Execution;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.flowable.engine.runtime.ProcessInstanceQuery;
|
||||
import org.flowable.task.api.Task;
|
||||
import org.flowable.task.api.TaskInfo;
|
||||
import org.flowable.task.api.TaskQuery;
|
||||
import org.flowable.variable.api.history.HistoricVariableInstance;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -431,9 +434,35 @@ public class ProcessInstanceServiceImpl implements ProcessInstanceService {
|
||||
instanceQuery.processInstanceTenantId(TenantContextHolder.getTenantId());
|
||||
//(x=1 or x=2) and
|
||||
if (Objects.equals(customStatus, 1)) {
|
||||
instanceQuery.or().startedBy(startUser + "").involvedUser(startUser + "").endOr();
|
||||
HistoricProcessInstanceQuery baseQuery = historyService.createHistoricProcessInstanceQuery()
|
||||
.or().startedBy(startUser)
|
||||
.involvedUser(startUser)
|
||||
.endOr()
|
||||
.unfinished();
|
||||
List<String> processInstanceIds = baseQuery.list()
|
||||
.stream()
|
||||
.map(HistoricProcessInstance::getId)
|
||||
.collect(Collectors.toList());
|
||||
// 获取当前用户待处理任务的流程实例ID
|
||||
TaskQuery taskQuery = taskService.createTaskQuery();
|
||||
ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery();
|
||||
Set<String> stringSet = processInstanceQuery.list().stream().map(Execution::getProcessInstanceId).collect(Collectors.toSet());
|
||||
taskQuery.active().taskTenantId(TenantContextHolder.getTenantId())
|
||||
.processInstanceIdIn(stringSet)
|
||||
.taskCandidateOrAssigned(startUser);
|
||||
List<String> activeTaskProcessIds = taskQuery.list()
|
||||
.stream()
|
||||
.map(Task::getProcessInstanceId)
|
||||
.collect(Collectors.toList());
|
||||
// 排除待处理的流程实例ID
|
||||
processInstanceIds.removeAll(activeTaskProcessIds);
|
||||
if (processInstanceIds.isEmpty()) {
|
||||
processInstanceIds.add("-100");
|
||||
}
|
||||
// 构造最终查询并分页
|
||||
instanceQuery.processInstanceIds(new HashSet<>(processInstanceIds));
|
||||
} else if (Objects.equals(customStatus, 2)) {
|
||||
instanceQuery.or().startedBy(startUser + "").involvedUser(startUser + "").endOr();
|
||||
instanceQuery.or().startedBy(startUser).involvedUser(startUser).endOr();
|
||||
instanceQuery.finished();
|
||||
}
|
||||
if (!Objects.equals(customStatus, 1) && !Objects.equals(customStatus, 2)) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user