|
@@ -8,6 +8,7 @@ import com.google.common.collect.Maps;
|
|
|
import com.microsvc.toolkit.middleware.rtc.RTCRoomPluginContext;
|
|
|
import com.microsvc.toolkit.middleware.rtc.RTCRoomPluginService;
|
|
|
import com.microsvc.toolkit.middleware.rtc.enums.EMemberAction;
|
|
|
+import com.microsvc.toolkit.middleware.rtc.impl.RongCloudRTCPlugin;
|
|
|
import com.microsvc.toolkit.middleware.rtc.impl.TencentCloudRTCPlugin;
|
|
|
import com.microsvc.toolkit.middleware.rtc.message.ImGroupMemberWrapper;
|
|
|
import com.microsvc.toolkit.middleware.rtc.message.RTCRoomMessage;
|
|
@@ -229,6 +230,24 @@ public class RoomServiceImpl implements RoomService {
|
|
|
log.info("joinRoom current: roomId={}, userId={}", roomId, userId);
|
|
|
RoleEnum roleEnum;
|
|
|
|
|
|
+ // 获取RTC服务提供方
|
|
|
+ String rtcServiceProvider = Optional.ofNullable(sysConfigDao.findConfigValue(SysConfigService.RTC_SERVICE_PROVIDER))
|
|
|
+ .orElse(RongCloudRTCPlugin.PLUGIN_NAME);
|
|
|
+
|
|
|
+ // 按分部强制开始腾讯网络教室
|
|
|
+ {
|
|
|
+ List<Integer> collect = Arrays.stream(Optional.ofNullable(sysConfigDao.findConfigValue(SysConfigService.TENCENT_RTC_SERVICE_PROVIDER)).orElse("").split(","))
|
|
|
+ .map(Integer::parseInt).distinct().collect(Collectors.toList());
|
|
|
+
|
|
|
+ if (collect.contains(courseSchedule.getOrganId())) {
|
|
|
+ // 强制开启腾讯网络教室
|
|
|
+ rtcServiceProvider = TencentCloudRTCPlugin.PLUGIN_NAME;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(courseSchedule.getServiceProvider())) {
|
|
|
+ courseSchedule.setServiceProvider(rtcServiceProvider);
|
|
|
+ }
|
|
|
+
|
|
|
// 全员静音状态
|
|
|
Boolean muteAll = Optional.ofNullable(courseSchedule.getMuteAll()).orElse(false);
|
|
|
|
|
@@ -251,7 +270,9 @@ public class RoomServiceImpl implements RoomService {
|
|
|
userName = sysUser.getUsername();
|
|
|
|
|
|
// 学生加入房间,判定老师是否已开启全员静音
|
|
|
- microphone = !muteAll;
|
|
|
+ if (TencentCloudRTCPlugin.PLUGIN_NAME.equals(rtcServiceProvider)) {
|
|
|
+ microphone = !muteAll;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
userResult.setMicrophone(microphone);
|
|
@@ -281,12 +302,6 @@ public class RoomServiceImpl implements RoomService {
|
|
|
throw new BizException("主讲老师不存在");
|
|
|
}
|
|
|
|
|
|
- // 获取RTC服务提供方
|
|
|
- String rtcServiceProvider = Optional.ofNullable(sysConfigDao.findConfigValue("rtc_service_provider")).orElse("rongCloud");
|
|
|
- if (StringUtils.isBlank(courseSchedule.getServiceProvider())) {
|
|
|
- courseSchedule.setServiceProvider(rtcServiceProvider);
|
|
|
- }
|
|
|
-
|
|
|
RTCRoomPluginService pluginService = rtcRoomPluginContext.getPluginService(rtcServiceProvider);
|
|
|
if (TencentCloudRTCPlugin.PLUGIN_NAME.equals(pluginService.pluginName())) {
|
|
|
// 腾讯云RTC
|
|
@@ -527,7 +542,9 @@ public class RoomServiceImpl implements RoomService {
|
|
|
userName = sysUser.getUsername();
|
|
|
|
|
|
// 判定老师是否已开启全员静音
|
|
|
- microphone = !courseSchedule.getMuteAll();
|
|
|
+ if (TencentCloudRTCPlugin.PLUGIN_NAME.equals(courseSchedule.getServiceProvider())) {
|
|
|
+ microphone = !courseSchedule.getMuteAll();
|
|
|
+ }
|
|
|
}
|
|
|
member = saveRoomMember(userId, sysUser.getAvatar(), userName, roomId, roleEnum.getValue(), curTime, microphone);
|
|
|
}
|
|
@@ -1853,7 +1870,8 @@ public class RoomServiceImpl implements RoomService {
|
|
|
|
|
|
// 全员静音开启状态
|
|
|
CourseSchedule courseSchedule = courseScheduleDao.get(Long.parseLong(roomId.substring(1)));
|
|
|
- if (Optional.ofNullable(courseSchedule.getMuteAll()).orElse(false)) {
|
|
|
+ if (Optional.ofNullable(courseSchedule.getMuteAll()).orElse(false)
|
|
|
+ && TencentCloudRTCPlugin.PLUGIN_NAME.equals(courseSchedule.getServiceProvider())) {
|
|
|
for (RoomResult.MemberResult item : roomResult.getMembers()) {
|
|
|
// 重置学生用户当前静音状态
|
|
|
if (RoleStudent.getValue() == item.getRole()) {
|