Ver código fonte

王耀栋--工作台模块代码,修改测试出来的bug

wangyaodong 3 anos atrás
pai
commit
80ce0e357f

+ 9 - 0
api-common/src/main/java/api/common/pojo/vo/project/ProjectDetailsVo.java

@@ -75,5 +75,14 @@ public class ProjectDetailsVo {
     //运行结果统计
     private List<ProjectRunResultRatioNumVo> resultList;
 
+    //并行度
+    private String parallelism;
+
+    //最大仿真时间
+    private Long maxSimulationTime;
+
+    //是否选择gpu
+    private String isChoiceGpu;
+
 
 }

+ 3 - 0
api-common/src/main/java/api/common/pojo/vo/project/SceneScListVo.java

@@ -30,5 +30,8 @@ public class SceneScListVo {
 
     private String scoreExplain;
 
+    //运行状态
+    private String runState;
+
 
 }

+ 1 - 0
api-common/src/main/java/api/common/pojo/vo/project/SublistScoreVo.java

@@ -23,5 +23,6 @@ public class SublistScoreVo {
     private String targetEvaluate;
     private String sceneType;
     private String returnSceneId;
+    private String runResult;
 
 }

+ 5 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/project/ctrl/SimulationProjectCtrl.java

@@ -222,6 +222,11 @@ public class SimulationProjectCtrl {
     }
 
 
+    /**
+     * 添加编辑自动项目
+     * @param param
+     * @return
+     */
     @RequestMapping("addOrUpdateAutomaticProject")
     @ResponseBody
     public ResponseBodyVO addOrUpdateAutomaticProject(@RequestBody SimulationManualProjectParam param){

+ 63 - 4
simulation-resource-server/src/main/java/com/css/simulation/resource/project/impl/SimulationProjectServiceImpl.java

@@ -439,6 +439,17 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         projectDetailsVo.setStateList(projectRunStateNumVos);
         projectDetailsVo.setResultList(projectRunResultRatioNumVos);
 
+        projectDetailsVo.setParallelism(po.getParallelism());
+        projectDetailsVo.setMaxSimulationTime(po.getMaxSimulationTime());
+        String isChoiceGpu = po.getIsChoiceGpu();
+        String g = "";
+        if("0".equals(isChoiceGpu)){
+            g = "是";
+        }else if("1".equals(isChoiceGpu)){
+            g = "否";
+        }
+        projectDetailsVo.setIsChoiceGpu(g);
+
         return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, projectDetailsVo);
     }
 
@@ -562,7 +573,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         /*
         汇总测试得分计算方法:(每一项一级指标的测试得分*测试权重)累加
         得分率计算方法:每一项一级指标的所有场景得分不为0的数量/每一项一级指标的场景数量
-        汇总得分率计算方法:每一项一级指标的所有场景得分不为0的数量_累加/每一项一级指标的场景数量_累加
+        汇总得分率计算方法:每一项一级指标的所有场景得分不为0的数量_累加/每一项一级指标的场景数量_累加)换成(得分累加取平均值)
          */
         List<ScenePackageSubListVO> scenePackageSubListVOS = simulationProjectMapper.selectSubSceneByPid(po.getScene());
 
@@ -612,7 +623,17 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
             //指标权重总和默认是100%
             algorithmScoreVo.setWeight("100");
             algorithmScoreVo.setScore(saveTwoDecimalPlaces(totalScore));
-            totalScoreRatio = Double.valueOf(totalSceneScoreNum)/Double.valueOf(totalSceneNum)*100;
+
+//            totalScoreRatio = Double.valueOf(totalSceneScoreNum)/Double.valueOf(totalSceneNum)*100;
+            //汇总得分率计算方式修改
+            Double d = 0D;
+            if(!isEmpty(algorithmScoreVoList)){
+                for(AlgorithmScoreVo a : algorithmScoreVoList){
+                    d +=a.getScoreRatio();
+                }
+                totalScoreRatio = saveTwoDecimalPlaces(d/algorithmScoreVoList.size());
+            }
+
             algorithmScoreVo.setScoreRatio(saveTwoDecimalPlaces(totalScoreRatio));
             algorithmScoreVoList.add(algorithmScoreVo);
 
@@ -1486,6 +1507,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
                     if (sc.getLastTargerId().equals(po.getId())) {
                         SublistScoreVo sublistScoreVo = new SublistScoreVo();
                         BeanUtils.copyProperties(po, sublistScoreVo);
+                        sublistScoreVo.setRunResult(sc.getRunResult());
 
                         sublistScoreVo.setSceneScore(sc.getScore()); //得分
                         sublistScoreVo.setTargetEvaluate(sc.getTargetEvaluate());//指标评价
@@ -1533,6 +1555,9 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
 
         int size = 0;
         List<List<String>> result = new ArrayList<>();
+
+        //新增返回状态
+        ArrayList<String> runStateList = new ArrayList<>();
         //末级指标
         for(SublistScoreVo sp : lastSubList){
             setParentSub(sp, null, pos);
@@ -1548,11 +1573,12 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
                 size = strings.size();
             }
             result.add(strings);
-
+            runStateList.add(sp.getRunResult());
         }
 
         List<SceneScListVo> objects = new ArrayList<>();
         //结果补全
