martin 2 년 전
부모
커밋
e5da089fc8

+ 1 - 1
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/consumer/ProjectConsumer.java

@@ -227,7 +227,7 @@ public class ProjectConsumer {
         List<CameraPO> cameraPOList = sensorCameraMapper.selectCameraByVehicleConfigId(vehicleConfigId);    // 摄像头
         List<OgtPO> ogtPOList = sensorOgtMapper.selectOgtByVehicleId(vehicleConfigId); // 完美传感器
         // -------------------------------- 3 发送任务消息 --------------------------------
-        projectService.sendTaskMessage(projectRunningPrefix, userId, projectId, maxSimulationTime, scenePOSet, vehiclePO, cameraPOList, ogtPOList);
+        projectService.sendTaskMessage(projectRunningPrefix, userId, projectId,projectType, maxSimulationTime, scenePOSet, vehiclePO, cameraPOList, ogtPOList);
         // -------------------------------- 4 算法导入(一期按单机版做) --------------------------------
         String algorithmDockerImage = projectService.handleAlgorithm(projectId, algorithmId);
         // -------------------------------- 5 创建 pod 开始执行 --------------------------------

+ 18 - 10
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/mapper/IndexMapper.java

@@ -69,16 +69,24 @@ public interface IndexMapper {
     @Select("select sublist_id\n" +
             "from scene_package_sublist\n" +
             "where is_deleted = '0'\n" +
-            "  and root_id =\n" +
-            "      (select scene\n" +
-            "       from simulation_manual_project smp\n" +
-            "       where id = #{projectId})\n" +
-            "         and (scene_natural_ids like #{idExtend}\n" +
-            "           or scene_traffic_ids like #{idExtend}\n" +
-            "           or scene_statue_ids like #{idExtend}\n" +
-            "           or scene_generalization_ids like #{idExtend}\n" +
-            "           )")
-    List<String> selectLeafIndexIdByProjectAndSceneId(@Param("projectId") String projectId, @Param("idExtend") String idExtend);
+            "  and root_id = (select scene from simulation_manual_project smp where id = #{projectId})\n" +
+            "  and (scene_natural_ids like #{idExtend}\n" +
+            "       or scene_traffic_ids like #{idExtend}\n" +
+            "       or scene_statue_ids like #{idExtend}\n" +
+            "       or scene_generalization_ids like #{idExtend}\n" +
+            "       )")
+    List<String> selectLeafIndexIdByProjectIdAndSceneIdOfManualProject(@Param("projectId") String projectId, @Param("idExtend") String idExtend);
+
+    @Select("select sublist_id\n" +
+            "from scene_package_sublist\n" +
+            "where is_deleted = '0'\n" +
+            "  and root_id = (select scene from simulation_automatic_project sap where id = #{projectId})\n" +
+            "  and (scene_natural_ids like #{idExtend}\n" +
+            "    or scene_traffic_ids like #{idExtend}\n" +
+            "    or scene_statue_ids like #{idExtend}\n" +
+            "    or scene_generalization_ids like #{idExtend}\n" +
+            "    )")
+    List<String> selectLeafIndexIdByProjectIdAndSceneIdOfAutoSubProject(@Param("projectId") String projectId, @Param("idExtend") String idExtend);
 
 
     @Delete("delete from simulation_mpt_first_target_score where p_id = #{projectId}")

+ 7 - 2
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/service/ProjectService.java

@@ -162,13 +162,18 @@ public class ProjectService {
      * @param cameraPOList
      * @param ogtPOList
      */
-    public void sendTaskMessage(String projectRunningPrefix, String userId, String projectId, Long maxSimulationTime, Set<ScenePO> scenePOSet, VehiclePO vehiclePO, List<CameraPO> cameraPOList, List<OgtPO> ogtPOList) {
+    public void sendTaskMessage(String projectRunningPrefix, String userId, String projectId, String projectType, Long maxSimulationTime, Set<ScenePO> scenePOSet, VehiclePO vehiclePO, List<CameraPO> cameraPOList, List<OgtPO> ogtPOList) {
         final int[] messageNumber = {0};
         log.info("ProjectService--sendTaskMessage 项目 " + projectId + " 获得的包括的场景信息为:" + scenePOSet);
         for (ScenePO scenePO : scenePOSet) {
             String sceneId = scenePO.getId();
             //3-1 可能会存在多个指标下有同样的场景,所以会查出多个指标,多个指标的场景需要发送多次
-            List<String> lastTargetIdList = indexMapper.selectLeafIndexIdByProjectAndSceneId(projectId, "%" + sceneId + "%");
+            List<String> lastTargetIdList = null;
+            if (DictConstants.PROJECT_TYPE_MANUAL.equals(projectType)) {
+                lastTargetIdList = indexMapper.selectLeafIndexIdByProjectIdAndSceneIdOfManualProject(projectId, "%" + sceneId + "%");
+            } else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(projectType)) {
+                lastTargetIdList = indexMapper.selectLeafIndexIdByProjectIdAndSceneIdOfAutoSubProject(projectId, "%" + sceneId + "%");
+            }
             lastTargetIdList.forEach(lastTargetId -> {
                 String taskId = StringUtil.getRandomUUID();
                 String taskRetryPrefix = projectRunningPrefix + ":task:" + taskId + ":retry";