Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
joylink_zhangsai 2023-05-26 15:27:10 +08:00
commit 3aed493654

View File

@ -67,13 +67,9 @@ public class ConversationGroupHandlerService {
* @param memberIds 群组成员
*/
public ConversationGroupVO createConversationGroup(Simulation simulation, SimulationMember member, String imageUrl, String name, List<String> memberIds) {
ConversationGroup conversationGroup = simulation.getConversationGroupByName(name);
if (conversationGroup != null) {
throw new SimulationException(SimulationExceptionType.Illegal_Argument, "" + name + "】已存在");
}
List<SimulationMember> simulationMembers = memberIds.stream().map(simulation::getSimulationMemberById).collect(Collectors.toList());
Long groupId = simulation.getMaxConversationGroupId();
conversationGroup = new ConversationGroup(groupId, imageUrl, name, simulation.getCorrectSystemTime(), member, simulationMembers);
ConversationGroup conversationGroup = new ConversationGroup(groupId, imageUrl, name, simulation.getCorrectSystemTime(), member, simulationMembers);
conversationGroup.initGroupType();
simulation.addConversationGroup(conversationGroup);
// 通知用户消息
@ -91,13 +87,6 @@ public class ConversationGroupHandlerService {
*/
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(id, nameConversationGroup.getId())) {
throw new SimulationException(SimulationExceptionType.Illegal_Argument, "" + name + "】已存在");
} else if (nameConversationGroup != null && Objects.equals(id, nameConversationGroup.getId())) {
return;
}
conversationGroup.setName(name);
// 通知其他用户群名变更
applicationEventPublisher.publishEvent(new SimulationConversationGroupUpdateEvent(this, simulation, conversationGroup, ConversationGroupSocketMessageVO.MessageType.UPDATE_NAME));