LingxinMeng 2 rokov pred
rodič
commit
febbef91c4

+ 1 - 1
simulation-resource-server/src/main/java/com/css/simulation/resource/project/constants/ProjectConstants.java → api-common/src/main/java/api/common/pojo/constants/ProjectConstants.java

@@ -1,4 +1,4 @@
-package com.css.simulation.resource.project.constants;
+package api.common.pojo.constants;
 
 /**
  * 工作相关常量

+ 6 - 5
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/configuration/feign/VideoFeignClient.java

@@ -16,9 +16,10 @@ public interface VideoFeignClient {
 
     @GetMapping(value = "/generate")
     ResponseBodyVO<String> generateVideo(
-           @RequestParam("projectId") String projectId,
-           @RequestParam("projectType") String projectType,
-           @RequestParam("maxSimulationTime") String maxSimulationTime,
-           @RequestParam("taskId") String taskId
+            @RequestParam("nodeName") String nodeName,
+            @RequestParam("projectId") String projectId,
+            @RequestParam("projectType") String projectType,
+            @RequestParam("maxSimulationTime") String maxSimulationTime,
+            @RequestParam("taskId") String taskId
     );
-}
+}

+ 1 - 1
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/util/TaskUtil.java

@@ -143,7 +143,7 @@ public class TaskUtil {
                     log.info("项目 {} 使用 GPU 生成视频。", projectId);
                 } else if (DictConstants.VIDEO_CPU.equals(isChoiceGpu)) {
                     log.info("项目 {} 使用 CPU 生成视频。", projectId);
-                    videoFeignClient.generateVideo(projectId, projectType, maxSimulationTime, taskId);
+                    videoFeignClient.generateVideo(nodeName, projectId, projectType, maxSimulationTime, taskId);
                 } else {
                     throw new RuntimeException("未设置视频生成。");
                 }

+ 2 - 6
simulation-resource-server/src/main/java/com/css/simulation/resource/project/controller/SimulationProjectController.java

@@ -41,17 +41,13 @@ public class SimulationProjectController {
     return service.updateProjectNowRunState(param);
   }
 
-  /**
-   * 修改自动运行状态
-   */
+
   @RequestMapping("updateAutomaticRunState")
   public ResponseBodyVO<String> updateAutomaticRunState(@RequestBody SimulationManualProjectParam param) {
     return service.updateAutomaticRunState(param);
   }
 
