李春阳 1 tahun lalu
induk
melakukan
c00751739f

+ 15 - 0
api-common/src/main/java/api/common/pojo/param/project/SimulationManualProjectEvaluationDetailParam.java

@@ -0,0 +1,15 @@
+package api.common.pojo.param.project;
+
+import api.common.pojo.common.PageVO;
+import lombok.*;
+
+
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class SimulationManualProjectEvaluationDetailParam extends PageVO {
+
+    private String id;
+}

+ 2 - 0
api-common/src/main/java/api/common/pojo/param/scene/SceneEvaluationForListParam.java

@@ -29,4 +29,6 @@ public class SceneEvaluationForListParam extends PageVO implements Serializable
     private String complexityLevel;
     // 危险度等级
     private String riskLevel;
+
+    private String taskId;
 }

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

@@ -29,4 +29,12 @@ public class ManualProjectTaskVo {
     private String runResultFilePath; //运行结果文件minio路径
     private String timeActual; // 实际用时
     private String timeCorrection; // 修正时间
+    // 复杂度
+    private String complexity;
+    // 危险度
+    private String risk;
+    // 复杂度等级
+    private String complexityLevel;
+    // 危险度等级
+    private String riskLevel;
 }

+ 22 - 0
api-common/src/main/java/api/common/pojo/vo/project/SimulationManualProjectSceneEvaluationDetailVo.java

@@ -0,0 +1,22 @@
+package api.common.pojo.vo.project;
+
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class SimulationManualProjectSceneEvaluationDetailVo {
+
+
+    private String sceneName;
+    // 复杂度
+    private String complexity;
+    // 危险度
+    private String risk;
+    // 复杂度等级
+    private String complexityLevel;
+    // 危险度等级
+    private String riskLevel;
+
+}

+ 5 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/server/adapter/controller/job_manage/JobManageController.java

@@ -313,6 +313,11 @@ public class JobManageController {
     return simulationProjectService.updateAutoProjectNowRunState(param);
   }
 
+  @RequestMapping("/querySceneEvaluationDetail")
+  public ResponseBodyVO<PageInfo<ManualProjectTaskVo>> querySceneEvaluationDetail(@RequestBody SimulationManualProjectEvaluationDetailParam param) {
+    return simulationProjectService.querySceneEvaluationDetail(param);
+  }
+
   /**
    * 根据id查询自动运行项目信息
    */

+ 61 - 27
simulation-resource-server/src/main/java/com/css/simulation/resource/server/app/impl/SimulationProjectServiceImpl.java

@@ -5,28 +5,23 @@ import api.common.pojo.common.ResponseBodyVO;
 import api.common.pojo.constants.DictConstants;
 import api.common.pojo.constants.ProjectConstants;
 import api.common.pojo.constants.StateConstant;
-import api.common.pojo.enums.SceneEvaluationEnum;
 import api.common.pojo.param.KafkaParameter;
 import api.common.pojo.param.MinioParameter;
 import api.common.pojo.param.algorithm.AlgorithmParameter;
-import api.common.pojo.param.project.ProjectTaskParam;
-import api.common.pojo.param.project.SceneScoreParam;
-import api.common.pojo.param.project.SimulationManualProjectKafkaParam;
-import api.common.pojo.param.project.SimulationManualProjectParam;
+import api.common.pojo.param.project.*;
+import api.common.pojo.param.scene.SceneEvaluationForListParam;
 import api.common.pojo.param.system.DictParam;
 import api.common.pojo.po.algorithm.AlgorithmPO;
 import api.common.pojo.po.model.ConfigPO;
 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.po.scene.*;
 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.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.*;
 import com.css.simulation.resource.server.app.service.AlgorithmService;
@@ -38,6 +33,7 @@ import com.css.simulation.resource.server.app.constant.ProjectRunStateEnum;
 import com.css.simulation.resource.server.app.constant.SceneTypeEnum;
 import com.css.simulation.resource.server.app.service.job_manage.SimulationProjectService;
 import com.css.simulation.resource.server.app.service.DictService;
+import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.google.common.collect.ImmutableMap;
 import com.itextpdf.text.*;
@@ -121,9 +117,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
     @Resource
     private UserDomainService userDomainService;
     @Resource
-    private SceneComplexityMapper sceneComplexityMapper;
-    @Resource
-    private SceneRiskMapper sceneRiskMapper;
+    private SceneEvaluationRuleService sceneEvaluationRuleService;
     @Resource
     private SceneEvaluationRuleMapper sceneEvaluationRuleMapper;
 
