diff --git a/src/main/java/club/joylink/rtss/services/training2/Training2Service.java b/src/main/java/club/joylink/rtss/services/training2/Training2Service.java index e4968a387..98d91ff9d 100644 --- a/src/main/java/club/joylink/rtss/services/training2/Training2Service.java +++ b/src/main/java/club/joylink/rtss/services/training2/Training2Service.java @@ -16,6 +16,8 @@ import club.joylink.rtss.simulation.cbtc.GroupSimulationService; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.SimulationLifeCycleService; import club.joylink.rtss.simulation.cbtc.SimulationService; +import club.joylink.rtss.simulation.cbtc.conversation.ConversationGroup; +import club.joylink.rtss.simulation.cbtc.conversation.ConversationMember; import club.joylink.rtss.simulation.cbtc.data.map.Switch; import club.joylink.rtss.simulation.cbtc.data.vo.ConversationMessageVO; import club.joylink.rtss.simulation.cbtc.data.vo.Training2MessageVO; @@ -96,6 +98,12 @@ public class Training2Service { Operation.Type.Conversation_Group_Private_Text_Chat.name() ); + private static final List PRIVATE_CONVERSATION_LIST = Arrays.asList( + Type.Conversation_Group_Private_Audio_Base64.name(), + Type.Conversation_Group_Private_Text_Chat.name(), + Type.Conversation_Group_Private_Audio_Chat.name() + ); + /** * 实训步骤执行道岔联动元素存在当前步骤元素 */ @@ -953,6 +961,32 @@ public class Training2Service { if (!simulation.getTraining2().isJumpStep(step) && !step.getSimulationMember().isRobot()) { applicationContext.publishEvent( new SimulationTrainingAudioEvent(this, simulation, step, simOperation2, doCompletion)); + if (!doCompletion) { + Operation.Type operationType; + HashMap params = new HashMap<>(event.getParams()); + SimulationMember member = null; + if (PRIVATE_CONVERSATION_LIST.contains(event.getOperate())) { + operationType = Type.Conversation_Group_Private_Audio_Chat; + Object memberId = params.put("memberId", event.getMember().getId()); + member = simulation.getSimulationMemberById((String) memberId); + } else { + operationType = Type.Conversation_Group_Audio_Chat; + ConversationGroup cg = simulation.getConversationGroup( + Long.valueOf(params.get("id").toString())); + for (ConversationMember cm : cg.getMemberList()) { + if (!Objects.equals(cm.getMember(), event.getMember())) { + member = cm.getMember(); + break; + } + } + } + if (member != null) { + VoiceCompose compose = voiceService.synthesis(new BaseVoiceSynthesisVO("请重复")); + params.put("audioPath", compose.getFilePath()); + params.put("content", compose.getMessage()); + atsOperationDispatcher.execute(simulation, member, operationType.name(), params); + } + } } }