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 SystemFuzzyReportData extends SystemReportData {
|
|
/**
|
* 构建摘要信息
|
* @return 摘要信息
|
*/
|
@Override
|
protected JSONObject buildAbstractInfo(){
|
var root = getFuzzyRoot();
|
if(root==null)
|
return new JSONObject();
|
var abstractInfo = new JSONObject();
|
abstractInfo.put("项目综合评分", formatFloat(root.getData().getScore()));
|
abstractInfo.put("项目综合评价", root.getData().getRiskLevel().getDesc());
|
|
var scoreArr = new JSONObject();
|
sysResult.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 信息
|
*/
|
@Override
|
protected void buildNode(JSONObject info, TreeNode<ScoreValue> c){
|
var parentWeight = c.getParent() == null ? 1f : c.getParent().getData().getWeight();
|
info.put("权重", formatFloatF4(c.getData().getWeight() * parentWeight ));
|
info.put("得分", formatFloat(c.getData().getScore()));
|
}
|
|
}
|