修改PIS发布消息bug

This commit is contained in:
joylink_zhangsai 2022-09-28 09:05:38 +08:00
parent 1441e973f1
commit f5f6188ff5

View File

@ -9,7 +9,6 @@ import club.joylink.rtss.simulation.cbtc.data.SimulationIscsDataRepository;
import club.joylink.rtss.simulation.cbtc.data.info.StandPis;
import club.joylink.rtss.simulation.cbtc.data.iscs.Audio;
import club.joylink.rtss.simulation.cbtc.data.iscs.LCD;
import club.joylink.rtss.simulation.cbtc.data.iscs.LED;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
import club.joylink.rtss.simulation.cbtc.data.map.Stand;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityAudio;
@ -72,7 +71,7 @@ public class IscsInteractiveService {
List<TimedPlayParamVO> infos = iscsRepository.getTimedPlayInfos(timedPlayParamVO.getStationCode());
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL
.assertTrue(infos.stream().noneMatch(info -> info.getDesc().equals(timedPlayParamVO.getDesc())),
"描述不能相同");
"描述不能相同");
iscsRepository.addTimedPlayParamVO(timedPlayParamVO);
}
@ -115,28 +114,13 @@ public class IscsInteractiveService {
SimulationIscsDataRepository iscsRepository = simulation.getIscsRepository();
for (String code : param.getIscsDeviceCodes()) {
MapElement element = repository.getByCode(code);
if (element instanceof Audio) {
AudioResourcesVO resourceVO;
if (element instanceof LCD) {
String content;
if (!IscsSystemResourcesVO.Type.REAL_TIME.equals(param.getType())) {
resourceVO = simulation.getIscsRepository().getAudioResource(param.getResourceId());
content = simulation.getIscsRepository().getAudioResource(param.getResourceId()).getDesc();
} 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);
content = param.getContent();
}
Audio audio = (Audio) element;
audio.updateResource(resourceVO);
VirtualRealityAudio vrAudio = audio.getVrAudio();
vrAudio.updateUrl(resourceVO.getUrl());
vrAudio.control(VirtualRealityAudio.Command.PLAY);
return resourceVO.getUrl();
} else if (element instanceof LED) {
// LED led = (LED) element;
// Station station = led.getStation();
// Stream<StandPis> standPisStream = iscsRepository.getStandPisStream(station);
// standPisStream.forEach(sp -> sp.setText(resourceVO.getDesc()));
} else if (element instanceof LCD) {
LCD lcd = (LCD) element;
IscsDeviceVO.Position position = lcd.getPosition();
Boolean up = null;
@ -150,7 +134,7 @@ public class IscsInteractiveService {
List<Stand> stands = lcd.getStation().getNormalStand(right);
for (Stand stand : stands) {
Optional<StandPis> standPisOptional = iscsRepository.findStandPisOptional(stand.getCode());
standPisOptional.ifPresent(sp -> sp.setText(param.getContent()));
standPisOptional.ifPresent(sp -> sp.setText(content));
}
}
}