瀏覽代碼

Merge branch 'feature/0414-trtc' into saas

# Conflicts:
#	mec-biz/pom.xml
#	mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java
#	mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml
#	mec-web/src/main/resources/bootstrap-local.properties
shangke 2 年之前
父節點
當前提交
9f90cdf737
共有 24 個文件被更改,包括 1056 次插入84 次删除
  1. 1 0
      .gitignore
  2. 5 0
      mec-biz/pom.xml
  3. 14 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java
  4. 7 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/VipGroupDao.java
  5. 67 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/TencentData.java
  6. 21 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CourseSchedule.java
  7. 47 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/ETencentTRTCCallbackCommand.java
  8. 6 0
      mec-biz/src/main/java/com/ym/mec/biz/service/SysConfigService.java
  9. 5 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java
  10. 22 1
      mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml
  11. 6 0
      mec-biz/src/main/resources/config/mybatis/VipGroupMapper.xml
  12. 1 1
      mec-im/src/main/java/com/ym/SealClassConfiguration.java
  13. 1 1
      mec-im/src/main/java/com/ym/config/ResourceServerConfig.java
  14. 61 5
      mec-im/src/main/java/com/ym/controller/RoomController.java
  15. 19 0
      mec-im/src/main/java/com/ym/dao/RoomMemberDao.java
  16. 18 7
      mec-im/src/main/java/com/ym/enums/DeviceTypeEnum.java
  17. 52 0
      mec-im/src/main/java/com/ym/pojo/ReqDeviceControlData.java
  18. 25 0
      mec-im/src/main/java/com/ym/pojo/RoomResult.java
  19. 628 65
      mec-im/src/main/java/com/ym/service/Impl/RoomServiceImpl.java
  20. 12 2
      mec-im/src/main/java/com/ym/service/RoomService.java
  21. 17 0
      mec-im/src/test/resources/application.yml
  22. 7 0
      mec-student/src/main/java/com/ym/mec/student/config/WebMvcConfig.java
  23. 7 0
      mec-teacher/src/main/java/com/ym/mec/teacher/config/WebMvcConfig.java
  24. 7 0
      mec-web/src/main/java/com/ym/mec/web/config/WebMvcConfig.java

+ 1 - 0
.gitignore

@@ -1,4 +1,5 @@
 *.class
+*.log
 .metadata
 /target/
 *.classpath

+ 5 - 0
mec-biz/pom.xml

@@ -62,6 +62,11 @@
 			<artifactId>microsvc-common-response</artifactId>
 			<version>1.0.0</version>
 		</dependency>
+		<dependency>
+			<groupId>com.microsvc.toolkit.middleware</groupId>
+			<artifactId>microsvc-middleware-rtc</artifactId>
+			<version>1.0.0</version>
+		</dependency>
 
 		<!--修复依赖冲突-->
 		<dependency>

+ 14 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java

@@ -1993,4 +1993,18 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
         "param") Map<String, Object> param, @Param("courseIds") List<Long> courseIds);
 
     int countTeacherServeHomeworkDetailV2(@Param("param") Map<String, Object> params, @Param("courseIds") List<Long> courseIds);
+
+    /**
+     * 网络课服务提供方
+     * @param courseScheduleId 课程ID
+     * @param serviceProvider 服务提供方
+     */
+    void updateServiceProvider(@Param("courseScheduleId") Long courseScheduleId, @Param("serviceProvider") String serviceProvider);
+
+    /**
+     * 更新全员静音状态
+     * @param courseScheduleId 课程ID
+     * @param muteAll 全员静音状态
+     */
+    void updateGroupMuteAllStatus(@Param("courseScheduleId") Long courseScheduleId, @Param("muteAll") Boolean muteAll);
 }

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/VipGroupDao.java

@@ -369,4 +369,11 @@ public interface VipGroupDao extends BaseDAO<Long, VipGroup> {
 
     int countStudentUseingActivityNum(@Param("vipGroupActivityId") Integer vipGroupActivityId,
                                     @Param("studentId") Integer studentId);
+
+    /**
+     * 获取课程人数
+     * @param groupId 课程类型ID
+     * @return int
+     */
+    int getCourseStudentNumsByGroupId(@Param("groupId") Long groupId);
 }

