zouxuan 5 years ago
parent
commit
a17c6c854f

+ 1 - 1
edu-im/edu-im-server/src/main/java/com/keao/edu/im/controller/RoomController.java

@@ -99,7 +99,7 @@ public class RoomController{
         if(notify.getEvent() == 12 || notify.getEvent() == 3){
 //            result = roomService.statusSync(notify.getChannelId(), notify.getUserId());
         }else if(notify.getEvent() == 11){
-            roomService.startRecord(notify.getChannelId());
+            roomService.startRecord(notify.getChannelId(),notify.getUserId());
 //            Teacher teacher = teacherDao.get(Integer.parseInt(notify.getUserId()));
 //            Long roomId = Long.parseLong(notify.getChannelId().substring(1));
 //            CourseSchedule courseSchedule = courseScheduleDao.get(roomId);

+ 6 - 5
edu-im/edu-im-server/src/main/java/com/keao/edu/im/mec/im/IMHelper.java

@@ -10,6 +10,7 @@ import com.keao.edu.im.pojo.IMTokenInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Component;
 
 import java.net.HttpURLConnection;
@@ -226,11 +227,11 @@ public class IMHelper {
      * @return
      * @throws Exception
      */
-    public IMApiResultInfo startRecord(String hostUserId, String roomId) throws Exception {
+    @Async
+    public IMApiResultInfo startRecord(String hostUserId, String roomId,Long registrationId) throws Exception {
         if (hostUserId == null) {
             throw new IllegalArgumentException("Paramer 'hostUserId' is required");
         }
-
         if (roomId == null) {
             throw new IllegalArgumentException("Paramer 'roomId' is required");
         }
@@ -242,17 +243,17 @@ public class IMHelper {
         jsonObject.put("mixLayout",3);
         jsonObject.put("sliceMin",60);
         jsonObject.put("hostUserId",hostUserId);
+        jsonObject.put("extra",registrationId);
         JSONObject json = new JSONObject();
-        String sessionId = roomQuery(roomId);
-        json.put("sessionId",sessionId);
+        json.put("sessionId",roomQuery(roomId));
         json.put("config",jsonObject);
 
         String body = json.toJSONString();
 
+        Thread.sleep(1000l);
         HttpURLConnection conn = httpHelper.createIMRtcPostHttpConnection("/rtc/record/start.json", "application/json",roomId);
         httpHelper.setBodyParameter(body, conn);
         IMApiResultInfo resultInfo = JSON.parseObject(httpHelper.returnResult(conn, body), IMApiResultInfo.class);
-        resultInfo.setSessionId(sessionId);
         return resultInfo;
     }
 

+ 0 - 2
edu-im/edu-im-server/src/main/java/com/keao/edu/im/pojo/IMApiResultInfo.java

@@ -11,8 +11,6 @@ public class IMApiResultInfo {
     Integer code;
     // 错误信息。
     String errorMessage;
-    // 错误信息。
-    String sessionId;
 
     public boolean isSuccess() {
         return code == 200;

+ 5 - 6
edu-im/edu-im-server/src/main/java/com/keao/edu/im/service/Impl/RoomServiceImpl.java

@@ -87,10 +87,9 @@ public class RoomServiceImpl implements RoomService {
     }
 
     @Override
-    public void startRecord(String roomId) throws Exception {
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        Integer userId = sysUser.getId();
-        ExamRoom examRoom = eduUserFeignService.getExamRoom(Integer.parseInt(roomId));
+    public void startRecord(String roomId,String userId) throws Exception {
+
+        /*ExamRoom examRoom = eduUserFeignService.getExamRoom(Integer.parseInt(roomId));
         boolean isAssistant = false;
         if (StringUtils.isNotEmpty(examRoom.getAssistantTeacherUserIdList())){
             List<String> list = Arrays.asList(examRoom.getAssistantTeacherUserIdList().split(","));
@@ -104,7 +103,7 @@ public class RoomServiceImpl implements RoomService {
             return;
         }else {
             imHelper.startRecord(userId.toString(), roomId);
-        }
+        }*/
     }
 
     @Override
@@ -365,7 +364,7 @@ public class RoomServiceImpl implements RoomService {
                 eduUserFeignService.updateFinishedExam(registrationId,0);
             }
             this.publishMessage(eduUserFeignService.getPublishMessage(registrationId));
-//            IMApiResultInfo imApiResultInfo = imHelper.startRecord(userId, roomId);
+            imHelper.startRecord(userId, roomId,registrationId);
 //            eduUserFeignService.updateSessionId(registrationId,imApiResultInfo.getSessionId());
         }
         return baseResponse;

+ 1 - 1
edu-im/edu-im-server/src/main/java/com/keao/edu/im/service/RoomService.java

@@ -20,7 +20,7 @@ public interface RoomService {
 
     void roomQuery(String roomId) throws Exception;
 
-    void startRecord(String roomId) throws Exception;
+    void startRecord(String roomId,String userId) throws Exception;
 
     void stopRecord(String roomId) throws Exception;
 

+ 1 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRoomStudentRelationServiceImpl.java

@@ -482,7 +482,7 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 		if(examStatus != null && examStatus == 0){
 			//未完成
 			examRoomStudentRelationDao.cleanSignInTime(examRoomStudentRelation.getExamRegistrationId());
-			studentExamResultDao.updateFinishedExam(examRoomStudentRelation.getExamRegistrationId(),2);
+			studentExamResultDao.updateFinishedExam(examRoomStudentRelation.getExamRegistrationId(),3);
 		}else {
 			//结束考试
 			studentExamResultDao.updateFinishedExam(examRoomStudentRelation.getExamRegistrationId(),5);