Selaa lähdekoodia

Merge remote-tracking branch 'origin/master'

Joburgess 5 vuotta sitten
vanhempi
commit
2ed18f0e01

+ 11 - 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.data.redis.core.RedisTemplate;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Component;
 
@@ -27,6 +28,9 @@ public class IMHelper {
     @Autowired
     HttpHelper httpHelper;
 
+    @Autowired
+    private RedisTemplate<String,String> redisTemplate;
+
     /**
      * 获取 Token 方法
      *
@@ -240,10 +244,9 @@ public class IMHelper {
         jsonObject.put("videoFormat","mp4");
         jsonObject.put("audioFormat","mp3");
         jsonObject.put("videoResolution","640x480");
-        jsonObject.put("mixLayout",3);
-        jsonObject.put("sliceMin",60);
+        jsonObject.put("mixLayout",2);
+        jsonObject.put("sliceMin",30);
         jsonObject.put("hostUserId",hostUserId);
-        jsonObject.put("extra",registrationId);
         JSONObject json = new JSONObject();
         json.put("sessionId",roomQuery(roomId));
         json.put("config",jsonObject);
@@ -254,6 +257,9 @@ public class IMHelper {
         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);
+        if(resultInfo.getResultCode() == 10000){
+            redisTemplate.opsForValue().set(resultInfo.getRecordId(),registrationId.toString());
+        }
         return resultInfo;
     }
 
@@ -276,8 +282,8 @@ public class IMHelper {
         jsonObject.put("videoFormat","mp4");
         jsonObject.put("audioFormat","mp3");
         jsonObject.put("videoResolution","640x480");
-        jsonObject.put("mixLayout",3);
-        jsonObject.put("sliceMin",60);
+        jsonObject.put("mixLayout",2);
+        jsonObject.put("sliceMin",30);
         jsonObject.put("hostUserId",hostUserId);
         JSONObject json = new JSONObject();
         json.put("sessionId",roomQuery(roomId));

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

@@ -12,6 +12,10 @@ public class IMApiResultInfo {
     // 错误信息。
     String errorMessage;
 
+    String recordId;
+
+    Integer resultCode;
+
     public boolean isSuccess() {
         return code == 200;
     }

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

@@ -29,6 +29,7 @@ import com.keao.edu.util.date.DateUtil;
 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;
@@ -364,7 +365,7 @@ public class RoomServiceImpl implements RoomService {
                 eduUserFeignService.updateFinishedExam(registrationId,0);
             }
             this.publishMessage(eduUserFeignService.getPublishMessage(registrationId));
-            imHelper.startRecord(userId, roomId,registrationId);
+            imHelper.startRecord(userId, roomId, registrationId);
 //            eduUserFeignService.updateSessionId(registrationId,imApiResultInfo.getSessionId());
         }
         return baseResponse;

+ 15 - 9
edu-user/edu-user-biz/src/main/java/com/keao/edu/user/service/impl/StudentExamResultServiceImpl.java

@@ -21,7 +21,6 @@ import com.keao.edu.user.dao.ExaminationBasicDao;
 import com.keao.edu.user.dao.StudentExamResultDao;
 import com.keao.edu.user.dto.ExaminationBasicDto;
 import com.keao.edu.user.dto.RecordNotify;
-import com.keao.edu.user.dto.RoomStudentListDto;
 import com.keao.edu.user.dto.StudentExamResultStatisticsDto;
 import com.keao.edu.user.entity.ExaminationBasic;
 import com.keao.edu.user.entity.Organization;
@@ -39,6 +38,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -64,6 +64,8 @@ public class StudentExamResultServiceImpl extends BaseServiceImpl<Long, StudentE
 	private ImFeignService imFeignService;
 	@Autowired
 	private ExamRoomService examRoomService;
+	@Autowired
+	private RedisTemplate<String,String> redisTemplate;
 
 	private final static Logger logger = LoggerFactory.getLogger(StudentExamResultServiceImpl.class);
 
@@ -203,15 +205,19 @@ public class StudentExamResultServiceImpl extends BaseServiceImpl<Long, StudentE
 		if (recordNotify.getType() == 4){
 			JSONObject jsonObject = JSONObject.parseObject(recordNotify.getOutput());
 			if("10000".equals(jsonObject.get("fileState"))){
-				StudentExamResult studentExamResult = studentExamResultDao.findByRoomIdAndUserId(recordNotify.getRoomId(), recordNotify.getUserId());
-				String videoUrl = studentExamResult.getVideoUrl();
-				if(StringUtils.isNotEmpty(videoUrl)){
-					videoUrl += "," + jsonObject.get("fileUrl");
-				}else {
-					videoUrl = jsonObject.get("fileUrl").toString();
+				String recordId = redisTemplate.opsForValue().get(recordNotify.getRecordId());
+				if(StringUtils.isNotEmpty(recordId)){
+					Long registrationId = Long.parseLong(recordId);
+					StudentExamResult studentExamResult = studentExamResultDao.findByRegistrationId(registrationId);
+					String videoUrl = studentExamResult.getVideoUrl();
+					if(StringUtils.isNotEmpty(videoUrl)){
+						videoUrl += "," + jsonObject.get("fileUrl");
+					}else {
+						videoUrl = jsonObject.get("fileUrl").toString();
+					}
+					studentExamResult.setVideoUrl(videoUrl);
+					studentExamResultDao.update(studentExamResult);
 				}
-				studentExamResult.setVideoUrl(videoUrl);
-				studentExamResultDao.update(studentExamResult);
 			}
 		}
 	}

+ 2 - 1
edu-user/edu-user-biz/src/main/resources/config/mybatis/ExamReviewMapper.xml

@@ -199,6 +199,7 @@
 	</resultMap>
 	<sql id="queryExamReviewRecordListSql">
 		<where>
+			ersr.sign_in_time_ IS NOT NULL
 			<if test="reviewFlag != null and reviewFlag == 1">
 				AND er.id_ IS NOT NULL
 			</if>
@@ -218,7 +219,7 @@
 		LEFT JOIN student_exam_result ser ON ser.exam_registration_id_ = ersr.exam_registration_id_
 		LEFT JOIN exam_review er ON ser.exam_registration_id_ = er.exam_registration_id_ AND er.teacher_id_ = #{teacherId}
 		<include refid="queryExamReviewRecordListSql"/>
-		ORDER BY ser.is_finished_exam_ DESC
+		ORDER BY ser.is_finished_exam_ ASC
 		<include refid="global.limit"/>
 	</select>