add 添加附件任务查询

This commit is contained in:
gssong 2024-02-26 21:41:37 +08:00
parent 2551d16d08
commit acbef6e170
3 changed files with 18 additions and 1 deletions

View File

@ -3,10 +3,12 @@ package org.dromara.workflow.domain.vo;
import lombok.Data; import lombok.Data;
import org.dromara.common.translation.annotation.Translation; import org.dromara.common.translation.annotation.Translation;
import org.dromara.common.translation.constant.TransConstant; import org.dromara.common.translation.constant.TransConstant;
import org.flowable.engine.task.Attachment;
import java.io.Serial; import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* 流程审批记录视图 * 流程审批记录视图
@ -79,4 +81,9 @@ public class ActHistoryInfoVo implements Serializable {
* 审批信息 * 审批信息
*/ */
private String comment; private String comment;
/**
* 审批附件
*/
private List<Attachment> attachmentList;
} }

View File

@ -49,7 +49,7 @@ public class AttachmentCmd implements Command<Boolean> {
AttachmentEntity attachmentEntity = attachmentEntityManager.create(); AttachmentEntity attachmentEntity = attachmentEntityManager.create();
attachmentEntity.setRevision(1); attachmentEntity.setRevision(1);
attachmentEntity.setUserId(LoginHelper.getUserId().toString()); attachmentEntity.setUserId(LoginHelper.getUserId().toString());
attachmentEntity.setName(sysOssVo.getFileName()); attachmentEntity.setName(sysOssVo.getOriginalName());
attachmentEntity.setDescription(sysOssVo.getOriginalName()); attachmentEntity.setDescription(sysOssVo.getOriginalName());
attachmentEntity.setType(sysOssVo.getFileSuffix()); attachmentEntity.setType(sysOssVo.getFileSuffix());
attachmentEntity.setTaskId(taskId); attachmentEntity.setTaskId(taskId);

View File

@ -42,6 +42,7 @@ import org.flowable.engine.impl.persistence.entity.ExecutionEntity;
import org.flowable.engine.repository.ProcessDefinition; import org.flowable.engine.repository.ProcessDefinition;
import org.flowable.engine.runtime.ProcessInstance; import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.engine.runtime.ProcessInstanceQuery; import org.flowable.engine.runtime.ProcessInstanceQuery;
import org.flowable.engine.task.Attachment;
import org.flowable.engine.task.Comment; import org.flowable.engine.task.Comment;
import org.flowable.task.api.Task; import org.flowable.task.api.Task;
import org.flowable.task.api.history.HistoricTaskInstance; import org.flowable.task.api.history.HistoricTaskInstance;
@ -318,6 +319,8 @@ public class ActProcessInstanceServiceImpl implements IActProcessInstanceService
list = StreamUtils.sorted(list, Comparator.comparing(HistoricTaskInstance::getEndTime, Comparator.nullsFirst(Date::compareTo)).reversed()); list = StreamUtils.sorted(list, Comparator.comparing(HistoricTaskInstance::getEndTime, Comparator.nullsFirst(Date::compareTo)).reversed());
List<ActHistoryInfoVo> actHistoryInfoVoList = new ArrayList<>(); List<ActHistoryInfoVo> actHistoryInfoVoList = new ArrayList<>();
List<Comment> processInstanceComments = taskService.getProcessInstanceComments(processInstanceId); List<Comment> processInstanceComments = taskService.getProcessInstanceComments(processInstanceId);
//附件
List<Attachment> attachmentList = taskService.getProcessInstanceAttachments(processInstanceId);
for (HistoricTaskInstance historicTaskInstance : list) { for (HistoricTaskInstance historicTaskInstance : list) {
ActHistoryInfoVo actHistoryInfoVo = new ActHistoryInfoVo(); ActHistoryInfoVo actHistoryInfoVo = new ActHistoryInfoVo();
BeanUtils.copyProperties(historicTaskInstance, actHistoryInfoVo); BeanUtils.copyProperties(historicTaskInstance, actHistoryInfoVo);
@ -342,6 +345,13 @@ public class ActProcessInstanceServiceImpl implements IActProcessInstanceService
} catch (NumberFormatException ignored) { } catch (NumberFormatException ignored) {
log.warn("当前任务【{}】,办理人转换人员ID【{}】异常!", historicTaskInstance.getName(), historicTaskInstance.getAssignee()); 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());
if (CollUtil.isNotEmpty(attachments)) {
actHistoryInfoVo.setAttachmentList(attachments);
}
}
actHistoryInfoVoList.add(actHistoryInfoVo); actHistoryInfoVoList.add(actHistoryInfoVo);
} }
List<ActHistoryInfoVo> collect = new ArrayList<>(); List<ActHistoryInfoVo> collect = new ArrayList<>();