[修改] 流程中心 效率优化

This commit is contained in:
bupengxiang
2023-05-18 09:07:53 +08:00
parent 0c0567095a
commit 9b4a5d12f9
3 changed files with 61 additions and 50 deletions
@@ -39,6 +39,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@@ -940,15 +941,24 @@ public class TodoTaskController {
eq(BusProcessName::getSubmitStatus,SubmitStatusEnum.STOP.getValue());
});
List<BusProcessName> list = iBusProcessNameService.list(queryWrapper);
IPage<BusProcessName> page1 =new com.baomidou.mybatisplus.extension.plugins.pagination.Page();
page1.setCurrent(taskCommonQuery.getCurrent());
page1.setSize(taskCommonQuery.getSize());
page1 = iBusProcessNameService.page(page1, queryWrapper);
List<BusProcessName> list = page1.getRecords();
List<Task> taskList = taskService.createTaskQuery().active().list();
Map<String, List<Task>> taskCollect =
taskList.stream().collect(Collectors.groupingBy(Task::getProcessInstanceId));
Page page = new Page();
if (list != null && list.size() > 0) {
List<BusProcessName> list1 = this.startPage(list, taskCommonQuery.getCurrent(), taskCommonQuery.getSize());
// List<BusProcessName> list1 = this.startPage(list, taskCommonQuery.getCurrent(), taskCommonQuery.getSize());
List<String> userIdList = new ArrayList<>();
for (BusProcessName busProcessName : list1) {
List<Task> list2 = taskService.createTaskQuery().processInstanceId(busProcessName.getPrcId()).active().list();
if (list2.size() > 0) {
for (BusProcessName busProcessName : list) {
List<Task> list2 = taskCollect.get(busProcessName.getPrcId());
if (list2 != null && list2.size() > 0) {
for (Task task : list2) {
if (task.getAssignee() != null && !task.getAssignee().equals("")) {
userIdList.add(task.getAssignee());
@@ -979,10 +989,10 @@ public class TodoTaskController {
userVOList.addAll(userInfoList);
}
for (BusProcessName busProcessName : list1) {
for (BusProcessName busProcessName : list) {
String assignee = "";
List<Task> list2 = taskService.createTaskQuery().processInstanceId(busProcessName.getPrcId()).active().list();
if (list2.size() > 0) {
List<Task> list2 = taskCollect.get(busProcessName.getPrcId());
if (list2 != null && list2.size() > 0) {
for (Task task : list2) {
if (task.getAssignee() != null && !task.getAssignee().equals("")) {
if(CollectionUtils.isNotEmpty(userVOList)){
@@ -1079,7 +1089,7 @@ public class TodoTaskController {
}
}
page.setList(list1);
page.setList(list);
page.setCount(Long.valueOf(list.size()));
page.setPageSize(taskCommonQuery.getSize());
page.setPageNo(taskCommonQuery.getCurrent());
@@ -1134,14 +1144,23 @@ public class TodoTaskController {
eq(BusProcessName::getSubmitStatus,SubmitStatusEnum.STOP.getValue());
});
List<BusProcessName> list = iBusProcessNameService.list(queryWrapper);
// List<BusProcessName> list = iBusProcessNameService.list(queryWrapper);
IPage<BusProcessName> page1 =new com.baomidou.mybatisplus.extension.plugins.pagination.Page();
page1.setCurrent(taskCommonQuery.getCurrent());
page1.setSize(taskCommonQuery.getSize());
page1 = iBusProcessNameService.page(page1, queryWrapper);
List<BusProcessName> list = page1.getRecords();
// List<BusProcessName> listPage = this.startPage(list, taskCommonQuery.getCurrent(), taskCommonQuery.getSize());
List<Task> taskList = taskService.createTaskQuery().active().list();
Map<String, List<Task>> taskCollect =
taskList.stream().collect(Collectors.groupingBy(Task::getProcessInstanceId));
List<BusProcessName> listPage = this.startPage(list, taskCommonQuery.getCurrent(), taskCommonQuery.getSize());
if (list != null && list.size() > 0) {
List<String> userIdList = new ArrayList<>();
for (BusProcessName busProcessName : listPage) {
List<Task> list2 = taskService.createTaskQuery().processInstanceId(busProcessName.getPrcId()).active().list();
if (list2.size() > 0) {
for (BusProcessName busProcessName : list) {
List<Task> list2 = taskCollect.get(busProcessName.getPrcId());
if (list2 != null && list2.size() > 0) {
for (Task task : list2) {
if (task.getAssignee() != null && !task.getAssignee().equals("")) {
userIdList.add(task.getAssignee());
@@ -1163,10 +1182,10 @@ public class TodoTaskController {
userVOList.addAll(userInfoList);
}
for (BusProcessName busProcessName : listPage) {
for (BusProcessName busProcessName : list) {
String assignee = "";
List<Task> list2 = taskService.createTaskQuery().processInstanceId(busProcessName.getPrcId()).active().list();
if (list2.size() > 0) {
List<Task> list2 = taskCollect.get(busProcessName.getPrcId());
if (list2 != null && list2.size() > 0) {
for (Task task : list2) {
if (task.getAssignee() != null && !task.getAssignee().equals("")) {
if(CollectionUtils.isNotEmpty(userVOList)){
@@ -1229,17 +1248,6 @@ public class TodoTaskController {
busProcessName.setTaskDefinitionKey(task.getActivityId());
}
});
//获取 审批结果
// if (StringUtils.isNotEmpty(busProcessName.getTaskId())) {
// List<BusProcessApprove> busProcessApproves = iBusProcessApproveService.selectEoByPrcIdAndTask(busProcessName.getPrcId());
// if(busProcessApproves.size() != 0){
// BusProcessApprove busProcessApprove = busProcessApproves.get(0);
// JSONObject dataJson = JSONObject.parseObject(busProcessApprove.getFromValsJson());
// if (StringUtils.isNotEmpty(dataJson.getString("flag"))) {
// busProcessName.setStatus(dataJson.getString("flag"));
// }
// }
// }
Date createTime = null;
Date endTime = null;
@@ -1256,7 +1264,7 @@ public class TodoTaskController {
busProcessName.setApprovalTime(approvalTime + "");
}
page.setList(listPage);
page.setList(list);
page.setCount(Long.valueOf(list.size()));
page.setPageSize(taskCommonQuery.getSize());
page.setPageNo(taskCommonQuery.getCurrent());
@@ -1311,19 +1319,28 @@ public class TodoTaskController {
eq(BusProcessName::getSubmitStatus,SubmitStatusEnum.STOP.getValue());
});
List<BusProcessName> list = iBusProcessNameService.list(queryWrapper);
IPage<BusProcessName> page1 =new com.baomidou.mybatisplus.extension.plugins.pagination.Page();
page1.setCurrent(taskCommonQuery.getCurrent());
page1.setSize(taskCommonQuery.getSize());
page1 = iBusProcessNameService.page(page1, queryWrapper);
List<BusProcessName> list = page1.getRecords();
// List<BusProcessName> listPage = this.startPage(list, taskCommonQuery.getCurrent(), taskCommonQuery.getSize());
List<Task> taskList = taskService.createTaskQuery().active().list();
Map<String, List<Task>> taskCollect =
taskList.stream().collect(Collectors.groupingBy(Task::getProcessInstanceId));
Page page = new Page();
if (list != null && list.size() > 0) {
List<BusProcessName> list1 = this.startPage(list, taskCommonQuery.getCurrent(), taskCommonQuery.getSize());
// List<BusProcessName> list1 = this.startPage(list, taskCommonQuery.getCurrent(), taskCommonQuery.getSize());
long startTime1 = System.currentTimeMillis();
List<String> userIdList = new ArrayList<>();
for (BusProcessName busProcessName : list1) {
for (BusProcessName busProcessName : list) {
if (busProcessName.getPrcId() != null) {
List<Task> list2 = taskService.createTaskQuery().processInstanceId(busProcessName.getPrcId()).active().list();
if (list2.size() > 0) {
List<Task> list2 = taskCollect.get(busProcessName.getPrcId());
if (list2 != null && list2.size() > 0) {
for (Task task : list2) {
if (task.getAssignee() != null && !task.getAssignee().equals("")) {
userIdList.add(task.getAssignee());
@@ -1345,11 +1362,11 @@ public class TodoTaskController {
List<UserVO> userInfoList = getUserInfoByIdList(userIdList);
userVOList.addAll(userInfoList);
}
for (BusProcessName busProcessName : list1) {
for (BusProcessName busProcessName : list) {
String assignee = "";
if (busProcessName.getPrcId() != null) {
List<Task> list2 = taskService.createTaskQuery().processInstanceId(busProcessName.getPrcId()).active().list();
if (list2.size() > 0) {
List<Task> list2 = taskCollect.get(busProcessName.getPrcId());
if (list2 != null && list2.size() > 0) {
for (Task task : list2) {
if (task.getAssignee() != null && !task.getAssignee().equals("")) {
if(CollectionUtils.isNotEmpty(userVOList)){
@@ -1426,7 +1443,7 @@ public class TodoTaskController {
long endTime1 = System.currentTimeMillis() - startTime1;
System.out.println("11111浪费时间为:" + endTime1);
page.setList(list1);
page.setList(list);
page.setCount(Long.valueOf(list.size()));
page.setPageSize(taskCommonQuery.getSize());
page.setPageNo(taskCommonQuery.getCurrent());