Bladeren bron

Merge remote-tracking branch 'origin/master'

Joburgess 5 jaren geleden
bovenliggende
commit
97adb6602e
16 gewijzigde bestanden met toevoegingen van 256 en 48 verwijderingen
  1. 7 7
      edu-im/edu-im-server/src/main/java/com/keao/edu/im/controller/RoomController.java
  2. 0 1
      edu-im/edu-im-server/src/main/java/com/keao/edu/im/dao/RoomMemberDao.java
  3. 11 9
      edu-im/edu-im-server/src/main/java/com/keao/edu/im/mec/im/IMHelper.java
  4. 2 0
      edu-im/edu-im-server/src/main/java/com/keao/edu/im/pojo/IMApiResultInfo.java
  5. 21 25
      edu-im/edu-im-server/src/main/java/com/keao/edu/im/service/Impl/RoomServiceImpl.java
  6. 2 0
      edu-im/edu-im-server/src/main/java/com/keao/edu/im/service/RoomService.java
  7. 8 0
      edu-user/edu-user-client-api/src/main/java/com/keao/edu/user/api/client/EduUserFeignService.java
  8. 5 0
      edu-user/edu-user-client-api/src/main/java/com/keao/edu/user/api/client/fallback/EduUserFeignServiceFallback.java
  9. 1 1
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/config/ResourceServerConfig.java
  10. 14 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/StudentExamResultController.java
  11. 14 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/StudentExamResultDao.java
  12. 97 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/dto/RecordNotify.java
  13. 14 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/StudentExamResultService.java
  14. 32 3
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/StudentExamResultServiceImpl.java
  15. 21 2
      edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRegistrationMapper.xml
  16. 7 0
      edu-user/edu-user-server/src/main/resources/config/mybatis/StudentExamResultMapper.xml

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

@@ -36,23 +36,23 @@ public class RoomController{
         return roomService.joinRoom(data.getRegistrationId(), data.isAudience(), data.isDisableCamera(),data.isMusicMode(),data.getRoomId());
     }
 
-    @RequestMapping(value = "/joinRecorded", method = RequestMethod.POST)
+    /*@RequestMapping(value = "/joinRecorded", method = RequestMethod.POST)
     public Object joinRecorded(Long registrationId)
             throws Exception {
         return new BaseResponse<>(roomService.joinRecorded(registrationId));
-    }
+    }*/
 
-    @RequestMapping(value = "/levelRecorded", method = RequestMethod.POST)
+    /*@RequestMapping(value = "/levelRecorded", method = RequestMethod.POST)
     public Object levelRecorded(Long registrationId)
             throws Exception {
         return new BaseResponse<>(roomService.levelRecorded(registrationId));
-    }
+    }*/
 
