fix 修复抄送后有多条记录信息展示错误

This commit is contained in:
gssong 2024-06-03 22:27:25 +08:00
parent e0253a4ea8
commit 95791254a9

View File

@ -313,21 +313,41 @@ public class ActProcessInstanceServiceImpl implements IActProcessInstanceService
Map<String, List<ActHistoryInfoVo>> groupByKey = StreamUtils.groupByKey(actHistoryInfoVoList, ActHistoryInfoVo::getTaskDefinitionKey); Map<String, List<ActHistoryInfoVo>> groupByKey = StreamUtils.groupByKey(actHistoryInfoVoList, ActHistoryInfoVo::getTaskDefinitionKey);
for (Map.Entry<String, List<ActHistoryInfoVo>> entry : groupByKey.entrySet()) { for (Map.Entry<String, List<ActHistoryInfoVo>> entry : groupByKey.entrySet()) {
ActHistoryInfoVo historyInfoVo = new ActHistoryInfoVo(); ActHistoryInfoVo historyInfoVo = new ActHistoryInfoVo();
BeanUtils.copyProperties(entry.getValue().get(0), historyInfoVo); if (entry.getValue().size() > 1) {
actHistoryInfoVoList.stream().filter(e -> e.getTaskDefinitionKey().equals(entry.getKey()) && e.getEndTime() == null).findFirst() List<ActHistoryInfoVo> historyInfoVos = StreamUtils.filter(entry.getValue(), e -> StringUtils.isNotBlank(e.getAssignee()));
.ifPresent(e -> { if (CollUtil.isNotEmpty(historyInfoVos)) {
historyInfoVo.setStatus("待处理"); ActHistoryInfoVo infoVo = historyInfoVos.get(0);
historyInfoVo.setStartTime(e.getStartTime()); BeanUtils.copyProperties(infoVo, historyInfoVo);
historyInfoVo.setEndTime(null); historyInfoVo.setStatus(infoVo.getEndTime() == null ? "待处理" : "已处理");
historyInfoVo.setRunDuration(null); historyInfoVo.setStartTime(infoVo.getStartTime());
if (ObjectUtil.isEmpty(e.getAssignee())) { historyInfoVo.setEndTime(infoVo.getEndTime() == null ? null : infoVo.getEndTime());
ParticipantVo participantVo = WorkflowUtils.getCurrentTaskParticipant(e.getId()); historyInfoVo.setRunDuration(infoVo.getEndTime() == null ? null : infoVo.getRunDuration());
if (ObjectUtil.isEmpty(infoVo.getAssignee())) {
ParticipantVo participantVo = WorkflowUtils.getCurrentTaskParticipant(infoVo.getId());
if (ObjectUtil.isNotEmpty(participantVo) && CollUtil.isNotEmpty(participantVo.getCandidate())) { if (ObjectUtil.isNotEmpty(participantVo) && CollUtil.isNotEmpty(participantVo.getCandidate())) {
historyInfoVo.setAssignee(StreamUtils.join(participantVo.getCandidate(), Convert::toStr)); historyInfoVo.setAssignee(StreamUtils.join(participantVo.getCandidate(), Convert::toStr));
} }
} }
}); }
} else {
actHistoryInfoVoList.stream().filter(e -> e.getTaskDefinitionKey().equals(entry.getKey())).findFirst()
.ifPresent(e -> {
BeanUtils.copyProperties(e, historyInfoVo);
historyInfoVo.setStatus(e.getEndTime() == null ? "待处理" : "已处理");
historyInfoVo.setStartTime(e.getStartTime());
historyInfoVo.setEndTime(e.getEndTime() == null ? null : e.getEndTime());
historyInfoVo.setRunDuration(e.getEndTime() == null ? null : e.getRunDuration());
if (ObjectUtil.isEmpty(e.getAssignee())) {
ParticipantVo participantVo = WorkflowUtils.getCurrentTaskParticipant(e.getId());
if (ObjectUtil.isNotEmpty(participantVo) && CollUtil.isNotEmpty(participantVo.getCandidate())) {
historyInfoVo.setAssignee(StreamUtils.join(participantVo.getCandidate(), Convert::toStr));
}
}
});
}
historyInfoVoList.add(historyInfoVo); historyInfoVoList.add(historyInfoVo);
} }
return historyInfoVoList; return historyInfoVoList;
} }