李春阳 il y a 1 an
Parent
commit
4c37db0a1d

+ 157 - 2
simulation-resource-server/src/main/java/com/css/simulation/resource/server/app/impl/SimulationProjectServiceImpl.java

@@ -71,6 +71,7 @@ import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.List;
 import java.util.*;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
@@ -2984,23 +2985,177 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
 
         // 场景评价
         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<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, SceneComplexityPO> compPOMap = null;
+        Map<String, SceneRiskPO> riskPOMap = null;
+        if (CollectionUtil.isNotEmpty(sceneComplexityPOS)) {
+            compPOMap = sceneComplexityPOS.stream().collect(Collectors.toMap(SceneComplexityPO::getSceneId, Function.identity()));
+        }
+        if (CollectionUtil.isNotEmpty(sceneRiskPOS)) {
+            riskPOMap = sceneRiskPOS.stream().collect(Collectors.toMap(SceneRiskPO::getSceneId, Function.identity()));
+        }
 
         Map<String, Integer> compRangeFor10 = new HashMap<>();
         Map<String, Integer> riskRangeFor10 = new HashMap<>();
         Map<String, Integer> compLevelForPassNum = new HashMap<>();
         Map<String, Integer> riskLevelForPassNum = new HashMap<>();
+        Map<String, Integer> otherBehaviorTypeForNum = new HashMap<>();
+        Map<String, Map<String, Integer>> otherBehaviorForCompLevelNum = new HashMap<>();
+        Map<String, Map<String, Integer>> otherBehaviorForRiskLevelNum = new HashMap<>();
+
+        Map<String, Integer> weatherTypeForNum = new HashMap<>();
+        Map<String, Map<String, Integer>> weatherForCompLevelNum = new HashMap<>();
+        Map<String, Map<String, Integer>> weatherForRiskLevelNum = new HashMap<>();
+
+        Map<String, Integer> roadTypeForNum = new HashMap<>();
+//        Map<String, Map<String, Integer>> roadTypeForCompLevelNum = new HashMap<>();
+//        Map<String, Map<String, Integer>> roadTypeForRiskLevelNum = new HashMap<>();
+
+        Map<String, Integer> operationAreaTypeForNum = new HashMap<>();
+        Map<String, Map<String, Integer>> operationAreaForCompLevelNum = new HashMap<>();
+        Map<String, Map<String, Integer>> operationAreaForRiskLevelNum = new HashMap<>();
+
+        Map<String, Integer> roadGeometryPlaneTypeForNum = new HashMap<>();
+        Map<String, Map<String, Integer>> roadGeometryPlaneForCompLevelNum = new HashMap<>();
+        Map<String, Map<String, Integer>> roadGeometryPlaneForRiskLevelNum = new HashMap<>();
+
+        Map<String, Integer> roadGeometryVerticalTypeForNum = new HashMap<>();
+        Map<String, Map<String, Integer>> roadGeometryVerticalForCompLevelNum = new HashMap<>();
+        Map<String, Map<String, Integer>> roadGeometryVerticalForRiskLevelNum = new HashMap<>();
+
         JSONObject jsonObject = new JSONObject();
+        jsonObject.put("otherBehavior", new JSONObject());
         sceneComplexityPOS.forEach(sceneComplexityPO -> checkAndSetDataSetValue(jsonObject, sceneComplexityPO.getComplexity(), sceneComplexityPO.getComplexityLevel()));
         sceneRiskPOS.forEach(sceneRiskPO -> checkAndSetDataSetValue(jsonObject, sceneRiskPO.getRisk(), sceneRiskPO.getRiskLevel()));
