|
@@ -3,6 +3,7 @@ package org.dromara.workflow.service.impl;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.codec.Base64;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.convert.Convert;
|
|
|
import cn.hutool.core.io.IoUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
@@ -300,7 +301,6 @@ public class ActProcessInstanceServiceImpl implements IActProcessInstanceService
|
|
|
for (HistoricTaskInstance historicTaskInstance : list) {
|
|
|
ActHistoryInfoVo actHistoryInfoVo = new ActHistoryInfoVo();
|
|
|
BeanUtils.copyProperties(historicTaskInstance, actHistoryInfoVo);
|
|
|
- actHistoryInfoVo.setAssignee(StringUtils.isNotBlank(historicTaskInstance.getAssignee()) ? Long.valueOf(historicTaskInstance.getAssignee()) : null);
|
|
|
actHistoryInfoVo.setStatus(actHistoryInfoVo.getEndTime() == null ? "待处理" : "已处理");
|
|
|
if (ObjectUtil.isNotEmpty(historicTaskInstance.getDurationInMillis())) {
|
|
|
actHistoryInfoVo.setRunDuration(getDuration(historicTaskInstance.getDurationInMillis()));
|
|
@@ -318,6 +318,12 @@ public class ActProcessInstanceServiceImpl implements IActProcessInstanceService
|
|
|
historyInfoVo.setStartTime(e.getStartTime());
|
|
|
historyInfoVo.setEndTime(null);
|
|
|
historyInfoVo.setRunDuration(null);
|
|
|
+ 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);
|
|
|
}
|
|
@@ -356,11 +362,6 @@ public class ActProcessInstanceServiceImpl implements IActProcessInstanceService
|
|
|
if (ObjectUtil.isNotEmpty(historicTaskInstance.getDurationInMillis())) {
|
|
|
actHistoryInfoVo.setRunDuration(getDuration(historicTaskInstance.getDurationInMillis()));
|
|
|
}
|
|
|
- try {
|
|
|
- actHistoryInfoVo.setAssignee(StringUtils.isNotBlank(historicTaskInstance.getAssignee()) ? Long.valueOf(historicTaskInstance.getAssignee()) : null);
|
|
|
- } catch (NumberFormatException ignored) {
|
|
|
- log.warn("当前任务【{}】,办理人转换人员ID【{}】异常!", historicTaskInstance.getName(), historicTaskInstance.getAssignee());
|
|
|
- }
|
|
|
//附件
|
|
|
if (CollUtil.isNotEmpty(attachmentList)) {
|
|
|
List<Attachment> attachments = attachmentList.stream().filter(e -> e.getTaskId().equals(historicTaskInstance.getId())).collect(Collectors.toList());
|
|
@@ -368,6 +369,13 @@ public class ActProcessInstanceServiceImpl implements IActProcessInstanceService
|
|
|
actHistoryInfoVo.setAttachmentList(attachments);
|
|
|
}
|
|
|
}
|
|
|
+ //设置人员id
|
|
|
+ if (ObjectUtil.isEmpty(historicTaskInstance.getAssignee())) {
|
|
|
+ ParticipantVo participantVo = WorkflowUtils.getCurrentTaskParticipant(historicTaskInstance.getId());
|
|
|
+ if (ObjectUtil.isNotEmpty(participantVo) && CollUtil.isNotEmpty(participantVo.getCandidate())) {
|
|
|
+ actHistoryInfoVo.setAssignee(StreamUtils.join(participantVo.getCandidate(), Convert::toStr));
|
|
|
+ }
|
|
|
+ }
|
|
|
actHistoryInfoVoList.add(actHistoryInfoVo);
|
|
|
}
|
|
|
List<ActHistoryInfoVo> collect = new ArrayList<>();
|
|
@@ -383,10 +391,6 @@ public class ActProcessInstanceServiceImpl implements IActProcessInstanceService
|
|
|
Map<String, List<ActHistoryInfoVo>> groupByKey = StreamUtils.groupByKey(actHistoryInfoVoList, ActHistoryInfoVo::getTaskDefinitionKey);
|
|
|
for (Map.Entry<String, List<ActHistoryInfoVo>> entry : groupByKey.entrySet()) {
|
|
|
ActHistoryInfoVo actHistoryInfoVo = BeanUtil.toBean(entry.getValue().get(0), ActHistoryInfoVo.class);
|
|
|
- String nickName = entry.getValue().stream().filter(e -> StringUtils.isNotBlank(e.getNickName()) && e.getEndTime() == null).map(ActHistoryInfoVo::getNickName).toList().stream().distinct().collect(Collectors.joining(StringUtils.SEPARATOR));
|
|
|
- if (StringUtils.isNotBlank(nickName)) {
|
|
|
- actHistoryInfoVo.setNickName(nickName);
|
|
|
- }
|
|
|
actHistoryInfoVoList.stream().filter(e -> e.getTaskDefinitionKey().equals(entry.getKey()) && e.getEndTime() != null).findFirst()
|
|
|
.ifPresent(e -> {
|
|
|
actHistoryInfoVo.setStatus("已处理");
|