Browse Source

getProcessMonitorPage

fanxp 1 month ago
parent
commit
cdd1773105

+ 5 - 2
src/main/java/com/xjrsoft/module/workflow/service/impl/WorkflowExecuteServiceImpl.java

@@ -4105,8 +4105,10 @@ public class WorkflowExecuteServiceImpl implements IWorkflowExecuteService {
         if (dto.getType() == 0) {
             historicProcessInstanceQuery.unfinished();
         }
+        historicProcessInstanceQuery.orderByProcessInstanceStartTime().desc();
 
-        List<HistoricProcessInstance> historicProcessInstances = historicProcessInstanceQuery.list();
+        int startNum = (dto.getLimit() - 1) * dto.getSize();
+        List<HistoricProcessInstance> historicProcessInstances = historicProcessInstanceQuery.listPage(startNum, startNum + dto.getSize());
 
         //获取到所有流程id
         List<String> processIds = historicProcessInstances.stream().map(HistoricProcessInstance::getId).collect(Collectors.toList());
@@ -4119,6 +4121,7 @@ public class WorkflowExecuteServiceImpl implements IWorkflowExecuteService {
                             .leftJoin(WorkflowSchema.class, WorkflowSchema::getId, WorkflowExtra::getSchemaId)
                             .leftJoin(DictionaryDetail.class, DictionaryDetail::getId, WorkflowSchema::getCategory)
                             .eq(StrUtil.isNotEmpty(dto.getCategory()), DictionaryDetail::getCode, dto.getCategory())
+                            .in(WorkflowExtra::getProcessId, processIds)
             );
             for (HistoricProcessInstance historicProcessInstance : historicProcessInstances) {
                 //找到当前流程的 任务开始时间 最大值  为当前审批节点
@@ -4159,7 +4162,7 @@ public class WorkflowExecuteServiceImpl implements IWorkflowExecuteService {
         PageOutput<MonitorPageVo> output = new PageOutput<>();
         output.setCurrentPage(dto.getLimit());
         output.setPageSize(dto.getSize());
-        output.setTotal(result.size());
+        output.setTotal(Convert.toInt(historicProcessInstanceQuery.count()));
         output.setList(result);
         return output;
     }