diff --git a/src/main/java/club/joylink/rtss/services/voice/discriminate/VoiceDiscriminateService.java b/src/main/java/club/joylink/rtss/services/voice/discriminate/VoiceDiscriminateService.java index 98020a7ee..8899a227f 100644 --- a/src/main/java/club/joylink/rtss/services/voice/discriminate/VoiceDiscriminateService.java +++ b/src/main/java/club/joylink/rtss/services/voice/discriminate/VoiceDiscriminateService.java @@ -1,16 +1,21 @@ package club.joylink.rtss.services.voice.discriminate; +import club.joylink.rtss.simulation.cbtc.conversation.ConversationGroup; import club.joylink.rtss.simulation.cbtc.discriminate.VoiceDiscriminateResult; import club.joylink.rtss.simulation.cbtc.Simulation; +import club.joylink.rtss.simulation.cbtc.event.conversation.SimulationConversationGroupDissolveEvent; +import club.joylink.rtss.simulation.cbtc.event.conversation.SimulationConversationGroupMessageEvent; +import club.joylink.rtss.simulation.cbtc.member.SimulationMember; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.event.EventListener; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; /** - * 语音识别服务类(多例) + * 语音识别服务类 */ @Slf4j @Service @@ -50,4 +55,16 @@ public class VoiceDiscriminateService { replyParseService.doExec(result, simulation); // 回复执行 correctSourceService.doExec(result, simulation);// 原信息纠错 } + + /** + * 处理聊天信息 + * @param event 聊天事件信息 + */ + @EventListener + public void handleMessage(SimulationConversationGroupMessageEvent event) { + ConversationGroup conversationGroup = event.getConversationGroup(); + + + + } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/conversation/ConversationGroupHandlerService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/conversation/ConversationGroupHandlerService.java index a7623fe97..be80c5d2c 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/conversation/ConversationGroupHandlerService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/conversation/ConversationGroupHandlerService.java @@ -1,6 +1,7 @@ package club.joylink.rtss.simulation.cbtc.conversation; import club.joylink.rtss.services.voice.VoiceService; +import club.joylink.rtss.services.voice.discriminate.VoiceDiscriminateService; import club.joylink.rtss.simulation.cbtc.GroupSimulationCache; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.data.vo.ConversationGroupMessageVO; @@ -445,6 +446,8 @@ public class ConversationGroupHandlerService { if (!CollectionUtils.isEmpty(userIdSet)) { doSendMessage(simulation, userIdSet, ConversationGroupSocketMessageVO.MessageType.MESSAGE.generateMessageVO(conversationGroup, messageVO)); } + // 语音识别开始 + applicationEventPublisher.publishEvent(new SimulationConversationGroupMessageEvent(this, simulation, conversationGroup, member, message.getContent())); return messageVO; } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/event/conversation/SimulationConversationGroupMessageEvent.java b/src/main/java/club/joylink/rtss/simulation/cbtc/event/conversation/SimulationConversationGroupMessageEvent.java new file mode 100644 index 000000000..ef5816db2 --- /dev/null +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/event/conversation/SimulationConversationGroupMessageEvent.java @@ -0,0 +1,37 @@ +package club.joylink.rtss.simulation.cbtc.event.conversation; + +import club.joylink.rtss.simulation.cbtc.Simulation; +import club.joylink.rtss.simulation.cbtc.conversation.ConversationGroup; +import club.joylink.rtss.simulation.cbtc.event.AbstractSimulationEvent; +import club.joylink.rtss.simulation.cbtc.member.SimulationMember; +import lombok.Getter; + +/** + * 群组退群事件 + */ +@Getter +public class SimulationConversationGroupMessageEvent extends AbstractSimulationEvent { + + /** + * 会话对象 + */ + private ConversationGroup conversationGroup; + + /** + * 操作用户 + */ + private SimulationMember member; + + /** + * 消息内容 + */ + private String content; + + public SimulationConversationGroupMessageEvent(Object source, Simulation simulation, ConversationGroup conversationGroup + , SimulationMember member, String content) { + super(source, simulation); + this.conversationGroup = conversationGroup; + this.member = member; + this.content = content; + } +}