|
|
@@ -8,6 +8,7 @@ import com.ningdatech.basic.exception.BizException; |
|
|
|
import com.ningdatech.basic.function.VUtils; |
|
|
|
import com.ningdatech.basic.model.PageVo; |
|
|
|
import com.ningdatech.basic.util.CollUtils; |
|
|
|
import com.ningdatech.basic.util.NdDateUtils; |
|
|
|
import com.ningdatech.pmapi.common.constant.CommonConst; |
|
|
|
import com.ningdatech.pmapi.common.helper.UserInfoHelper; |
|
|
|
import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; |
|
|
@@ -123,26 +124,12 @@ public class TodoCenterManage { |
|
|
|
} |
|
|
|
List<String> instCodes = userTodoList.stream().map(ProcessTaskVo::getInstanceId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
List<ProcessTaskVo> resList = new ArrayList<>(); |
|
|
|
List<String> instList = new ArrayList<>(); |
|
|
|
for (ProcessTaskVo processTaskVo : userTodoList) { |
|
|
|
Map<String, ProcessTaskVo> 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<String, ProcessTaskVo> taskVoMap = resList.stream().collect(Collectors.toMap(ProcessTaskVo::getInstanceId, v -> v)); |
|
|
|
Set<String> processSet = Sets.newHashSet(); |
|
|
|
Map<String, ProcessTaskVo> taskMap = userTodoList.stream() |
|
|
|
.sorted((t1,t2) -> t2.getTaskCreateTime().compareTo(t1.getTaskCreateTime())) |
|
|
|
.collect(Collectors.toList()).stream() |
|
|
|
.filter(v -> processSet.add(v.getInstanceId())) |
|
|
|
.collect(Collectors.toMap(ProcessTaskVo::getInstanceId, v -> v)); |
|
|
|
|
|
|
|
//2.再分页查询项目信息 |
|
|
|
ProjectListReq projectListReq = new ProjectListReq(); |
|
|
@@ -158,7 +145,7 @@ public class TodoCenterManage { |
|
|
|
ResToBeProcessedVO res = new ResToBeProcessedVO(); |
|
|
|
BeanUtils.copyProperties(d, res); |
|
|
|
res.setProjectId(d.getId()); |
|
|
|
ProcessTaskVo taskVo = taskVoMap.get(d.getInstCode()); |
|
|
|
ProcessTaskVo taskVo = taskMap.get(d.getInstCode()); |
|
|
|
res.setNodeId(taskVo.getTaskDefKey()); |
|
|
|
res.setProcessStatusName(taskVo.getStatus()); |
|
|
|
res.setProcessLaunchTime(d.getCreateOn()); |
|
|
@@ -192,7 +179,6 @@ public class TodoCenterManage { |
|
|
|
projectListReq.setInstCodes(instCodes); |
|
|
|
BeanUtils.copyProperties(param, projectListReq); |
|
|
|
List<Project> projects = CollUtil.isEmpty(userTodoList) ? Collections.emptyList() : projectLibManage.projectList(projectListReq); |
|
|
|
PageVo<ProjectLibListItemVO> projectLibList = projectLibManage.projectLibList(projectListReq); |
|
|
|
|
|
|
|
ExcelExportWriter excelExportWriter = new ExcelExportWriter(); |
|
|
|
String fileName = null; |
|
|
@@ -644,26 +630,13 @@ public class TodoCenterManage { |
|
|
|
|
|
|
|
List<String> instCodes = userIdoList.stream().map(ProcessTaskVo::getInstanceId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
List<ProcessTaskVo> resList = new ArrayList<>(); |
|
|
|
List<String> instList = new ArrayList<>(); |
|
|
|
for (ProcessTaskVo processTaskVo : userIdoList) { |
|
|
|
Map<String, ProcessTaskVo> 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); |
|
|
|
} |
|
|
|
Set<String> processSet = Sets.newHashSet(); |
|
|
|
Map<String, ProcessTaskVo> taskMap = userIdoList.stream() |
|
|
|
.sorted((t1,t2) -> t2.getTaskEndTime().compareTo(t1.getTaskEndTime())) |
|
|
|
.collect(Collectors.toList()).stream() |
|
|
|
.filter(v -> processSet.add(v.getInstanceId())) |
|
|
|
.collect(Collectors.toMap(ProcessTaskVo::getInstanceId, v -> v)); |
|
|
|
|
|
|
|
Map<String, ProcessTaskVo> taskVoMap = resList.stream().collect(Collectors.toMap(ProcessTaskVo::getInstanceId, v -> v)); |
|
|
|
// 分页查询项目信息 |
|
|
|
ProjectListReq projectListReq = new ProjectListReq(); |
|
|
|
projectListReq.setInstCodes(instCodes); |
|
|
@@ -677,10 +650,10 @@ public class TodoCenterManage { |
|
|
|
ResToBeProcessedVO res = new ResToBeProcessedVO(); |
|
|
|
BeanUtils.copyProperties(d, res); |
|
|
|
res.setProjectId(d.getId()); |
|
|
|
ProcessTaskVo taskVo = taskVoMap.get(d.getInstCode()); |
|
|
|
ProcessTaskVo taskVo = taskMap.get(d.getInstCode()); |
|
|
|
res.setProcessStatusName(taskVo.getStatus()); |
|
|
|
res.setProcessLaunchTime(d.getCreateOn()); |
|
|
|
res.setProcessHandleTime(d.getUpdateOn()); |
|
|
|
res.setProcessHandleTime(NdDateUtils.date2LocalDateTime(taskVo.getTaskEndTime())); |
|
|
|
return res; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
return PageVo.of(resVos, projectPage.getTotal()); |
|
|
|