李春阳 hai 1 ano
pai
achega
87e7330959

+ 8 - 0
api-common/src/main/java/api/common/pojo/vo/project/SimulationManualProjectSingleVo.java

@@ -49,5 +49,13 @@ public class SimulationManualProjectSingleVo {
     private String[] vehicleArrayS;
     //场景测试包数组(公私有)
     private String[] sceneArrayS;
+    // 复杂度规则
+    private String complexityEvaluationRuleName;
+    // 危险度
+    private String riskEvaluationRuleName;
+    // 暴露率
+    private String exposureRateEvaluationRuleName;
+    // 覆盖率
+    private String coverageRateEvaluationRuleName;
 
 }

+ 20 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/server/app/impl/SimulationProjectServiceImpl.java

@@ -20,6 +20,7 @@ import api.common.pojo.po.model.ConfigSensorPO;
 import api.common.pojo.po.model.VehiclePO;
 import api.common.pojo.po.project.*;
 import api.common.pojo.po.scene.SceneComplexityPO;
+import api.common.pojo.po.scene.SceneEvaluationRulePO;
 import api.common.pojo.po.scene.ScenePackagePO;
 import api.common.pojo.po.scene.SceneRiskPO;
 import api.common.pojo.vo.algorithm.AlgorithmVO;
@@ -122,6 +123,8 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
     private SceneComplexityMapper sceneComplexityMapper;
     @Resource
     private SceneRiskMapper sceneRiskMapper;
+    @Resource
+    private SceneEvaluationRuleMapper sceneEvaluationRuleMapper;
 
     // * -------------------------------- Comment --------------------------------
 
@@ -227,6 +230,23 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
 
         SimulationManualProjectSingleVo vo = new SimulationManualProjectSingleVo();
         convertPoToVo(po, vo);
+        if (StringUtil.isNotEmpty(po.getComplexityEvaluationRuleId())) {
+            SceneEvaluationRulePO sceneComRule = sceneEvaluationRuleMapper.querySceneEvaluationPyById(po.getComplexityEvaluationRuleId());
+            vo.setComplexityEvaluationRuleName(sceneComRule == null ? null : sceneComRule.getRuleName());
+        }
+        if (StringUtil.isNotEmpty(po.getRiskEvaluationRuleId())) {
+            SceneEvaluationRulePO sceneRiskRule = sceneEvaluationRuleMapper.querySceneEvaluationPyById(po.getRiskEvaluationRuleId());
+            vo.setRiskEvaluationRuleName(sceneRiskRule == null ? null : sceneRiskRule.getRuleName());
+        }
+        if (StringUtil.isNotEmpty(po.getCoverageRateEvaluationRuleId())) {
+            SceneEvaluationRulePO sceneCoverRule = sceneEvaluationRuleMapper.querySceneEvaluationPyById(po.getCoverageRateEvaluationRuleId());
+            vo.setCoverageRateEvaluationRuleName(sceneCoverRule == null ? null : sceneCoverRule.getRuleName());
+        }
+        if (StringUtil.isNotEmpty(po.getExposureRateEvaluationRuleId())) {
+            SceneEvaluationRulePO sceneExposureRule = sceneEvaluationRuleMapper.querySceneEvaluationPyById(po.getExposureRateEvaluationRuleId());
+            vo.setExposureRateEvaluationRuleName(sceneExposureRule == null ? null : sceneExposureRule.getRuleName());
+        }
+
         if (ObjectUtil.isNotNull(po.getAlgorithmArray())) {
             vo.setAlgorithmArrayS(po.getAlgorithmArray().split(","));
         }

+ 36 - 36
simulation-resource-server/src/main/java/com/css/simulation/resource/server/app/service/SceneEvaluationRuleService.java

