|
@@ -3041,7 +3041,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
|
task.setRisk(String.valueOf(firstRiskPOMap.get(task.getSceneId()).getRisk()));
|
|
|
task.setRiskLevel(String.valueOf(firstRiskPOMap.get(task.getSceneId()).getRiskLevel()));
|
|
|
}
|
|
|
- if (task.getScore() >= 80) {
|
|
|
+ if (task.getScore() != null && task.getScore() >= 80) {
|
|
|
passNum++;
|
|
|
task.setScoreResult("pass");
|
|
|
} else {
|
|
@@ -3160,8 +3160,8 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
|
String area = sceneReferenceLibPO.getOperationArea();
|
|
|
if (StringUtil.isNotEmpty(area) && (taskMap != null && taskMap.get(sceneId) != null)) {
|
|
|
Map<String, Integer> numMap = otherBehaviorAndAreaPassNum.computeIfAbsent("(" + area + ", " + otherBehavior + ")", s -> new HashMap<>());
|
|
|
- double score = taskMap.get(sceneId).getScore();
|
|
|
- if (score >= 80) {
|
|
|
+ Double score = taskMap.get(sceneId).getScore();
|
|
|
+ if (score != null && score >= 80) {
|
|
|
int tempNum = numMap.computeIfAbsent("passNum", s -> 0);
|
|
|
numMap.put("passNum", ++tempNum);
|
|
|
} else {
|
|
@@ -3192,8 +3192,8 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
|
String area = sceneReferenceLibPO.getOperationArea();
|
|
|
if (StringUtil.isNotEmpty(area) && (taskMap != null && taskMap.get(sceneId) != null)) {
|
|
|
Map<String, Integer> numMap = weatherAndAreaPassNum.computeIfAbsent("(" + area + ", " + weather + ")", s -> new HashMap<>());
|
|
|
- double score = taskMap.get(sceneId).getScore();
|
|
|
- if (score >= 80) {
|
|
|
+ Double score = taskMap.get(sceneId).getScore();
|
|
|
+ if (score != null && score >= 80) {
|
|
|
int tempNum = numMap.computeIfAbsent("passNum", s -> 0);
|
|
|
numMap.put("passNum", ++tempNum);
|
|
|
} else {
|
|
@@ -3266,8 +3266,8 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
|
String roadGeometryVertical = sceneReferenceLibPO.getRoadGeometryVertical();
|
|
|
if (StringUtil.isNotEmpty(roadGeometryVertical) && (taskMap != null && taskMap.get(sceneId) != null)) {
|
|
|
Map<String, Integer> numMap = roadPlanePassNum.computeIfAbsent("(" + roadGeometryPlane + ", " + roadGeometryVertical + ")", s -> new HashMap<>());
|
|
|
- double score = taskMap.get(sceneId).getScore();
|
|
|
- if (score >= 80) {
|
|
|
+ Double score = taskMap.get(sceneId).getScore();
|
|
|
+ if (score != null && score >= 80) {
|
|
|
int tempNum = numMap.computeIfAbsent("passNum", s -> 0);
|
|
|
numMap.put("passNum", ++tempNum);
|
|
|
} else {
|
|
@@ -4167,110 +4167,6 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
|
document.add(elm);
|
|
|
}
|
|
|
|
|
|
- private void createBarAndPieImg(Document document, List<SceneComplexityPO> sceneComplexityPOS, List<SceneRiskPO> sceneRiskPOS) {
|
|
|
- try {
|
|
|
- // 饼图
|
|
|
- DefaultPieDataset complexityDataSet = new DefaultPieDataset();
|
|
|
- DefaultCategoryDataset complexityData = getBarDataSet();
|
|
|
- DefaultCategoryDataset riskData = getBarDataSet();
|
|
|
- if (CollectionUtil.isNotEmpty(sceneComplexityPOS)) {
|
|
|
- sceneComplexityPOS.forEach(sceneComplexityPO -> {
|
|
|
- if (complexityDataSet.getValue(sceneComplexityPO.getComplexityLevel()) == null) {
|
|
|
- complexityDataSet.setValue(sceneComplexityPO.getComplexityLevel(), 1);
|
|
|
- } else {
|
|
|
- int num = complexityDataSet.getValue(sceneComplexityPO.getComplexityLevel()).intValue();
|
|
|
- complexityDataSet.setValue(sceneComplexityPO.getComplexityLevel(), ++num);
|
|
|
- }
|
|
|
-// checkAndSetDataSetValue(complexityData, sceneComplexityPO.getComplexity());
|
|
|
-
|
|
|
- });
|
|
|
- }
|
|
|
- ByteArrayOutputStream pieBos = new ByteArrayOutputStream();
|
|
|
- ChartUtils.writeChartAsJPEG(pieBos, ChartUtil.pieChart("复杂度等级分布图", complexityDataSet), 300, 188);
|
|
|
- Image pieImage = Image.getInstance(pieBos.toByteArray());
|
|
|
- pieImage.setAlignment(Element.ALIGN_CENTER);
|
|
|
- pieBos.close();
|
|
|
-
|
|
|
- // 饼图
|
|
|
- DefaultPieDataset riskDataSet = new DefaultPieDataset();
|
|
|
- if (CollectionUtil.isNotEmpty(sceneRiskPOS)) {
|
|
|
- sceneRiskPOS.forEach(sceneRiskPO -> {
|
|
|
- if (riskDataSet.getValue(sceneRiskPO.getRiskLevel()) == null) {
|
|
|
- riskDataSet.setValue(sceneRiskPO.getRiskLevel(), 1);
|
|
|
- } else {
|
|
|
- int num = riskDataSet.getValue(sceneRiskPO.getRiskLevel()).intValue();
|
|
|
- riskDataSet.setValue(sceneRiskPO.getRiskLevel(), ++num);
|
|
|
- }
|
|
|
-// checkAndSetDataSetValue(riskData, sceneRiskPO.getRisk());
|
|
|
- });
|
|
|
- }
|
|
|
- ByteArrayOutputStream riskBos = new ByteArrayOutputStream();
|
|
|
- ChartUtils.writeChartAsJPEG(riskBos, ChartUtil.pieChart("危险度等级分布图", riskDataSet), 300, 188);
|
|
|
- Image riskLevelImage = Image.getInstance(riskBos.toByteArray());
|
|
|
- riskLevelImage.setAlignment(Element.ALIGN_CENTER);
|
|
|
- riskBos.close();
|
|
|
- if (CollectionUtil.isNotEmpty(sceneComplexityPOS) && CollectionUtil.isNotEmpty(sceneRiskPOS)) {
|
|
|
- float[] floats = new float[2];
|
|
|
- Arrays.fill(floats, 60);
|
|
|
- PdfPTable table = new PdfPTable(floats);
|
|
|
- table.setTotalWidth(600);
|
|
|
- table.setLockedWidth(true);
|
|
|
- table.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
|
- table.getDefaultCell().setBorder(1);
|
|
|
- PdfPCell complexityCell = new PdfPCell(pieImage);
|
|
|
- pieImage.scaleAbsolute(300, 188);
|
|
|
- complexityCell.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
|
- complexityCell.setBorder(com.itextpdf.text.Rectangle.NO_BORDER);
|
|
|
- table.addCell(complexityCell);
|
|
|
-
|
|
|
- PdfPCell riskCell = new PdfPCell(riskLevelImage);
|
|
|
- riskLevelImage.scaleAbsolute(300, 188);
|
|
|
- riskCell.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
|
- riskCell.setBorder(com.itextpdf.text.Rectangle.NO_BORDER);
|
|
|
- table.addCell(riskCell);
|
|
|
- document.add(table);
|
|
|
- BaseFont font = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
|
|
|
- Paragraph elements = new Paragraph(40, " ", new com.itextpdf.text.Font(font, 14));
|
|
|
- document.add(elements);
|
|
|
- } else if (CollectionUtil.isNotEmpty(sceneComplexityPOS)) {
|
|
|
- document.add(pieImage);
|
|
|
- } else if (CollectionUtil.isNotEmpty(sceneRiskPOS)) {
|
|
|
- document.add(riskLevelImage);
|
|
|
- }
|
|
|
- if (CollectionUtil.isNotEmpty(sceneComplexityPOS)) {
|
|
|
- ByteArrayOutputStream pieBos2 = new ByteArrayOutputStream();
|
|
|
- ChartUtils.writeChartAsJPEG(pieBos2, ChartUtil.barChart("复杂度分布图", null, "复杂度", complexityData), 620, 200);
|
|
|
- Image pieImage3 = Image.getInstance(pieBos2.toByteArray());
|
|
|
- pieImage3.setAlignment(Element.ALIGN_CENTER);
|
|
|
- document.add(pieImage3);
|
|
|
- }
|
|
|
- if (CollectionUtil.isNotEmpty(sceneRiskPOS)) {
|
|
|
- ByteArrayOutputStream pieBos3 = new ByteArrayOutputStream();
|
|
|
- ChartUtils.writeChartAsJPEG(pieBos3, ChartUtil.barChart("危险度分布图", null, "危险度", riskData), 620, 200);
|
|
|
- Image pieImage4 = Image.getInstance(pieBos3.toByteArray());
|
|
|
- pieImage4.setAlignment(Element.ALIGN_CENTER);
|
|
|
- document.add(pieImage4);
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("创建饼图和柱状图失败. ", e);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private DefaultCategoryDataset getBarDataSet() {
|
|
|
- DefaultCategoryDataset dataset = new DefaultCategoryDataset();
|
|
|
- dataset.addValue(0, "场景名称", "[0,10]");
|
|
|
- dataset.addValue(0, "场景名称", "(10,20]");
|
|
|
- dataset.addValue(0, "场景名称", "(20,30]");
|
|
|
- dataset.addValue(0, "场景名称", "(30,40]");
|
|
|
- dataset.addValue(0, "场景名称", "(40,50]");
|
|
|
- dataset.addValue(0, "场景名称", "(50,60]");
|
|
|
- dataset.addValue(0, "场景名称", "(60,70]");
|
|
|
- dataset.addValue(0, "场景名称", "(70,80]");
|
|
|
- dataset.addValue(0, "场景名称", "(80,90]");
|
|
|
- dataset.addValue(0, "场景名称", "(90,100]");
|
|
|
- return dataset;
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
private void checkAndSetDataSetValue(Map<String, Integer> desTriMap, Map<String, Map<String, Integer>> levelMap, String value, String valueLevel) {
|
|
|
double valDouble = Double.parseDouble(value);
|