Pis发布信息不再直接转语音;修改查询进路路径逻辑以排除掉空列表;修改沙盘订阅路径

This commit is contained in:
joylink_zhangsai 2022-09-27 10:22:42 +08:00
parent dce23dbff7
commit 1441e973f1
3 changed files with 16 additions and 16 deletions

View File

@ -111,27 +111,26 @@ public class IscsInteractiveService {
} }
public String pisPlay(Simulation simulation, PlayParamVO param) { public String pisPlay(Simulation simulation, PlayParamVO param) {
AudioResourcesVO resourceVO;
if (!IscsSystemResourcesVO.Type.REAL_TIME.equals(param.getType())) {
resourceVO = simulation.getIscsRepository().getAudioResource(param.getResourceId());
} else {
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertHasText(param.getName(), "实时消息名称不能为空");
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertHasText(param.getContent(), "实时消息内容不能为空");
String url = iVoiceService.synthesis(param.getContent());
resourceVO = new AudioResourcesVO(param.getName(), param.getContent(), url);
}
SimulationDataRepository repository = simulation.getRepository(); SimulationDataRepository repository = simulation.getRepository();
SimulationIscsDataRepository iscsRepository = simulation.getIscsRepository(); SimulationIscsDataRepository iscsRepository = simulation.getIscsRepository();
boolean play = false;
for (String code : param.getIscsDeviceCodes()) { for (String code : param.getIscsDeviceCodes()) {
MapElement element = repository.getByCode(code); MapElement element = repository.getByCode(code);
if (element instanceof Audio) { if (element instanceof Audio) {
AudioResourcesVO resourceVO;
if (!IscsSystemResourcesVO.Type.REAL_TIME.equals(param.getType())) {
resourceVO = simulation.getIscsRepository().getAudioResource(param.getResourceId());
} else {
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertHasText(param.getName(), "实时消息名称不能为空");
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertHasText(param.getContent(), "实时消息内容不能为空");
String url = iVoiceService.synthesis(param.getContent());
resourceVO = new AudioResourcesVO(param.getName(), param.getContent(), url);
}
Audio audio = (Audio) element; Audio audio = (Audio) element;
audio.updateResource(resourceVO); audio.updateResource(resourceVO);
VirtualRealityAudio vrAudio = audio.getVrAudio(); VirtualRealityAudio vrAudio = audio.getVrAudio();
vrAudio.updateUrl(resourceVO.getUrl()); vrAudio.updateUrl(resourceVO.getUrl());
vrAudio.control(VirtualRealityAudio.Command.PLAY); vrAudio.control(VirtualRealityAudio.Command.PLAY);
play = true; return resourceVO.getUrl();
} else if (element instanceof LED) { } else if (element instanceof LED) {
// LED led = (LED) element; // LED led = (LED) element;
// Station station = led.getStation(); // Station station = led.getStation();
@ -151,14 +150,11 @@ public class IscsInteractiveService {
List<Stand> stands = lcd.getStation().getNormalStand(right); List<Stand> stands = lcd.getStation().getNormalStand(right);
for (Stand stand : stands) { for (Stand stand : stands) {
Optional<StandPis> standPisOptional = iscsRepository.findStandPisOptional(stand.getCode()); Optional<StandPis> standPisOptional = iscsRepository.findStandPisOptional(stand.getCode());
standPisOptional.ifPresent(sp -> sp.setText(resourceVO.getDesc())); standPisOptional.ifPresent(sp -> sp.setText(param.getContent()));
} }
} }
} }
} }
if (play) {
return resourceVO.getUrl();
}
return null; return null;
} }

View File

@ -519,6 +519,8 @@ public class SimulationDataRepository {
public List<RoutePath> queryRoutePathsByStart(Section start) { public List<RoutePath> queryRoutePathsByStart(Section start) {
List<RoutePath> pathList = new ArrayList<>(); List<RoutePath> pathList = new ArrayList<>();
for (List<RoutePath> list : routePathMap.values()) { for (List<RoutePath> list : routePathMap.values()) {
if (CollectionUtils.isEmpty(list))
continue;
if (Objects.equals(list.get(0).getStart(), start)) { if (Objects.equals(list.get(0).getStart(), start)) {
pathList.addAll(list); pathList.addAll(list);
} }
@ -535,6 +537,8 @@ public class SimulationDataRepository {
public List<RoutePath> queryRoutePathsByEnd(Section end) { public List<RoutePath> queryRoutePathsByEnd(Section end) {
List<RoutePath> pathList = new ArrayList<>(); List<RoutePath> pathList = new ArrayList<>();
for (List<RoutePath> list : routePathMap.values()) { for (List<RoutePath> list : routePathMap.values()) {
if (CollectionUtils.isEmpty(list))
continue;
if (Objects.equals(list.get(0).getEnd(), end)) { if (Objects.equals(list.get(0).getEnd(), end)) {
pathList.addAll(list); pathList.addAll(list);
} }

View File

@ -11,7 +11,7 @@ import java.util.Properties;
public enum SimulationSubscribeTopic { public enum SimulationSubscribeTopic {
Main("/queue/simulation/{id}"), Main("/queue/simulation/{id}"),
SandBox("/queue/simulation/jl3d/{id}"), SandBox("/queue/simulation/{id}/jl3d"),
Drive("/queue/simulation/drive/{id}"), Drive("/queue/simulation/drive/{id}"),
PassengerFlow("/queue/simulation/passenger/{id}"), PassengerFlow("/queue/simulation/passenger/{id}"),
WeChatMini("/topic/simulation/assistant/{id}"), WeChatMini("/topic/simulation/assistant/{id}"),