fix:数据总览,任务按照维度配置,计算挂在最深路径
This commit is contained in:
@@ -195,7 +195,7 @@ public class SimulationNodeController implements ISimulationNodeFeignClient {
|
||||
/**
|
||||
* 所有项目的人员任务完成情况统计
|
||||
* 涉及 simulation_task
|
||||
* 只统计 负责人、执行人
|
||||
* 只统计 执行人
|
||||
* simulation_task_member MemberTypeEnum.PRINCIPAL 负责人/ MemberTypeEnum.EXECUTOR 仿真执行人
|
||||
*/
|
||||
@PostMapping("/getAllUserTaskCompleteStatistics")
|
||||
@@ -221,7 +221,7 @@ public class SimulationNodeController implements ISimulationNodeFeignClient {
|
||||
* 用户组任务完成情况统计
|
||||
* 涉及 simulation_task.exe_status
|
||||
*
|
||||
* 只统计 负责人、执行人
|
||||
* 只统计 执行人
|
||||
* simulation_task_member MemberTypeEnum.PRINCIPAL 负责人/ MemberTypeEnum.EXECUTOR 仿真执行人
|
||||
*
|
||||
* 需要传:
|
||||
@@ -240,7 +240,7 @@ public class SimulationNodeController implements ISimulationNodeFeignClient {
|
||||
* 用户组难度系数统计
|
||||
* 涉及 simulation_task.difficult
|
||||
*
|
||||
* 只统计 负责人、执行人
|
||||
* 只统计 执行人
|
||||
* simulation_task_member MemberTypeEnum.PRINCIPAL 负责人/ MemberTypeEnum.EXECUTOR 仿真执行人
|
||||
*
|
||||
*
|
||||
|
||||
@@ -2613,7 +2613,7 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
log.info("getAllNodeByProjectIdAndType sameTypeChildren size:{}, currentNodeType:{}, inputUuidsSize:{}",
|
||||
sameTypeChildren.size(), currentNodeType, uuids.size());
|
||||
|
||||
Set<String> matchedParentUuids = sameTypeChildren.stream()
|
||||
/*Set<String> matchedParentUuids = sameTypeChildren.stream()
|
||||
.map(SimulationNode::getParentId)
|
||||
.filter(StringUtils::isNotBlank)
|
||||
.collect(Collectors.toSet());
|
||||
@@ -2622,7 +2622,7 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
.filter(uuid -> !matchedParentUuids.contains(uuid))
|
||||
.toList();
|
||||
log.info("getAllNodeByProjectIdAndType remainingUuids size:{}, matchedParentUuids size:{}",
|
||||
remainingUuids.size(), matchedParentUuids.size());
|
||||
remainingUuids.size(), matchedParentUuids.size());*/
|
||||
|
||||
List<SimulationNode> simulationNodeList = new ArrayList<>(sameTypeChildren);
|
||||
|
||||
@@ -2635,47 +2635,41 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
return SdmResponse.success(buildNodeRespList(simulationNodeList));
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(remainingUuids)) {
|
||||
String currentNodeTag = tagMap.get(currentNodeType);
|
||||
String nextNodeTag = tagMap.get(nextNodeType);
|
||||
if (StringUtils.isBlank(currentNodeTag) || StringUtils.isBlank(nextNodeTag)) {
|
||||
log.error("节点类型未配置tag映射,currentNodeType:{},nextNodeType:{}", currentNodeType, nextNodeType);
|
||||
if (CollectionUtils.isEmpty(simulationNodeList)) {
|
||||
return SdmResponse.success();
|
||||
}
|
||||
// 再查询指定 nextNodeType 类型节点
|
||||
String currentNodeTag = tagMap.get(currentNodeType);
|
||||
String nextNodeTag = tagMap.get(nextNodeType);
|
||||
if (StringUtils.isBlank(currentNodeTag) || StringUtils.isBlank(nextNodeTag)) {
|
||||
log.error("节点类型未配置tag映射,currentNodeType:{},nextNodeType:{}", currentNodeType, nextNodeType);
|
||||
if (CollectionUtils.isEmpty(simulationNodeList)) {
|
||||
return SdmResponse.success();
|
||||
}
|
||||
} else {
|
||||
// 规则1:剩余节点不能直接拿uuid去匹配tag,必须先取出当前层对应的tag值(兼容tag链路逗号拼接)
|
||||
List<String> currentTagValues = extractTagValuesByNodeTag(currentNodes, currentNodeTag);
|
||||
if (CollectionUtils.isEmpty(currentTagValues)) {
|
||||
log.info("getAllNodeByProjectIdAndType currentTagValues empty, currentNodeTag:{}, remainingUuidsSize:{}",
|
||||
currentNodeTag, uuids.size());
|
||||
} else {
|
||||
// 规则1:剩余节点不能直接拿uuid去匹配tag,必须先取出当前层对应的tag值(兼容tag链路逗号拼接)
|
||||
List<String> currentTagValues = extractTagValuesByNodeTag(currentNodes, remainingUuids, currentNodeTag);
|
||||
if (CollectionUtils.isEmpty(currentTagValues)) {
|
||||
log.info("getAllNodeByProjectIdAndType currentTagValues empty, currentNodeTag:{}, remainingUuidsSize:{}",
|
||||
currentNodeTag, remainingUuids.size());
|
||||
} else {
|
||||
// 规则2:按当前层tag值定位同链路节点,再映射到下一层tag值并反查uuid
|
||||
List<SimulationNode> matchedChainNodes = queryNodesByCurrentTagValues(currentNodeTag, currentTagValues);
|
||||
List<String> preUUids = matchedChainNodes.stream()
|
||||
.map(simulationNode -> resolveTagValue(simulationNode, nextNodeTag))
|
||||
.filter(StringUtils::isNotBlank)
|
||||
.map(tag-> {
|
||||
return tag.split(",")[0];
|
||||
})
|
||||
.toList();
|
||||
// 规则2:按当前层tag值定位同链路节点,再映射到下一层tag值并反查uuid
|
||||
List<SimulationNode> matchedChainNodes = queryNodesByCurrentTagValues(currentNodeTag, currentTagValues);
|
||||
List<String> preUUids = matchedChainNodes.stream()
|
||||
.map(simulationNode -> resolveTagValue(simulationNode, nextNodeTag))
|
||||
.filter(StringUtils::isNotBlank)
|
||||
.map(tag -> {
|
||||
return tag.split(",")[0];
|
||||
})
|
||||
.toList();
|
||||
|
||||
List<SimulationNode> preSimulationNodeList = CollectionUtils.isEmpty(preUUids)
|
||||
? Collections.emptyList()
|
||||
: this.lambdaQuery().in(SimulationNode::getUuid, preUUids).list();
|
||||
simulationNodeList.addAll(preSimulationNodeList);
|
||||
// 规则3:同时保留原有“按nextNodeType正向查下一层”能力
|
||||
/* List<SimulationNode> nextTypeNodeList = matchedChainNodes.stream()
|
||||
.filter(node -> StringUtils.equals(node.getNodeType(), nextNodeType))
|
||||
.toList();
|
||||
simulationNodeList.addAll(nextTypeNodeList);
|
||||
*/
|
||||
log.info("getAllNodeByProjectIdAndType matchedChainNodes size:{}, nextNodeType:{}",
|
||||
matchedChainNodes.size(), nextNodeType);
|
||||
}
|
||||
List<SimulationNode> preSimulationNodeList = CollectionUtils.isEmpty(preUUids)
|
||||
? Collections.emptyList()
|
||||
: this.lambdaQuery().in(SimulationNode::getUuid, preUUids).list();
|
||||
simulationNodeList.addAll(preSimulationNodeList);
|
||||
log.info("getAllNodeByProjectIdAndType matchedChainNodes size:{}, nextNodeType:{}",
|
||||
matchedChainNodes.size(), nextNodeType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (CollectionUtils.isEmpty(simulationNodeList)) {
|
||||
return SdmResponse.success();
|
||||
}
|
||||
@@ -2690,9 +2684,8 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
* 2) 提取的是 tag 字段值,不是 uuid,兼容 tag4 这类“逗号拼接链路”场景;
|
||||
* 3) 统一去空和去重,减少后续 in 查询的数据量。
|
||||
*/
|
||||
private List<String> extractTagValuesByNodeTag(List<SimulationNode> currentNodes, List<String> remainingUuids, String currentNodeTag) {
|
||||
private List<String> extractTagValuesByNodeTag(List<SimulationNode> currentNodes, String currentNodeTag) {
|
||||
return currentNodes.stream()
|
||||
.filter(node -> remainingUuids.contains(node.getUuid()))
|
||||
.map(node -> resolveTagValue(node, currentNodeTag))
|
||||
.filter(StringUtils::isNotBlank)
|
||||
.distinct()
|
||||
@@ -2903,7 +2896,7 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
|
||||
req.setUserIds(userIds);
|
||||
|
||||
List<UserGroupTaskCompleteVo> userGroupTaskCompleteStatistics = this.baseMapper.getUserGroupTaskCompleteStatistics(req,Arrays.asList(MemberTypeEnum.PRINCIPAL.getCode(),MemberTypeEnum.EXECUTOR.getCode()));
|
||||
List<UserGroupTaskCompleteVo> userGroupTaskCompleteStatistics = this.baseMapper.getUserGroupTaskCompleteStatistics(req,Arrays.asList(MemberTypeEnum.EXECUTOR.getCode()));
|
||||
|
||||
// 按用户分组统计任务状态
|
||||
Map<Long, UserGroupTaskCompleteStatisticsVo> userStatisticsMap = new HashMap<>();
|
||||
@@ -2959,7 +2952,7 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
userId2Nickname = new HashMap<>();
|
||||
}
|
||||
|
||||
List<UserGroupTaskCompleteVo> userGroupTaskCompleteStatistics = this.baseMapper.getAllUserTaskCompleteStatistics(req,Arrays.asList(MemberTypeEnum.PRINCIPAL.getCode(),MemberTypeEnum.EXECUTOR.getCode()));
|
||||
List<UserGroupTaskCompleteVo> userGroupTaskCompleteStatistics = this.baseMapper.getAllUserTaskCompleteStatistics(req,Arrays.asList(MemberTypeEnum.EXECUTOR.getCode()));
|
||||
|
||||
// 按用户分组统计任务状态
|
||||
Map<Long, UserGroupTaskCompleteStatisticsVo> userStatisticsMap = new HashMap<>();
|
||||
@@ -3010,7 +3003,7 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
}
|
||||
req.setUserIds(userIds);
|
||||
|
||||
List<UserGroupDifficultyVo> userGroupDifficultyStatistics = this.baseMapper.getUserGroupDifficultyStatistics(req,Arrays.asList(MemberTypeEnum.PRINCIPAL.getCode(),MemberTypeEnum.EXECUTOR.getCode()));
|
||||
List<UserGroupDifficultyVo> userGroupDifficultyStatistics = this.baseMapper.getUserGroupDifficultyStatistics(req,Arrays.asList(MemberTypeEnum.EXECUTOR.getCode()));
|
||||
|
||||
// 按用户分组统计任务状态
|
||||
Map<Long, UserGroupDifficultyStatisticsVo> userStatisticsMap = new HashMap<>();
|
||||
|
||||
Reference in New Issue
Block a user