|
@@ -308,7 +308,7 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
|
|
public String create(ImGroupWrapper.ImGroup imGroup) throws Exception {
|
|
public String create(ImGroupWrapper.ImGroup imGroup) throws Exception {
|
|
// 群成员数量限制校验
|
|
// 群成员数量限制校验
|
|
SysConfig config = sysConfigService.findByParamName(SysConfigConstant.GROUP_MEMBER_LIMIT);
|
|
SysConfig config = sysConfigService.findByParamName(SysConfigConstant.GROUP_MEMBER_LIMIT);
|
|
- if (config != null && Integer.parseInt(config.getParamValue()) < imGroup.getStudentIdList().size()) {
|
|
|
|
|
|
+ if (config != null && Integer.parseInt(config.getParamValue()) < (imGroup.getStudentIdList().size() + 1)) {
|
|
throw new BizException("群成员人数上限为:" + config.getParamValue() + "人");
|
|
throw new BizException("群成员人数上限为:" + config.getParamValue() + "人");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -367,6 +367,15 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
|
|
throw new BizException("添加的群成员不能为空");
|
|
throw new BizException("添加的群成员不能为空");
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+ // 群成员数量限制校验
|
|
|
|
+ int memberCount = imGroupMemberService.countGroupMember(groupId);
|
|
|
|
+ // 查询群成员人数限制
|
|
|
|
+ SysConfig config = sysConfigService.findByParamName(SysConfigConstant.GROUP_MEMBER_LIMIT);
|
|
|
|
+ if (Objects.nonNull(config) && Integer.parseInt(config.getParamValue()) > 0
|
|
|
|
+ && (memberCount + studentIdList.size()) > Integer.parseInt(config.getParamValue())) {
|
|
|
|
+ throw new BizException("群成员数量已达上限");
|
|
|
|
+ }
|
|
|
|
+
|
|
List<ImGroupMember> groupMemberList = imGroupMemberService.initGroupMembers(groupId,
|
|
List<ImGroupMember> groupMemberList = imGroupMemberService.initGroupMembers(groupId,
|
|
studentIdList, ImGroupMemberRoleType.STUDENT);
|
|
studentIdList, ImGroupMemberRoleType.STUDENT);
|
|
imGroupMemberService.join(groupMemberList, groupId);
|
|
imGroupMemberService.join(groupMemberList, groupId);
|
|
@@ -391,7 +400,7 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
//获取学员列表,按购买时间顺序升序排列返回
|
|
//获取学员列表,按购买时间顺序升序排列返回
|
|
- Set<Long> studentIds = courseScheduleStudentPaymentDao.queryStudentIds(courseGroupId, courseGroupType);
|
|
|
|
|
|
+ Set<Long> studentIds = new LinkedHashSet<>(courseScheduleStudentPaymentDao.queryStudentIds(courseGroupId, courseGroupType));
|
|
// studentIds集合中所有null元素移除
|
|
// studentIds集合中所有null元素移除
|
|
studentIds.removeAll(Collections.singleton(null));
|
|
studentIds.removeAll(Collections.singleton(null));
|
|
if (CollectionUtils.isEmpty(studentIds)) {
|
|
if (CollectionUtils.isEmpty(studentIds)) {
|