liujie
2026-09-20 25999c575dd42b4715e49d3fe57e73c2c3204ccb
admin-server/src/main/java/com/estate/expert/admin/stat/report/data/SystemReportData.java
@@ -46,9 +46,21 @@
        evalInfo.put("综合信息", buildAbstractInfo());
        evalInfo.put("检查项", buildCheckItems());
        evalInfo.put("隐患等级分布", buildErrorLevel(getFuzzyRoot()));
        evalInfo.put("隐患等级分布", buildErrorLevel(getErrorLevelCounts()));
        return evalInfo;
    }
    /**
     * 获取报告使用的隐患等级计数。
     * 默认使用模糊结果,评分报告可按需使用评分结果。
     */
    protected int[] getErrorLevelCounts() {
        var root = getFuzzyRoot();
        if (root == null || root.getData() == null) {
            return null;
        }
        return root.getData().getTotalErrorCounts();
    }
    /**
@@ -123,7 +135,9 @@
            return null;
        JSONObject result = new JSONObject();
        result.put("名称", node.getName());
        var name = node.getName();
        result.put("名称", name);
        result.put("问题清单标题", buildProblemListTitle(name));
        buildNode(result, node);
        var cfuzzyNode = getFuzzyNodeByPath(node.getPath());
@@ -178,6 +192,16 @@
        return result;
    }
    private String buildProblemListTitle(String name) {
        if (name == null || name.isBlank()) {
            return "问题清单";
        }
        if ("安全检查".equals(name)) {
            return "安全问题清单";
        }
        return name + "问题清单";
    }
    /**
     * 构建错误信息
     * @param nodePath 节点路径
@@ -186,18 +210,10 @@
    protected List<Object> buildErrorInfo(String nodePath) {
        var suffix = nodePath + "/";
        var errors = new ArrayList<>();
        // 按 problem.id 去重,相同问题只保留第一个记录
        var nodeRecords = records.stream()
                .filter(record -> record.getProblem() != null &&
                        record.getProblem().getHierarchyPath() != null &&
                        record.getProblem().getHierarchyPath().startsWith(suffix))
                .collect(java.util.stream.Collectors.toMap(
                        record -> record.getProblem().getId(),
                        record -> record,
                        (existing, replacement) -> existing  // 保留第一个遇到的记录
                ))
                .values()
                .stream()
                // 按照record.errorLevel排序
                .sorted(Comparator.comparing(ErrorRecord::getLevel, Comparator.nullsLast(Comparator.naturalOrder())))
                .toList();