|
@@ -61,7 +61,10 @@ public class ManualProjectService {
|
|
|
public void prepare(String manualProjectTopic, String projectId) {
|
|
|
|
|
|
//1 redis 设置项目已完成任务为 0
|
|
|
- stringRedisTemplate.opsForValue().set(manualProjectTopic + ":" + projectId + ":taskCompleted", "0");
|
|
|
+ Set<String> oldKeys = stringRedisTemplate.keys(manualProjectTopic + ":" + projectId + "*");
|
|
|
+ assert oldKeys != null;
|
|
|
+ stringRedisTemplate.delete(oldKeys);
|
|
|
+ stringRedisTemplate.opsForValue().set(manualProjectTopic + ":" + projectId + ":completed", "0");
|
|
|
|
|
|
try (SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false)) {
|
|
|
ManualProjectMapper manualProjectMapper = sqlSession.getMapper(ManualProjectMapper.class);
|
|
@@ -78,7 +81,6 @@ public class ManualProjectService {
|
|
|
try (SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false)) {
|
|
|
IndexTemplateMapper indexTemplateMapper = sqlSession.getMapper(IndexTemplateMapper.class);
|
|
|
SceneMapper sceneMapper = sqlSession.getMapper(SceneMapper.class);
|
|
|
- ManualProjectMapper manualProjectMapper = sqlSession.getMapper(ManualProjectMapper.class);
|
|
|
//1 查询该场景包的所有指标列表存入 redis
|
|
|
List<IndexTemplatePO> allIndexList = indexTemplateMapper.selectByPackageIdIncludeDeleted(packageId);
|
|
|
stringRedisTemplate.opsForValue().set(manualProjectTopic + ":" + projectId + ":" + packageId + ":all", JsonUtil.listToJson(allIndexList));
|
|
@@ -109,14 +111,14 @@ public class ManualProjectService {
|
|
|
return sceneList;
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
- throw new RuntimeException("ManualProjectService--handlePackage 场景包处理出错!");
|
|
|
+ throw new RuntimeException("ManualProjectService--handlePackage 场景包处理出错:" + e.getMessage());
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
- public void sendTaskMessage(String manualProjectTopic, String projectId,int maxSimulationTime, Set<ScenePO> scenePOSet, VehiclePO vehiclePO, List<CameraPO> cameraPOList, List<OgtPO> ogtPOList) {
|
|
|
+ public void sendTaskMessage(String manualProjectTopic, String projectId, int maxSimulationTime, Set<ScenePO> scenePOSet, VehiclePO vehiclePO, List<CameraPO> cameraPOList, List<OgtPO> ogtPOList) {
|
|
|
|
|
|
try (SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false)) {
|
|
|
IndexMapper indexMapper = sqlSession.getMapper(IndexMapper.class);
|
|
@@ -218,14 +220,14 @@ public class ManualProjectService {
|
|
|
}, failure -> {
|
|
|
log.error("------- 发送消息失败:" + failure.getMessage());
|
|
|
});
|
|
|
- messageNumber[0] = messageNumber[0] +1;
|
|
|
+ messageNumber[0] = messageNumber[0] + 1;
|
|
|
stringRedisTemplate.opsForValue().set(manualProjectTopic + ":" + projectId + ":" + taskId + ":message", taskJson);
|
|
|
});
|
|
|
});
|
|
|
log.info("------- ManualProjectConsumer 共发送了" + messageNumber[0] + " 条消息!");
|
|
|
sqlSession.commit();
|
|
|
} catch (Exception e) {
|
|
|
- throw new RuntimeException("ManualProjectService--sendTaskMessage 发送任务消息出错!");
|
|
|
+ throw new RuntimeException("ManualProjectService--sendTaskMessage 发送任务消息出错:" + e.getMessage());
|
|
|
}
|
|
|
|
|
|
|