-    @RequestMapping(value = "/startRecord", method = RequestMethod.POST)
-    public Object signIn(String roomId) throws Exception {
+    /*@RequestMapping(value = "/startRecord", method = RequestMethod.POST)
+    public Object startRecord(String roomId) throws Exception {
         roomService.startRecord(roomId);
         return new BaseResponse<>();
-    }
+    }*/
 
     @RequestMapping(value = "/signIn", method = RequestMethod.POST)
     public Object signIn(Long roomId){

+ 0 - 1
edu-im/edu-im-server/src/main/java/com/keao/edu/im/dao/RoomMemberDao.java

@@ -18,7 +18,6 @@ import java.util.List;
 public interface RoomMemberDao extends JpaRepository<RoomMember, Long> {
     public List<RoomMember> findByRid(String rid);
 
-    @Lock(value = LockModeType.PESSIMISTIC_WRITE)
     public List<RoomMember> findByRidAndUid(String rid, String uid);
 
     public List<RoomMember> findByRidAndRole(String rid, int role);

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

@@ -235,23 +235,25 @@ public class IMHelper {
             throw new IllegalArgumentException("Paramer 'roomId' is required");
         }
         JSONObject jsonObject = new JSONObject();
-        jsonObject.put("mode","3");
+        jsonObject.put("mode",3);
         jsonObject.put("videoFormat","mp4");
         jsonObject.put("audioFormat","mp3");
         jsonObject.put("videoResolution","640x480");
-        jsonObject.put("mixLayout","3");
-        jsonObject.put("sliceMin","60");
+        jsonObject.put("mixLayout",3);
+        jsonObject.put("sliceMin",60);
         jsonObject.put("hostUserId",hostUserId);
         JSONObject json = new JSONObject();
-        json.put("sessionId","roomQuery(roomId)");
+        String sessionId = roomQuery(roomId);
+        json.put("sessionId",sessionId);
         json.put("config",jsonObject);
 
         String body = json.toJSONString();
 
         HttpURLConnection conn = httpHelper.createIMRtcPostHttpConnection("/rtc/record/start.json", "application/json",roomId);
         httpHelper.setBodyParameter(body, conn);
-
-        return JSON.parseObject(httpHelper.returnResult(conn, body), IMApiResultInfo.class);
+        IMApiResultInfo resultInfo = JSON.parseObject(httpHelper.returnResult(conn, body), IMApiResultInfo.class);
+        resultInfo.setSessionId(sessionId);
+        return resultInfo;
     }
 
     /**
@@ -269,12 +271,12 @@ public class IMHelper {
             throw new IllegalArgumentException("Paramer 'groupId' is required");
         }
         JSONObject jsonObject = new JSONObject();
-        jsonObject.put("mode","3");
+        jsonObject.put("mode",3);
         jsonObject.put("videoFormat","mp4");
         jsonObject.put("audioFormat","mp3");
         jsonObject.put("videoResolution","640x480");
-        jsonObject.put("mixLayout","3");
-        jsonObject.put("sliceMin","60");
+        jsonObject.put("mixLayout",3);
+        jsonObject.put("sliceMin",60);
         jsonObject.put("hostUserId",hostUserId);
         JSONObject json = new JSONObject();
         json.put("sessionId",roomQuery(roomId));

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

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

+ 21 - 25
edu-im/edu-im-server/src/main/java/com/keao/edu/im/service/Impl/RoomServiceImpl.java

@@ -89,7 +89,13 @@ public class RoomServiceImpl implements RoomService {
     @Override
     public void startRecord(String roomId) throws Exception {
         SysUser sysUser = sysUserFeignService.queryUserInfo();
-        imHelper.startRecord(sysUser.getId().toString(),roomId);
+        IMApiResultInfo imApiResultInfo = imHelper.startRecord(sysUser.getId().toString(), roomId);
+    }
+
+    @Override
+    public void stopRecord(String roomId) throws Exception {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        imHelper.stopRecord(sysUser.getId().toString(),roomId);
     }
 
     @Override
@@ -343,6 +349,8 @@ public class RoomServiceImpl implements RoomService {
                 eduUserFeignService.updateFinishedExam(registrationId,0);
             }
             this.publishMessage(eduUserFeignService.getPublishMessage(registrationId));
+            IMApiResultInfo imApiResultInfo = imHelper.startRecord(userId, roomId);
+            eduUserFeignService.updateSessionId(registrationId,imApiResultInfo.getSessionId());
         }
         return baseResponse;
     }
@@ -471,20 +479,21 @@ public class RoomServiceImpl implements RoomService {
     public Boolean leaveRoom(Long registrationId,String userId,String roomId) throws Exception {
         if(registrationId != null){
             StudentExamResultApiDto examResult = eduUserFeignService.getExamResult(registrationId);
-            Integer recordFlag = examResult.getRecordFlag();
+            /*Integer recordFlag = examResult.getRecordFlag();
             if(recordFlag != null && recordFlag == 1){
                 levelRecorded(registrationId);
-            }
+            }*/
             roomId = examResult.getRoomId();
         }
 
-        SysUser user = null;
-        if(StringUtils.isEmpty(userId)){
+        SysUser user = sysUserFeignService.queryUserInfo();
+        userId = user.getId().toString();
+        /*if(StringUtils.isEmpty(userId)){
             user = sysUserFeignService.queryUserInfo();
             userId = user.getId().toString();
         }else {
             user = sysUserFeignService.queryUserById(Integer.parseInt(userId));
-        }
+        }*/
         log.info("leaveRoom: roomId={}, userId={}", roomId,userId);
 
         CheckUtils.checkArgument(userId != null, "userId must't be null");
@@ -539,29 +548,16 @@ public class RoomServiceImpl implements RoomService {
             }*/
         } else {
             roomMemberDao.deleteUserByRidAndUid(roomId, userId);
-
-            /*IMApiResultInfo apiResultInfo = null;
-            try {
-                apiResultInfo = imHelper.quit(new String[]{userId}, roomId);
-                if (apiResultInfo.isSuccess()) {
-                    roomMemberDao.deleteUserByRidAndUid(roomId, userId);
-                    MemberChangedMessage msg = new MemberChangedMessage(MemberChangedMessage.Action_Leave, userId, userRole);
-                    msg.setUserName(user.getUsername());
-                    imHelper.publishMessage(userId, roomId, msg);
-                    imHelper.quit(new String[]{userId}, roomId);
-                    log.info("quit group: roomId={},userId: {}", roomId,userId);
-                } else {
-                    throw new ApiException(ErrorEnum.ERR_EXIT_ROOM_ERROR, apiResultInfo.getErrorMessage());
-                }
-            } catch (Exception e) {
-                log.error("leave room error: roomId={}, {}", roomId, e.getMessage());
-                throw new ApiException(ErrorEnum.ERR_EXIT_ROOM_ERROR);
-            }*/
+            MemberChangedMessage msg = new MemberChangedMessage(MemberChangedMessage.Action_Leave, userId, userRole);
+            msg.setUserName(user.getUsername());
+            imHelper.publishMessage(userId, roomId, msg);
+            log.info("quit group: roomId={},userId: {}", roomId,userId);
         }
         userDao.deleteByUid(userId);
 //        this.signOut(Long.parseLong(roomId));
+//        this.publishMessage(eduUserFeignService.getPublishMessage(registrationId));
         if(registrationId != null){
-            this.publishMessage(eduUserFeignService.getPublishMessage(registrationId));
+            imHelper.stopRecord(userId,roomId);
         }
         return true;
     }

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

