|
@@ -3,9 +3,11 @@ package com.ym.service.Impl;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import com.microsvc.toolkit.middleware.rtc.RTCRoomPluginContext;
|
|
|
import com.microsvc.toolkit.middleware.rtc.RTCRoomPluginService;
|
|
|
import com.microsvc.toolkit.middleware.rtc.impl.TencentCloudRTCPlugin;
|
|
|
+import com.microsvc.toolkit.middleware.rtc.message.ImGroupMemberWrapper;
|
|
|
import com.ym.common.ApiException;
|
|
|
import com.ym.common.BaseResponse;
|
|
|
import com.ym.common.DisplayEnum;
|
|
@@ -43,6 +45,7 @@ import com.ym.utils.DateTimeUtils;
|
|
|
import com.ym.utils.IdentifierUtils;
|
|
|
import com.ym.whiteboard.WhiteBoardHelper;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
@@ -286,13 +289,28 @@ public class RoomServiceImpl implements RoomService {
|
|
|
log.info("createImGroup: roomId = {}, userId = {}", roomId, teacherInfo.getId());
|
|
|
pluginService.chatRoomCreate(roomId, courseSchedule.getName(), teacherInfo.getAvatar());
|
|
|
|
|
|
+ // 群组老师信息
|
|
|
+ List<ImGroupMemberWrapper.ImGroupMember> groupMembers = Lists.newArrayList(ImGroupMemberWrapper.ImGroupMember
|
|
|
+ .builder()
|
|
|
+ .userId(Long.valueOf(teacherInfo.getId()))
|
|
|
+ .imUserIdFormat(false)
|
|
|
+ .build());
|
|
|
+
|
|
|
List<CourseScheduleStudentPayment> payments = courseScheduleStudentPaymentDao.findByCourseSchedule(Long.parseLong(roomId.substring(1)));
|
|
|
- // 学生信息
|
|
|
- List<String> collect = payments.stream().map(e -> e.getUserId().toString()).collect(Collectors.toList());
|
|
|
- // 老师信息
|
|
|
- collect.add(teacherInfo.getId().toString());
|
|
|
+ // 群组学生信息
|
|
|
+ if (CollectionUtils.isNotEmpty(payments)) {
|
|
|
+ for (CourseScheduleStudentPayment item : payments) {
|
|
|
+ groupMembers.add(ImGroupMemberWrapper.ImGroupMember
|
|
|
+ .builder()
|
|
|
+ .userId(Long.valueOf(item.getUserId()))
|
|
|
+ .imUserIdFormat(false)
|
|
|
+ .build());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 加入群组成员
|
|
|
- log.info("joinImGroup: roomId = {}, userIds = {}", roomId, collect);
|
|
|
+ log.info("joinImGroup: roomId = {}, userIds = {}", roomId, groupMembers);
|
|
|
+ pluginService.chatRoomGroupJoin(roomId, courseSchedule.getName(), groupMembers);
|
|
|
}
|
|
|
|
|
|
// 返回配置参数
|