孟令鑫 1 anno fa
parent
commit
b53b19db02

+ 13 - 2
simulation-resource-common/src/main/java/com/css/simulation/resource/common/domain/service/algorithm/AlgorithmExpandDomainService.java

@@ -42,9 +42,20 @@ public class AlgorithmExpandDomainService {
                     log.info("更新算法平台算法。");
                     final List<AlgorithmExpandEntity> AlgorithmExpandInfrastructureEntities = algorithmExpandMapper.select(AlgorithmExpandInfrastructureParam.builder().algorithmId(algorithmId).build());
                     final AlgorithmExpandEntity algorithmExpandEntity = AlgorithmExpandInfrastructureEntities.get(0);
-                    BeanUtils.copyProperties(algorithmExpandAclEntity, algorithmExpandEntity);
+                    // status 不能被覆盖
+//                    BeanUtils.copyProperties(algorithmExpandAclEntity, algorithmExpandEntity);
+                    {
+                        algorithmExpandEntity.setId(algorithmExpandAclEntity.getId());
+                        algorithmExpandEntity.setAlgorithmId(algorithmExpandAclEntity.getAlgorithmId());
+                        algorithmExpandEntity.setAlgorithmName(algorithmExpandAclEntity.getAlgorithmName());
+                        algorithmExpandEntity.setDescription(algorithmExpandAclEntity.getDescription());
+                        algorithmExpandEntity.setAlgorithmType(algorithmExpandAclEntity.getAlgorithmType());
+                        algorithmExpandEntity.setAlgorithmVersion(algorithmExpandAclEntity.getAlgorithmVersion());
+                        algorithmExpandEntity.setTeam(algorithmExpandAclEntity.getTeam());
+                        algorithmExpandEntity.setTopic(algorithmExpandAclEntity.getTopic());
+                    }
                     algorithmExpandMapper.update(algorithmExpandEntity);
-                }else {
+                } else {
                     log.info("插入算法平台算法。");
                     final AlgorithmExpandEntity algorithmExpandEntity = new AlgorithmExpandEntity();
                     BeanUtils.copyProperties(algorithmExpandAclEntity, algorithmExpandEntity);

+ 1 - 1
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/infra/configuration/scheduler/AlgorithmScheduler.java → simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/infra/scheduler/AlgorithmScheduler.java

@@ -1,4 +1,4 @@
-package com.css.simulation.resource.scheduler.infra.configuration.scheduler;
+package com.css.simulation.resource.scheduler.infra.scheduler;
 
 import api.common.util.SshUtil;
 import com.css.simulation.resource.scheduler.infra.configuration.docker.DockerConfiguration;

+ 1 - 1
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/infra/configuration/scheduler/ProjectScheduler.java → simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/infra/scheduler/ProjectScheduler.java

@@ -1,4 +1,4 @@
-package com.css.simulation.resource.scheduler.infra.configuration.scheduler;
+package com.css.simulation.resource.scheduler.infra.scheduler;
 
 import api.common.pojo.constants.DictConstants;
 import api.common.util.CollectionUtil;

+ 55 - 8
simulation-resource-server/src/main/java/com/css/simulation/resource/server/app/impl/SimulationProjectServiceImpl.java

@@ -19,6 +19,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.ScenePackagePO;
+import api.common.pojo.vo.algorithm.AlgorithmVO;
 import api.common.pojo.vo.project.*;
 import api.common.util.*;
 import com.css.simulation.resource.server.domain.service.UserDomainService;
@@ -91,6 +92,8 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
     @Resource
     private AlgorithmMapper algorithmMapper;
     @Resource
+    private AlgorithmExpandMapper algorithmExpandMapper;
+    @Resource
     private KafkaTemplate<String, String> kafkaTemplate;
     @Resource
     private DictService dictService;
@@ -401,17 +404,40 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         ProjectDetailsVO projectDetailsVO;
         final String projectType = param.getProjectType();
         String details;
+        String algorithmType;
+        String algorithmId;
         if (DictConstants.PROJECT_TYPE_MANUAL.equals(projectType)) { // 手动运行任务
             SimulationManualProjectPO simulationManualProjectPO = simulationManualProjectMapper.selectProjectById(param);
             details = simulationManualProjectPO.getDetails();
+            algorithmType = simulationManualProjectPO.getAlgorithmType();
+            algorithmId = simulationManualProjectPO.getAlgorithm();
         } else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(projectType)) {
             SimulationManualProjectVO simulationManualProjectVO = simulationAutomaticSubProjectMapper.selectProjectInfo(param);
             details = simulationManualProjectVO.getDetails();
+            algorithmType = simulationManualProjectVO.getAlgorithmType();
+            algorithmId = simulationManualProjectVO.getAlgorithm();
         } else {
             throw new RuntimeException("未知项目类型:" + projectType);
         }
         projectDetailsVO = JsonUtil.jsonToBean(details, ProjectDetailsVO.class);
 