+        for (SceneReferenceLibPO sceneReferenceLibPO : sceneReferenceLibPOS) {
+            String sceneId = sceneReferenceLibPO.getSceneId();
+            String otherBehavior = sceneReferenceLibPO.getOtherBehavior();
+            if (StringUtil.isNotEmpty(otherBehavior)) {
+                int num = otherBehaviorTypeForNum.putIfAbsent(otherBehavior, 0);
+                otherBehaviorTypeForNum.put(otherBehavior, ++num);
+                if (compPOMap != null && compPOMap.get(sceneId) != null) {
+                    SceneComplexityPO sceneComplexityPO = compPOMap.get(sceneId);
+                    Map<String, Integer> levelNumMap = otherBehaviorForCompLevelNum.putIfAbsent(otherBehavior, new HashMap<>());
+                    String level = sceneComplexityPO.getComplexityLevel();
+                    int tempNum = levelNumMap.putIfAbsent(level, 0);
+                    levelNumMap.put(level, ++tempNum);
+                }
+                if (riskPOMap != null && riskPOMap.get(sceneId) != null) {
+                    SceneRiskPO sceneRiskPO = riskPOMap.get(sceneId);
+                    Map<String, Integer> levelNumMap = otherBehaviorForRiskLevelNum.putIfAbsent(otherBehavior, new HashMap<>());
+                    String level = sceneRiskPO.getRiskLevel();
+                    int tempNum = levelNumMap.putIfAbsent(level, 0);
+                    levelNumMap.put(level, ++tempNum);
+                }
+            }
+
+            String weather = sceneReferenceLibPO.getWeather();
+            if (StringUtil.isNotEmpty(weather)) {
+                int num = weatherTypeForNum.putIfAbsent(weather, 0);
+                weatherTypeForNum.put(weather, ++num);
+                if (compPOMap != null && compPOMap.get(sceneId) != null) {
+                    SceneComplexityPO sceneComplexityPO = compPOMap.get(sceneId);
+                    Map<String, Integer> levelNumMap = weatherForCompLevelNum.putIfAbsent(weather, new HashMap<>());
+                    String level = sceneComplexityPO.getComplexityLevel();
+                    int tempNum = levelNumMap.putIfAbsent(level, 0);
+                    levelNumMap.put(level, ++tempNum);
+                }
+                if (riskPOMap != null && riskPOMap.get(sceneId) != null) {
+                    SceneRiskPO sceneRiskPO = riskPOMap.get(sceneId);
+                    Map<String, Integer> levelNumMap = weatherForRiskLevelNum.putIfAbsent(weather, new HashMap<>());
+                    String level = sceneRiskPO.getRiskLevel();
+                    int tempNum = levelNumMap.putIfAbsent(level, 0);
+                    levelNumMap.put(level, ++tempNum);
+                }
+            }
+
+            String roadType = sceneReferenceLibPO.getRoadType();
+            if (StringUtil.isNotEmpty(roadType)) {
+                int num = roadTypeForNum.putIfAbsent(roadType, 0);
+                roadTypeForNum.put(roadType, ++num);
+//                if (compPOMap != null && compPOMap.get(sceneId) != null) {
+//                    SceneComplexityPO sceneComplexityPO = compPOMap.get(sceneId);
+//                    Map<String, Integer> levelNumMap = roadTypeForCompLevelNum.putIfAbsent(roadType, new HashMap<>());
+//                    String level = sceneComplexityPO.getComplexityLevel();
+//                    int tempNum = levelNumMap.putIfAbsent(level, 0);
+//                    levelNumMap.put(level, ++tempNum);
+//                }
+//                if (riskPOMap != null && riskPOMap.get(sceneId) != null) {
+//                    SceneRiskPO sceneRiskPO = riskPOMap.get(sceneId);
+//                    Map<String, Integer> levelNumMap = roadTypeForRiskLevelNum.putIfAbsent(roadType, new HashMap<>());
+//                    String level = sceneRiskPO.getRiskLevel();
+//                    int tempNum = levelNumMap.putIfAbsent(level, 0);
+//                    levelNumMap.put(level, ++tempNum);
+//                }
 
+            }
 
+            String operationArea = sceneReferenceLibPO.getOperationArea();
+            if (StringUtil.isNotEmpty(operationArea)) {
+                int num = operationAreaTypeForNum.putIfAbsent(operationArea, 0);
+                operationAreaTypeForNum.put(operationArea, ++num);
+                if (compPOMap != null && compPOMap.get(sceneId) != null) {
+                    SceneComplexityPO sceneComplexityPO = compPOMap.get(sceneId);
+                    Map<String, Integer> levelNumMap = operationAreaForCompLevelNum.putIfAbsent(operationArea, new HashMap<>());
+                    String level = sceneComplexityPO.getComplexityLevel();
+                    int tempNum = levelNumMap.putIfAbsent(level, 0);
+                    levelNumMap.put(level, ++tempNum);
+                }
+                if (riskPOMap != null && riskPOMap.get(sceneId) != null) {
+                    SceneRiskPO sceneRiskPO = riskPOMap.get(sceneId);
+                    Map<String, Integer> levelNumMap = operationAreaForRiskLevelNum.putIfAbsent(operationArea, new HashMap<>());
+                    String level = sceneRiskPO.getRiskLevel();
+                    int tempNum = levelNumMap.putIfAbsent(level, 0);
+                    levelNumMap.put(level, ++tempNum);
+                }
+            }
+
+            String roadGeometryPlane = sceneReferenceLibPO.getRoadGeometryPlane();
+            if (StringUtil.isNotEmpty(roadGeometryPlane)) {
+                int num = roadGeometryPlaneTypeForNum.putIfAbsent(roadGeometryPlane, 0);
+                roadGeometryPlaneTypeForNum.put(roadGeometryPlane, ++num);
+                if (compPOMap != null && compPOMap.get(sceneId) != null) {
+                    SceneComplexityPO sceneComplexityPO = compPOMap.get(sceneId);
+                    Map<String, Integer> levelNumMap = roadGeometryPlaneForCompLevelNum.putIfAbsent(roadGeometryPlane, new HashMap<>());
+                    String level = sceneComplexityPO.getComplexityLevel();
+                    int tempNum = levelNumMap.putIfAbsent(level, 0);
+                    levelNumMap.put(level, ++tempNum);
+                }
+                if (riskPOMap != null && riskPOMap.get(sceneId) != null) {
+                    SceneRiskPO sceneRiskPO = riskPOMap.get(sceneId);
+                    Map<String, Integer> levelNumMap = roadGeometryPlaneForRiskLevelNum.putIfAbsent(roadGeometryPlane, new HashMap<>());
+                    String level = sceneRiskPO.getRiskLevel();
+                    int tempNum = levelNumMap.putIfAbsent(level, 0);
+                    levelNumMap.put(level, ++tempNum);
+                }
+            }
+
+
+            String roadGeometryVertical = sceneReferenceLibPO.getRoadGeometryVertical();
+            if (StringUtil.isNotEmpty(roadGeometryVertical)) {
+                int num = roadGeometryVerticalTypeForNum.putIfAbsent(roadGeometryVertical, 0);
+                roadGeometryVerticalTypeForNum.put(roadGeometryVertical, ++num);
+                if (compPOMap != null && compPOMap.get(sceneId) != null) {
+                    SceneComplexityPO sceneComplexityPO = compPOMap.get(sceneId);
+                    Map<String, Integer> levelNumMap = roadGeometryVerticalForCompLevelNum.putIfAbsent(roadGeometryVertical, new HashMap<>());
+                    String level = sceneComplexityPO.getComplexityLevel();
+                    int tempNum = levelNumMap.putIfAbsent(level, 0);
+                    levelNumMap.put(level, ++tempNum);
+                }
+                if (riskPOMap != null && riskPOMap.get(sceneId) != null) {
+                    SceneRiskPO sceneRiskPO = riskPOMap.get(sceneId);
+                    Map<String, Integer> levelNumMap = roadGeometryVerticalForRiskLevelNum.putIfAbsent(roadGeometryVertical, new HashMap<>());
+                    String level = sceneRiskPO.getRiskLevel();
+                    int tempNum = levelNumMap.putIfAbsent(level, 0);
+                    levelNumMap.put(level, ++tempNum);
+                }
+            }
+        }
     }
 
     @Override