|
@@ -3,6 +3,7 @@ package com.css.simulation.resource.scheduler.consumer;
|
|
|
|
|
|
import api.common.pojo.constants.DictConstants;
|
|
import api.common.pojo.constants.DictConstants;
|
|
import api.common.pojo.dto.ProjectMessageDTO;
|
|
import api.common.pojo.dto.ProjectMessageDTO;
|
|
|
|
+import api.common.util.CollectionUtil;
|
|
import api.common.util.JsonUtil;
|
|
import api.common.util.JsonUtil;
|
|
import api.common.util.StringUtil;
|
|
import api.common.util.StringUtil;
|
|
import api.common.util.TimeUtil;
|
|
import api.common.util.TimeUtil;
|
|
@@ -113,9 +114,15 @@ public class ManualProjectConsumer {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
List<ScenePO> sceneList = new ArrayList<>();
|
|
List<ScenePO> sceneList = new ArrayList<>();
|
|
- sceneList.addAll(sceneMapper.selectNaturalByIdList(naturalIdList));
|
|
|
|
- sceneList.addAll(sceneMapper.selectStandardByIdList(standardIdList));
|
|
|
|
- sceneList.addAll(sceneMapper.selectAccidentByIdList(accidentIdList));
|
|
|
|
|
|
+ if (CollectionUtil.isNotEmpty(naturalIdList)){
|
|
|
|
+ sceneList.addAll(sceneMapper.selectNaturalByIdList(naturalIdList));
|
|
|
|
+ }
|
|
|
|
+ if (CollectionUtil.isNotEmpty(standardIdList)){
|
|
|
|
+ sceneList.addAll(sceneMapper.selectStandardByIdList(standardIdList));
|
|
|
|
+ }
|
|
|
|
+ if (CollectionUtil.isNotEmpty(accidentIdList)){
|
|
|
|
+ sceneList.addAll(sceneMapper.selectAccidentByIdList(accidentIdList));
|
|
|
|
+ }
|
|
projectMapper.updateTaskNumber(projectId, sceneList.size()); // 有多少场景就有多少任务
|
|
projectMapper.updateTaskNumber(projectId, sceneList.size()); // 有多少场景就有多少任务
|
|
// -------------------------------- 2 模型 --------------------------------
|
|
// -------------------------------- 2 模型 --------------------------------
|
|
// 根据车辆配置id vehicleConfigId, 获取 模型信息和传感器信息
|
|
// 根据车辆配置id vehicleConfigId, 获取 模型信息和传感器信息
|
|
@@ -315,9 +322,15 @@ public class ManualProjectConsumer {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
List<ScenePO> sceneList = new ArrayList<>();
|
|
List<ScenePO> sceneList = new ArrayList<>();
|
|
- sceneList.addAll(sceneMapper.selectNaturalByIdList(naturalIdList));
|
|
|
|
- sceneList.addAll(sceneMapper.selectStandardByIdList(standardIdList));
|
|
|
|
- sceneList.addAll(sceneMapper.selectAccidentByIdList(accidentIdList));
|
|
|
|
|
|
+ if (CollectionUtil.isNotEmpty(naturalIdList)){
|
|
|
|
+ sceneList.addAll(sceneMapper.selectNaturalByIdList(naturalIdList));
|
|
|
|
+ }
|
|
|
|
+ if (CollectionUtil.isNotEmpty(standardIdList)){
|
|
|
|
+ sceneList.addAll(sceneMapper.selectStandardByIdList(standardIdList));
|
|
|
|
+ }
|
|
|
|
+ if (CollectionUtil.isNotEmpty(accidentIdList)){
|
|
|
|
+ sceneList.addAll(sceneMapper.selectAccidentByIdList(accidentIdList));
|
|
|
|
+ }
|
|
projectMapper.updateTaskNumber(projectId, sceneList.size()); // 有多少场景就有多少任务
|
|
projectMapper.updateTaskNumber(projectId, sceneList.size()); // 有多少场景就有多少任务
|
|
// -------------------------------- 2 模型 --------------------------------
|
|
// -------------------------------- 2 模型 --------------------------------
|
|
// 根据车辆配置id vehicleConfigId, 获取 模型信息和传感器信息
|
|
// 根据车辆配置id vehicleConfigId, 获取 模型信息和传感器信息
|
|
@@ -397,8 +410,8 @@ public class ManualProjectConsumer {
|
|
//4-4 将对象转成 json
|
|
//4-4 将对象转成 json
|
|
String taskJson = JsonUtil.beanToJson(taskTO);
|
|
String taskJson = JsonUtil.beanToJson(taskTO);
|
|
//4-5 将 projectId 作为 topic 名称,发送 task 信息到 kafka
|
|
//4-5 将 projectId 作为 topic 名称,发送 task 信息到 kafka
|
|
-// kafkaTemplate.send(projectId, taskJson).addCallback(success -> {
|
|
|
|
- kafkaTemplate.send("test", taskJson).addCallback(success -> {
|
|
|
|
|
|
+ kafkaTemplate.send(projectId, taskJson).addCallback(success -> {
|
|
|
|
+// kafkaTemplate.send("test", taskJson).addCallback(success -> {
|
|
// 消息发送到的topic
|
|
// 消息发送到的topic
|
|
String topic = success.getRecordMetadata().topic();
|
|
String topic = success.getRecordMetadata().topic();
|
|
// 消息发送到的分区
|
|
// 消息发送到的分区
|