update - 任务日志过滤系统操作

This commit is contained in:
wangli 2023-12-07 20:22:06 +08:00
parent d3c23d72dd
commit fb059cced1
2 changed files with 10 additions and 8 deletions

View File

@ -7,8 +7,13 @@ import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import static cn.axzo.workflow.core.common.enums.BpmnProcessTaskResultEnum.REJECTION_AUTO_COMPLETED;
import static org.mapstruct.NullValueCheckStrategy.ALWAYS;
/**
@ -44,13 +49,14 @@ public interface BpmnHistoricTaskInstanceConverter extends EntityConverter<BpmnH
BpmnHistoricTaskInstanceVO toVo(HistoricTaskInstance entity);
default List<BpmnHistoricTaskInstanceVO> toVosSkipMiEnd(List<HistoricTaskInstance> entities) {
default List<BpmnHistoricTaskInstanceVO> toVosSkipSystemOperation(List<HistoricTaskInstance> entities) {
if (CollectionUtils.isEmpty(entities)) {
return Collections.emptyList();
}
List<BpmnHistoricTaskInstanceVO> vos = new ArrayList<>();
entities.stream()
.filter(i -> !Objects.equals(DELETE_REASON_END, i.getDeleteReason()))
.filter(i -> Objects.equals(REJECTION_AUTO_COMPLETED.getDesc(), i.getDeleteReason()))
.forEach(i -> vos.add(toVo(i)));
return vos;
}

View File

@ -528,21 +528,17 @@ public class BpmnProcessTaskServiceImpl implements BpmnProcessTaskService {
List<HistoricTaskInstance> taskInstances = query.orderByHistoricTaskInstanceStartTime().desc() // 创建时间倒序
.list();
// 过滤了多实例或签自动完成的任务
List<BpmnHistoricTaskInstanceVO> vos = historicTaskInstanceConverter.toVosSkipMiEnd(taskInstances);
List<BpmnHistoricTaskInstanceVO> vos = historicTaskInstanceConverter.toVosSkipSystemOperation(taskInstances);
Map<String, List<Comment>> commentByTaskIdMap =
taskService.getProcessInstanceComments(processInstanceId).stream().collect(Collectors.groupingBy(Comment::getTaskId));
Map<String, HistoricVariableInstance> variableInstanceMap =
// 不能使用框架提供的历史变量 API 查询, BUG
historyService.createNativeHistoricVariableInstanceQuery().sql("select * from ACT_HI_VARINST t where " +
"t.proc_inst_id_= #{processInstanceId}")
.parameter("processInstanceId", processInstanceId)
.list().stream().collect(Collectors.toMap(HistoricVariableInstance::getVariableName,
Function.identity(), (s, t) -> s));
// Map<String, HistoricVariableInstance> variableInstanceMap =
// historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstanceId)
// .list().stream()
// .collect(Collectors.toMap(HistoricVariableInstance::getVariableName,
// Function.identity(), (s, t) -> s));
Map<String, List<Attachment>> attachmentByTaskIdMap = taskService.getProcessInstanceAttachments(processInstanceId).stream()
.collect(Collectors.groupingBy(Attachment::getTaskId));