我的申请模糊查询

This commit is contained in:
wangliwen 2022-05-27 10:43:32 +08:00
parent 7f7fadbafc
commit 698576ad9a
1 changed files with 26 additions and 22 deletions

View File

@ -37,7 +37,10 @@ import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.InputStream; 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"))) { if (StringUtils.isNotEmpty((String) params.get("startBy"))) {
query.startedBy((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(); query.orderByProcessInstanceStartTime().desc();
List<HistoricProcessInstance> list = query.listPage((curPage - 1) * limit, limit); List<HistoricProcessInstance> list = query.listPage((curPage - 1) * limit, limit);
List<ProcessInstanceDTO> listInstance = new ArrayList<>(); List<ProcessInstanceDTO> listInstance = new ArrayList<>();
@ -251,13 +259,13 @@ public class ActHistoryService {
public PageData<ProcessInstanceDTO> getMyProcessInstancePage(Map<String, Object> params) { public PageData<ProcessInstanceDTO> getMyProcessInstancePage(Map<String, Object> params) {
params.put("startBy", SecurityUser.getUserId().toString()); params.put("startBy", SecurityUser.getUserId().toString());
PageData<ProcessInstanceDTO> pageData = this.getHistoryProcessInstancePage(params); PageData<ProcessInstanceDTO> pageData = this.getHistoryProcessInstancePage(params);
String limit = params.get("limit").toString(); // String limit = params.get("limit").toString();
String page = params.get("page").toString(); // String page = params.get("page").toString();
if (params.containsKey("name") && StringUtils.isNotBlank(params.get("name").toString())) { // if (params.containsKey("name") && StringUtils.isNotBlank(params.get("name").toString())) {
params.put("limit", String.valueOf(pageData.getTotal())); // params.put("limit", String.valueOf(pageData.getTotal()));
params.put("page", "1"); // params.put("page", "1");
pageData = this.getHistoryProcessInstancePage(params); // pageData = this.getHistoryProcessInstancePage(params);
} // }
List<ProcessInstanceDTO> list = pageData.getList(); List<ProcessInstanceDTO> list = pageData.getList();
for (ProcessInstanceDTO dto : list) { for (ProcessInstanceDTO dto : list) {
TAbilityApplicationDTO abilityApplicationDTO = tAbilityApplicationService.getByInstanceId(dto.getProcessInstanceId()); // 获取申请表单 TAbilityApplicationDTO abilityApplicationDTO = tAbilityApplicationService.getByInstanceId(dto.getProcessInstanceId()); // 获取申请表单
@ -315,20 +323,16 @@ public class ActHistoryService {
} }
dto.setCurrentTaskList(taskDTOList); dto.setCurrentTaskList(taskDTOList);
} }
List<ProcessInstanceDTO> list1 = new ArrayList<>(); // List<ProcessInstanceDTO> list1;
if (params.containsKey("name") && StringUtils.isNotBlank(params.get("name").toString())) { // if (params.containsKey("name") && StringUtils.isNotBlank(params.get("name").toString())) {
pageData.getList().stream() // list1 = pageData.getList().stream()
.filter(Objects::nonNull) // .filter(Objects::nonNull)
.filter(index -> null != index.getName() && index.getName().contains(params.get("name").toString())) // .filter(index -> null != index.getName() && index.getName().contains(params.get("name").toString()))
.forEach(list1::add); // .collect(Collectors.toList());
ArrayList<ProcessInstanceDTO> list2 = new ArrayList<>(); // List<ProcessInstanceDTO> list2 = list1.stream().skip((Integer.parseInt(page) - 1) * Integer.parseInt(limit)).limit(Integer.parseInt(limit)).collect(Collectors.toList());
int j = Math.min(Integer.parseInt(page) * Integer.parseInt(limit), list1.size()); // pageData.setTotal(list1.size());
for (int i = (Integer.parseInt(page) - 1) * Integer.parseInt(limit); i < j; i++) { // pageData.setList(list2);
list2.add(list1.get(i)); // }
}
pageData.setTotal(list1.size());
pageData.setList(list2);
}
return pageData; return pageData;
} }