This commit is contained in:
wangliwen 2022-05-27 11:11:53 +08:00
parent 698576ad9a
commit 61db8a5f7d
1 changed files with 19 additions and 27 deletions

View File

@ -37,10 +37,8 @@ import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
* 工作流
@ -212,18 +210,12 @@ 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<HistoricProcessInstance> list = query.listPage((curPage - 1) * limit, limit);
List<ProcessInstanceDTO> listInstance = new ArrayList<>();
if (!list.isEmpty()) {
this.converHistoricProcessInstance(list, listInstance);
}
return new PageData<ProcessInstanceDTO>(listInstance, (int) query.count());
}
@ -259,13 +251,13 @@ public class ActHistoryService {
public PageData<ProcessInstanceDTO> getMyProcessInstancePage(Map<String, Object> params) {
params.put("startBy", SecurityUser.getUserId().toString());
PageData<ProcessInstanceDTO> 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<ProcessInstanceDTO> list = pageData.getList();
for (ProcessInstanceDTO dto : list) {
TAbilityApplicationDTO abilityApplicationDTO = tAbilityApplicationService.getByInstanceId(dto.getProcessInstanceId()); // 获取申请表单
@ -323,16 +315,16 @@ public class ActHistoryService {
}
dto.setCurrentTaskList(taskDTOList);
}
// List<ProcessInstanceDTO> 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<ProcessInstanceDTO> 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);
// }
List<ProcessInstanceDTO> 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<ProcessInstanceDTO> 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;
}