@@ -1942,6 +1936,11 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
                 vo.setSceneName(sceneBaseInfoVo.getSceneName());
             }
 
+        } else if (DictConstants.SCENE_REFERENCE_LIB.equals(sceneType)) {
+            sceneBaseInfoVo = simulationManualProjectMapper.selectSceneReferenceLibDataById(sceneId);
+            if (sceneBaseInfoVo != null) {
+                vo.setSceneName(sceneBaseInfoVo.getSceneName());
+            }
         }
     }
 
@@ -3046,7 +3045,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
             List<AlgorithmScoreVO> algorithmScoreList = vo.getAlgorithmScoreList();
 
             StringBuilder stringBuilder = new StringBuilder("       " + vo.getAlgorithmName() + "在");
-            int totalSceneNum = vo.getSceneScoreLi().size();
+//            int totalSceneNum = vo.getSceneScoreLi().size();
             for (AlgorithmScoreVO v : algorithmScoreList) {
                 if ("汇总".equals(v.getProjectName())) {
                     continue;
@@ -3181,20 +3180,20 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
             document.add(pdfPTable2);
             List<SceneScListVo> sceneScoreLi = vo.getSceneScoreLi();
 
-            if ("1".equals(param.getProjectType())) {
-                // 场景评价
-                List<String> sceneIds = sceneScoreLi.stream().map(SceneScListVo::getSceneId).collect(Collectors.toList());
-                // 查询复杂度和危险度
-                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())));
-                if (CollectionUtil.isNotEmpty(sceneComplexityPOS) || CollectionUtil.isNotEmpty(sceneRiskPOS)) {
-                    addElement(document, "场景评价", null, bf3, 15, false, 30, true);
-                    addElement(document, "       场景测试包共包含" + totalSceneNum + "个场景.", null, bf3, 15, false, 30, false);
-                    createBarAndPieImg(document, sceneComplexityPOS, sceneRiskPOS);
-                }
-            }
+//            if ("1".equals(param.getProjectType())) {
+//                // 场景评价
+//                List<String> sceneIds = sceneScoreLi.stream().map(SceneScListVo::getSceneId).collect(Collectors.toList());
+//                // 查询复杂度和危险度
+//                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())));
+//                if (CollectionUtil.isNotEmpty(sceneComplexityPOS) || CollectionUtil.isNotEmpty(sceneRiskPOS)) {
+//                    addElement(document, "场景评价", null, bf3, 15, false, 30, true);
+//                    addElement(document, "       场景测试包共包含" + totalSceneNum + "个场景.", null, bf3, 15, false, 30, false);
+//                    createBarAndPieImg(document, sceneComplexityPOS, sceneRiskPOS);
+//                }
+//            }
 
             // ------- 4.详细得分说明 -------
 
@@ -5240,6 +5239,41 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, po);
     }
 
