From 1441e973f179d8de1c7a70560e6842200b272411 Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Tue, 27 Sep 2022 10:22:42 +0800 Subject: [PATCH] =?UTF-8?q?Pis=E5=8F=91=E5=B8=83=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E4=B8=8D=E5=86=8D=E7=9B=B4=E6=8E=A5=E8=BD=AC=E8=AF=AD=E9=9F=B3?= =?UTF-8?q?=EF=BC=9B=E4=BF=AE=E6=94=B9=E6=9F=A5=E8=AF=A2=E8=BF=9B=E8=B7=AF?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E9=80=BB=E8=BE=91=E4=BB=A5=E6=8E=92=E9=99=A4?= =?UTF-8?q?=E6=8E=89=E7=A9=BA=E5=88=97=E8=A1=A8=EF=BC=9B=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=B2=99=E7=9B=98=E8=AE=A2=E9=98=85=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../interactive/IscsInteractiveService.java | 26 ++++++++----------- .../cbtc/data/SimulationDataRepository.java | 4 +++ .../message/SimulationSubscribeTopic.java | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/main/java/club/joylink/rtss/services/iscs/interactive/IscsInteractiveService.java b/src/main/java/club/joylink/rtss/services/iscs/interactive/IscsInteractiveService.java index 0713d87e0..f9d2ccf26 100644 --- a/src/main/java/club/joylink/rtss/services/iscs/interactive/IscsInteractiveService.java +++ b/src/main/java/club/joylink/rtss/services/iscs/interactive/IscsInteractiveService.java @@ -111,27 +111,26 @@ public class IscsInteractiveService { } 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(); SimulationIscsDataRepository iscsRepository = simulation.getIscsRepository(); - boolean play = false; for (String code : param.getIscsDeviceCodes()) { MapElement element = repository.getByCode(code); 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.updateResource(resourceVO); VirtualRealityAudio vrAudio = audio.getVrAudio(); vrAudio.updateUrl(resourceVO.getUrl()); vrAudio.control(VirtualRealityAudio.Command.PLAY); - play = true; + return resourceVO.getUrl(); } else if (element instanceof LED) { // LED led = (LED) element; // Station station = led.getStation(); @@ -151,14 +150,11 @@ public class IscsInteractiveService { List stands = lcd.getStation().getNormalStand(right); for (Stand stand : stands) { Optional 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; } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/SimulationDataRepository.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/SimulationDataRepository.java index 4e7c4a67c..ace7b7fb8 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/SimulationDataRepository.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/SimulationDataRepository.java @@ -519,6 +519,8 @@ public class SimulationDataRepository { public List queryRoutePathsByStart(Section start) { List pathList = new ArrayList<>(); for (List list : routePathMap.values()) { + if (CollectionUtils.isEmpty(list)) + continue; if (Objects.equals(list.get(0).getStart(), start)) { pathList.addAll(list); } @@ -535,6 +537,8 @@ public class SimulationDataRepository { public List queryRoutePathsByEnd(Section end) { List pathList = new ArrayList<>(); for (List list : routePathMap.values()) { + if (CollectionUtils.isEmpty(list)) + continue; if (Objects.equals(list.get(0).getEnd(), end)) { pathList.addAll(list); } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/message/SimulationSubscribeTopic.java b/src/main/java/club/joylink/rtss/simulation/cbtc/message/SimulationSubscribeTopic.java index 43be31392..f39f3a836 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/message/SimulationSubscribeTopic.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/message/SimulationSubscribeTopic.java @@ -11,7 +11,7 @@ import java.util.Properties; public enum SimulationSubscribeTopic { Main("/queue/simulation/{id}"), - SandBox("/queue/simulation/jl3d/{id}"), + SandBox("/queue/simulation/{id}/jl3d"), Drive("/queue/simulation/drive/{id}"), PassengerFlow("/queue/simulation/passenger/{id}"), WeChatMini("/topic/simulation/assistant/{id}"),