+ 67 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/TencentData.java

@@ -4,8 +4,10 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.annotation.JSONField;
+import com.fasterxml.jackson.annotation.JsonProperty;
 import com.ym.mec.biz.dal.enums.ETencentGroupType;
 import com.ym.mec.biz.dal.enums.ETencentImCallbackCommand;
+import com.ym.mec.biz.dal.enums.ETencentTRTCCallbackCommand;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;
@@ -16,6 +18,7 @@ import lombok.NoArgsConstructor;
 import java.io.Serializable;
 import java.time.LocalDateTime;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 import java.util.Locale;
 
@@ -25,6 +28,8 @@ import java.util.Locale;
  * @author liujunchi
  * @date 2023-03-06
  */
+@NoArgsConstructor
+@Data
 public class TencentData {
 
     // 群成员离开之后回调对象
@@ -451,4 +456,66 @@ public class TencentData {
         private Integer code;
     }
 
+
+    @Data
+    @NoArgsConstructor
+    @AllArgsConstructor
+    @ApiModel("腾讯云回调事件")
+    public static class TRTCEventInfo implements Serializable {
+
+        @JsonProperty("EventGroupId")
+        @ApiModelProperty("事件组")
+        private Integer eventGroupId;
+
+        @JsonProperty("EventType")
+        @ApiModelProperty("事件类型")
+        private Integer eventType;
+
+        @JsonProperty("CallbackTs")
+        @ApiModelProperty("事件时间")
+        private Long callbackTs;
+
+        @JsonProperty("EventInfo")
+        @ApiModelProperty("事件消息")
+        private EventInfo eventInfo;
+
+        public String jsonString() {
+            return JSON.toJSONString(this);
+        }
+    }
+
+    @Data
+    @NoArgsConstructor
+    @AllArgsConstructor
+    @ApiModel("事件消息")
+    public static class EventInfo implements Serializable {
+
+        @JsonProperty("RoomId")
+        @ApiModelProperty("房间号")
+        private String roomId;
+
+        @JsonProperty("EventTs")
+        @ApiModelProperty("事件发生时间")
+        private Long eventTs;
+
+        @JsonProperty("UserId")
+        @ApiModelProperty("事件发生用户")
+        private String userId;
+
+        @JsonProperty("Role")
+        @ApiModelProperty("用户角色")
+        private String role;
+
+        @JsonProperty("TerminalType")
+        @ApiModelProperty("终端类型")
+        private String terminalType;
+
+        @JsonProperty("UserType")
+        @ApiModelProperty("用户类型")
+        private String userType;
+
+        @JsonProperty("Reason")
+        @ApiModelProperty("原因")
+        private String reason;
+    }
 }

+ 21 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CourseSchedule.java