+    @SneakyThrows
+    @Override
+    public ResponseBodyVO<PageInfo<ManualProjectTaskVo>> querySceneEvaluationDetail(SimulationManualProjectEvaluationDetailParam param) {
+        setPage(param.getCurrentPage() == null ? 1 : param.getCurrentPage(), param.getPageSize() == null ? 10 : param.getPageSize());
+        // 获取任务包信息
+        ProjectTaskParam projectTaskParam = new ProjectTaskParam();
+        projectTaskParam.setPId(param.getId());
+        List<ManualProjectTaskVo> tasks = simulationManualProjectTaskMapper.selectProjectTaskByProjectId(projectTaskParam);
+
+        PageInfo<ManualProjectTaskVo> pageInfo = new PageInfo<>(tasks);
+        PageHelper.clearPage();
+        if (pageInfo.getList() != null) {
+            // 添加复杂度 危险度数据
+            List<String> sceneIdList = pageInfo.getList().stream().map(ManualProjectTaskVo::getSceneId).collect(Collectors.toList());
+            SceneEvaluationForListParam sceneEvaluationForListParam = new SceneEvaluationForListParam();
+            sceneEvaluationForListParam.setSceneIdList(sceneIdList);
+            sceneEvaluationForListParam.setTaskId(param.getId());
+            SceneEvaluationOperatePO sceneEvaluationOperatePO = sceneEvaluationRuleService.getSceneEvaluationFirst(sceneEvaluationForListParam);
+            Map<String, SceneComplexityPO> complexityPOMap = sceneEvaluationOperatePO.getSceneComplexityPOMap();
+            Map<String, SceneRiskPO> riskPOMap = sceneEvaluationOperatePO.getSceneRiskPOMap();
+            for (ManualProjectTaskVo po : pageInfo.getList()) {
+                if (complexityPOMap.get(po.getSceneId()) != null) {
+                    po.setComplexity(String.valueOf(complexityPOMap.get(po.getSceneId()).getComplexity()));
+                    po.setComplexityLevel(String.valueOf(complexityPOMap.get(po.getSceneId()).getComplexityLevel()));
+                }
+                if (riskPOMap.get(po.getSceneId()) != null) {
+                    po.setRisk(String.valueOf(riskPOMap.get(po.getSceneId()).getRisk()));
+                    po.setRiskLevel(String.valueOf(riskPOMap.get(po.getSceneId()).getRiskLevel()));
+                }
+            }
+        }
+
+        return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, pageInfo);
+    }
+
     private void convertPoToVo(SimulationAutomaticProjectPO po, SimulationManualProjectSingleVo vo) {
         vo.setId(po.getId());
         vo.setProjectName(po.getProjectName());

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

@@ -258,6 +258,7 @@ public class SceneEvaluationRuleService {
         sceneComplexityPO.setMaxComplexity(param.getMaxComplexity());
         sceneComplexityPO.setComplexityLevel(SceneEvaluationEnum.matchLevelEnumByLevel(param.getComplexityLevel()));
         sceneComplexityPO.setSceneIdList(param.getSceneIdList());
+        sceneComplexityPO.setTaskId(param.getTaskId());
         // 查询复杂度的符合条件的第一条数据
         List<SceneComplexityPO> sceneReferenceLibCSPOS = sceneComplexityMapper.selectSceneIdsByEvaluation(sceneComplexityPO);
         sceneReferenceLibCSPOS.forEach(po -> po.setComplexityLevel(SceneEvaluationEnum.matchLevelEnumByLevelValue(po.getComplexityLevel())));
@@ -268,6 +269,7 @@ public class SceneEvaluationRuleService {
         sceneRiskPO.setMinRisk(param.getMinRisk());
         sceneRiskPO.setRiskLevel(SceneEvaluationEnum.matchLevelEnumByLevel(param.getRiskLevel()));
         sceneRiskPO.setSceneIdList(param.getSceneIdList());
+        sceneRiskPO.setTaskId(param.getTaskId());
         // 查询复杂度的符合条件的第一条数据
         List<SceneRiskPO> sceneReferenceLibCRPOS = sceneRiskMapper.selectSceneIdsByEvaluation(sceneRiskPO);
         sceneReferenceLibCRPOS.forEach(po -> po.setRiskLevel(SceneEvaluationEnum.matchLevelEnumByLevelValue(po.getRiskLevel())));

+ 3 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/server/app/service/job_manage/SimulationProjectService.java

@@ -1,6 +1,7 @@
 package com.css.simulation.resource.server.app.service.job_manage;
 
 import api.common.pojo.common.ResponseBodyVO;
+import api.common.pojo.param.project.SimulationManualProjectEvaluationDetailParam;
 import api.common.pojo.param.project.SimulationManualProjectParam;
 import api.common.pojo.vo.project.*;
 import com.github.pagehelper.PageInfo;
@@ -83,4 +84,6 @@ public interface SimulationProjectService {
   ResponseBodyVO<String> updateAutoProjectNowRunState(SimulationManualProjectParam param);
 
   ResponseBodyVO<SimulationManualProjectEvaluationRuleVo> getEvaluationRuleDetail(SimulationManualProjectParam param);
+
+  ResponseBodyVO<PageInfo<ManualProjectTaskVo>> querySceneEvaluationDetail(SimulationManualProjectEvaluationDetailParam param);
 }

+ 3 - 0
simulation-resource-server/src/main/resources/mysql/mapper/SceneComplexityMapper.xml

@@ -16,6 +16,9 @@
         scene_complexity
         <where>
             is_deleted = '0'
+            <if test="taskId != null and taskId != ''">
+                AND task_id = #{taskId}
+            </if>
             <if test="minComplexity != null and minComplexity != ''">
                 AND complexity+0 >= #{minComplexity}
             </if>

+ 3 - 0
simulation-resource-server/src/main/resources/mysql/mapper/SceneRiskMapper.xml

@@ -16,6 +16,9 @@
         scene_risk
         <where>
             is_deleted = '0'
+            <if test="taskId != null and taskId != ''">
+                AND task_id = #{taskId}
+            </if>
             <if test="minRisk != null and minRisk != ''">
                 AND risk+0 >= #{minRisk}
             </if>