From 91ad31582581c54bff2243c0f7a3d0470e0a1e6b Mon Sep 17 00:00:00 2001 From: weizhihong Date: Wed, 19 Apr 2023 17:21:35 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E3=80=90=E5=A2=9E=E5=8A=A0=E6=94=B9?= =?UTF-8?q?=E6=96=B9=E6=8C=89=E9=92=AE=E6=8A=AC=E8=B5=B7=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assist/StationDirectionService.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/assist/StationDirectionService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/assist/StationDirectionService.java index 39b1e78e6..7d1d6e618 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/assist/StationDirectionService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/assist/StationDirectionService.java @@ -73,6 +73,26 @@ public class StationDirectionService { } }; + /** + * 改方按钮抬起验证 + */ + private final ButtonValidInterface turnDirectionPressUpValid = (simulation, stationDirection) -> { + // 原接车站无发车进路锁闭 + boolean isDeliverConflict = stationDirection.getDeliverRouteList().stream().anyMatch(Route::isLock); + if (isDeliverConflict) { + throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:存在发车进路"); + } + // 原发车站无发车进路锁闭 + StationDirection relativeDirection = getRelativeStationDirection(simulation, stationDirection); + boolean isReceiverConflict = relativeDirection != null; + if (isReceiverConflict) { + isReceiverConflict = relativeDirection.getReceiveRouteList().stream().anyMatch(Route::isLock); + } + if (isReceiverConflict) { + throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:相对方向存在接车进路"); + } + }; + /** * 总辅助校验 */ @@ -311,6 +331,8 @@ public class StationDirectionService { this.operationButtonValidMap = new HashMap<>(); // 改方按下验证函数 this.operationButtonValidMap.put(Operation.Type.ASSIST_PRESS_DOWN_TURN_DIRECTION, this.turnDirectionPressDownValid); + // 改方抬起验证函数 + this.operationButtonValidMap.put(Operation.Type.ASSIST_PRESS_UP_TURN_DIRECTION, this.turnDirectionPressUpValid); // 总辅助按下验证函数 this.operationButtonValidMap.put(Operation.Type.ASSIST_PRESS_MAIN_ASSIST, this.turnAssistValid); // 接辅助按下验证函数 From f8f7cc03df4327d8939d5c41b74cbafa20c22544 Mon Sep 17 00:00:00 2001 From: weizhihong Date: Wed, 19 Apr 2023 17:50:08 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E6=AD=A7?= =?UTF-8?q?=E4=B9=89=E5=8F=82=E6=95=B0=E5=90=8D=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ConversationGroupHandlerService.java | 74 +++++++++---------- .../ConversationGroupOperateHandler.java | 42 +++++------ 2 files changed, 57 insertions(+), 59 deletions(-) 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 d19591564..6d7dfd4fd 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,7 +1,6 @@ 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; @@ -19,7 +18,6 @@ import club.joylink.rtss.vo.client.voice.VoiceRecognitionResult; import club.joylink.rtss.vo.client.voice.VoiceRecognitionVO; import club.joylink.rtss.websocket.StompMessageService; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.event.EventListener; @@ -95,13 +93,13 @@ public class ConversationGroupHandlerService { * @param groupId 群组主键 * @param name 群组名称 */ - public void updateConversationGroupName(Simulation simulation, SimulationMember member, Long groupId, String name) { - ConversationGroup conversationGroup = checkGroupIdAndReturn(simulation, member, groupId); + public void updateConversationGroupName(Simulation simulation, SimulationMember member, Long id, String name) { + ConversationGroup conversationGroup = checkGroupIdAndReturn(simulation, member, id); // 查找名称是否已存在 ConversationGroup nameConversationGroup = simulation.getConversationGroupByName(name); - if (nameConversationGroup != null && !Objects.equals(groupId, nameConversationGroup.getId())) { + if (nameConversationGroup != null && !Objects.equals(id, nameConversationGroup.getId())) { throw new SimulationException(SimulationExceptionType.Illegal_Argument, "【" + name + "】已存在"); - } else if (nameConversationGroup != null && Objects.equals(groupId, nameConversationGroup.getId())) { + } else if (nameConversationGroup != null && Objects.equals(id, nameConversationGroup.getId())) { return; } conversationGroup.setName(name); @@ -114,11 +112,11 @@ public class ConversationGroupHandlerService { * * @param simulation 仿真 * @param member 用户 - * @param groupId 群组主键 + * @param id 群组主键 * @param memberId 目标用户 */ - public void updateConversationGroupLeader(Simulation simulation, SimulationMember member, Long groupId, String memberId) { - ConversationGroup conversationGroup = checkGroupIdAndReturn(simulation, member, groupId); + public void updateConversationGroupLeader(Simulation simulation, SimulationMember member, Long id, String memberId) { + ConversationGroup conversationGroup = checkGroupIdAndReturn(simulation, member, id); SimulationMember simulationMember = simulation.getSimulationMemberById(memberId); if (!conversationGroup.isConversationMember(simulationMember)) { conversationGroup.addSimulationMember(simulationMember, simulation.getCorrectSystemTime()); @@ -133,11 +131,11 @@ public class ConversationGroupHandlerService { * 邀请用户进群 * @param simulation 仿真 * @param member 用户 - * @param groupId 群组主键 + * @param id 群组主键 * @param memberIds 角色ID */ - public void inviteMembersInConversationGroup(Simulation simulation, SimulationMember member, Long groupId, List memberIds) { - ConversationGroup conversationGroup = checkGroupIdAndReturn(simulation, null, groupId); + public void inviteMembersInConversationGroup(Simulation simulation, SimulationMember member, Long id, List memberIds) { + ConversationGroup conversationGroup = checkGroupIdAndReturn(simulation, null, id); if (!conversationGroup.isConversationMember(member)) { throw new SimulationException(SimulationExceptionType.Illegal_Argument, "非本组成员,不能邀请用户"); } @@ -157,11 +155,11 @@ public class ConversationGroupHandlerService { * 移除群组用户 * @param simulation 仿真 * @param member 用户 - * @param groupId 群组主键 + * @param id 群组主键 * @param memberIds 角色ID */ - public void removeMemberConversationGroup(Simulation simulation, SimulationMember member, Long groupId, List memberIds) { - ConversationGroup conversationGroup = checkGroupIdAndReturn(simulation, member, groupId); + public void removeMemberConversationGroup(Simulation simulation, SimulationMember member, Long id, List memberIds) { + ConversationGroup conversationGroup = checkGroupIdAndReturn(simulation, member, id); if (memberIds.contains(conversationGroup.getLeader().getId())) { throw new SimulationException(SimulationExceptionType.Illegal_Argument, "群主不能移除"); } @@ -181,8 +179,8 @@ public class ConversationGroupHandlerService { * @param simulation 仿真 * @param member 用户 */ - public void exitConversationGroup(Simulation simulation, SimulationMember member, Long groupId) { - ConversationGroup conversationGroup = checkGroupIdAndReturn(simulation, null, groupId); + public void exitConversationGroup(Simulation simulation, SimulationMember member, Long id) { + ConversationGroup conversationGroup = checkGroupIdAndReturn(simulation, null, id); if (!conversationGroup.isConversationMember(member)) { throw new SimulationException(SimulationExceptionType.Illegal_Argument, "非本组成员,不能邀请用户"); } @@ -198,10 +196,10 @@ public class ConversationGroupHandlerService { * 解散群组 * @param simulation 仿真 * @param member 用户 - * @param groupId 群组主键 + * @param id 群组主键 */ - public void dissolveConversationGroup(Simulation simulation, SimulationMember member, Long groupId) { - ConversationGroup conversationGroup = checkGroupIdAndReturn(simulation, member, groupId); + public void dissolveConversationGroup(Simulation simulation, SimulationMember member, Long id) { + ConversationGroup conversationGroup = checkGroupIdAndReturn(simulation, member, id); simulation.removeConversionGroup(conversationGroup); // 发送解散消息 applicationEventPublisher.publishEvent(new SimulationConversationGroupDissolveEvent(this, simulation, conversationGroup)); @@ -212,13 +210,13 @@ public class ConversationGroupHandlerService { * * @param simulation 仿真 * @param member 用户 - * @param groupId 用户组 + * @param id 用户组 * @param audioPath 文件路径 * @param content 文件内容 * @return 消息信息实体 */ - public ConversationGroupMessageVO audioChat(Simulation simulation, SimulationMember member, Long groupId, String audioPath, String content) { - return sendMessage(simulation, member, groupId, () -> { + public ConversationGroupMessageVO audioChat(Simulation simulation, SimulationMember member, Long id, String audioPath, String content) { + return sendMessage(simulation, member, id, () -> { VoiceRecognitionResult recognitionResult = new VoiceRecognitionResult(); recognitionResult.setFilePath(audioPath); recognitionResult.setResult(content); @@ -231,12 +229,12 @@ public class ConversationGroupHandlerService { * * @param simulation 仿真 * @param member 用户 - * @param groupId 用户组 + * @param id 用户组 * @param content 文字信息 * @return 消息信息实体 */ - public ConversationGroupMessageVO textChat(Simulation simulation, SimulationMember member, Long groupId, String content) { - return sendMessage(simulation, member, groupId, () -> { + public ConversationGroupMessageVO textChat(Simulation simulation, SimulationMember member, Long id, String content) { + return sendMessage(simulation, member, id, () -> { VoiceRecognitionResult recognitionResult = new VoiceRecognitionResult(); recognitionResult.setResult(content); return recognitionResult; @@ -247,12 +245,12 @@ public class ConversationGroupHandlerService { * 发送Base64文件消息 * @param simulation 仿真 * @param member 成员 - * @param groupId 用户群组ID + * @param id 用户群组ID * @param fileBase64Str base64文件内容 * @return 消息信息实体 */ - public ConversationGroupMessageVO audioBase64(Simulation simulation, SimulationMember member, Long groupId, String fileBase64Str) { - return sendMessage(simulation, member, groupId, () -> { + public ConversationGroupMessageVO audioBase64(Simulation simulation, SimulationMember member, Long id, String fileBase64Str) { + return sendMessage(simulation, member, id, () -> { VoiceRecognitionVO vo = VoiceRecognitionVO.load(fileBase64Str); return iVoiceService.voiceRecognition(vo); }); @@ -263,11 +261,11 @@ public class ConversationGroupHandlerService { * * @param simulation 仿真 * @param member 群组成员 - * @param groupId 群组ID + * @param id 群组ID * @return 未读的消息列表 */ - public List readConversationGroup(Simulation simulation, SimulationMember member, Long groupId) { - ConversationGroup conversationGroup = simulation.getConversationGroup(groupId); + public List readConversationGroup(Simulation simulation, SimulationMember member, Long id) { + ConversationGroup conversationGroup = simulation.getConversationGroup(id); // 没有消息,不是本群人员 List messageList = conversationGroup.getUnreadMessages(member); if (CollectionUtils.isEmpty(messageList)) { @@ -428,11 +426,11 @@ public class ConversationGroupHandlerService { * * @param simulation 仿真 * @param member 操作人员 - * @param groupId 群组ID + * @param id 群组ID * @return 群组信息 */ - private ConversationGroup checkGroupIdAndReturn(Simulation simulation, SimulationMember member, Long groupId) { - ConversationGroup conversationGroup = simulation.getConversationGroup(groupId); + private ConversationGroup checkGroupIdAndReturn(Simulation simulation, SimulationMember member, Long id) { + ConversationGroup conversationGroup = simulation.getConversationGroup(id); if (conversationGroup == null) { throw new SimulationException(SimulationExceptionType.Illegal_Argument, "群组不存在"); } @@ -446,13 +444,13 @@ public class ConversationGroupHandlerService { * 处理并发送消息方法 * @param simulation 仿真 * @param member 操作人 - * @param groupId 用户组 + * @param id 用户组 * @param handleSupplier 处理消息方法 * @return 用户组消息 */ - private ConversationGroupMessageVO sendMessage(Simulation simulation, SimulationMember member, Long groupId + private ConversationGroupMessageVO sendMessage(Simulation simulation, SimulationMember member, Long id , Supplier handleSupplier) { - ConversationGroup conversationGroup = checkGroupIdAndReturn(simulation, null, groupId); + ConversationGroup conversationGroup = checkGroupIdAndReturn(simulation, null, id); if (!conversationGroup.isConversationMember(member)) { throw new SimulationException(SimulationExceptionType.Illegal_Argument, "非本组成员"); } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/conversation/ConversationGroupOperateHandler.java b/src/main/java/club/joylink/rtss/simulation/cbtc/conversation/ConversationGroupOperateHandler.java index fa0482fb8..85ee6d288 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/conversation/ConversationGroupOperateHandler.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/conversation/ConversationGroupOperateHandler.java @@ -37,8 +37,8 @@ public class ConversationGroupOperateHandler { * 修改群组名称等基本信息 */ @OperateHandlerMapping(type = Operation.Type.Conversation_Group_Update_Name) - public void updateConversationGroup(Simulation simulation, SimulationMember member, Long groupId, String name) { - conversationGroupManagerService.updateConversationGroupName(simulation, member, groupId, name); + public void updateConversationGroup(Simulation simulation, SimulationMember member, Long id, String name) { + conversationGroupManagerService.updateConversationGroupName(simulation, member, id, name); } /** @@ -46,75 +46,75 @@ public class ConversationGroupOperateHandler { * * @param simulation 仿真 * @param member 用户 - * @param groupId 群组ID + * @param id 群组ID * @param memberId 用户ID */ @OperateHandlerMapping(type = Operation.Type.Conversation_Group_Update_Leader) - public void setConversationGroupLeader(Simulation simulation, SimulationMember member, Long groupId, String memberId) { - conversationGroupManagerService.updateConversationGroupLeader(simulation, member, groupId, memberId); + public void setConversationGroupLeader(Simulation simulation, SimulationMember member, Long id, String memberId) { + conversationGroupManagerService.updateConversationGroupLeader(simulation, member, id, memberId); } /** * 邀请角色进群组 */ @OperateHandlerMapping(type = Operation.Type.Conversation_Group_Invite_Member) - public void inviteMembersInConversationGroup(Simulation simulation, SimulationMember member, Long groupId, List memberIds) { - conversationGroupManagerService.inviteMembersInConversationGroup(simulation, member, groupId, memberIds); + public void inviteMembersInConversationGroup(Simulation simulation, SimulationMember member, Long id, List memberIds) { + conversationGroupManagerService.inviteMembersInConversationGroup(simulation, member, id, memberIds); } /** * 踢人 */ @OperateHandlerMapping(type = Operation.Type.Conversation_Group_Remove_Member) - public void removeMemberConversationGroup(Simulation simulation, SimulationMember member, Long groupId, List memberIds) { - conversationGroupManagerService.removeMemberConversationGroup(simulation, member, groupId, memberIds); + public void removeMemberConversationGroup(Simulation simulation, SimulationMember member, Long id, List memberIds) { + conversationGroupManagerService.removeMemberConversationGroup(simulation, member, id, memberIds); } /** * 退出群组信息 */ @OperateHandlerMapping(type = Operation.Type.Conversation_Group_Exit) - public void exitConversationGroup(Simulation simulation, SimulationMember member, Long groupId) { - conversationGroupManagerService.exitConversationGroup(simulation, member, groupId); + public void exitConversationGroup(Simulation simulation, SimulationMember member, Long id) { + conversationGroupManagerService.exitConversationGroup(simulation, member, id); } /** * 解散群组 */ @OperateHandlerMapping(type = Operation.Type.Conversation_Group_Dissolve) - public void dissolveConversationGroup(Simulation simulation, SimulationMember member, Long groupId) { - conversationGroupManagerService.dissolveConversationGroup(simulation, member, groupId); + public void dissolveConversationGroup(Simulation simulation, SimulationMember member, Long id) { + conversationGroupManagerService.dissolveConversationGroup(simulation, member, id); } /** * 发送语音信息 */ @OperateHandlerMapping(type = Operation.Type.Conversation_Group_Audio_Chat) - public ConversationGroupMessageVO audioChat(Simulation simulation, SimulationMember member, Long groupId, String audioPath, String content) { - return conversationGroupManagerService.audioChat(simulation, member, groupId, audioPath, content); + public ConversationGroupMessageVO audioChat(Simulation simulation, SimulationMember member, Long id, String audioPath, String content) { + return conversationGroupManagerService.audioChat(simulation, member, id, audioPath, content); } /** * 发送文字信息 */ @OperateHandlerMapping(type = Operation.Type.Conversation_Group_Text_Chat) - public ConversationGroupMessageVO textChat(Simulation simulation, SimulationMember member, Long groupId, String content) { - return conversationGroupManagerService.textChat(simulation, member, groupId, content); + public ConversationGroupMessageVO textChat(Simulation simulation, SimulationMember member, Long id, String content) { + return conversationGroupManagerService.textChat(simulation, member, id, content); } /** * 发送Base64音频文件 */ @OperateHandlerMapping(type = Operation.Type.Conversation_Group_Audio_Base64) - public ConversationGroupMessageVO audioBase64(Simulation simulation, SimulationMember member, Long groupId, String fileBase64Str) { - return conversationGroupManagerService.audioBase64(simulation, member, groupId, fileBase64Str); + public ConversationGroupMessageVO audioBase64(Simulation simulation, SimulationMember member, Long id, String fileBase64Str) { + return conversationGroupManagerService.audioBase64(simulation, member, id, fileBase64Str); } /** * 阅读群组信息 */ @OperateHandlerMapping(type = Operation.Type.Conversation_Group_Get_Unread_Message) - public List readConversationGroup(Simulation simulation, SimulationMember member, Long groupId) { - return conversationGroupManagerService.readConversationGroup(simulation, member, groupId); + public List readConversationGroup(Simulation simulation, SimulationMember member, Long id) { + return conversationGroupManagerService.readConversationGroup(simulation, member, id); } } From 550b85b8eace34809b63bef014192a5d6ebe30c4 Mon Sep 17 00:00:00 2001 From: weizhihong Date: Wed, 19 Apr 2023 17:59:42 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E3=80=90=E5=A4=84=E7=90=86=E5=8F=91?= =?UTF-8?q?=E9=80=81=E6=B6=88=E6=81=AFBUG=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cbtc/conversation/ConversationGroup.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/conversation/ConversationGroup.java b/src/main/java/club/joylink/rtss/simulation/cbtc/conversation/ConversationGroup.java index 591c3c6e0..c0294969d 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/conversation/ConversationGroup.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/conversation/ConversationGroup.java @@ -57,7 +57,8 @@ public class ConversationGroup extends Chat { this.id = info.getId(); this.name = info.getName(); this.imageUrl = info.getImageUrl(); - setTime(simulation.getCorrectSystemTime()); + LocalDateTime time = simulation.getCorrectSystemTime(); + setTime(time); // 成员中放入群主 SimulationMember leader = simulation.getSimulationMemberById(info.getLeaderId()); setCreator(leader); @@ -65,12 +66,16 @@ public class ConversationGroup extends Chat { List memberList = new ArrayList<>(size); ConversationMember conversationLeader = new ConversationMember(leader); conversationLeader.setLeader(); + conversationLeader.setTime(time); memberList.add(conversationLeader); // 处理群成员 if (size > 1) { info.getMemberIds().stream().filter(id -> !Objects.equals(id, info.getLeaderId())).distinct() - .map(simulation::getSimulationMemberById) - .forEach(member -> memberList.add(new ConversationMember(member))); + .map(simulation::getSimulationMemberById).forEach(member -> { + ConversationMember conversationMember = new ConversationMember(member); + conversationMember.setTime(time); + memberList.add(conversationMember); + }); } setMemberList(memberList); } @@ -88,7 +93,11 @@ public class ConversationGroup extends Chat { // 处理群成员 if (size > 1) { simulationMembers.stream().filter(member -> !Objects.equals(member.getId(), leader.getId())).distinct() - .forEach(member -> memberList.add(new ConversationMember(member))); + .forEach(member -> { + ConversationMember conversationMember = new ConversationMember(member); + conversationMember.setTime(time); + memberList.add(conversationMember); + }); } setMemberList(memberList); } From 07aa27bd4e0602b88a33984cd38f43ead9ac0fad Mon Sep 17 00:00:00 2001 From: weizhihong Date: Thu, 20 Apr 2023 09:58:03 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E3=80=90=E4=BC=9A=E8=AF=9D=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E9=80=BB=E8=BE=91=E4=BA=BA=E5=AE=B6=E6=9C=BA=E5=99=A8?= =?UTF-8?q?=E4=BA=BA=E6=B6=88=E6=81=AF=E4=B8=8D=E5=81=9A=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../voice/discriminate/ReplyParseServiceImpl.java | 5 +++-- .../voice/discriminate/VoiceDiscriminateService.java | 8 +++++--- .../cbtc/discriminate/VoiceDiscriminateResult.java | 5 +++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main/java/club/joylink/rtss/services/voice/discriminate/ReplyParseServiceImpl.java b/src/main/java/club/joylink/rtss/services/voice/discriminate/ReplyParseServiceImpl.java index 6d5d1765c..3d8c528db 100644 --- a/src/main/java/club/joylink/rtss/services/voice/discriminate/ReplyParseServiceImpl.java +++ b/src/main/java/club/joylink/rtss/services/voice/discriminate/ReplyParseServiceImpl.java @@ -1,6 +1,7 @@ package club.joylink.rtss.services.voice.discriminate; import club.joylink.rtss.simulation.cbtc.Simulation; +import club.joylink.rtss.simulation.cbtc.conversation.ConversationGroupHandlerService; import club.joylink.rtss.simulation.cbtc.conversation.ConversationManagerService; import club.joylink.rtss.simulation.cbtc.discriminate.*; import club.joylink.rtss.simulation.cbtc.member.SimulationMember; @@ -18,7 +19,7 @@ import java.util.List; public class ReplyParseServiceImpl implements VoiceTransactionalService { @Autowired - private ConversationManagerService conversationManagerService; + private ConversationGroupHandlerService conversationGroupHandlerService; @Override @Async("voiceDiscriminateExecutor") @@ -55,7 +56,7 @@ public class ReplyParseServiceImpl implements VoiceTransactionalService { replyResult.getParamList().toArray(objArr); replyResult.setContent(String.format(replyRule.getMessageFormat(), objArr)); // 执行回复 - simulationMemberList.forEach(member -> conversationManagerService.conversationChat(simulation, member, replyResult.getContent(), null)); + simulationMemberList.forEach(member -> conversationGroupHandlerService.textChat(simulation, member, result.getConversionGroupId(), replyResult.getContent())); } /** 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 ac04ea401..76dcaf4b6 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 @@ -69,8 +69,9 @@ public class VoiceDiscriminateService { /** * 接受语音文件、资源等必要条件,解析开始 */ - public void doAnalysis(Simulation simulation, String content, List memberList) { + public void doAnalysis(Simulation simulation, Long id, String content, List memberList) { VoiceDiscriminateResult result = voiceParseService.doParse(simulation, content); + result.setConversionGroupId(id); result.setSimulationMemberList(memberList); // 匹配到人员集合 operateParseService.doExec(result, simulation); // 指令执行 replyParseService.doExec(result, simulation); // 回复执行 @@ -93,7 +94,8 @@ public class VoiceDiscriminateService { } // 增加机器人已读操作 memberList.forEach(m -> conversationGroupManagerService.readConversationGroup(event.getSimulation(), m, conversationGroup.getId())); - // 执行语音识别 - doAnalysis(event.getSimulation(), event.getMessage().getContent(), memberList); + if (!event.getMessage().getMember().isRobot()) { // 如果消息来源不为机器人,则执行语音识别 + doAnalysis(event.getSimulation(), conversationGroup.getId(), event.getMessage().getContent(), memberList); + } } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/discriminate/VoiceDiscriminateResult.java b/src/main/java/club/joylink/rtss/simulation/cbtc/discriminate/VoiceDiscriminateResult.java index c296485b9..ff5766cec 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/discriminate/VoiceDiscriminateResult.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/discriminate/VoiceDiscriminateResult.java @@ -52,6 +52,11 @@ public class VoiceDiscriminateResult { */ private List paramExtractResultList; + /** + * 会话的ID,用于回复 + */ + private Long conversionGroupId; + /** * 匹配人员集合 */