fix[project]: 汇总机台的完成率

This commit is contained in:
2026-03-30 18:03:53 +08:00
parent cba6d58208
commit f276807cca
2 changed files with 38 additions and 0 deletions

View File

@@ -252,4 +252,8 @@ public class NodeAllBase extends BaseEntity {
*/
private String reportTemplateNames;
private long finishTaskNum = 0;
private long totalTaskNum = 0;
}

View File

@@ -680,6 +680,7 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
// 汇总任务进度、仿真负责人、执行人
for (ProjectNodePo projectNodePo : realTopProjectNodeList) {
summaryWorkspaceNode(projectNodePo,projectNodePo.getChildren());
summaryMachineNode(projectNodePo,projectNodePo.getChildren());
}
// 对工位进行排序,-M工位顺序排第一个
if (lyricFlag == 1) {
@@ -768,6 +769,39 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
}
}
private void summaryMachineNode(ProjectNodePo projectNodePo,List<NodeAllBase> children) {
if (!NodeTypeEnum.MACHINE.getValue().equals(projectNodePo.getNodeType())) {
List<NodeAllBase> fChildren = projectNodePo.getChildren();
if (CollectionUtils.isEmpty(fChildren)) {
return;
}
for (NodeAllBase fChild : fChildren) {
if (!NodeTypeEnum.WORKSPACE.getValue().equals(fChild.getNodeType())) {
summaryMachineNode((ProjectNodePo) fChild,fChild.getChildren());
}
}
}
if (CollectionUtils.isEmpty(children)) {
return;
}
List<NodeAllBase> workspaceChildren = children.stream().filter(node -> NodeTypeEnum.WORKSPACE.getValue().equals(node.getNodeType())).toList();
if (CollectionUtils.isEmpty(workspaceChildren)) {
return;
}
projectNodePo.setFinishTaskNum(projectNodePo.getFinishTaskNum() + workspaceChildren.stream().filter(node -> ObjectUtils.isNotEmpty(node.getFinishTaskNum())).mapToLong(NodeAllBase::getFinishTaskNum).sum());
projectNodePo.setTotalTaskNum(projectNodePo.getTotalTaskNum() + workspaceChildren.stream().filter(node -> ObjectUtils.isNotEmpty(node.getTotalTaskNum())).mapToLong(NodeAllBase::getTotalTaskNum).sum());
for (NodeAllBase child : children) {
List<NodeAllBase> eachChildren = child.getChildren();
if (CollectionUtils.isEmpty(eachChildren)) {
continue;
}
List<NodeAllBase> eachWorkspaceChildren = eachChildren.stream().filter(node -> NodeTypeEnum.WORKSPACE.getValue().equals(node.getNodeType())).toList();
if (CollectionUtils.isEmpty(eachWorkspaceChildren)) {
continue;
}
summaryMachineNode(projectNodePo,eachWorkspaceChildren);
}
}
private void summaryWorkspaceNode(ProjectNodePo projectNodePo,List<NodeAllBase> children) {
if (!NodeTypeEnum.WORKSPACE.getValue().equals(projectNodePo.getNodeType())) {