【去除群组名称校验】

This commit is contained in:
weizhihong 2023-05-26 15:09:09 +08:00
parent 957dc9bd7f
commit 9eaf172a99

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));