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();
    }
    /**
@@ -198,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();