liujie
2026-05-16 d6968f0c33f2ce53018af4b0d6bae79a91f2332a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package com.estate.expert.admin.stat.report.data.impl;
 
import com.alibaba.fastjson.JSONObject;
import com.estate.expert.admin.domain.exam.eval.score.ScoreValue;
import com.estate.expert.admin.stat.report.data.SystemReportData;
import com.estate.expert.admin.utils.tree.TreeNode;
import lombok.experimental.SuperBuilder;
 
/**
 * 综合体系-打分报告数据
 */
@SuperBuilder
public class SystemScoreReportData extends SystemReportData {
 
    /**
     * 构建摘要信息
     * @return 摘要信息
     */
    @Override
    protected JSONObject buildAbstractInfo() {
        var abstractInfo = new JSONObject();
        
        // 使用父类提供的安全方法获取根节点
        var fuzzyRoot = getFuzzyRoot();
        var root = getScoreRoot();
        
        if(root==null || fuzzyRoot==null)
            return abstractInfo;
            
        abstractInfo.put("项目综合评分", formatFloat(root.getData().getScore()));
        abstractInfo.put("项目综合评价", fuzzyRoot.getData().getRiskLevel().getDesc());
 
        var scoreArr = new JSONObject();
        if(root.getChildren() != null) {
            root.getChildren().values().forEach(node -> {
                var name = node.getName();
                var score = formatFloat(node.getData().getScore());
                scoreArr.put(name, score);
            });
        }
        abstractInfo.put("分项得分", scoreArr);
        return abstractInfo;
    }
 
    /**
     * 构建节点
     * @param info 信息
     * @param node 节点
     */
    @Override
    protected void buildNode(JSONObject info, TreeNode<ScoreValue> node) {
        if(scoreResult == null || node == null) {
            info.put("权重", "-");
            info.put("得分", "-");
            return;
        }
        var path = node.getPath();
        var scoreNode = scoreResult.get(path);
        if(scoreNode!=null){
            var weight = scoreNode.getData().getNormalizedWeight();
 
            var parent = scoreNode.getParent();
            if(parent!=null){
                weight *= parent.getData().getNormalizedWeight();
            }
 
            var grandparent = scoreNode.getParent().getParent();
            if(grandparent!=null){
                weight *= grandparent.getData().getNormalizedWeight();
            }
 
            info.put("权重", formatFloat(weight));
            info.put("得分", formatFloat(scoreNode.getData().getScore()));
            info.put("总分", formatFloat(scoreNode.getData().getTotal()));
        }else{
            info.put("权重", "-");
            info.put("得分", "-");
        }
    }
}