|
@@ -78,7 +78,7 @@ public class RoomServiceImpl implements RoomService {
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class, isolation = Isolation.SERIALIZABLE)
|
|
|
- public void joinRoomSuccess(Long registrationId,String roomId,String userId,String msid) throws Exception {
|
|
|
+ public void joinRoomSuccess(Long registrationId,String roomId,String userId) throws Exception {
|
|
|
StudentExamResultApiDto examResult = null;
|
|
|
log.info("joinRoomSuccess: roomId={}, isAudience={}, isDisableCamera={},isMusicMode={}", roomId);
|
|
|
|
|
@@ -160,10 +160,10 @@ public class RoomServiceImpl implements RoomService {
|
|
|
}
|
|
|
this.publishMessage(eduUserFeignService.getPublishMessage(registrationId));
|
|
|
eduUserFeignService.upsetStudentAttendance(registrationId,0);
|
|
|
- imHelper.startRecord(roomId, registrationId,msid);
|
|
|
+ imHelper.startRecord(roomId, registrationId);
|
|
|
}else {
|
|
|
eduUserFeignService.upsetTeacherAttendance(examRoom.getId(),sysUser.getId(),0);
|
|
|
- imHelper.configRecord(roomId,roomMembers,msid);
|
|
|
+ imHelper.configRecord(roomId);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -286,7 +286,7 @@ public class RoomServiceImpl implements RoomService {
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class, isolation = Isolation.SERIALIZABLE)
|
|
|
- public void leaveRoomSuccess(Long registrationId,String roomId,String userId,String msid) throws Exception {
|
|
|
+ public void leaveRoomSuccess(Long registrationId,String roomId,String userId) throws Exception {
|
|
|
if(registrationId != null){
|
|
|
StudentExamResultApiDto examResult = eduUserFeignService.getExamResult(registrationId);
|
|
|
roomId = examResult.getRoomId();
|
|
@@ -327,7 +327,7 @@ public class RoomServiceImpl implements RoomService {
|
|
|
imHelper.stopRecord(roomId);
|
|
|
}else {
|
|
|
eduUserFeignService.upsetTeacherAttendance(Long.parseLong(roomId),Integer.parseInt(userId),1);
|
|
|
- imHelper.configRecord(roomId,roomMemberDao.findByRidAndMsidFlag(roomId,true),msid);
|
|
|
+ imHelper.configRecord(roomId);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1258,14 +1258,9 @@ public class RoomServiceImpl implements RoomService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
|
- public boolean statusSync(ChannelStateNotify notify) throws Exception {
|
|
|
- log.info("statusSync notify:{}",notify);
|
|
|
- String roomId = notify.getChannelId();
|
|
|
- String userId = notify.getUserId();
|
|
|
- RoomMember roomMember = roomMemberDao.findByRidAndUid(roomId, userId);
|
|
|
- log.info("statusSync roomMember:{}",roomMember);
|
|
|
+ public static void main(String[] args) {
|
|
|
+ String body = "{\"members\":[],\"appKey\":\"mgb7ka1nme0yg\",\"sessionId\":\"hjcKwEaRIm8scdSeDHgF7A\",\"event\":11,\"userId\":\"113\",\"channelId\":\"31\",\"timestamp\":1598235225551,\"token\":\"\"}";
|
|
|
+ ChannelStateNotify notify = JSONObject.parseObject(body, ChannelStateNotify.class);
|
|
|
String msidStr = null;
|
|
|
boolean msidFlag = false;
|
|
|
List<Member> members = notify.getMembers();
|
|
@@ -1279,6 +1274,17 @@ public class RoomServiceImpl implements RoomService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
|
+ public boolean statusSync(ChannelStateNotify notify) throws Exception {
|
|
|
+ log.info("statusSync notify:{}",notify);
|
|
|
+ String roomId = notify.getChannelId();
|
|
|
+ String userId = notify.getUserId();
|
|
|
+ RoomMember roomMember = roomMemberDao.findByRidAndUid(roomId, userId);
|
|
|
+ log.info("statusSync roomMember:{}",roomMember);
|
|
|
+
|
|
|
if(roomMember == null){
|
|
|
return false;
|
|
|
}
|
|
@@ -1291,14 +1297,39 @@ public class RoomServiceImpl implements RoomService {
|
|
|
redisTemplate.delete("sessionId:" + roomId);
|
|
|
}else if(notify.getEvent() == 11){
|
|
|
//成员加入
|
|
|
- roomMemberDao.updateMsidByRidAndUid(roomId,userId,msidFlag);
|
|
|
- joinRoomSuccess(roomMember.getExamRegistrationId(),roomId,userId,msidStr);
|
|
|
+// roomMemberDao.updateMsidByRidAndUid(roomId,userId,msidFlag);
|
|
|
+ joinRoomSuccess(roomMember.getExamRegistrationId(),roomId,userId);
|
|
|
}else if(notify.getEvent() == 12){
|
|
|
//成员退出
|
|
|
- roomMemberDao.updateMsidByRidAndUid(roomId,userId,msidFlag);
|
|
|
- leaveRoomSuccess(roomMember.getExamRegistrationId(),roomId,userId,msidStr);
|
|
|
+// roomMemberDao.updateMsidByRidAndUid(roomId,userId,msidFlag);
|
|
|
+ leaveRoomSuccess(roomMember.getExamRegistrationId(),roomId,userId);
|
|
|
}else if(notify.getEvent() == 20){
|
|
|
+ boolean msidFlag = false;
|
|
|
+ Integer state = null;
|
|
|
+ List<Member> members = notify.getMembers();
|
|
|
+ if(members != null && members.size() != 0){
|
|
|
+ Object uris = JSONObject.parseObject(members.get(0).getData().toJSONString()).get("uris");
|
|
|
+ if(uris != null){
|
|
|
+ List<UrisDto> jsonArray = JSONObject.parseArray(uris.toString(),UrisDto.class);
|
|
|
+ for (UrisDto urisDto : jsonArray) {
|
|
|
+ //视频流
|
|
|
+ if(urisDto.getMediaType() == 1){
|
|
|
+ state = urisDto.getState();
|
|
|
+ if(state == 1){
|
|
|
+ msidFlag = true;
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ //音频流
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //同步录制资源
|
|
|
//资源发生变动
|
|
|
+ if(state == null || state == 0 || !msidFlag){
|
|
|
+ roomMemberDao.updateMsidByRidAndUid(roomId,userId,msidFlag);
|
|
|
+ imHelper.configRecord(roomId);
|
|
|
+ }
|
|
|
}
|
|
|
return true;
|
|
|
}
|