@@ -371,47 +371,47 @@ public class SceneEvaluationRuleService {
                 ObjectMapper mapper = new ObjectMapper();
                 //JSON ----> JsonNode
                 rootNode = mapper.readTree(replace);
+
+                if (StringUtils.equals(sceneEvaluationComputeParam.getComputeType(), DictConstants.COMPLEXITY)) {
+                    String complexity = rootNode.path("复杂度").asText();
+                    String complexityLevel = rootNode.path("复杂度等级").asText();
+                    SceneComplexityPO sceneComplexityPO = new SceneComplexityPO();
+                    sceneComplexityPO.setSceneId(sceneEvaluationComputeParam.getSceneId());
+                    sceneComplexityPO.setComplexityId(StringUtil.getRandomUUID());
+                    sceneComplexityPO.setSceneType(sceneEvaluationComputeParam.getSceneType());
+                    sceneComplexityPO.setRuleId(ruleId);
+                    sceneComplexityPO.setTaskId(sceneEvaluationComputeParam.getTaskId());
+                    sceneComplexityPO.setComplexity(complexity);
+                    sceneComplexityPO.setComplexityLevel(matchLevelEnumByLevel(complexityLevel));
+                    sceneComplexityPO.setIsDeleted(DictConstants.IS_NOT_DELETED);
+                    sceneComplexityPO.setCreateUserId(AuthUtil.getCurrentUserId());
+                    sceneComplexityPO.setCreateTime(TimeUtil.getNowForMysql());
+                    sceneComplexityMapper.saveSceneComplexity(sceneComplexityPO);
+                    if (CollectionUtil.isNotEmpty(sceneEvaluationComputeParam.getCopySceneId())) {
+                        copySceneComplexityResult(sceneEvaluationComputeParam.getTaskId(), sceneEvaluationComputeParam.getSceneId(), sceneEvaluationComputeParam.getCopySceneId());
+                    }
+                } else {
+                    String risk = rootNode.path("危险度").asText();
+                    String riskLevel = rootNode.path("危险度等级").asText();
+                    SceneRiskPO sceneRiskPO = new SceneRiskPO();
+                    sceneRiskPO.setSceneId(sceneEvaluationComputeParam.getSceneId());
+                    sceneRiskPO.setRuleId(StringUtil.getRandomUUID());
+                    sceneRiskPO.setSceneType(sceneEvaluationComputeParam.getSceneType());
+                    sceneRiskPO.setRuleId(ruleId);
+                    sceneRiskPO.setTaskId(sceneEvaluationComputeParam.getTaskId());
+                    sceneRiskPO.setRisk(risk);
+                    sceneRiskPO.setRiskLevel(matchLevelEnumByLevel(riskLevel));
+                    sceneRiskPO.setIsDeleted(DictConstants.IS_NOT_DELETED);
+                    sceneRiskPO.setCreateUserId(AuthUtil.getCurrentUserId());
+                    sceneRiskPO.setCreateTime(TimeUtil.getNowForMysql());
+                    sceneRiskMapper.saveSceneRisk(sceneRiskPO);
+                }
             } catch (Exception e) {
                 log.error("场景" + sceneEvaluationComputeParam.getSceneId() + " 的场景评价失败:", e);
-                continue;
-            }
-            if (StringUtils.equals(sceneEvaluationComputeParam.getComputeType(), DictConstants.COMPLEXITY)) {
-                String complexity = rootNode.path("复杂度").asText();
-                String complexityLevel = rootNode.path("复杂度等级").asText();
-                SceneComplexityPO sceneComplexityPO = new SceneComplexityPO();
-                sceneComplexityPO.setSceneId(sceneEvaluationComputeParam.getSceneId());
-                sceneComplexityPO.setComplexityId(StringUtil.getRandomUUID());
-                sceneComplexityPO.setSceneType(sceneEvaluationComputeParam.getSceneType());
-                sceneComplexityPO.setRuleId(ruleId);
-                sceneComplexityPO.setTaskId(sceneEvaluationComputeParam.getTaskId());
-                sceneComplexityPO.setComplexity(complexity);
-                sceneComplexityPO.setComplexityLevel(matchLevelEnumByLevel(complexityLevel));
-                sceneComplexityPO.setIsDeleted(DictConstants.IS_NOT_DELETED);
-                sceneComplexityPO.setCreateUserId(AuthUtil.getCurrentUserId());
-                sceneComplexityPO.setCreateTime(TimeUtil.getNowForMysql());
-                sceneComplexityMapper.saveSceneComplexity(sceneComplexityPO);
-                if (CollectionUtil.isNotEmpty(sceneEvaluationComputeParam.getCopySceneId())) {
-                    copySceneComplexityResult(sceneEvaluationComputeParam.getTaskId(), sceneEvaluationComputeParam.getSceneId(), sceneEvaluationComputeParam.getCopySceneId());
-                }
-            } else {
-                String risk = rootNode.path("危险度").asText();
-                String riskLevel = rootNode.path("危险度等级").asText();
-                SceneRiskPO sceneRiskPO = new SceneRiskPO();
-                sceneRiskPO.setSceneId(sceneEvaluationComputeParam.getSceneId());
-                sceneRiskPO.setRuleId(StringUtil.getRandomUUID());
-                sceneRiskPO.setSceneType(sceneEvaluationComputeParam.getSceneType());
-                sceneRiskPO.setRuleId(ruleId);
-                sceneRiskPO.setTaskId(sceneEvaluationComputeParam.getTaskId());
-                sceneRiskPO.setRisk(risk);
-                sceneRiskPO.setRiskLevel(matchLevelEnumByLevel(riskLevel));
-                sceneRiskPO.setIsDeleted(DictConstants.IS_NOT_DELETED);
-                sceneRiskPO.setCreateUserId(AuthUtil.getCurrentUserId());
-                sceneRiskPO.setCreateTime(TimeUtil.getNowForMysql());
-                sceneRiskMapper.saveSceneRisk(sceneRiskPO);
             }
         }
         // 删除临时文件
-        FileUtil.deleteFolder(linuxTempPath + "scene/evaluation/" + sceneEvaluationComputeParams.get(0).getTaskId());   // 删除临时文件
+//        FileUtil.deleteFolder(linuxTempPath + "scene/evaluation/" + sceneEvaluationComputeParams.get(0).getTaskId());   // 删除临时文件
         return true;
     }
 

+ 1 - 1
simulation-resource-server/src/main/java/com/css/simulation/resource/server/app/service/SceneNaturalService.java

@@ -716,7 +716,7 @@ public class SceneNaturalService {
                                     sceneEvaluationComputeParam.setCopySceneId(scenes.stream().map(SceneNaturalPO::getNaturalId).filter(sceneId -> !StringUtils.equals(tempSceneId, sceneId)).collect(Collectors.toList()));
                                 }
                                 paramList.add(sceneEvaluationComputeParam);
-
+                                log.info("添加计算复杂度数据:" + sceneEvaluationComputeParam);
                             }
                         } catch (Exception e) {
                             errorMessage = e.getMessage();

+ 5 - 1
simulation-resource-server/src/main/resources/mysql/mapper/SimulationManualProjectMapper.xml

@@ -256,7 +256,11 @@
                details,
                algorithm_array,
                vehicle_array,
-               scene_array
+               scene_array,
+               coverage_rate_evaluation_ruleId,
+               exposure_rate_rvaluation_rule_id,
+               complexity_evaluation_rule_id,
+               risk_evaluation_rule_id
         from simulation_manual_project
         where id = #{id}
           and is_deleted = '0'