REQ-3345: 直接解散群

This commit is contained in:
yanglin 2025-02-19 11:35:25 +08:00
parent dc53d3fd7c
commit 953dcd2438
2 changed files with 4 additions and 3 deletions

View File

@ -50,6 +50,7 @@ public class GroupDao extends ServiceImpl<GroupMapper, Group> {
return lambdaQuery() return lambdaQuery()
.eq(Group::getBizCode, bizCode) .eq(Group::getBizCode, bizCode)
.eq(Group::getType, groupType) .eq(Group::getType, groupType)
.ne(Group::getIsDismissed, YesOrNo.NO)
.last(forUpdate, "FOR UPDATE") .last(forUpdate, "FOR UPDATE")
.oneOpt(); .oneOpt();
} }

View File

@ -66,10 +66,10 @@ public class GroupManager {
// DON'T delete this line // DON'T delete this line
accountService.maybeCreateImAccounts(request.getPeople()); accountService.maybeCreateImAccounts(request.getPeople());
return transactionTemplate.execute(unused -> { return transactionTemplate.execute(unused -> {
Group savedGroup = groupDao.findByBizCode(request.getBizCode(), request.getGroupType(), true) Group savedGroup = groupDao
.findByBizCode(request.getBizCode(), request.getGroupType(), true)
.orElse(null); .orElse(null);
BizAssertions.assertTrue(savedGroup == null || savedGroup.isDismissed(), BizAssertions.assertTrue(savedGroup == null, String.format("群已经存在: %s", request.getName()));
String.format("群已经存在: %s", request.getName()));
ImAccounts imAccounts = accountService.getAccountsByPersons(request.getPeople()); ImAccounts imAccounts = accountService.getAccountsByPersons(request.getPeople());
String owner = imAccounts.findAccount(request.getOwner()).orElse(null); String owner = imAccounts.findAccount(request.getOwner()).orElse(null);
BizAssertions.assertNotNull(owner, "群主没有IM账号, 无法创建群. {}", request.getOwner()); BizAssertions.assertNotNull(owner, "群主没有IM账号, 无法创建群. {}", request.getOwner());