From 698576ad9a555e05bc3af178d58465c35dbbdb3a Mon Sep 17 00:00:00 2001 From: wangliwen Date: Fri, 27 May 2022 10:43:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=91=E7=9A=84=E7=94=B3=E8=AF=B7=E6=A8=A1?= =?UTF-8?q?=E7=B3=8A=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activiti/service/ActHistoryService.java | 48 ++++++++++--------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java index 2090a007..782e6f03 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java @@ -37,7 +37,10 @@ import javax.imageio.ImageIO; import javax.servlet.http.HttpServletResponse; import java.awt.image.BufferedImage; import java.io.InputStream; -import java.util.*; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; /** * 工作流 @@ -209,6 +212,11 @@ public class ActHistoryService { if (StringUtils.isNotEmpty((String) params.get("startBy"))) { query.startedBy((String) params.get("startBy")); } + + if (params.containsKey("name") && StringUtils.isNotEmpty(params.get("name").toString())) { + query.processInstanceNameLike(params.get("name").toString()); + } + query.orderByProcessInstanceStartTime().desc(); List list = query.listPage((curPage - 1) * limit, limit); List listInstance = new ArrayList<>(); @@ -251,13 +259,13 @@ public class ActHistoryService { public PageData getMyProcessInstancePage(Map params) { params.put("startBy", SecurityUser.getUserId().toString()); PageData pageData = this.getHistoryProcessInstancePage(params); - String limit = params.get("limit").toString(); - String page = params.get("page").toString(); - if (params.containsKey("name") && StringUtils.isNotBlank(params.get("name").toString())) { - params.put("limit", String.valueOf(pageData.getTotal())); - params.put("page", "1"); - pageData = this.getHistoryProcessInstancePage(params); - } +// String limit = params.get("limit").toString(); +// String page = params.get("page").toString(); +// if (params.containsKey("name") && StringUtils.isNotBlank(params.get("name").toString())) { +// params.put("limit", String.valueOf(pageData.getTotal())); +// params.put("page", "1"); +// pageData = this.getHistoryProcessInstancePage(params); +// } List list = pageData.getList(); for (ProcessInstanceDTO dto : list) { TAbilityApplicationDTO abilityApplicationDTO = tAbilityApplicationService.getByInstanceId(dto.getProcessInstanceId()); // 获取申请表单 @@ -315,20 +323,16 @@ public class ActHistoryService { } dto.setCurrentTaskList(taskDTOList); } - List list1 = new ArrayList<>(); - if (params.containsKey("name") && StringUtils.isNotBlank(params.get("name").toString())) { - pageData.getList().stream() - .filter(Objects::nonNull) - .filter(index -> null != index.getName() && index.getName().contains(params.get("name").toString())) - .forEach(list1::add); - ArrayList list2 = new ArrayList<>(); - int j = Math.min(Integer.parseInt(page) * Integer.parseInt(limit), list1.size()); - for (int i = (Integer.parseInt(page) - 1) * Integer.parseInt(limit); i < j; i++) { - list2.add(list1.get(i)); - } - pageData.setTotal(list1.size()); - pageData.setList(list2); - } +// List list1; +// if (params.containsKey("name") && StringUtils.isNotBlank(params.get("name").toString())) { +// list1 = pageData.getList().stream() +// .filter(Objects::nonNull) +// .filter(index -> null != index.getName() && index.getName().contains(params.get("name").toString())) +// .collect(Collectors.toList()); +// List list2 = list1.stream().skip((Integer.parseInt(page) - 1) * Integer.parseInt(limit)).limit(Integer.parseInt(limit)).collect(Collectors.toList()); +// pageData.setTotal(list1.size()); +// pageData.setList(list2); +// } return pageData; }