+        int r = 0;
         for(List<String> list : result){
             int start = list.size() - 5;
             SceneScListVo sceneScListVo = new SceneScListVo();
@@ -1579,7 +1605,10 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
             sceneScListVo.setTargetEvaluate(list.get(start+3));
             sceneScListVo.setScoreExplain(list.get(start+4));
 
+            sceneScListVo.setRunState(runStateList.get(r));
+
             objects.add(sceneScListVo);
+            r ++;
         }
 
         List<Map<String, String>> cloums = new ArrayList<>();
@@ -2317,7 +2346,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
             //表头
             PdfPTable pdfPTable = new PdfPTable(5);
             pdfPTable.setHeaderRows(1);//换页每页显示表头
-            addTitleList(pdfPTable, font, new String[]{"测试项目","场景数量","测试权重(%)","测试得分","得分率"});
+            addTitleList(pdfPTable, font, new String[]{"测试项目","场景数量","测试权重(%)","测试得分","得分率(%)"});
 
             //数据
             List<AlgorithmScoreVo> algorithmScoreList = vo.getAlgorithmScoreList();
@@ -3466,9 +3495,39 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
             return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE,"工作名称不能为空");
         }
 
+        SimulationAutomaticProjectPo po = convertToSimulationAutomaticProjectPo(param);
+
+        if(isEmpty(param.getId())){
+            //工作名称一样的的不能创建
+            List<SimulationManualProjectPo> simulationManualProjectPos = simulationProjectMapper.selectProjectByName(param);
+            if(!isEmpty(simulationManualProjectPos)){
+                return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE,"工作名称已经存在,请修改后再保存");
+            }
+        }
+
+
+
         return null;
     }
 
+    private SimulationAutomaticProjectPo convertToSimulationAutomaticProjectPo(SimulationManualProjectParam param){
+        SimulationAutomaticProjectPo po = new SimulationAutomaticProjectPo();
+        po.setId(param.getId());
+        po.setProjectName(param.getProjectName());
+        po.setProjectDescribe(param.getProjectDescribe());
+        po.setAlgorithm(param.getAlgorithm());
+        po.setVehicle(param.getVehicle());
+        po.setScene(param.getScene());
+        po.setOperationCycle(param.getOperationCycle());
+        po.setMaxSimulationTime(param.getMaxSimulationTime());
+        po.setParallelism(param.getParallelism());
+        po.setRuleView(param.getRuleView());
+        po.setIsChoiceGpu(param.getIsChoiceGpu());
+        po.setNowRunState(param.getNowRunState());
+        po.setAlgorithmType(param.getAlgorithmType());
+        return po;
+    }
+
     /**
      * 换行
      * @param lineNum 换行数量

+ 26 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/project/mapper/SimulationAutomaticProjectMapper.java

@@ -0,0 +1,26 @@
+package com.css.simulation.resource.project.mapper;
+
+import api.common.pojo.param.project.SimulationManualProjectParam;
+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.ScenePackagePO;
+import api.common.pojo.vo.project.*;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Map;
+
+@Mapper
+@Repository
+public interface SimulationAutomaticProjectMapper {
+
+//    SimulationAutomaticProjectPo selectById(String id);
+
+
+
+
+}

+ 11 - 0
simulation-resource-server/src/main/resources/mapper/project/SimulationAutomaticProjectMapper.xml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.css.simulation.resource.project.mapper.SimulationAutomaticProjectMapper" >
+
+
+
+    <!--根据id查询项目信息-->
+
+
+
+</mapper>

+ 3 - 4
simulation-resource-server/src/main/resources/mapper/project/SimulationProjectMapper.xml

@@ -465,11 +465,10 @@
         select sub.sublist_id as id, sub.parent_id, sub.sublist_name,sub.scene_num,
         fir.score as firScore,las.score as lasScore, sub.package_and_rules, las.not_standard_scene_num, las.score_explain
         from scene_package_sublist sub
-				left JOIN simulation_mpt_first_target_score fir on fir.target=sub.sublist_id
-				left JOIN simulation_mpt_last_target_score las on las.target = sub.sublist_id
+				left JOIN simulation_mpt_first_target_score fir on fir.target=sub.sublist_id and fir.p_id=#{id,jdbcType=VARCHAR}
+				left JOIN simulation_mpt_last_target_score las on las.target = sub.sublist_id and las.p_id=#{id,jdbcType=VARCHAR}
         where sub.root_id = #{packageId,jdbcType=VARCHAR} and sub.is_deleted='0'
-        and (fir.p_id=#{id,jdbcType=VARCHAR} or las.p_id=#{id,jdbcType=VARCHAR})
-				order by seq
+		order by seq
     </select>
 
     <!--查询某天运行项目数量-->