@@ -207,6 +207,12 @@ public class CourseSchedule  extends BaseEntity{
 	//当前课程是否是转换课
 	private Boolean convertFlag = false;
 
+	@ApiModelProperty("服务提供方")
+	private String serviceProvider;
+
+	@ApiModelProperty("全员静音")
+	private Boolean muteAll;
+
 	public Boolean getSettlementReportFlag() {
 		return settlementReportFlag;
 	}
@@ -661,6 +667,21 @@ public class CourseSchedule  extends BaseEntity{
 		this.teacher = teacher;
 	}
 
+	public String getServiceProvider() {
+		return serviceProvider;
+	}
+
+	public void setServiceProvider(String serviceProvider) {
+		this.serviceProvider = serviceProvider;
+	}
+
+	public Boolean getMuteAll() {
+		return muteAll;
+	}
+
+	public void setMuteAll(Boolean muteAll) {
+		this.muteAll = muteAll;
+	}
 
 	public static CourseScheduleType getCourseScheduleTypeByCode(String code) {
 		CourseScheduleType type = null;

+ 47 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/ETencentTRTCCallbackCommand.java

@@ -0,0 +1,47 @@
+package com.ym.mec.biz.dal.enums;
+
+import lombok.Getter;
+
+/**
+ * Description
+ *
+ * @author liujunchi
+ * @date 2023-03-02
+ */
+@Getter
+public enum ETencentTRTCCallbackCommand {
+
+    EVENT_TYPE_CREATE_ROOM("101", "创建房间"),
+    EVENT_TYPE_DISMISS_ROOM("102", "解散房间"),
+    EVENT_TYPE_ENTER_ROOM("103", "进入房间"),
+    EVENT_TYPE_EXIT_ROOM("104", "退出房间"),
+    EVENT_DEFAULT("-1", "默认无效事件"),
+    ;
+
+    private final String command;
+    private final String desc;
+
+    private final Integer code;
+
+    ETencentTRTCCallbackCommand(String command, String desc) {
+        this.command = command;
+        this.desc = desc;
+
+        // 枚举转换对象
+        this.code = Integer.parseInt(command);
+    }
+
+    /**
+     * 回调事件对象枚举
+     * @param eventType 事件类型
+     * @return ETencentTRTCCallbackCommand
+     */
+    public static ETencentTRTCCallbackCommand get(Integer eventType) {
+        for (ETencentTRTCCallbackCommand e : ETencentTRTCCallbackCommand.values()) {
+            if (e.getCode().equals(eventType)) {
+                return e;
+            }
+        }
+        return EVENT_DEFAULT;
+    }
+}

+ 6 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/SysConfigService.java

@@ -398,6 +398,12 @@ public interface SysConfigService extends BaseService<Long, SysConfig> {
     //机构云教室账户余额提醒
     String TENANT_CLOUD_ROOM_BALANCE_NOTICE = "tenant_cloud_room_balance_notice_";
 
+    // 网络教室服务提供方配置
+    String RTC_SERVICE_PROVIDER = "rtc_service_provider";
+
+    // 按分部强制开始为腾讯服务提供
+    String TENCENT_RTC_SERVICE_PROVIDER = "tencent_rtc_service_provider";
+
     static void checkActivityDate(String startTimeStr, String endTimeStr) {
         if(StringUtils.isEmpty(startTimeStr) || StringUtils.isEmpty(startTimeStr)){
             return;

+ 5 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -30,7 +30,9 @@ import com.ym.mec.util.date.DateConvertor;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.json.JsonUtil;
 
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.ListUtils;
+import org.apache.commons.collections.MapUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -63,6 +65,7 @@ import static com.ym.mec.biz.dal.enums.PracticeGroupType.FREE;
 import static com.ym.mec.biz.dal.enums.PracticeGroupType.TRIAL;
 import static com.ym.mec.biz.dal.enums.SysUserRoleEnum.ORGAN_MANAGER;
 
+@Slf4j
 @Service
 public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSchedule> implements CourseScheduleService {
 
@@ -1126,8 +1129,8 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
             } else {
                 courseScheduleDto.setStatus(CourseStatusEnum.UNDERWAY);
             }
-            courseScheduleDto.setSubjectName(subjectNameCourseMap.get(courseScheduleDto.getId().intValue()));
-            courseScheduleDto.setSubjectId(subjectIdCourseMap.get(courseScheduleDto.getId().intValue()));
+            courseScheduleDto.setSubjectName(MapUtils.getString(subjectNameCourseMap, courseScheduleDto.getId()));
+            courseScheduleDto.setSubjectId(MapUtils.getString(subjectIdCourseMap, courseScheduleDto.getId()));
 			courseScheduleDto.setReviewId(reviewIdMap.get(courseScheduleDto.getId().intValue()));
 			courseScheduleDto.setStudentReviewId(StudentReviewIdMap.get(courseScheduleDto.getId()));
 			if(CourseScheduleType.PRACTICE.equals(courseScheduleDto.getType())&&Objects.nonNull(courseScheduleDto.getMusicGroupId())){

+ 22 - 1
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -44,6 +44,8 @@
         <result column="evaluate_flag_" property="evaluateFlag"/>
         <result column="convert_flag_" property="convertFlag"/>
         <result column="settlement_report_flag_" property="settlementReportFlag"/>
+        <result column="service_provider_" property="serviceProvider"/>
+        <result column="mute_all_" property="muteAll"/>
     </resultMap>
 
     <resultMap type="com.ym.mec.biz.dal.dto.Mapper" id="Mapper">
@@ -174,7 +176,9 @@
         cs.valid_start_time_,
         cs.pre_course_flag_,
         cs.tenant_id_,
-        cs.evaluate_flag_
+        cs.evaluate_flag_,
+        cs.service_provider_,
+        cs.mute_all_
     </sql>
 
     <sql id="courseIgnore">
@@ -4132,6 +4136,23 @@
         SELECT COUNT(*) FROM course_schedule where settlement_report_flag_ = 1 and id_ = #{courseScheduleId}
     </select>
 
+    <update id="updateServiceProvider">
+        UPDATE course_schedule
+        SET service_provider_ = #{serviceProvider},
+            update_time_ = NOW()
+        WHERE id_ = #{courseScheduleId}
+    </update>
+
+    <!--更新全员静音状态-->
+    <update id="updateGroupMuteAllStatus">
+        UPDATE course_schedule
+        SET mute_all_ = #{muteAll},
+            update_time_ = NOW()
+        WHERE id_ = #{courseScheduleId}
+    </update>
+    <!--更新全员静音状态-->
+
+
     <sql id="selectPage">
         <if test="param.teacherId != null">
                 and ( cs.actual_teacher_id_ = #{param.teacherId})

+ 6 - 0
mec-biz/src/main/resources/config/mybatis/VipGroupMapper.xml

@@ -1060,4 +1060,10 @@
             AND cg.del_flag_!=1
             AND cgsm.user_id_=#{studentId}
     </select>
+
+    <!--获取课程人数-->
+    <select id="getCourseStudentNumsByGroupId" resultType="java.lang.Integer">
+        SELECT t2.student_num_ FROM vip_group t1 JOIN vip_group_category t2 ON (t1.vip_group_category_id_ = t2.id_) WHERE t1.id_ = #{groupId}
+    </select>
+    <!--获取课程人数-->
 </mapper>

+ 1 - 1
mec-im/src/main/java/com/ym/SealClassConfiguration.java

@@ -61,7 +61,7 @@ public class SealClassConfiguration {
                 supportedMediaTypes.add(MediaType.MULTIPART_FORM_DATA);
                 converter.setSupportedMediaTypes(supportedMediaTypes);
                 FastJsonConfig fastJsonConfig = new FastJsonConfig();
-                fastJsonConfig.setSerializerFeatures(SerializerFeature.WriteMapNullValue, SerializerFeature.PrettyFormat);
+                fastJsonConfig.setSerializerFeatures(SerializerFeature.WriteMapNullValue, SerializerFeature.PrettyFormat, SerializerFeature.DisableCircularReferenceDetect);
                 converter.setFastJsonConfig(fastJsonConfig);
                 converters.add(converter);
             }

+ 1 - 1
mec-im/src/main/java/com/ym/config/ResourceServerConfig.java

@@ -26,7 +26,7 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
                         "/room/statusImMsg", "/group/batchDismiss", "/private/send", "/group/send", "/user/tencentImCallback",
                         "/group/dismiss", "/room/statusImMsg", "/history/get", "/user/statusImUser", "/liveRoom/recordSync",
                         "/liveRoom/publishRoomMsg", "/liveRoom/destroy", "/liveRoom/create", "/liveRoom/startRecord",
-                        "/liveRoom/stopRecord", "/liveRoom/userExistInRoom","/liveRoom/checkOnline",
+                        "/liveRoom/stopRecord", "/liveRoom/userExistInRoom","/liveRoom/checkOnline","/room/statusSyncTencent",
                         "/user/tencentStreamEventCallback", "/user/tencentStreamRecordCallback", "/user/tencentStreamExceptionCallback",
                         "/liveRoom/addUserUnableSpeak","/liveRoom/removeUserUnableSpeak","/liveRoom/syncChatRoomStatus","/liveRoom/tencentImCallback")
                 .permitAll().anyRequest().authenticated().and().csrf().disable();

+ 61 - 5
mec-im/src/main/java/com/ym/controller/RoomController.java

@@ -2,15 +2,21 @@ package com.ym.controller;
 
 import com.alibaba.fastjson.JSONObject;
 import com.ym.common.BaseResponse;
+import com.ym.mec.biz.dal.dto.TencentData;
+import com.ym.mec.biz.dal.enums.ETencentTRTCCallbackCommand;
 import com.ym.pojo.*;
 import com.ym.service.MessageService;
 import com.ym.service.RoomService;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.joda.time.DateTime;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
+import java.util.Objects;
 
 @RestController
 @RequestMapping("/room")
@@ -23,7 +29,16 @@ public class RoomController{
 
     @RequestMapping(value = "/join", method = RequestMethod.POST)
     public BaseResponse joinRoom(@RequestBody ReqUserData data) throws Exception {
-        return roomService.joinRoom(data.getRoomId());
+        return roomService.joinRoom(data.getRoomId(), true);
+    }
+
+    @ApiOperation("查询网络教室信息")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "roomId", value = "房间id", required = true, dataType = "String", paramType = "query")
+    })
+    @GetMapping(value = "/info")
+    public BaseResponse getRoomInfo(@RequestParam String roomId) throws Exception {
+        return roomService.joinRoom(roomId.substring(1), false);
     }
 
     @RequestMapping(value = "/signIn", method = RequestMethod.POST)
@@ -39,7 +54,7 @@ public class RoomController{
     @RequestMapping(value = "/leave", method = RequestMethod.POST)
     public Object leaveRoom(@RequestBody RoomStatusNotify roomStatusNotify) throws Exception {
         //成员退出
-        roomService.leaveRoomSuccess(roomStatusNotify.getRoomId(), roomStatusNotify.getUserId(),roomStatusNotify.getDeviceNum());
+        roomService.leaveRoomSuccess(roomStatusNotify.getRoomId(), roomStatusNotify.getUserId(), roomStatusNotify.getDeviceNum());
         return new BaseResponse<>();
     }
 
@@ -96,7 +111,7 @@ public class RoomController{
                     break;
                 case 12:
                     //成员退出
-                    roomService.leaveRoomSuccess(roomId, userId,null);
+                    roomService.leaveRoomSuccess(roomId, userId,null, notify.getTimestamp());
                     break;
             }
         }catch (Exception e){
@@ -104,6 +119,43 @@ public class RoomController{
         }
     }
 
+
+    @PostMapping(value = "/statusSyncTencent")
+    public void statusSyncTencent(@RequestBody TencentData.TRTCEventInfo eventInfo) {
+        try {
+            if (Objects.isNull(eventInfo.getEventInfo())) {
+                log.warn("statusSyncTencent eventInfo is null, time={}", DateTime.now().toString("yyy-MM-dd HH:mm:ss"));
+                return;
+            }
+            log.info("statusSyncTencent: {}", eventInfo.jsonString());
+            String roomId = eventInfo.getEventInfo().getRoomId();
+
+            // 网络教室回调整消息
+            if (roomId.startsWith("S") || roomId.startsWith("I")) {
+                // 进出用户信息
+                String userId = eventInfo.getEventInfo().getUserId();
+                switch (ETencentTRTCCallbackCommand.get(eventInfo.getEventType())){
+                    case EVENT_TYPE_ENTER_ROOM:
+                        //成员加入
+                        roomService.joinRoomSuccess(roomId, userId,null);
+                        break;
+                    case EVENT_TYPE_EXIT_ROOM:
+                        //成员退出
+                        roomService.leaveRoomSuccess(roomId, userId,null, eventInfo.getCallbackTs());
+                        break;
+                    default:
+                        // 默认事件,直接忽略
+                        break;
+                }
+            }
+
+            // 直播回调整消息, roomId.startsWith("LIVE")
+
+        }catch (Exception e){
+            log.error("statusSyncTencent event={}", eventInfo.jsonString(), e);
+        }
+    }
+
     @RequestMapping(value = "/downgrade", method = RequestMethod.POST)
     public Object downRole(@RequestBody ReqChangeUserRoleData data)
             throws Exception {
@@ -209,10 +261,14 @@ public class RoomController{
         return new BaseResponse<>(result);
     }
 
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "roomId", value = "房间id", required = true, dataType = "String"),
+            @ApiImplicitParam(name = "userId", value = "用户Id", dataType = "String"),
+    })
     @RequestMapping(value = "/members", method = RequestMethod.GET)
-    public Object getMembers(@RequestParam String roomId)
+    public Object getMembers(@RequestParam String roomId, @RequestParam String userId)
             throws Exception {
-        List<RoomResult.MemberResult> whiteboards = roomService.getMembers(roomId);
+        List<RoomResult.MemberResult> whiteboards = roomService.getMembers(roomId, userId);
         return new BaseResponse<>(whiteboards);
     }
 

+ 19 - 0
mec-im/src/main/java/com/ym/dao/RoomMemberDao.java

@@ -58,4 +58,23 @@ public interface RoomMemberDao extends JpaRepository<RoomMember, Long> {
     int updateMusicByRidAndUid(String rid, String uid, boolean musicMode);
 
     boolean existsByRidAndUid(String rid, String uid);
+
+    @Modifying
+    @Query(value = "update rongyun_room_member set camera=?3 where rid=?1 and role=?2", nativeQuery = true)
+    void updateCameraByRidAndRole(String roomId, int role, boolean enable);
+
+
+    @Modifying
+    @Query(value = "update rongyun_room_member set mic=?3 where rid=?1 and role=?2", nativeQuery = true)
+    void updateMicByRidAndRole(String roomId, int role, boolean enable);
+
+
+    @Modifying
+    @Query(value = "update rongyun_room_member set music_mode=?3 where rid=?1 and role=?2", nativeQuery = true)
+    void updateMusicByRidAndRole(String roomId, int role, boolean enable);
+
+
+    @Modifying
+    @Query(value = "update rongyun_room_member set hand=?3 where rid=?1 and role=?2", nativeQuery = true)
+    void updateHandByRidAndRole(String roomId, int role, boolean enable);
 }

+ 18 - 7
mec-im/src/main/java/com/ym/enums/DeviceTypeEnum.java

@@ -1,11 +1,22 @@
 package com.ym.enums;
 
 public enum DeviceTypeEnum {
-    Microphone,
-    Camera,
-    MusicMode,
-    HandUp,
-    ExamSong,
-    MusicScore,
-    MusicScoreAccompaniment,
+    Microphone(1),
+    Camera(2),
+    MusicMode(3),
+    HandUp(4),
+    ExamSong(5),
+    MusicScore(6),
+    MusicScoreAccompaniment(7),;
+
+
+    private int value;
+
+    DeviceTypeEnum(int value) {
+        this.value = value;
+    }
+
+    public int getValue() {
+        return value;
+    }
 }

+ 52 - 0
mec-im/src/main/java/com/ym/pojo/ReqDeviceControlData.java

@@ -2,6 +2,8 @@ package com.ym.pojo;
 
 import lombok.Data;
 
+import java.util.Optional;
+
 @Data
 public class ReqDeviceControlData {
 	private Boolean cameraOn;
@@ -16,12 +18,19 @@ public class ReqDeviceControlData {
 
 	private String roomId;
 	private String userId;
+	private String userName;
 	private String ticket;
 	private Integer status;
 	private Integer examSongId;
 	private Integer musicScoreAccompanimentId;
 	//伴奏音量
 	private Integer soundVolume = 100;
+	// 服务提供方
+	private String serviceProvider;
+	// 发送用户信息
+	private String sendUserId;
+	private String sendUserName;
+	private String avatar;
 
 	public Integer getMusicScoreAccompanimentId() {
 		return musicScoreAccompanimentId;
@@ -102,4 +111,47 @@ public class ReqDeviceControlData {
 		this.ticket = ticket;
 	}
 
+	public String getServiceProvider() {
+		return serviceProvider;
+	}
+
+	public void setServiceProvider(String serviceProvider) {
+		this.serviceProvider = serviceProvider;
+	}
+
+	public String getSendUserId() {
+		return sendUserId;
+	}
+
+	public void setSendUserId(String sendUserId) {
+		this.sendUserId = sendUserId;
+	}
+
+	public String getSendUserName() {
+		return sendUserName;
+	}
+
+	public void setSendUserName(String sendUserName) {
+		this.sendUserName = sendUserName;
+	}
+
+	public String getAvatar() {
+		return avatar;
+	}
+
+	public void setAvatar(String avatar) {
+		this.avatar = avatar;
+	}
+
+	public String getUserName() {
+		return userName;
+	}
+
+	public void setUserName(String userName) {
+		this.userName = userName;
+	}
+
+	public Integer getSoundVolume() {
+		return Optional.ofNullable(soundVolume).orElse(100);
+	}
 }

+ 25 - 0
mec-im/src/main/java/com/ym/pojo/RoomResult.java

@@ -2,7 +2,9 @@ package com.ym.pojo;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.microsvc.toolkit.middleware.rtc.message.RTCRoomConfig;
 import com.ym.mec.biz.dal.entity.CourseScheduleStudentMusicScore;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Getter;
 import lombok.Setter;
@@ -35,6 +37,27 @@ public class RoomResult {
     private @Getter @Setter MemberResult userInfo;
     private @Getter @Setter String randomNumeric = "0";
 
+    @ApiModelProperty("RTC接入参数")
+    private @Getter @Setter RTCRoomConfig rtcRoomConfig;
+    @ApiModelProperty("直播间用户签名")
+    private @Getter @Setter String userSig;
+    @ApiModelProperty("群组id")
+    private @Getter @Setter String groupId;
+    @ApiModelProperty("服务提供商")
+    private @Getter @Setter String serviceProvider;
+    @ApiModelProperty("课程人数")
+    private @Getter @Setter Integer studentNums;
+
+    public RoomResult rtcRoomConfig(RTCRoomConfig rtcRoomConfig) {
+        this.rtcRoomConfig = rtcRoomConfig;
+        return this;
+    }
+
+    public RoomResult userSig(String userSig) {
+        this.userSig = userSig;
+        return this;
+    }
+
     @Data
     public static class MemberResult {
         String userId;
@@ -93,4 +116,6 @@ public class RoomResult {
             whiteboards.add(r);
         }
     }
+
+
 }

文件差異過大導致無法顯示
+ 628 - 65
mec-im/src/main/java/com/ym/service/Impl/RoomServiceImpl.java


+ 12 - 2
mec-im/src/main/java/com/ym/service/RoomService.java

@@ -12,7 +12,7 @@ import java.util.List;
  */
 public interface RoomService {
     //everyone
-    BaseResponse joinRoom(String roomId) throws Exception;
+    BaseResponse joinRoom(String roomId, Boolean joinRoom) throws Exception;
 
     Integer getCurrentCourseId(String roomId);
 
@@ -25,6 +25,16 @@ public interface RoomService {
 
     void leaveRoomSuccess(String roomId,String userId,String deviceNum) throws Exception;
 
+    /**
+     * 事件回调通知
+     * @param roomId 房间编号
+     * @param userId 用户编号
+     * @param deviceNum 设备编号
+     * @param callbackTs 事件回调时间
+     * @throws Exception Exception
+     */
+    void leaveRoomSuccess(String roomId,String userId,String deviceNum, Long callbackTs) throws Exception;
+
     //only teacher
     Boolean display(String roomId, int type, String uri, String userId) throws Exception;
 
@@ -45,7 +55,7 @@ public interface RoomService {
     Boolean rejectControlDevice(String roomId, String ticket) throws Exception;
 
 
-    List<RoomResult.MemberResult> getMembers(String roomId) throws  Exception;
+    List<RoomResult.MemberResult> getMembers(String roomId, String userId) throws  Exception;
 
     Boolean applySpeech(String roomId) throws  Exception;
 

+ 17 - 0
mec-im/src/test/resources/application.yml

@@ -0,0 +1,17 @@
+
+# JPA配置
+spring:
+  jpa:
+    show-sql: true
+    properties:
+      hibernate:
+        show_sql: true
+        format_sql: true
+        use_sql_comments: true
+    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+
+# JPA参数打印
+logging:
+  level:
+    org.hibernate.SQL: debug
+    org.hibernate.type.descriptor.sql.BasicBinder: trace

+ 7 - 0
mec-student/src/main/java/com/ym/mec/student/config/WebMvcConfig.java

@@ -1,5 +1,7 @@
 package com.ym.mec.student.config;
 
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.alibaba.fastjson.support.config.FastJsonConfig;
 import com.ym.mec.common.config.EnumConverterFactory;
 import com.ym.mec.common.config.LocalFastJsonHttpMessageConverter;
 import com.ym.mec.student.interceptor.MDCInterceptor;
@@ -54,6 +56,11 @@ public class WebMvcConfig implements WebMvcConfigurer {
 		List<MediaType> fastMediaTypes = new ArrayList<MediaType>();
 		fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
 		converter.setSupportedMediaTypes(fastMediaTypes);
+
+		/*FastJsonConfig fastJsonConfig = new FastJsonConfig();
+		fastJsonConfig.setSerializerFeatures(SerializerFeature.WriteMapNullValue, SerializerFeature.PrettyFormat, SerializerFeature.DisableCircularReferenceDetect);
+		converter.setFastJsonConfig(fastJsonConfig);*/
+
 		return new HttpMessageConverters(converter);
 	}
 }

+ 7 - 0
mec-teacher/src/main/java/com/ym/mec/teacher/config/WebMvcConfig.java

@@ -1,5 +1,7 @@
 package com.ym.mec.teacher.config;
 
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.alibaba.fastjson.support.config.FastJsonConfig;
 import com.ym.mec.common.config.EnumConverterFactory;
 import com.ym.mec.common.config.LocalFastJsonHttpMessageConverter;
 import com.ym.mec.teacher.interceptor.MDCInterceptor;
@@ -54,6 +56,11 @@ public class WebMvcConfig implements WebMvcConfigurer {
         List<MediaType> fastMediaTypes =  new ArrayList<MediaType>();
         fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
         converter.setSupportedMediaTypes(fastMediaTypes);
+
+		/*FastJsonConfig fastJsonConfig = new FastJsonConfig();
+		fastJsonConfig.setSerializerFeatures(SerializerFeature.WriteMapNullValue, SerializerFeature.PrettyFormat, SerializerFeature.DisableCircularReferenceDetect);
+		converter.setFastJsonConfig(fastJsonConfig);*/
+
         return new HttpMessageConverters(converter);
     }
 

+ 7 - 0
mec-web/src/main/java/com/ym/mec/web/config/WebMvcConfig.java

@@ -3,6 +3,8 @@ package com.ym.mec.web.config;
 import java.util.ArrayList;
 import java.util.List;
 
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.alibaba.fastjson.support.config.FastJsonConfig;
 import com.ym.mec.web.interceptor.TenantInterceptor;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
@@ -45,6 +47,11 @@ public class WebMvcConfig implements WebMvcConfigurer {
 		List<MediaType> fastMediaTypes = new ArrayList<MediaType>();
 		fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
 		converter.setSupportedMediaTypes(fastMediaTypes);
+
+		/*FastJsonConfig fastJsonConfig = new FastJsonConfig();
+		fastJsonConfig.setSerializerFeatures(SerializerFeature.WriteMapNullValue, SerializerFeature.PrettyFormat, SerializerFeature.DisableCircularReferenceDetect);
+		converter.setFastJsonConfig(fastJsonConfig);*/
+
 		return new HttpMessageConverters(converter);
 	}
 }

部分文件因文件數量過多而無法顯示