zouxuan 5 lat temu
rodzic
commit
14f7c23fd5

+ 7 - 9
edu-im/edu-im-server/src/main/java/com/keao/edu/im/mec/im/IMHelper.java

@@ -252,11 +252,14 @@ public class IMHelper {
         jsonObject.put("hostUserId",hostUserId);
         jsonObject.put("hostStreamId",hostUserId);
         JSONObject json = new JSONObject();
-        json.put("sessionId",roomQuery(roomId));
+        String sessionId = redisTemplate.opsForValue().get("sessionId:" + roomId);
+        if(StringUtils.isEmpty(sessionId)){
+            sessionId = roomQuery(roomId);
+            redisTemplate.opsForValue().set("sessionId:" + roomId,sessionId);
+        }
+        json.put("sessionId",sessionId);
         json.put("config",jsonObject);
 
-
-
         /*JSONObject jsonObject = new JSONObject();
         jsonObject.put("mode",3);
         jsonObject.put("videoFormat","mp4");
@@ -293,12 +296,6 @@ public class IMHelper {
         JSONObject jsonObject1 = new JSONObject();
         jsonObject1.put("video",jsonArray);
         jsonObject.put("input",jsonObject1);*/
-
-
-        json.put("sessionId",roomQuery(roomId));
-        json.put("config",jsonObject);
-
-
         String body = json.toJSONString();
 
         Thread.sleep(1000l);
@@ -421,6 +418,7 @@ public class IMHelper {
         if("200".equals(code)){
             return resultObject.get("sessionId").toString();
         }else {
+            log.error("获取sessionId失败 returnResult:{}",returnResult);
             throw new BizException("获取sessionId失败");
         }
     }

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

@@ -28,11 +28,10 @@ import com.keao.edu.user.api.client.EduUserFeignService;
 import com.keao.edu.user.api.entity.ExamRoom;
 import com.keao.edu.user.api.entity.ExamRoomStudentRelation;
 import com.keao.edu.user.api.enums.StudentExamResultApiDto;
-import com.keao.edu.util.date.DateUtil;
-import io.swagger.models.auth.In;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Transactional;
@@ -78,6 +77,9 @@ public class RoomServiceImpl implements RoomService {
     @Autowired
     private EduUserFeignService eduUserFeignService;
 
+    @Autowired
+    private RedisTemplate<String,String> redisTemplate;
+
     @Override
     public void roomQuery(String roomId) throws Exception {
         imHelper.roomQuery(roomId);
@@ -584,6 +586,7 @@ public class RoomServiceImpl implements RoomService {
             });
             roomDao.deleteByRid(roomId.toString());
             imHelper.dismiss(userId,roomId.toString());
+            redisTemplate.delete("sessionId:" + roomId);
         }
     }
 

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

@@ -688,7 +688,6 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 	private void currentStudent(Long examRoomStudentRelationId,Boolean isPush,Integer examStatus,Integer operator){
 		ExamRoomStudentRelation examRoomStudentRelation = examRoomStudentRelationDao.get(examRoomStudentRelationId);
 		//将当前学员退出教室并添加参考状态,如果考试未完成,清除签到时间,重新签到
-//
 		if(examStatus != null && examStatus == 0){
 			//未完成
 			examRoomStudentRelationDao.cleanSignInTime(examRoomStudentRelation.getExamRegistrationId());