From ad7be7f066dcf9e524dcfc47daa569bb983fa974 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Thu, 9 Mar 2023 15:49:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=85=E6=88=91=E5=A4=84=E7=90=86=E3=80=81?= =?UTF-8?q?=E6=88=91=E5=B7=B2=E5=A4=84=E7=90=86=E5=88=97=E8=A1=A8=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/todocenter/manage/TodoCenterManage.java | 44 +++++++++++++++++++++- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java index d11230d..58e2f41 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java @@ -65,6 +65,7 @@ import org.flowable.bpmn.model.*; import org.flowable.engine.HistoryService; import org.flowable.engine.history.HistoricProcessInstance; import org.flowable.engine.runtime.ActivityInstance; +import org.mockito.internal.matchers.CompareTo; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -122,7 +123,27 @@ public class TodoCenterManage { } List instCodes = userTodoList.stream().map(ProcessTaskVo::getInstanceId).collect(Collectors.toList()); - Map taskVoMap = userTodoList.stream().collect(Collectors.toMap(ProcessTaskVo::getInstanceId, v -> v)); + List resList = new ArrayList<>(); + List instList = new ArrayList<>(); + for (ProcessTaskVo processTaskVo : userTodoList) { + Map map = resList.stream().collect(Collectors.toMap(ProcessTaskVo::getInstanceId, v -> v)); + if (instList.contains(processTaskVo.getInstanceId())){ + // 比较两个processTaskVo的endTime,保留最后处理的 + ProcessTaskVo vo = map.get(processTaskVo.getInstanceId()); + int compare = processTaskVo.getTaskEndTime().compareTo(vo.getTaskEndTime()); + if (compare > 0){ + instList.remove(processTaskVo.getInstanceId()); + resList.remove(vo); + }else { + continue; + } + } + instList.add(processTaskVo.getInstanceId()); + resList.add(processTaskVo); + } + + Map taskVoMap = resList.stream().collect(Collectors.toMap(ProcessTaskVo::getInstanceId, v -> v)); + //2.再分页查询项目信息 ProjectListReq projectListReq = new ProjectListReq(); projectListReq.setInstCodes(instCodes); @@ -620,10 +641,29 @@ public class TodoCenterManage { if (CollUtil.isEmpty(userIdoList)) { return PageVo.empty(); } + List instCodes = userIdoList.stream().map(ProcessTaskVo::getInstanceId).collect(Collectors.toList()); - Map taskVoMap = userIdoList.stream().collect(Collectors.toMap(ProcessTaskVo::getInstanceId, v -> v)); + List resList = new ArrayList<>(); + List instList = new ArrayList<>(); + for (ProcessTaskVo processTaskVo : userIdoList) { + Map map = resList.stream().collect(Collectors.toMap(ProcessTaskVo::getInstanceId, v -> v)); + if (instList.contains(processTaskVo.getInstanceId())){ + // 比较两个processTaskVo的endTime,保留最后处理的 + ProcessTaskVo vo = map.get(processTaskVo.getInstanceId()); + int compare = processTaskVo.getTaskEndTime().compareTo(vo.getTaskEndTime()); + if (compare > 0){ + instList.remove(processTaskVo.getInstanceId()); + resList.remove(vo); + }else { + continue; + } + } + instList.add(processTaskVo.getInstanceId()); + resList.add(processTaskVo); + } + Map taskVoMap = resList.stream().collect(Collectors.toMap(ProcessTaskVo::getInstanceId, v -> v)); // 分页查询项目信息 ProjectListReq projectListReq = new ProjectListReq(); projectListReq.setInstCodes(instCodes);