@@ -22,6 +22,8 @@ public interface RoomService {
 
     void startRecord(String roomId) throws Exception;
 
+    void stopRecord(String roomId) throws Exception;
+
     void signOut(Long roomId);
 
     public Boolean leaveRoom(Long registrationId,String userId,String roomId) throws ApiException, Exception;

+ 8 - 0
edu-user/edu-user-client-api/src/main/java/com/keao/edu/user/api/client/EduUserFeignService.java

@@ -73,4 +73,12 @@ public interface EduUserFeignService {
 	 */
 	@PostMapping(value = "studentExamResult/api/updateFinishedExam")
 	void updateFinishedExam(@RequestParam("examRegistrationId") Long examRegistrationId, @RequestParam("finishedExam") Integer finishedExam);
+
+	/**
+	 * 修改学员sessionId
+	 * @param examRegistrationId
+	 * @param sessionId
+	 */
+	@PostMapping(value = "studentExamResult/api/updateSessionId")
+	void updateSessionId(@RequestParam("examRegistrationId") Long examRegistrationId, @RequestParam("sessionId") String sessionId);
 }

+ 5 - 0
edu-user/edu-user-client-api/src/main/java/com/keao/edu/user/api/client/fallback/EduUserFeignServiceFallback.java

@@ -44,4 +44,9 @@ public class EduUserFeignServiceFallback implements EduUserFeignService {
 	public void updateFinishedExam(Long examRegistrationId, Integer finishedExam) {
 
 	}
+
+	@Override
+	public void updateSessionId(Long examRegistrationId, String sessionId) {
+
+	}
 }

+ 1 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/config/ResourceServerConfig.java

@@ -26,7 +26,7 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
     public void configure(HttpSecurity http) throws Exception {
         http.authorizeRequests()
                 .antMatchers("/task/*","/v2/api-docs", "/su/**", "/student/apply", "/examRegistration/ocr", "/examOrder/paymentResult",
-                        "/examOrder/notify","/examinationBasic/getInfo","/examOrder/executePayment","/examOrder/pageList")
+                        "/examOrder/notify","/examinationBasic/getInfo","/examOrder/executePayment","/examOrder/pageList","/studentExamResult/recordSync")
                 .permitAll()
                 .anyRequest().authenticated().and().csrf().disable().exceptionHandling().accessDeniedHandler(baseAccessDeniedHandler)
                 .authenticationEntryPoint(baseAuthenticationEntryPoint).and();

+ 14 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/StudentExamResultController.java

@@ -1,11 +1,13 @@
 package com.keao.edu.user.controller;
 
+import com.alibaba.fastjson.JSONObject;
 import com.keao.edu.auth.api.client.SysUserFeignService;
 import com.keao.edu.auth.api.entity.SysUser;
 import com.keao.edu.common.controller.BaseController;
 import com.keao.edu.common.entity.HttpResponseResult;
 import com.keao.edu.common.page.PageInfo;
 import com.keao.edu.user.api.enums.StudentExamResultApiDto;
+import com.keao.edu.user.dto.RecordNotify;
 import com.keao.edu.user.dto.StudentExamResultStatisticsDto;
 import com.keao.edu.user.entity.Employee;
 import com.keao.edu.user.entity.StudentExamResult;
@@ -35,6 +37,12 @@ public class StudentExamResultController extends BaseController {
     @Autowired
     private EmployeeService employeeService;
 
+    @RequestMapping(value = "/recordSync")
+    public void recordSync(@RequestBody String body) throws Exception {
+        RecordNotify recordNotify = JSONObject.parseObject(body, RecordNotify.class);
+        studentExamResultService.recordSync(recordNotify);
+    }
+
     @ApiOperation("查询考试结果")
     @GetMapping(value = "/queryStudentExamResult")
     public HttpResponseResult<PageInfo<StudentExamResult>> queryStudentExamResult(StudentExamResultQueryInfo queryInfo){
@@ -62,6 +70,12 @@ public class StudentExamResultController extends BaseController {
         studentExamResultService.updateFinishedExam(examRegistrationId,finishedExam);
     }
 
+    @ApiOperation("修改SessionId")
+    @PostMapping(value = "/api/updateSessionId")
+    public void updateSessionId(Long examRegistrationId,String sessionId){
+        studentExamResultService.updateSessionId(examRegistrationId,sessionId);
+    }
+
     @ApiOperation("获取考试结果")
     @PostMapping(value = "/api/get")
     public StudentExamResultApiDto get(Long id){

+ 14 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/StudentExamResultDao.java

@@ -80,4 +80,18 @@ public interface StudentExamResultDao extends BaseDAO<Long, StudentExamResult> {
      * @param finishedExam
      */
     void updateFinishedExam(@Param("examRegistrationId") Long examRegistrationId, @Param("finishedExam") Integer finishedExam);
+
+    /**
+     * 获取学员房间关联
+     * @param roomId
+     * @param userId
+     */
+    StudentExamResult findByRoomIdAndUserId(@Param("roomId") String roomId, @Param("userId") String userId);
+
+    /**
+     * 修改学员SessionId
+     * @param examRegistrationId
+     * @param sessionId
+     */
+    void updateSessionId(@Param("examRegistrationId") Long examRegistrationId, @Param("sessionId") String sessionId);
 }

+ 97 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dto/RecordNotify.java

@@ -0,0 +1,97 @@
+package com.keao.edu.user.dto;
+
+public class RecordNotify {
+	private Long timestamp;
+
+	private Integer type;
+
+	private String appkey;
+
+	private String recordId;
+
+	private String sessionId;
+
+	private String roomId;
+
+	private String userId;
+
+	private String output;
+
+	public Long getTimestamp() {
+		return timestamp;
+	}
+
+	public void setTimestamp(Long timestamp) {
+		this.timestamp = timestamp;
+	}
+
+	public Integer getType() {
+		return type;
+	}
+
+	public void setType(Integer type) {
+		this.type = type;
+	}
+
+	public String getAppkey() {
+		return appkey;
+	}
+
+	public void setAppkey(String appkey) {
+		this.appkey = appkey;
+	}
+
+	public String getRecordId() {
+		return recordId;
+	}
+
+	public void setRecordId(String recordId) {
+		this.recordId = recordId;
+	}
+
+	public String getSessionId() {
+		return sessionId;
+	}
+
+	public void setSessionId(String sessionId) {
+		this.sessionId = sessionId;
+	}
+
+	public String getRoomId() {
+		return roomId;
+	}
+
+	public void setRoomId(String roomId) {
+		this.roomId = roomId;
+	}
+
+	public String getUserId() {
+		return userId;
+	}
+
+	public void setUserId(String userId) {
+		this.userId = userId;
+	}
+
+	public String getOutput() {
+		return output;
+	}
+
+	public void setOutput(String output) {
+		this.output = output;
+	}
+
+	@Override
+	public String toString() {
+		return "RecordNotify{" +
+				"timestamp=" + timestamp +
+				", type=" + type +
+				", appkey='" + appkey + '\'' +
+				", recordId='" + recordId + '\'' +
+				", sessionId='" + sessionId + '\'' +
+				", roomId='" + roomId + '\'' +
+				", userId='" + userId + '\'' +
+				", output='" + output + '\'' +
+				'}';
+	}
+}

+ 14 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/StudentExamResultService.java

@@ -3,6 +3,7 @@ package com.keao.edu.user.service;
 import com.keao.edu.common.page.PageInfo;
 import com.keao.edu.common.service.BaseService;
 import com.keao.edu.user.api.enums.StudentExamResultApiDto;
+import com.keao.edu.user.dto.RecordNotify;
 import com.keao.edu.user.dto.StudentExamResultStatisticsDto;
 import com.keao.edu.user.entity.StudentExamResult;
 import com.keao.edu.user.page.StudentExamResultQueryInfo;
@@ -57,4 +58,17 @@ public interface StudentExamResultService extends BaseService<Long, StudentExamR
      * @param finishedExam
      */
     void updateFinishedExam(Long examRegistrationId, Integer finishedExam);
+
+    /**
+     * 录像结束回调
+     * @param recordNotify
+     */
+    void recordSync(RecordNotify recordNotify);
+
+    /**
+     * 修改SessionId
+     * @param examRegistrationId
+     * @param sessionId
+     */
+    void updateSessionId(Long examRegistrationId, String sessionId);
 }

+ 32 - 3
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/StudentExamResultServiceImpl.java

@@ -1,7 +1,6 @@
 package com.keao.edu.user.service.impl;
 
-import com.keao.edu.auth.api.client.SysUserFeignService;
-import com.keao.edu.auth.api.entity.SysUser;
+import com.alibaba.fastjson.JSONObject;
 import com.keao.edu.common.dal.BaseDAO;
 import com.keao.edu.common.enums.MessageTypeEnum;
 import com.keao.edu.common.exception.BizException;
@@ -9,7 +8,6 @@ import com.keao.edu.common.page.PageInfo;
 import com.keao.edu.common.service.SysMessageService;
 import com.keao.edu.common.service.impl.BaseServiceImpl;
 import com.keao.edu.thirdparty.message.provider.JiguangPushPlugin;
-import com.keao.edu.thirdparty.message.provider.YimeiSmsPlugin;
 import com.keao.edu.user.api.entity.ExamRoomStudentRelation;
 import com.keao.edu.user.api.entity.Student;
 import com.keao.edu.user.api.enums.StudentExamResultApiDto;
@@ -17,6 +15,7 @@ import com.keao.edu.user.dao.ExamRoomStudentRelationDao;
 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.StudentExamResultStatisticsDto;
 import com.keao.edu.user.entity.ExaminationBasic;
 import com.keao.edu.user.entity.Organization;
@@ -28,6 +27,9 @@ import com.keao.edu.user.page.StudentExamResultQueryInfo;
 import com.keao.edu.user.service.OrganizationService;
 import com.keao.edu.user.service.StudentExamResultService;
 import com.keao.edu.util.collection.MapUtil;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -49,6 +51,8 @@ public class StudentExamResultServiceImpl extends BaseServiceImpl<Long, StudentE
 	@Autowired
 	private SysMessageService sysMessageService;
 
+	private final static Logger logger = LoggerFactory.getLogger(StudentExamResultServiceImpl.class);
+
 	@Override
 	public BaseDAO<Long, StudentExamResult> getDAO() {
 		return studentExamResultDao;
@@ -174,4 +178,29 @@ public class StudentExamResultServiceImpl extends BaseServiceImpl<Long, StudentE
 	public void updateFinishedExam(Long examRegistrationId, Integer finishedExam) {
 		studentExamResultDao.updateFinishedExam(examRegistrationId,finishedExam);
 	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void recordSync(RecordNotify recordNotify) {
+		logger.info("recordSync paramJson{}",recordNotify);
+		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();
+				}
+				studentExamResult.setVideoUrl(videoUrl);
+				studentExamResultDao.update(studentExamResult);
+			}
+		}
+	}
+
+	@Override
+	public void updateSessionId(Long examRegistrationId, String sessionId) {
+		studentExamResultDao.updateSessionId(examRegistrationId,sessionId);
+	}
 }

+ 21 - 2
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRegistrationMapper.xml

@@ -586,7 +586,7 @@
 
 	<select id="countStudentBaseExams" resultType="java.lang.Integer">
 		SELECT COUNT(er.id_) FROM exam_registration er
-		<include refid="queryStudentListSql"/>
+		<include refid="queryStudentBaseExamsSql"/>
 	</select>
 	<resultMap id="StudentBaseExamsDtoMap" type="com.keao.edu.user.dto.StudentBaseExamsDto">
 		<result property="baseExamName" column="examBaseName"/>
@@ -595,10 +595,29 @@
 	<select id="queryStudentBaseExams" resultMap="StudentBaseExamsDtoMap">
 		SELECT eb.name_ examBaseName,eb.tenant_id_ FROM examination_basic eb
 		LEFT JOIN exam_registration er ON er.examination_basic_id_ = eb.id_
-		<include refid="queryStudentListSql"/>
+		<include refid="queryStudentBaseExamsSql"/>
 		ORDER BY er.update_time_ DESC
 		<include refid="global.limit"/>
 	</select>
+	<sql id="queryStudentBaseExamsSql">
+		<where>
+			er.level_ = ess.level_
+			<if test="studentId != null">
+				AND er.student_id_ = #{studentId}
+			</if>
+			<if test="examRegistrationId != null">
+				AND er.id_ = #{examRegistrationId}
+			</if>
+			<if test="paymentStatus != null">
+				<if test="paymentStatus == 1">
+					AND er.status_ IN ('AUDIT_PASS','AUDIT_WAIT','AUDIT_REJECT')
+				</if>
+				<if test="paymentStatus == 0">
+					AND er.status_ IN ('CANCEL','PAY_WAIT')
+				</if>
+			</if>
+		</where>
+	</sql>
 	<resultMap id="StuRecordDetailDtoMap" type="com.keao.edu.user.dto.StuRecordDetailDto">
 		<result property="songJson" column="song_json_"/>
 		<result property="recordStartTime" column="record_start_time_"/>

+ 7 - 0
edu-user/edu-user-server/src/main/resources/config/mybatis/StudentExamResultMapper.xml

@@ -113,6 +113,10 @@
 		UPDATE student_exam_result SET is_finished_exam_ = #{finishedExam},update_time_ = NOW()
 		WHERE exam_registration_id_ = #{examRegistrationId}
 	</update>
+	<update id="updateSessionId">
+		UPDATE student_exam_result SET session_id_ = #{sessionId},update_time_ = NOW()
+		WHERE exam_registration_id_ = #{examRegistrationId}
+	</update>
 
 	<!-- 根据主键删除一条记录 -->
 	<delete id="delete" >
@@ -276,4 +280,7 @@
 		LEFT JOIN exam_registration er ON ser.exam_registration_id_ = er.id_
 		WHERE examination_basic_id_=#{examId}
 	</select>
+    <select id="findByRoomIdAndUserId" resultMap="StudentExamResult">
+		SELECT * FROM student_exam_result WHERE exam_room_id_ = #{roomId} AND student_id_ = #{userId} LIMIT 1
+	</select>
 </mapper>