|
@@ -10,6 +10,7 @@ import api.common.pojo.param.MinioParameter;
|
|
|
import api.common.pojo.param.algorithm.AlgorithmParameter;
|
|
|
import api.common.pojo.param.project.*;
|
|
|
import api.common.pojo.param.scene.SceneEvaluationForListParam;
|
|
|
+import api.common.pojo.param.scene.SceneReferenceLibSelectParam;
|
|
|
import api.common.pojo.param.system.DictParam;
|
|
|
import api.common.pojo.po.algorithm.AlgorithmPO;
|
|
|
import api.common.pojo.po.model.ConfigPO;
|
|
@@ -21,6 +22,7 @@ import api.common.pojo.vo.algorithm.AlgorithmVO;
|
|
|
import api.common.pojo.vo.project.*;
|
|
|
import api.common.pojo.vo.scene.ScenePackageNewVO;
|
|
|
import api.common.util.*;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.css.simulation.resource.server.app.service.SceneEvaluationRuleService;
|
|
|
import com.css.simulation.resource.server.domain.service.UserDomainService;
|
|
|
import com.css.simulation.resource.server.infra.db.mysql.mapper.*;
|
|
@@ -64,6 +66,7 @@ import java.math.RoundingMode;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
import java.nio.file.Files;
|
|
|
+import java.text.DecimalFormat;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.List;
|
|
@@ -124,6 +127,15 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
|
@Resource
|
|
|
ScenePackageMapper scenePackageMapper;
|
|
|
|
|
|
+ @Resource
|
|
|
+ SceneComplexityMapper sceneComplexityMapper;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ SceneRiskMapper sceneRiskMapper;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ SceneReferenceLibMapper sceneReferenceLibMapper;
|
|
|
+
|
|
|
// * -------------------------------- Comment --------------------------------
|
|
|
|
|
|
private final String[] dateFmtArr = new String[]{"yyyyMMdd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd"};
|
|
@@ -2949,6 +2961,48 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
|
return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, maps);
|
|
|
}
|
|
|
|
|
|
+ public void getProjectReportForAllReferenceScene(SimulationManualProjectParam param) {
|
|
|
+ // 获取要生成的数据
|
|
|
+ ResponseBodyVO<ProjectReportVO> bodyVO = selectProjectReportById(param);
|
|
|
+ ProjectReportVO vo = bodyVO.getInfo();
|
|
|
+ String algorithmName = vo.getAlgorithmName();
|
|
|
+ String algorithmScore = vo.getAlgorithmScore().toString();
|
|
|
+ String evaluationLevel = vo.getEvaluationLevel();
|
|
|
+ double passNum = 0;
|
|
|
+ List<AlgorithmScoreVO> algorithmScoreList = vo.getAlgorithmScoreList();
|
|
|
+ double size = algorithmScoreList.size();
|
|
|
+ for (AlgorithmScoreVO v : algorithmScoreList) {
|
|
|
+ if (v.getScore() >= 80) {
|
|
|
+ passNum++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ DecimalFormat df = new DecimalFormat("#.###");
|
|
|
+
|
|
|
+ double passRate = passNum / size;
|
|
|
+ String formattedNumber = df.format(passRate);
|
|
|
+ List<SceneScListVo> sceneScoreLi = vo.getSceneScoreLi();
|
|
|
+
|
|
|
+ // 场景评价
|
|
|
+ List<String> sceneIds = sceneScoreLi.stream().map(SceneScListVo::getSceneId).collect(Collectors.toList());
|
|
|
+ List<SceneReferenceLibPO> sceneReferenceLibPOS = sceneReferenceLibMapper.querySceneReferenceLibList( SceneReferenceLibSelectParam.builder().ids(sceneIds.toArray(new String[sceneIds.size()])).build());
|
|
|
+ // 查询复杂度和危险度
|
|
|
+ List<SceneComplexityPO> sceneComplexityPOS = sceneComplexityMapper.selectSceneComplexityEvaluationForExport(param.getProjectId(), sceneIds);
|
|
|
+// sceneComplexityPOS.forEach(sceneComplexityPO -> sceneComplexityPO.setComplexityLevel(SceneEvaluationEnum.matchLevelEnumByLevelValue(sceneComplexityPO.getComplexityLevel())));
|
|
|
+ List<SceneRiskPO> sceneRiskPOS = sceneRiskMapper.selectSceneRiskEvaluationForExport(param.getProjectId(), sceneIds);
|
|
|
+// sceneRiskPOS.forEach(sceneRiskPO -> sceneRiskPO.setRiskLevel(SceneEvaluationEnum.matchLevelEnumByLevelValue(sceneRiskPO.getRiskLevel())));
|
|
|
+
|
|
|
+
|
|
|
+ Map<String, Integer> compRangeFor10 = new HashMap<>();
|
|
|
+ Map<String, Integer> riskRangeFor10 = new HashMap<>();
|
|
|
+ Map<String, Integer> compLevelForPassNum = new HashMap<>();
|
|
|
+ Map<String, Integer> riskLevelForPassNum = new HashMap<>();
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ sceneComplexityPOS.forEach(sceneComplexityPO -> checkAndSetDataSetValue(jsonObject, sceneComplexityPO.getComplexity(), sceneComplexityPO.getComplexityLevel()));
|
|
|
+ sceneRiskPOS.forEach(sceneRiskPO -> checkAndSetDataSetValue(jsonObject, sceneRiskPO.getRisk(), sceneRiskPO.getRiskLevel()));
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
@SneakyThrows
|
|
|
public void exportProjectReport(SimulationManualProjectParam param) {
|
|
@@ -3829,7 +3883,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
|
int num = complexityDataSet.getValue(sceneComplexityPO.getComplexityLevel()).intValue();
|
|
|
complexityDataSet.setValue(sceneComplexityPO.getComplexityLevel(), ++num);
|
|
|
}
|
|
|
- checkAndSetDataSetValue(complexityData, sceneComplexityPO.getComplexity());
|
|
|
+// checkAndSetDataSetValue(complexityData, sceneComplexityPO.getComplexity());
|
|
|
|
|
|
});
|
|
|
}
|
|
@@ -3849,7 +3903,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
|
int num = riskDataSet.getValue(sceneRiskPO.getRiskLevel()).intValue();
|
|
|
riskDataSet.setValue(sceneRiskPO.getRiskLevel(), ++num);
|
|
|
}
|
|
|
- checkAndSetDataSetValue(riskData, sceneRiskPO.getRisk());
|
|
|
+// checkAndSetDataSetValue(riskData, sceneRiskPO.getRisk());
|
|
|
});
|
|
|
}
|
|
|
ByteArrayOutputStream riskBos = new ByteArrayOutputStream();
|
|
@@ -3919,40 +3973,45 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
|
return dataset;
|
|
|
}
|
|
|
|
|
|
- private void checkAndSetDataSetValue(DefaultCategoryDataset dataset, String value) {
|
|
|
+
|
|
|
+ private void checkAndSetDataSetValue(JSONObject jsonObject, String value, String valueLevel) {
|
|
|
int valInt = Integer.parseInt(value);
|
|
|
+ jsonObject.computeIfAbsent(valueLevel, k -> new JSONObject());
|
|
|
+ if (Integer.parseInt(value) >= 80) {
|
|
|
+ jsonObject.getJSONObject(valueLevel).putIfAbsent("passNum", 0);
|
|
|
+ int tempNum = jsonObject.getJSONObject(valueLevel).getIntValue("passNum");
|
|
|
+ jsonObject.getJSONObject(valueLevel).put("passNum", ++tempNum);
|
|
|
+ } else {
|
|
|
+ jsonObject.getJSONObject(valueLevel).putIfAbsent("unPassNum", 0);
|
|
|
+ int tempNum = jsonObject.getJSONObject(valueLevel).getIntValue("unPassNum");
|
|
|
+ jsonObject.getJSONObject(valueLevel).put("unPassNum", ++tempNum);
|
|
|
+ }
|
|
|
+
|
|
|
+ String rangeVal = "";
|
|
|
if (valInt >= 0 && valInt <= 10) {
|
|
|
- int num = dataset.getValue("场景名称", "[0,10]").intValue();
|
|
|
- dataset.setValue(++num, "场景名称", "[0,10]");
|
|
|
+ rangeVal = "[0,10]";
|
|
|
} else if (valInt > 10 && valInt <= 20) {
|
|
|
- int num = dataset.getValue("场景名称", "(10,20]").intValue();
|
|
|
- dataset.setValue(++num, "场景名称", "(10,20]");
|
|
|
+ rangeVal = "(10,20]";
|
|
|
} else if (valInt > 20 && valInt <= 30) {
|
|
|
- int num = dataset.getValue("场景名称", "(20,30]").intValue();
|
|
|
- dataset.setValue(++num, "场景名称", "(20,30]");
|
|
|
+ rangeVal = "(20,30]";
|
|
|
} else if (valInt > 30 && valInt <= 40) {
|
|
|
- int num = dataset.getValue("场景名称", "(30,40]").intValue();
|
|
|
- dataset.setValue(++num, "场景名称", "(30,40]");
|
|
|
+ rangeVal = "(30,40]";
|
|
|
} else if (valInt > 40 && valInt <= 50) {
|
|
|
- int num = dataset.getValue("场景名称", "(40,50]").intValue();
|
|
|
- dataset.setValue(++num, "场景名称", "(40,50]");
|
|
|
+ rangeVal = "(40,50]";
|
|
|
} else if (valInt > 50 && valInt <= 60) {
|
|
|
- int num = dataset.getValue("场景名称", "(50,60]").intValue();
|
|
|
- dataset.setValue(++num, "场景名称", "(50,60]");
|
|
|
+ rangeVal = "(50,60]";
|
|
|
} else if (valInt > 60 && valInt <= 70) {
|
|
|
- int num = dataset.getValue("场景名称", "(60,70]").intValue();
|
|
|
- dataset.setValue(++num, "场景名称", "(60,70]");
|
|
|
+ rangeVal = "(60,70]";
|
|
|
} else if (valInt > 70 && valInt <= 80) {
|
|
|
- int num = dataset.getValue("场景名称", "(70,80]").intValue();
|
|
|
- dataset.setValue(++num, "场景名称", "(70,80]");
|
|
|
+ rangeVal = "(70,80]";
|
|
|
} else if (valInt > 80 && valInt <= 90) {
|
|
|
- int num = dataset.getValue("场景名称", "(80,90]").intValue();
|
|
|
- dataset.setValue(++num, "场景名称", "(80,90]");
|
|
|
+ rangeVal = "(80,90]";
|
|
|
} else if (valInt > 90 && valInt <= 100) {
|
|
|
- int num = dataset.getValue("场景名称", "(90,100]").intValue();
|
|
|
- dataset.setValue(++num, "场景名称", "(90,100]");
|
|
|
+ rangeVal = "(90,100]";
|
|
|
}
|
|
|
-
|
|
|
+ jsonObject.putIfAbsent(rangeVal, 0);
|
|
|
+ int newVal = jsonObject.getInteger(rangeVal);
|
|
|
+ jsonObject.put(rangeVal, ++newVal);
|
|
|
}
|
|
|
|
|
|
/**
|