+        //TODO 修正算法名称,后期可删掉
+        {
+            String algorithmName = null;
+            String algorithmDescription = null;
+            {
+                if (DictConstants.ALGORITHM_UPLOAD_MODE_PLATFORM.equals(algorithmType)) {
+                    List<AlgorithmVO> select = algorithmExpandMapper.select(AlgorithmParameter.builder().algorithmId(algorithmId).build());
+                    AlgorithmVO algorithmVO = select.get(0);
+                    algorithmName = algorithmVO.getAlgorithmName() + "-" + algorithmVO.getAlgorithmVersion();
+                    algorithmDescription = select.get(0).getDescription();
+                }
+                //TODO 暂时不处理非算法平台的算法
+                projectDetailsVO.setAlgorithmName(algorithmName);
+                projectDetailsVO.setAlgorithmDescribe(algorithmDescription);
+            }
+        }
+
         //* -------------------------------- 任务 --------------------------------
         List<ProjectRunStateNumVo> states = null;
         List<ProjectRunResultRatioNumVo> resultScoreList = null;
@@ -477,6 +503,8 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
     public ResponseBodyVO<ProjectDetailsVO> selectProjectDetailsByIdForScheduler(SimulationManualProjectParam param) {
 
         ProjectDetailsVO projectDetailsVO = null;
+        String algorithmType = null;
+        String algorithmId = null;
         if (DictConstants.PROJECT_TYPE_MANUAL.equals(param.getProjectType())) { // 手动运行任务
             SimulationManualProjectPO po = simulationManualProjectMapper.selectProjectById(param);
             projectDetailsVO = JsonUtil.jsonToBean(po.getDetails(), ProjectDetailsVO.class);
@@ -485,6 +513,8 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
             projectDetailsVO.setFinishTime(getRqStr(po.getFinishTime(), 1));
             projectDetailsVO.setNowRunState(po.getNowRunState());
             projectDetailsVO.setNowRunStateName(getDictName(DictConstants.PROJECT_RUN_STATE, po.getNowRunState()));
+            algorithmType = po.getAlgorithmType();
+            algorithmId = po.getAlgorithm();
         } else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(param.getProjectType())) {
             SimulationManualProjectVO po = simulationAutomaticSubProjectMapper.selectProjectInfo(param);
             projectDetailsVO = JsonUtil.jsonToBean(po.getDetails(), ProjectDetailsVO.class);
@@ -493,12 +523,29 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
             projectDetailsVO.setFinishTime(getRqStr(po.getFinishTime(), 1));
             projectDetailsVO.setNowRunState(po.getNowRunState());
             projectDetailsVO.setNowRunStateName(getDictName(DictConstants.PROJECT_RUN_STATE, po.getNowRunState()));
-
+            algorithmType = po.getAlgorithmType();
+            algorithmId = po.getAlgorithm();
         }
         // 获取测试得分列表
         List<AlgorithmScoreVO> firstTargetScore = getFirstTargetScore(param.getId());
         projectDetailsVO.setAlgorithmScoreList(firstTargetScore);
 
