diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/task/BpmTaskConvert.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/task/BpmTaskConvert.java index 101dc1e48..96f273bf6 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/task/BpmTaskConvert.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/task/BpmTaskConvert.java @@ -6,6 +6,7 @@ import cn.iocoder.yudao.adminserver.modules.bpm.controller.task.vo.task.TaskStep import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import org.activiti.engine.history.HistoricActivityInstance; +import org.activiti.engine.history.HistoricProcessInstance; import org.activiti.engine.history.HistoricTaskInstance; import org.activiti.engine.impl.persistence.entity.SuspensionState; import org.activiti.engine.runtime.ProcessInstance; @@ -64,10 +65,10 @@ public interface BpmTaskConvert { } default List convertList2(List tasks, - Map processInstanceMap, + Map historicProcessInstanceMap, Map userMap) { return CollectionUtils.convertList(tasks, task -> { - ProcessInstance processInstance = processInstanceMap.get(task.getProcessInstanceId()); + HistoricProcessInstance processInstance = historicProcessInstanceMap.get(task.getProcessInstanceId()); return convert(task, processInstance, userMap.get(Long.valueOf(processInstance.getStartUserId()))); }); } @@ -85,6 +86,6 @@ public interface BpmTaskConvert { @Mapping(source = "processInstance.processDefinitionId", target = "processInstance.processDefinitionId"), @Mapping(source = "user.nickname", target = "processInstance.startUserNickname") }) - BpmTaskDonePageItemRespVO convert(HistoricTaskInstance task, ProcessInstance processInstance, SysUserDO user); + BpmTaskDonePageItemRespVO convert(HistoricTaskInstance task, HistoricProcessInstance processInstance, SysUserDO user); } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/BpmProcessInstanceService.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/BpmProcessInstanceService.java index 96d751a01..255b8f5ae 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/BpmProcessInstanceService.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/BpmProcessInstanceService.java @@ -8,6 +8,7 @@ import cn.iocoder.yudao.adminserver.modules.bpm.enums.task.BpmProcessInstanceDel import cn.iocoder.yudao.adminserver.modules.bpm.enums.task.BpmProcessInstanceResultEnum; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; +import org.activiti.engine.history.HistoricProcessInstance; import org.activiti.engine.runtime.ProcessInstance; import javax.validation.Valid; @@ -91,4 +92,30 @@ public interface BpmProcessInstanceService { return CollectionUtils.convertMap(getProcessInstances(ids), ProcessInstance::getProcessInstanceId); } + /** + * 获得历史的流程实例 + * + * @param id 流程实例的编号 + * @return 历史的流程实例 + */ + HistoricProcessInstance getHistoricProcessInstance(String id); + + /** + * 获得历史的流程实例列表 + * + * @param ids 流程实例的编号集合 + * @return 历史的流程实例列表 + */ + List getHistoricProcessInstances(Set ids); + + /** + * 获得历史的流程实例 Map + * + * @param ids 流程实例的编号集合 + * @return 历史的流程实例列表 Map + */ + default Map getHistoricProcessInstanceMap(Set ids) { + return CollectionUtils.convertMap(getHistoricProcessInstances(ids), HistoricProcessInstance::getId); + } + } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/impl/BpmProcessInstanceServiceImpl.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/impl/BpmProcessInstanceServiceImpl.java index 7082924a2..66770cb07 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/impl/BpmProcessInstanceServiceImpl.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/impl/BpmProcessInstanceServiceImpl.java @@ -186,8 +186,14 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService * @param id 流程实例的编号 * @return 历史的流程实例 */ - private HistoricProcessInstance getHistoricProcessInstance(String id) { + @Override + public HistoricProcessInstance getHistoricProcessInstance(String id) { return historyService.createHistoricProcessInstanceQuery().processInstanceId(id).singleResult(); } + @Override + public List getHistoricProcessInstances(Set ids) { + return historyService.createHistoricProcessInstanceQuery().processInstanceIds(ids).list(); + } + } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/impl/BpmTaskServiceImpl.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/impl/BpmTaskServiceImpl.java index e155349fa..baca9f41f 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/impl/BpmTaskServiceImpl.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/impl/BpmTaskServiceImpl.java @@ -144,13 +144,13 @@ public class BpmTaskServiceImpl implements BpmTaskService { } // 获得 ProcessInstance Map - Map processInstanceMap = processInstanceService.getProcessInstanceMap( + Map historicProcessInstanceMap = processInstanceService.getHistoricProcessInstanceMap( convertSet(tasks, HistoricTaskInstance::getProcessInstanceId)); // 获得 User Map Map userMap = userService.getUserMap( - convertSet(processInstanceMap.values(), instance -> Long.valueOf(instance.getStartUserId()))); + convertSet(historicProcessInstanceMap.values(), instance -> Long.valueOf(instance.getStartUserId()))); // 拼接结果 - return new PageResult<>(BpmTaskConvert.INSTANCE.convertList2(tasks, processInstanceMap, userMap), + return new PageResult<>(BpmTaskConvert.INSTANCE.convertList2(tasks, historicProcessInstanceMap, userMap), taskQuery.count()); } diff --git a/yudao-admin-ui/src/api/bpm/task.js b/yudao-admin-ui/src/api/bpm/task.js index 623291575..3b4dc305f 100644 --- a/yudao-admin-ui/src/api/bpm/task.js +++ b/yudao-admin-ui/src/api/bpm/task.js @@ -8,6 +8,14 @@ export function getTodoTaskPage(query) { }) } +export function getDoneTaskPage(query) { + return request({ + url: '/bpm/task/done-page', + method: 'get', + params: query + }) +} + export function completeTask(data) { return request({ url: '/bpm/task/complete', diff --git a/yudao-admin-ui/src/views/bpm/task/done.vue b/yudao-admin-ui/src/views/bpm/task/done.vue new file mode 100644 index 000000000..8def1171e --- /dev/null +++ b/yudao-admin-ui/src/views/bpm/task/done.vue @@ -0,0 +1,105 @@ + + + diff --git a/yudao-admin-ui/src/views/bpm/task/todo.vue b/yudao-admin-ui/src/views/bpm/task/todo.vue index ac39f7a21..53063e0f1 100644 --- a/yudao-admin-ui/src/views/bpm/task/todo.vue +++ b/yudao-admin-ui/src/views/bpm/task/todo.vue @@ -52,7 +52,7 @@