Quellcode durchsuchen

机构群限制调整

yuanliang vor 11 Monaten
Ursprung
Commit
d7d5f9b0a3

+ 6 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TenantGroupServiceImpl.java

@@ -169,7 +169,7 @@ public class TenantGroupServiceImpl extends ServiceImpl<TenantGroupMapper, Tenan
         if (adminId != null && Boolean.TRUE.equals(imGroupCreate)) {
             // 群成员数量限制校验
             SysConfig config = sysConfigService.findByParamName(SysConfigConstant.GROUP_MEMBER_LIMIT);
-            if (config != null && Integer.parseInt(config.getParamValue()) < userIds.size()) {
+            if (config != null && Integer.parseInt(config.getParamValue()) < (userIds.size() + 1)) {
                 throw new BizException("群成员人数上限为:" + config.getParamValue() + "人");
             }
 
@@ -242,6 +242,11 @@ public class TenantGroupServiceImpl extends ServiceImpl<TenantGroupMapper, Tenan
             ImGroup imGroup = imGroupService.getById(oldImGroupId);
             // 群被删除过,并且需要重新建群
             if (imGroup == null) {
+                SysConfig config = sysConfigService.findByParamName(SysConfigConstant.GROUP_MEMBER_LIMIT);
+                if (config != null && Integer.parseInt(config.getParamValue()) < (tenantGroup.getUserIds().size() + 1)) {
+                    throw new BizException("群成员人数上限为:" + config.getParamValue() + "人");
+                }
+
                 String imGroupId = createImGroup(entity.getAdminId(), tenantGroup.getName());
                 entity.setImGroupId(imGroupId);