+        // 修改算法名称和算法描述
+        String algorithmName = null;
+        String algorithmDescription = null;
+        {
+            if (DictConstants.ALGORITHM_UPLOAD_MODE_PLATFORM.equals(algorithmType)) {
+                List<AlgorithmVO> select = algorithmExpandMapper.select(AlgorithmParameter.builder().algorithmId(algorithmId).build());
+                AlgorithmVO algorithmVO = select.get(0);
+                algorithmName = algorithmVO.getAlgorithmName() + "-" + algorithmVO.getAlgorithmVersion();
+                algorithmDescription = select.get(0).getDescription();
+            }
+            //TODO 暂时不处理非算法平台的算法
+            projectDetailsVO.setAlgorithmName(algorithmName);
+            projectDetailsVO.setAlgorithmDescribe(algorithmDescription);
+        }
+
+
         //* -------------------------------- 任务 --------------------------------
         List<ProjectRunStateNumVo> states = null;
         List<ProjectRunResultRatioNumVo> resultScoreList = null;
@@ -990,10 +1037,10 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         // 第三方算法平台
         if ("3".equals(algorithmType)) {
             String sort = "algorithmId-desc";
-            int page = 1;
-            int size = 1;// 全部
+            int page = 0;
+            int size = 99999;// 全部
 
-            String urlParam = "&algorithmId" + algorithmId + "&page=" + page + "&size=" + size + "&sort=" + sort;
+            String urlParam = "&algorithmId=" + algorithmId + "&page=" + page + "&size=" + size + "&sort=" + sort;
             List<DropDownVo> otherAlgorithmInfo = getOtherAlgorithmInfo(urlParam);
             if (StringUtil.isNotEmpty(otherAlgorithmInfo)) {
                 DropDownVo dropDownVo = otherAlgorithmInfo.get(0);
@@ -1539,8 +1586,8 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         } else if (DictConstants.PLATFORM.equals(algorithmType)) {
             // 第三方算法平台获取(索为)
             String sort = "algorithmId-desc";
-            int page = 1;
-            int size = 999;// 全部
+            int page = 0;
+            int size = 99999;// 全部
             String urlParam = "&page=" + page + "&size=" + size + "&sort=" + sort;
             algorithmList = getOtherAlgorithmInfo(urlParam);
 
@@ -5302,8 +5349,8 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         } else if (DictConstants.PLATFORM.equals(algorithmType)) {
             // 第三方算法平台获取(索为)
             String sort = "algorithmId-desc";
-            int page = 1;
-            int size = 999;// 全部
+            int page = 0;
+            int size = 99999;// 全部
             String urlParam = "&page=" + page + "&size=" + size + "&sort=" + sort;
             algorithmListSy = getOtherAlgorithmInfo(urlParam);
 

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

@@ -139,7 +139,41 @@
     <!--查询项目列表-->
     <select id="selectProjectList" parameterType="api.common.pojo.param.project.SimulationManualProjectParam"
             resultType="api.common.pojo.vo.project.SimulationManualProjectVO">
-        select * from simulation_manual_project
+        select id,
+        project_date,
+        project_num,
+        project_id,
+        project_name,
+        project_describe,
+        algorithm,
+        algorithm_type,
+        vehicle,
+        scene,
+        operation_cycle,
+        parallelism,
+        rule_view,
+        is_choice_gpu,
+        automatic_run_times,
+        last_run_time,
+        automatic_run_state,
+        now_run_state,
+        error_message,
+        evaluation_level,
+        start_time,
+        finish_time,
+        max_simulation_time,
+        algorithm_score,
+        task_number,
+        task_completed,
+        create_time,
+        create_user_id,
+        modify_time,
+        modify_user_id,
+        is_deleted,
+        algorithm_array,
+        vehicle_array,
+        scene_array
+        from simulation_manual_project
         <where>
             is_deleted = '0'
             <if test="projectId != null and projectId != ''">