夜得朦胧 1 år sedan
förälder
incheckning
cb42127c37

+ 7 - 4
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/app/service/ProjectApplicationService.java

@@ -128,6 +128,8 @@ public class ProjectApplicationService {
 
     @Resource
     private MultiSimulationProjectTaskRecordMapper taskRecordMapper;
+    @Resource
+    private MultiSimulationProjectResultMapper resultMapper;
 
 
     // -------------------------------- Comment --------------------------------
@@ -1104,6 +1106,7 @@ public class ProjectApplicationService {
         try {
             // 首先删掉历史的projectId记录
             taskRecordMapper.deleteProjectByProjectId(projectId);
+            resultMapper.deleteProjectResultByProjectId(projectId);
 
             List<MultiSimulationSceneKafkaParam> kafkaParamList = projectStartMessageEntity.getKafkaParamList();
             List<MultiTaskMessageEntity> entityList = new ArrayList<>();
@@ -1166,11 +1169,11 @@ public class ProjectApplicationService {
                     if (vehicle == null){
                         String carId = sceneCar.getCarId();
                         //1 根据车辆配置id vehicleConfigId, 获取 模型信息和传感器信息
-//                        com.css.simulation.resource.scheduler.infra.entity.VehicleEntity vehicleEntity = vehicleMapper.selectByVehicleConfigId(carId);   // 车辆
+                        com.css.simulation.resource.scheduler.infra.entity.VehicleEntity vehicleEntity = vehicleMapper.selectByVehicleConfigId(carId);   // 车辆
                         // TODO 上线之前删掉
-                        com.css.simulation.resource.scheduler.infra.entity.VehicleEntity vehicleEntity = com.css.simulation.resource.scheduler.infra.entity.VehicleEntity.builder()
-                            .modelLabel("AudiA6_10").maxSpeed(new BigDecimal("67")).enginePower(new BigDecimal("150000"))
-                            .build();
+//                        com.css.simulation.resource.scheduler.infra.entity.VehicleEntity vehicleEntity = com.css.simulation.resource.scheduler.infra.entity.VehicleEntity.builder()
+//                            .modelLabel("AudiA6_10").maxSpeed(new BigDecimal("67")).enginePower(new BigDecimal("150000"))
+//                            .build();
                         List<CameraEntity> cameraEntityList = sensorCameraMapper.selectCameraByVehicleConfigId(carId);    // 摄像头
                         List<OgtEntity> ogtEntityList = sensorOgtMapper.selectOgtByVehicleId(carId); // 完美传感器
                         vehicle = VehicleEntity.builder().model(ModelEntity.builder().model_label(vehicleEntity.getModelLabel()).build())

+ 6 - 5
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/app/service/TaskApplicationService.java

@@ -315,21 +315,22 @@ public class TaskApplicationService {
                         JSONObject jsonObject = JSONObject.parseObject(podString).getJSONObject("scenario");
                         MultiSimulationProjectResultPO multiSimulationProjectResultPO = new MultiSimulationProjectResultPO();
                         multiSimulationProjectResultPO.setId(StringUtil.getRandomUUID()).setSceneId(taskEntity.getSceneId())
-                            .setAbnormalTimeDescription(jsonObject.getString("collision_time")).setAbnormalType(MultiSimulationResultTypeEnum.COLLISION.getResultType());
+                            .setAbnormalTimeDescription(jsonObject.getString("collision_time"))
+                            .setProjectId(projectId)
+                            .setAbnormalType(MultiSimulationResultTypeEnum.COLLISION.getResultType());
                         multiSimulationResultMapper.insertProjectResult(multiSimulationProjectResultPO);
                         multiSimulationProjectResultPO = new MultiSimulationProjectResultPO();
-                        multiSimulationProjectResultPO.setId(StringUtil.getRandomUUID()).setSceneId(taskEntity.getSceneId())
+                        multiSimulationProjectResultPO.setId(StringUtil.getRandomUUID()).setSceneId(taskEntity.getSceneId()).setProjectId(projectId)
                             .setAbnormalTimeDescription(jsonObject.getString("line_crossing_time")).setAbnormalType(MultiSimulationResultTypeEnum.ABNORMAL_PARKING.getResultType());
                         multiSimulationResultMapper.insertProjectResult(multiSimulationProjectResultPO);
                         multiSimulationProjectResultPO = new MultiSimulationProjectResultPO();
-                        multiSimulationProjectResultPO.setId(StringUtil.getRandomUUID()).setSceneId(taskEntity.getSceneId())
+                        multiSimulationProjectResultPO.setId(StringUtil.getRandomUUID()).setSceneId(taskEntity.getSceneId()).setProjectId(projectId)
                             .setAbnormalTimeDescription(jsonObject.getString("lane_departure")).setAbnormalType(MultiSimulationResultTypeEnum.OUT_OF_PAVEMENT.getResultType());
                         multiSimulationResultMapper.insertProjectResult(multiSimulationProjectResultPO);
                         multiSimulationProjectResultPO = new MultiSimulationProjectResultPO();
-                        multiSimulationProjectResultPO.setId(StringUtil.getRandomUUID()).setSceneId(taskEntity.getSceneId())
+                        multiSimulationProjectResultPO.setId(StringUtil.getRandomUUID()).setSceneId(taskEntity.getSceneId()).setProjectId(projectId)
                             .setAbnormalTimeDescription(jsonObject.getString("phrases")).setAbnormalType(MultiSimulationResultTypeEnum.LAST_DESCRIPTION.getResultType());
                         multiSimulationResultMapper.insertProjectResult(multiSimulationProjectResultPO);
-
 //                        String urlMp4Pub = minioClient.getPresignedObjectUrl(GetPresignedObjectUrlArgs.builder()
 //                                .method(Method.GET)
 //                                .bucket(bucketName)

+ 5 - 5
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/infra/db/mysql/mapper/MultiSimulationProjectResultMapper.java

@@ -3,18 +3,18 @@ package com.css.simulation.resource.scheduler.infra.db.mysql.mapper;
 import api.common.pojo.param.project.MultiSimulationProjectResultParam;
 import api.common.pojo.po.project.MultiSimulationProjectResultPO;
 import api.common.pojo.vo.project.MultiSimulationProjectResultVO;
-import org.apache.ibatis.annotations.Insert;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.*;
 
 import java.util.List;
 
 @Mapper
 public interface MultiSimulationProjectResultMapper {
     @Insert("<script>" +
-        "insert into multi_simulation_project_result (id,scene_id,abnormal_type,abnormal_time_description) values" +
-        "(#{id},#{sceneId},#{abnormalType},#{abnormalTimeDescription})" +
+        "insert into multi_simulation_project_result (id,scene_id,project_id,abnormal_type,abnormal_time_description) values" +
+        "(#{id},#{sceneId},#{projectId},#{abnormalType},#{abnormalTimeDescription})" +
         "</script>")
     int insertProjectResult(MultiSimulationProjectResultPO param);
 
+    @Delete("delete from multi_simulation_project_result where project_id = #{projectId}")
+    int deleteProjectResultByProjectId(@Param("projectId") String projectId);
 }