wangwei 6 年之前
父节点
当前提交
328d54faa2

+ 16 - 0
examcloud-core-examwork-dao/src/main/java/cn/com/qmth/examcloud/core/examwork/dao/ExamPaperTypeRelationRepo.java

@@ -0,0 +1,16 @@
+package cn.com.qmth.examcloud.core.examwork.dao;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.repository.query.QueryByExampleExecutor;
+
+import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamPaperTypeRelationEntity;
+import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamPaperTypeRelationPK;
+
+public interface ExamPaperTypeRelationRepo
+		extends
+			JpaRepository<ExamPaperTypeRelationEntity, ExamPaperTypeRelationPK>,
+			QueryByExampleExecutor<ExamPaperTypeRelationEntity>,
+			JpaSpecificationExecutor<ExamPaperTypeRelationEntity> {
+
+}

+ 12 - 1
examcloud-core-examwork-service/src/main/java/cn/com/qmth/examcloud/core/examwork/service/impl/ExamStudentServiceImpl.java

@@ -23,10 +23,12 @@ import cn.com.qmth.examcloud.core.basic.api.response.GetStudentResp;
 import cn.com.qmth.examcloud.core.basic.api.response.SaveCourseResp;
 import cn.com.qmth.examcloud.core.examwork.dao.ExamCourseRelationRepo;
 import cn.com.qmth.examcloud.core.examwork.dao.ExamOrgSettingsRepo;
+import cn.com.qmth.examcloud.core.examwork.dao.ExamPaperTypeRelationRepo;
 import cn.com.qmth.examcloud.core.examwork.dao.ExamRepo;
 import cn.com.qmth.examcloud.core.examwork.dao.ExamStudentRepo;
 import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamCourseRelationEntity;
 import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamEntity;
+import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamPaperTypeRelationEntity;
 import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamStudentEntity;
 import cn.com.qmth.examcloud.core.examwork.service.ExamStudentService;
 import cn.com.qmth.examcloud.core.examwork.service.bean.ExamStudentInfo;
@@ -74,6 +76,9 @@ public class ExamStudentServiceImpl implements ExamStudentService {
 	@Autowired
 	ExamRecordCloudService examRecordCloudService;
 
+	@Autowired
+	ExamPaperTypeRelationRepo examPaperTypeRelationRepo;
+
 	private boolean isStarted(Long examId, Long StudentId, Long courseId) {
 		CheckExamIsStartedReq checkExamIsStartedReq = new CheckExamIsStartedReq();
 		checkExamIsStartedReq.setExamId(examId);
@@ -243,13 +248,19 @@ public class ExamStudentServiceImpl implements ExamStudentService {
 		ExamStudentEntity saved = examStudentRepo.saveAndFlush(examStudent);
 
 		ExamCourseRelationEntity relation = new ExamCourseRelationEntity();
-		relation.setExamId(saved.getId());
+		relation.setExamId(saved.getExamId());
 		relation.setCourseId(saved.getCourseId());
 		relation.setCourseLevel(saved.getCourseLevel());
 		relation.setCourseCode(courseBean.getCode());
 		relation.setCourseName(saved.getCourseName());
 		examCourseRelationRepo.save(relation);
 
+		ExamPaperTypeRelationEntity pt = new ExamPaperTypeRelationEntity();
+		pt.setCourseId(saved.getCourseId());
+		pt.setExamId(saved.getExamId());
+		pt.setPageType(saved.getPaperType());
+		examPaperTypeRelationRepo.save(pt);
+
 		// 同步操作
 		SyncExamStudentReq req = new SyncExamStudentReq();
 		req.setSyncType("update");