-  /**
-   * 手动运行自动项目
-   */
+
   @RequestMapping("createAutomaticSubProject")
   public ResponseBodyVO<String> createAutomaticSubProject(@RequestBody SimulationManualProjectParam param) {
     return service.createAutomaticSubProject(param);

+ 1 - 3
simulation-resource-server/src/main/java/com/css/simulation/resource/project/mapper/SimulationProjectMapper.java

@@ -8,7 +8,6 @@ import api.common.pojo.po.model.VehiclePO;
 import api.common.pojo.po.project.SimulationManualProjectPO;
 import api.common.pojo.po.project.SimulationMptFirstTargetScorePO;
 import api.common.pojo.po.project.SimulationMptLastTargetScorePO;
-import api.common.pojo.po.project.SimulationMptSceneScorePO;
 import api.common.pojo.po.scene.ScenePackagePO;
 import api.common.pojo.vo.project.*;
 import org.apache.ibatis.annotations.Mapper;
@@ -98,13 +97,12 @@ public interface SimulationProjectMapper {
 
     List<ScenePackageSubListVO> selectSubListByPid(String id);
 
-    List<SublistScoreVo> selectsublistByRootId(SimulationManualProjectParam param);
+    List<SublistScoreVo> selectSublistByRootId(SimulationManualProjectParam param);
 
     int insertSimulationMptLastTargetScorePo(SimulationMptLastTargetScorePO po);
 
     int insertSimulationMptFirstTargetScorePo(SimulationMptFirstTargetScorePO po);
 
-    List<SimulationMptSceneScorePO> selectSceneScore(SimulationMptSceneScorePO po);
 
     SystemUserVo selectUserById(String id);
 

+ 15 - 22
simulation-resource-server/src/main/java/com/css/simulation/resource/project/service/impl/SimulationProjectServiceImpl.java

@@ -3,6 +3,7 @@ package com.css.simulation.resource.project.service.impl;
 import api.common.pojo.common.PageVO;
 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.param.KafkaParameter;
 import api.common.pojo.param.MinioParameter;
@@ -28,7 +29,6 @@ import com.css.simulation.resource.feign.AlgoPlatformService;
 import com.css.simulation.resource.feign.FileDownService;
 import com.css.simulation.resource.feign.MonitorService;
 import com.css.simulation.resource.model.mapper.VehicleMapper;
-import com.css.simulation.resource.project.constants.ProjectConstants;
 import com.css.simulation.resource.project.enums.ProjectRunStateEnum;
 import com.css.simulation.resource.project.enums.SceneTypeEnum;
 import com.css.simulation.resource.project.mapper.*;
@@ -256,6 +256,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
 
     /**
      * 1. 手动项目:第一次运行项目 10 -> 20
+     * 2. 手动项目:已完成的项目再次运行 20
      * 2. 手动项目:终止项目 20 -> 40
      * 3. 手动项目:重新运行项目 40 -> 20
      */
@@ -265,36 +266,28 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
 
         // 1 查询项目详细信息
         SimulationManualProjectPO po = projectUtil.getProjectInfo(param);
-        // 2 项目终止信息直接推送
-        if (DictConstants.PROJECT_TERMINATED.equals(param.getNowRunState())) {
+        if (DictConstants.PROJECT_TERMINATED.equals(param.getNowRunState())) {  // 2 项目终止信息直接推送
             projectStopToKafka(po);
             simulationProjectMapper.updateProjectNowRunState(param);
         } else {
-            // 3 校验项目的信息是否可用
+            // 校验项目的信息是否可用
             projectUtil.checkProject(po.getAlgorithm(), po.getVehicle(), po.getScene());
-            // 已经完成的项目再次运行
-            if (DictConstants.PROJECT_COMPLETED.equals(po.getNowRunState())) {
-                po.createPo(AuthUtil.getCurrentUserId());
-                // 生成id
-                createProjectId(po);
-                // 初始化数据
+
+            if (DictConstants.PROJECT_COMPLETED.equals(po.getNowRunState())) {  //3 已经完成的项目再次运行
+                //1 查询项目详情信息并保存,固定项目最原始的运行数据
+                po.setDetails(JsonUtil.beanToJson(selectProjectDetailsByIdBackUp(SimulationManualProjectParam.builder().id(po.getId()).projectType(DictConstants.PROJECT_TYPE_MANUAL).build()).getInfo()));
+                //2 初始化数据
                 po.setNowRunState(param.getNowRunState());
                 po.setEvaluationLevel("");
                 po.setStartTime(new Date());
                 po.setFinishTime(null);
-                int add = simulationProjectMapper.add(po);
-                if (add <= 0) {
-                    return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "生成新工作失败。");
-                }
-                // 查询项目详情信息并保存,固定项目最原始的运行数据
-                String projectId = po.getId();
-                ProjectDetailsVo info = selectProjectDetailsByIdBackUp(SimulationManualProjectParam.builder().id(projectId).projectType(DictConstants.PROJECT_TYPE_MANUAL).build()).getInfo();
-                String infoJson = JsonUtil.beanToJson(info);
-                // 保存項目詳情信息
-                simulationProjectMapper.updateDetailsById(projectId, infoJson);
-                // Kafka推送消息
+                po.createPo(AuthUtil.getCurrentUserId());
+                createProjectId(po);
+                //3 保存
+                simulationProjectMapper.add(po);
+                //4 Kafka推送消息
                 projectRunToKafka(po);
-            } else { // 创建新的项目或者重新运行被终止的项目
+            } else { //4 创建新的项目或者重新运行被终止的项目
                 // 查询项目详情信息并保存
                 String projectId = param.getId();
                 ProjectDetailsVo info = selectProjectDetailsByIdBackUp(SimulationManualProjectParam.builder().id(projectId).projectType(DictConstants.PROJECT_TYPE_MANUAL).build()).getInfo();

+ 144 - 151
simulation-resource-server/src/main/resources/mapper/project/SimulationProjectMapper.xml

@@ -35,55 +35,57 @@
          is_deleted,
          algorithm_array,
          vehicle_array,
-         scene_array)
-        values (#{id,jdbcType=VARCHAR},
+         scene_array,
+         details)
+        values (#{id},
                 #{projectDate,jdbcType=INTEGER},
                 #{projectNum,jdbcType=INTEGER},
-                #{projectId,jdbcType=VARCHAR},
-                #{projectName,jdbcType=VARCHAR},
-                #{projectDescribe,jdbcType=VARCHAR},
-                #{algorithm,jdbcType=VARCHAR},
-                #{algorithmType,jdbcType=VARCHAR},
-                #{vehicle,jdbcType=VARCHAR},
-                #{scene,jdbcType=VARCHAR},
-                #{operationCycle,jdbcType=VARCHAR},
-                #{parallelism,jdbcType=VARCHAR},
-                #{ruleView,jdbcType=VARCHAR},
-                #{isChoiceGpu,jdbcType=VARCHAR},
+                #{projectId},
+                #{projectName},
+                #{projectDescribe},
+                #{algorithm},
+                #{algorithmType},
+                #{vehicle},
+                #{scene},
+                #{operationCycle},
+                #{parallelism},
+                #{ruleView},
+                #{isChoiceGpu},
                 #{automaticRunTimes,jdbcType=BIGINT},
-                #{lastRunTime,jdbcType=TIMESTAMP},
-                #{automaticRunState,jdbcType=VARCHAR},
-                #{nowRunState,jdbcType=VARCHAR},
-                #{evaluationLevel,jdbcType=VARCHAR},
-                #{startTime,jdbcType=TIMESTAMP},
-                #{finishTime,jdbcType=TIMESTAMP},
+                #{lastRunTime},
+                #{automaticRunState},
+                #{nowRunState},
+                #{evaluationLevel},
+                #{startTime},
+                #{finishTime},
                 #{maxSimulationTime,jdbcType=BIGINT},
-                #{createTime,jdbcType=TIMESTAMP},
-                #{createUserId,jdbcType=VARCHAR},
-                #{modifyTime,jdbcType=TIMESTAMP},
-                #{modifyUserId,jdbcType=VARCHAR},
-                #{isDeleted,jdbcType=VARCHAR},
-                #{algorithmArray,jdbcType=VARCHAR},
-                #{vehicleArray,jdbcType=VARCHAR},
-                #{sceneArray,jdbcType=VARCHAR})
+                #{createTime},
+                #{createUserId},
+                #{modifyTime},
+                #{modifyUserId},
+                #{isDeleted},
+                #{algorithmArray},
+                #{vehicleArray},
+                #{sceneArray},
+                #{details})
     </insert>
 
     <!--修改-->
     <update id="update" parameterType="api.common.pojo.po.project.SimulationManualProjectPO">
         update simulation_manual_project
-        set project_name        = #{projectName,jdbcType=VARCHAR},
-            project_describe    = #{projectDescribe,jdbcType=VARCHAR},
-            algorithm           = #{algorithm,jdbcType=VARCHAR},
-            algorithm_type      = #{algorithmType,jdbcType=VARCHAR},
-            vehicle             = #{vehicle,jdbcType=VARCHAR},
-            scene               = #{scene,jdbcType=VARCHAR},
+        set project_name        = #{projectName},
+            project_describe    = #{projectDescribe},
+            algorithm           = #{algorithm},
+            algorithm_type      = #{algorithmType},
+            vehicle             = #{vehicle},
+            scene               = #{scene},
             max_simulation_time = #{maxSimulationTime,jdbcType=BIGINT},
-            parallelism         = #{parallelism,jdbcType=VARCHAR},
-            is_choice_gpu       = #{isChoiceGpu,jdbcType=VARCHAR},
-            algorithm_array     = #{algorithmArray,jdbcType=VARCHAR},
-            vehicle_array       = #{vehicleArray,jdbcType=VARCHAR},
-            scene_array         = #{sceneArray,jdbcType=VARCHAR}
-        where id = #{id,jdbcType=VARCHAR}
+            parallelism         = #{parallelism},
+            is_choice_gpu       = #{isChoiceGpu},
+            algorithm_array     = #{algorithmArray},
+            vehicle_array       = #{vehicleArray},
+            scene_array         = #{sceneArray}
+        where id = #{id}
           and is_deleted = '0'
     </update>
 
@@ -94,7 +96,8 @@
         from simulation_manual_project
         where project_date = #{nowRq,jdbcType=INTEGER}
           and is_deleted = '0'
-        order by project_date desc, project_num desc limit 1
+        order by project_date desc, project_num desc
+        limit 1
     </select>
 
     <!--查询项目列表-->
@@ -104,10 +107,10 @@
         <where>
             is_deleted = '0'
             <if test="projectId != null and projectId != ''">
-                and project_id like CONCAT('%',#{project_id,jdbcType=VARCHAR},'%')
+                and project_id like CONCAT('%',#{project_id},'%')
             </if>
             <if test="projectName != null and projectName != ''">
-                and project_name like CONCAT('%',#{project_name,jdbcType=VARCHAR},'%')
+                and project_name like CONCAT('%',#{project_name},'%')
             </if>
             <if test="nowRunState != null and nowRunState != ''">
                 and now_run_state = #{nowRunState}
@@ -116,19 +119,19 @@
                 and evaluation_level = #{evaluationLevel}
             </if>
             <if test="createTimeStart != null">
-                and create_time &gt;= #{createTimeStart,jdbcType=TIMESTAMP}
+                and create_time &gt;= #{createTimeStart}
             </if>
             <if test="createTimeEnd != null">
-                and create_time &lt;= #{createTimeEnd,jdbcType=TIMESTAMP}
+                and create_time &lt;= #{createTimeEnd}
             </if>
             <if test="finishTimeStart != null">
-                and finish_time &gt;= #{finishTimeStart,jdbcType=TIMESTAMP}
+                and finish_time &gt;= #{finishTimeStart}
             </if>
             <if test="finishTimeEnd != null">
-                and finish_time &lt;= #{finishTimeEnd,jdbcType=TIMESTAMP}
+                and finish_time &lt;= #{finishTimeEnd}
             </if>
             <if test="isDeleted != null and isDeleted != ''">
-                and is_deleted = #{isDeleted,jdbcType=VARCHAR}
+                and is_deleted = #{isDeleted}
             </if>
         </where>
         order by project_date desc, project_num desc, modify_time desc
@@ -141,10 +144,10 @@
         <where>
             is_deleted = '0'
             <if test="projectId != null and projectId != ''">
-                and project_id like CONCAT('%',#{projectId,jdbcType=VARCHAR},'%')
+                and project_id like CONCAT('%',#{projectId},'%')
             </if>
             <if test="projectName != null and projectName != ''">
-                and project_name like CONCAT('%',#{projectName,jdbcType=VARCHAR},'%')
+                and project_name like CONCAT('%',#{projectName},'%')
             </if>
             <if test="nowRunState != null and nowRunState != ''">
                 and now_run_state = #{nowRunState}
@@ -153,22 +156,22 @@
                 and evaluation_level = #{evaluationLevel}
             </if>
             <if test="createTimeStart != null">
-                and create_time &gt;= #{createTimeStart,jdbcType=TIMESTAMP}
+                and create_time &gt;= #{createTimeStart}
             </if>
             <if test="createTimeEnd != null">
-                and create_time &lt;= #{createTimeEnd,jdbcType=TIMESTAMP}
+                and create_time &lt;= #{createTimeEnd}
             </if>
             <if test="finishTimeStart != null">
-                and finish_time &gt;= #{finishTimeStart,jdbcType=TIMESTAMP}
+                and finish_time &gt;= #{finishTimeStart}
             </if>
             <if test="finishTimeEnd != null">
-                and finish_time &lt;= #{finishTimeEnd,jdbcType=TIMESTAMP}
+                and finish_time &lt;= #{finishTimeEnd}
             </if>
             <if test="isDeleted != null and isDeleted != ''">
-                and is_deleted = #{isDeleted,jdbcType=VARCHAR}
+                and is_deleted = #{isDeleted}
             </if>
             <if test="createUserId != null and createUserId != ''">
-                and create_user_id = #{createUserId,jdbcType=VARCHAR}
+                and create_user_id = #{createUserId}
             </if>
         </where>
         order by project_date desc, project_num desc, modify_time desc
@@ -212,7 +215,7 @@
                vehicle_array,
                scene_array
         from simulation_manual_project
-        where id = #{id,jdbcType=VARCHAR}
+        where id = #{id}
           and is_deleted = '0'
     </select>
 
@@ -221,7 +224,7 @@
             resultType="api.common.pojo.po.project.SimulationManualProjectPO">
         select *
         from simulation_manual_project
-        where project_name = #{projectName,jdbcType=VARCHAR}
+        where project_name = #{projectName}
           and is_deleted = '0'
     </select>
 
@@ -239,7 +242,7 @@
                start_time
         from simulation_manual_project
         where is_deleted = '0'
-          and id = #{id,jdbcType=VARCHAR}
+          and id = #{id}
     </select>
 
     <!--删除-->
@@ -248,7 +251,7 @@
         set is_deleted='1'
         where id in
         <foreach collection="array" open="(" separator="," close=")" item="id">
-            #{id,jdbcType=VARCHAR}
+            #{id}
         </foreach>
 
     </update>
@@ -261,7 +264,7 @@
         is_deleted='0' and
         id in
         <foreach collection="array" open="(" separator="," close=")" item="id">
-            #{id,jdbcType=VARCHAR}
+            #{id}
         </foreach>
     </select>
 
@@ -270,16 +273,16 @@
         update simulation_manual_project
         <set>
             <if test="nowRunState != null and nowRunState != ''">
-                now_run_state = #{nowRunState,jdbcType=VARCHAR},
+                now_run_state = #{nowRunState},
             </if>
             <if test="startTime != null">
-                start_time=#{startTime,jdbcType=TIMESTAMP},
+                start_time=#{startTime},
             </if>
             <if test="finishTime != null">
-                finish_time=#{finishTime,jdbcType=TIMESTAMP},
+                finish_time=#{finishTime},
             </if>
         </set>
-        where id = #{id,jdbcType=VARCHAR} and is_deleted = '0'
+        where id = #{id} and is_deleted = '0'
     </update>
 
     <!--获取算法基本信息 /*where a.share = '0' and a.is_deleted = '0'*/-->
@@ -289,19 +292,19 @@
         from algorithm a
         where a.is_deleted = '0' and share='0'
         <if test="id != null and id != ''">
-            and a.id = #{id,jdbcType=VARCHAR}
+            and a.id = #{id}
         </if>
         <if test="createUserId != null and createUserId !=''">
-            and create_user_id=#{createUserId,jdbcType=VARCHAR}
+            and create_user_id=#{createUserId}
         </if>
         <if test="uploadMode != null and uploadMode != ''">
-            and upload_mode = #{uploadMode,jdbcType=VARCHAR}
+            and upload_mode = #{uploadMode}
         </if>
         union select b.id, b.algorithm_name,b.description,b.share,b.modify_time
         from algorithm b
         where b.is_deleted = '0' and b.share='1'
         <if test="uploadMode != null and uploadMode != ''">
-            and upload_mode = #{uploadMode,jdbcType=VARCHAR}
+            and upload_mode = #{uploadMode}
         </if>
         )c order by c.share ,c.modify_time desc
     </select>
@@ -312,7 +315,7 @@
         from model_vehicle a
         where is_deleted = '0'
         <if test="id != null and id != ''">
-            and a.id = #{id,jdbcType=VARCHAR}
+            and a.id = #{id}
         </if>
     </select>
 
@@ -322,10 +325,10 @@
         from model_config
         where is_deleted = '0'
         <if test="id != null and id != ''">
-            and id = #{id,jdbcType=VARCHAR}
+            and id = #{id}
         </if>
         <if test="createUserId != null and createUserId !=''">
-            and create_user_id=#{createUserId,jdbcType=VARCHAR}
+            and create_user_id=#{createUserId}
         </if>
     </select>
 
@@ -336,10 +339,10 @@
         from model_config
         where is_deleted = '0' and share='0'
         <if test="id != null and id != ''">
-            and id = #{id,jdbcType=VARCHAR}
+            and id = #{id}
         </if>
         <if test="createUserId != null and createUserId !=''">
-            and create_user_id=#{createUserId,jdbcType=VARCHAR}
+            and create_user_id=#{createUserId}
         </if>
         union select id, config_name, vehicle_id, description,share,modify_time
         from model_config
@@ -352,7 +355,7 @@
         from relation_config_sensor
         where is_deleted = '0'
         <if test="id != null and id != ''">
-            and config_id = #{id,jdbcType=VARCHAR}
+            and config_id = #{id}
         </if>
         group by sensor_type
     </select>
@@ -364,10 +367,10 @@
         from scene_package a
         where a.share = '0' and a.is_deleted = '0' and is_unavailable = '0'
         <if test="packageId != null and packageId != ''">
-            and a.package_id = #{packageId,jdbcType=VARCHAR}
+            and a.package_id = #{packageId}
         </if>
         <if test="createUserId != null and createUserId !=''">
-            and create_user_id=#{createUserId,jdbcType=VARCHAR}
+            and create_user_id=#{createUserId}
         </if>
         union select b.package_id,b.package_name, b.scene_num,b.share,b.modify_time
         from scene_package b where b.share = '1' and b.is_deleted = '0'
@@ -378,7 +381,7 @@
     <select id="selectScenePackageInfoById" parameterType="string" resultType="api.common.pojo.po.scene.ScenePackagePO">
         select a.package_id, a.package_name, a.scene_num
         from scene_package a
-        where a.package_id = #{id,jdbcType=VARCHAR}
+        where a.package_id = #{id}
     </select>
 
     <!--查询车辆与传感器关联信息-->
@@ -394,68 +397,68 @@
                sensor_r,
                sensor_port
         from relation_config_sensor
-        where config_id = #{id,jdbcType=VARCHAR}
+        where config_id = #{id}
           and is_deleted = '0'
     </select>
 
     <!--摄像头基本信息-->
     <select id="selectSensorCamera" parameterType="string" resultType="api.common.pojo.vo.project.SensorBaseInfoVo">
-        select a.sensor_name, description as sensorDescription,share
+        select a.sensor_name, description as sensorDescription, share
         from model_sensor_camera a
-        where a.id = #{id,jdbcType=VARCHAR}
+        where a.id = #{id}
     </select>
 
     <!--完美传感器基本信息-->
     <select id="selectSensorOgt" parameterType="string" resultType="api.common.pojo.vo.project.SensorBaseInfoVo">
-        select a.sensor_name, description as sensorDescription,share
+        select a.sensor_name, description as sensorDescription, share
         from model_sensor_ogt a
-        where a.id = #{id,jdbcType=VARCHAR}
+        where a.id = #{id}
     </select>
 
     <!--激光雷达基本信息-->
     <select id="selectSensorLidar" parameterType="string" resultType="api.common.pojo.vo.project.SensorBaseInfoVo">
-        select a.sensor_name, description as sensorDescription,share
+        select a.sensor_name, description as sensorDescription, share
         from model_sensor_lidar a
-        where a.id = #{id,jdbcType=VARCHAR}
+        where a.id = #{id}
     </select>
     <!--毫米波雷达基本信息-->
     <select id="selectSensorRadar" parameterType="string" resultType="api.common.pojo.vo.project.SensorBaseInfoVo">
-        select a.name as sensor_name, description as sensorDescription,share
+        select a.name as sensor_name, description as sensorDescription, share
         from model_sensor_radar a
-        where a.id = #{id,jdbcType=VARCHAR}
+        where a.id = #{id}
     </select>
     <!--gps基本信息-->
     <select id="selectSensorGps" parameterType="string" resultType="api.common.pojo.vo.project.SensorBaseInfoVo">
         select a.sensor_name, description as sensorDescription
         from model_sensor_gps a
-        where a.id = #{id,jdbcType=VARCHAR}
+        where a.id = #{id}
     </select>
 
     <!--查询交通事故场景信息-->
     <select id="selectSceneAccidentById" parameterType="string" resultType="api.common.pojo.vo.project.SceneBaseInfoVo">
         select scene_name
         from scene_accident
-        where accident_id = #{id,jdbcType=VARCHAR}
+        where accident_id = #{id}
     </select>
     <!--查询自然场景信息-->
     <select id="selectSceneNatural" parameterType="string" resultType="api.common.pojo.vo.project.SceneBaseInfoVo">
         select natural_name
         from scene_natural
-        where natural_id = #{id,jdbcType=VARCHAR}
+        where natural_id = #{id}
     </select>
     <!--查询泛化场景信息-->
     <select id="selectSceneGeneralDataById" parameterType="string"
             resultType="api.common.pojo.vo.project.SceneBaseInfoVo">
         select scene_id scene_name
         from scene_general_data
-        where id = #{id,jdbcType=VARCHAR}
+        where id = #{id}
     </select>
     <!--查询标准法规场景信息-->
     <select id="selectSceneStandardsRegulations" parameterType="string"
             resultType="api.common.pojo.vo.project.SceneBaseInfoVo">
         select scene_name
         from scene_standards_regulations
-        where regulations_id = #{id,jdbcType=VARCHAR}
+        where regulations_id = #{id}
     </select>
 
     <!--根据场景包id获取场景子集-->
@@ -471,7 +474,7 @@
                scene_statue_ids,
                scene_generalization_ids
         from scene_package_sublist
-        where parent_id = #{id,jdbcType=VARCHAR}
+        where parent_id = #{id}
         order by seq
     </select>
 
@@ -488,15 +491,15 @@
                scene_statue_ids,
                scene_generalization_ids
         from scene_package_sublist
-        where sublist_id = #{id,jdbcType=VARCHAR}
+        where sublist_id = #{id}
     </select>
 
     <!--获取场景包下指标信息-->
-    <select id="selectsublistByRootId" parameterType="api.common.pojo.param.project.SimulationManualProjectParam"
+    <select id="selectSublistByRootId" parameterType="api.common.pojo.param.project.SimulationManualProjectParam"
             resultType="api.common.pojo.vo.project.SublistScoreVo">
         select sub.sublist_id as id, sub.parent_id, sub.sublist_name, sub.scene_num, sub.package_and_rules
         from scene_package_sublist sub
-        where sub.root_id = #{packageId,jdbcType=VARCHAR}
+        where sub.root_id = #{packageId}
         order by sub.seq
     </select>
 
@@ -512,9 +515,9 @@
                scene_statue_ids,
                scene_generalization_ids
         from scene_package_sublist
-        where package_and_rules != null
-        and package_and_rules != ''
-        and root_id = #{id,jdbcType=VARCHAR}
+        where package_and_rules is not null
+          and package_and_rules != ''
+          and root_id = #{id}
           and is_deleted = '0'
     </select>
 
@@ -530,14 +533,14 @@
          modify_time,
          modify_user_id,
          is_deleted)
-        values (#{id,jdbcType=VARCHAR}
-        #{pId,jdbcType=VARCHAR}
-        #{target,jdbcType=VARCHAR}
-        #{createTime,jdbcType=TIMESTAMP},
-                #{createUserId,jdbcType=VARCHAR},
-                #{modifyTime,jdbcType=TIMESTAMP},
-                #{modifyUserId,jdbcType=VARCHAR},
-                #{isDeleted,jdbcType=VARCHAR})
+        values (#{id},
+                #{pId},
+                #{target},
+                #{createTime},
+                #{createUserId},
+                #{modifyTime},
+                #{modifyUserId},
+                #{isDeleted})
     </insert>
 
     <!--保存第一级指标信息-->
@@ -552,33 +555,22 @@
          modify_time,
          modify_user_id,
          is_deleted)
-        values (#{id,jdbcType=VARCHAR}
-        #{pId,jdbcType=VARCHAR}
-        #{target,jdbcType=VARCHAR}
-        #{createTime,jdbcType=TIMESTAMP},
-                #{createUserId,jdbcType=VARCHAR},
-                #{modifyTime,jdbcType=TIMESTAMP},
-                #{modifyUserId,jdbcType=VARCHAR},
-                #{isDeleted,jdbcType=VARCHAR})
+        values (#{id},
+                #{pId},
+                #{target},
+                #{createTime},
+                #{createUserId},
+                #{modifyTime},
+                #{modifyUserId},
+                #{isDeleted})
     </insert>
 
-    <!--查询场景得分-->
-    <select id="selectSceneScore" parameterType="api.common.pojo.po.project.SimulationMptSceneScorePO"
-            resultType="api.common.pojo.po.project.SimulationMptSceneScorePO">
-        select score, target_evaluate
-        from simulation_mpt_scene_score
-        where p_id = #{pId,jdbcType=VARCHAR} and is_deleted = '0'
-        <if test="sceneId != null and sceneId != ''">
-            and scene_id = #{sceneId,jdbcType=VARCHAR}
-        </if>
-    </select>
-
 
     <!--获取人员信息-->
     <select id="selectUserById" resultType="api.common.pojo.vo.project.SystemUserVo">
         select *
         from system_user
-        where id = #{id,jdbcType=VARCHAR}
+        where id = #{id}
     </select>
 
     <!--查询所有指标得分-->
@@ -595,10 +587,10 @@
                las.score_explain
         from scene_package_sublist sub
                  left JOIN simulation_mpt_first_target_score fir
-                           on fir.target = sub.sublist_id and fir.p_id = #{id,jdbcType=VARCHAR}
+                           on fir.target = sub.sublist_id and fir.p_id = #{id}
                  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}
+                           on las.target = sub.sublist_id and las.p_id = #{id}
+        where sub.root_id = #{packageId}
           and (fir.target is not null or las.target is not null)
         order by sub.seq
     </select>
@@ -622,10 +614,10 @@
                las.target     as lasTarget
         from scene_package_sublist sub
                  left join simulation_mpt_first_target_score fir
-                           on fir.target = sub.sublist_id and fir.p_id = #{id,jdbcType=VARCHAR}
+                           on fir.target = sub.sublist_id and fir.p_id = #{id}
                  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}
+                           on las.target = sub.sublist_id and las.p_id = #{id}
+        where sub.root_id = #{packageId}
         order by sub.seq
     </select>
 
@@ -650,7 +642,7 @@
         where
         is_deleted = '0' and evaluation_level is not null
         <if test="createUserId != null and createUserId != ''">
-            and create_user_id = #{createUserId,jdbcType=VARCHAR}
+            and create_user_id = #{createUserId}
         </if>
         group by evaluation_level
     </select>
@@ -662,26 +654,26 @@
          algorithm_name,
          upload_mode,
          is_deleted)
-        values (id = #{id,jdbcType=VARCHAR},
-                algorithm_name = #{algorithmName,jdbcType=VARCHAR},
-                upload_mode = #{uploadMode,jdbcType=VARCHAR},
-                is_deleted = #{isDeleted,jdbcType=VARCHAR},)
+        values (id = #{id},
+                algorithm_name = #{algorithmName},
+                upload_mode = #{uploadMode},
+                is_deleted = #{isDeleted})
     </insert>
 
     <!--更新第三方算法信息到算法表-->
     <update id="updateOtherAlgorithm" parameterType="api.common.pojo.po.algorithm.AlgorithmPO">
         update algorithm
-        set algorithm_name=#{algorithmName,jdbcType=VARCHAR}
-        where id = #{id,jdbcType=VARCHAR}
+        set algorithm_name=#{algorithmName}
+        where id = #{id}
           and is_deleted = '0'
     </update>
 
     <!--查询第三方算法信息是否已经存在-->
     <select id="selectAlgorithmByQuery" parameterType="api.common.pojo.po.algorithm.AlgorithmPO"
             resultType="api.common.pojo.po.algorithm.AlgorithmPO">
-        select id, algorithmName
+        select id, algorithm_name
         from algorithm
-        where id = #{id,jdbcType=VARCHAR}
+        where id = #{id}
           and is_deleted = '0'
     </select>
 
@@ -690,10 +682,11 @@
             resultType="api.common.pojo.po.project.SimulationManualProjectPO">
         select id
         from simulation_manual_project
-        where algorithm = #{algorithmId,jdbcType=VARCHAR}
+        where algorithm = #{algorithmId}
           and is_deleted = '0'
           and now_run_state = '30'
-        order by finish_time desc limit 1
+        order by finish_time desc
+        limit 1
     </select>
 
     <!--获取算法基本信息 /*where a.share = '0' and a.is_deleted = '0'*/-->
@@ -702,13 +695,13 @@
         from algorithm
         where is_deleted = '0' and share='0'
         <if test="id != null and id != ''">
-            and id = #{id,jdbcType=VARCHAR}
+            and id = #{id}
         </if>
         <if test="createUserId != null and createUserId !=''">
-            and create_user_id=#{createUserId,jdbcType=VARCHAR}
+            and create_user_id=#{createUserId}
         </if>
         <if test="uploadMode != null and uploadMode != ''">
-            and upload_mode = #{uploadMode,jdbcType=VARCHAR}
+            and upload_mode = #{uploadMode}
         </if>
         order by modify_time desc
     </select>
@@ -719,7 +712,7 @@
         from algorithm
         where is_deleted = '0' and share='1'
         <if test="uploadMode != null and uploadMode != ''">
-            and upload_mode = #{uploadMode,jdbcType=VARCHAR}
+            and upload_mode = #{uploadMode}
         </if>
         order by modify_time desc
     </select>
@@ -741,10 +734,10 @@
         from model_config a left join model_vehicle b on a.vehicle_id=b.id
         where a.is_deleted = '0' and a.is_unavailable = '0' and a.share='0' and b.is_deleted='0'
         <if test="id != null and id != ''">
-            and a.id = #{id,jdbcType=VARCHAR}
+            and a.id = #{id}
         </if>
         <if test="createUserId != null and createUserId !=''">
-            and a.create_user_id=#{createUserId,jdbcType=VARCHAR}
+            and a.create_user_id=#{createUserId}
         </if>
         order by a.modify_time desc
     </select>
@@ -764,10 +757,10 @@
         from scene_package
         where share = '0' and is_deleted = '0' and is_unavailable = '0'
         <if test="packageId != null and packageId != ''">
-            and package_id = #{packageId,jdbcType=VARCHAR}
+            and package_id = #{packageId}
         </if>
         <if test="createUserId != null and createUserId !=''">
-            and create_user_id=#{createUserId,jdbcType=VARCHAR}
+            and create_user_id=#{createUserId}
         </if>
         order by modify_time desc
     </select>

+ 3 - 2
simulation-resource-video/src/main/java/com/css/simulation/resource/video/controller/VideoController.java

@@ -33,14 +33,15 @@ public class VideoController {
      */
     @GetMapping(value = "/generate")
     ResponseBodyVO<String> generateVideo(
+            @RequestParam("nodeName") String nodeName,
             @RequestParam("projectId") String projectId,
             @RequestParam("projectType") String projectType,
             @RequestParam("maxSimulationTime") String maxSimulationTime,
             @RequestParam("taskId") String taskId
     ) {
-        log.info("收到项目 " + projectId + " 的任务 " + taskId + " 生成 cpu 视频的请求。");
+        log.info("节点 nodeName 收到项目 " + projectId + " 的任务 " + taskId + " 生成 cpu 视频的请求。");
         new Thread(
-                () -> videoService.generateVideo(projectId, projectType, maxSimulationTime, taskId),
+                () -> videoService.generateVideo(nodeName, projectId, projectType, maxSimulationTime, taskId),
                 "generateVideo-" + StringUtil.getRandomEightBitUUID()
         ).start();
         return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);

+ 1 - 1
simulation-resource-video/src/main/java/com/css/simulation/resource/video/entity/VehicleEntity.java → simulation-resource-video/src/main/java/com/css/simulation/resource/video/data/entity/VehicleEntity.java

@@ -1,4 +1,4 @@
-package com.css.simulation.resource.video.entity;
+package com.css.simulation.resource.video.data.entity;
 
 import lombok.Data;
 

+ 1 - 1
simulation-resource-video/src/main/java/com/css/simulation/resource/video/mapper/VehicleMapper.java

@@ -1,6 +1,6 @@
 package com.css.simulation.resource.video.mapper;
 
-import com.css.simulation.resource.video.entity.VehicleEntity;
+import com.css.simulation.resource.video.data.entity.VehicleEntity;
 import feign.Param;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Result;

+ 9 - 23
simulation-resource-video/src/main/java/com/css/simulation/resource/video/service/VideoService.java

@@ -6,7 +6,7 @@ import api.common.util.LinuxUtil;
 import api.common.util.OsUtil;
 import api.common.util.StringUtil;
 import com.css.simulation.resource.video.configuration.redis.CustomRedisClient;
-import com.css.simulation.resource.video.entity.VehicleEntity;
+import com.css.simulation.resource.video.data.entity.VehicleEntity;
 import com.css.simulation.resource.video.mapper.ConfigMapper;
 import com.css.simulation.resource.video.mapper.SimulationAutomaticProjectMapper;
 import com.css.simulation.resource.video.mapper.VehicleMapper;
@@ -74,11 +74,11 @@ public class VideoService {
     /**
      * 生成视频
      */
-    public void generateVideo(String projectId, String projectType, String maxSimulationTime, String taskId) {
+    public void generateVideo(String nodeName, String projectId, String projectType, String maxSimulationTime, String taskId) {
         final Set<String> cpuNodeParallelismKeys = customRedisClient.keys("esmini-node*");
         // 获取本地 hostname
         final String hostName = OsUtil.getHostName();
-        String cpuNodeParallelismKey = "esmini-node:simulation003:parallelism";
+        String cpuNodeParallelismKey = "esmini-node:" + nodeName + ":parallelism";
         for (String tempCpuNodeParallelismKey : cpuNodeParallelismKeys) {
             if (tempCpuNodeParallelismKey.contains(hostName)) {
                 cpuNodeParallelismKey = tempCpuNodeParallelismKey;
@@ -103,7 +103,6 @@ public class VideoService {
             MinioUtil.downloadToFile(minioClient, bucketName, osgbPathOfMinio, osgbPathOfLinux);
             MinioUtil.downloadToFile(minioClient, bucketName, csv1PathOfMinio, csv1PathOfLinux);
             MinioUtil.downloadToFile(minioClient, bucketName, csv2PathOfMinio, csv2PathOfLinux);
-
             log.info("生成 xosc 文件。");
             String xoscPath = generateXosc(rootDirectoryPathOfLinux, xodrPathOfLinux, osgbPathOfLinux, projectId,
                     projectType);
@@ -117,46 +116,33 @@ public class VideoService {
             final String esminiCommand2 = esminiCommand.replaceAll("screen-num", newScreenNum + "")
                     + " " + xoscPath + " " + pictureDirectoryPath + "/screenshot " + StringUtil.doubleToString(Double
                     .parseDouble(maxSimulationTime), 2);
-            OsUtil.exec( xvfbCommand2);
-            OsUtil.exec( esminiCommand2);
-
-//            LinuxUtil.execute(xvfbCommand2);
-//            LinuxUtil.execute(esminiCommand2);
+            OsUtil.exec(xvfbCommand2);
+            OsUtil.exec(esminiCommand2);
             log.info("删除 esmini 进程。");
-            OsUtil.kill( esminiCommand2);
-//            LinuxUtil.kill(esminiCommand2);
+            OsUtil.kill(esminiCommand2);
             StringBuilder removeCommand = new StringBuilder();
             removeCommand.append("rm -f ");
             int num = 14;
             for (int i = 0; i < num; i++) {
                 removeCommand.append(pictureDirectoryPath).append("/screenshot_0000").append(i).append(".tga ");
             }
-            OsUtil.kill( removeCommand.toString());
+            OsUtil.kill(removeCommand.toString());
             log.info("生成视频。");
             String videoTargetPathOfLinux = rootDirectoryPathOfLinux + "video/" + videoName;
             FileUtil.createParentDirectory(videoTargetPathOfLinux);
             String videoTargetPathOfMinio = rootDirectoryPathOfMinio + videoName;
-            OsUtil.exec( "ffmpeg -f image2 -framerate 30 -start_number " + num + " -i "
+            OsUtil.exec("ffmpeg -f image2 -framerate 30 -start_number " + num + " -i "
                     + pictureDirectoryPath + "/screenshot_%05d.tga" + " -c:v libx264 -vf format=yuv420p -crf 20 "
                     + videoTargetPathOfLinux);
-//            LinuxUtil.execute("ffmpeg -f image2 -framerate 30 -start_number " + num
-//                    + " -i " + pictureDirectoryPath + "/screenshot_%05d.tga"
-//                    + " -c:v libx264 -vf format=yuv420p -crf 20 " + videoTargetPathOfLinux);
             //删除生成的临时文件
             String removeAll = "rm -rf " + pictureDirectoryPath;
             log.info("删除全部图片==" + removeAll);
-            OsUtil.exec( removeAll);
-//            LinuxUtil.execute(removeAll);
+            OsUtil.exec(removeAll);
             //6 将视频上传到 minio
             MinioUtil.uploadFromFile(minioClient, videoTargetPathOfLinux, bucketName, videoTargetPathOfMinio);
             log.info("上传成功:" + videoTargetPathOfMinio);
             OsUtil.kill(xvfbCommand2);
-//            LinuxUtil.kill(xvfbCommand2);
             //* -------------------------------- 删除临时文件 --------------------------------
-//        FileUtil.rm(xodrPathOfLinux);
-//        FileUtil.rm(osgbPathOfLinux);
-//        FileUtil.rm(csv1PathOfLinux);
-//        FileUtil.rm(csv2PathOfLinux);
         } catch (Exception e) {
             throw new RuntimeException("视频生成失败。", e);
         } finally {