xiatian 4 years ago
parent
commit
d24c29e030

+ 11 - 0
examcloud-core-oe-student-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/student/api/provider/ExamRecordDataCloudServiceProvider.java

@@ -1,5 +1,6 @@
 package cn.com.qmth.examcloud.core.oe.student.api.provider;
 
+import cn.com.qmth.examcloud.commons.exception.StatusException;
 import cn.com.qmth.examcloud.core.oe.student.api.ExamRecordDataCloudService;
 import cn.com.qmth.examcloud.core.oe.student.api.bean.ExamFaceLivenessVerifyBean;
 import cn.com.qmth.examcloud.core.oe.student.api.bean.FaceBiopsyBean;
@@ -300,4 +301,14 @@ public class ExamRecordDataCloudServiceProvider extends ControllerSupport implem
         UpdatePartialExamRecordResp res = new UpdatePartialExamRecordResp();
         return res;
     }
+
+	@ApiOperation(value = "检查试卷是否已使用")
+    @PostMapping("/checkPaperInExam")
+	@Override
+	public CheckPaperInExamResp checkPaperInExam(@RequestBody CheckPaperInExamReq req) {
+		if (org.apache.commons.lang3.StringUtils.isBlank(req.getBasePaperId())) {
+            throw new StatusException("500", "basePaperId不允许为空");
+        }
+		return examRecordDataService.checkPaperInExam(req);
+	}
 }

+ 3 - 0
examcloud-core-oe-student-dao/src/main/java/cn/com/qmth/examcloud/core/oe/student/dao/ExamRecordDataRepo.java

@@ -38,4 +38,7 @@ public interface ExamRecordDataRepo extends JpaRepository<ExamRecordDataEntity,
     @Query(value = "SELECT c.name from ec_oes_exam_record_data d LEFT JOIN ec_b_course c ON d.course_id = c.id " +
             "WHERE d.id = ?1", nativeQuery = true)
     String findCourseNameById(Long id);
+    
+    @Query(value = "select t.id from ec_oes_exam_record_data t where t.base_paper_id=?1 limit 1", nativeQuery = true)
+    Long getRecordIdByPaperId(String basePaperId);
 }

+ 1 - 0
examcloud-core-oe-student-dao/src/main/java/cn/com/qmth/examcloud/core/oe/student/dao/entity/ExamRecordDataEntity.java

@@ -36,6 +36,7 @@ import org.hibernate.annotations.DynamicUpdate;
         @Index(name = "IDX_E_O_E_R_D_004", columnList = "courseId"),
         @Index(name = "IDX_E_O_E_R_D_005", columnList = "batchNum"),
         @Index(name = "IDX_E_O_E_R_D_006", columnList = "creationTime"),
+        @Index(name = "IDX_E_O_E_R_D_007", columnList = "basePaperId"),
 })
 @DynamicInsert
 @DynamicUpdate

+ 3 - 0
examcloud-core-oe-student-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/service/ExamRecordDataService.java

@@ -5,6 +5,7 @@ import java.util.List;
 import cn.com.qmth.examcloud.core.oe.student.api.request.*;
 import cn.com.qmth.examcloud.core.oe.student.api.response.CalcExamScoreResp;
 import cn.com.qmth.examcloud.core.oe.student.api.response.CalcFaceBiopsyResultResp;
+import cn.com.qmth.examcloud.core.oe.student.api.response.CheckPaperInExamResp;
 import cn.com.qmth.examcloud.support.cache.bean.CourseCacheBean;
 import cn.com.qmth.examcloud.support.cache.bean.ExamSettingsCacheBean;
 import cn.com.qmth.examcloud.support.examing.ExamRecordData;
@@ -73,4 +74,6 @@ public interface ExamRecordDataService {
     void updatePartialExamRecord(UpdatePartialExamRecordReq req);
 
     String findCourseNameById(Long id);
+
+	CheckPaperInExamResp checkPaperInExam(CheckPaperInExamReq req);
 }

+ 14 - 0
examcloud-core-oe-student-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/service/impl/ExamRecordDataServiceImpl.java

@@ -6,12 +6,14 @@ import cn.com.qmth.examcloud.api.commons.enums.ExamType;
 import cn.com.qmth.examcloud.commons.exception.StatusException;
 import cn.com.qmth.examcloud.core.oe.student.api.request.CalcExamScoreReq;
 import cn.com.qmth.examcloud.core.oe.student.api.request.CalcFaceBiopsyResultReq;
+import cn.com.qmth.examcloud.core.oe.student.api.request.CheckPaperInExamReq;
 import cn.com.qmth.examcloud.core.oe.student.api.request.GetExamRecordDataIdsReq;
 import cn.com.qmth.examcloud.core.oe.student.api.request.UpdateExamRecordDataBatchNumReq;
 import cn.com.qmth.examcloud.core.oe.student.api.request.UpdateExamRecordStatusReq;
 import cn.com.qmth.examcloud.core.oe.student.api.request.UpdatePartialExamRecordReq;
 import cn.com.qmth.examcloud.core.oe.student.api.response.CalcExamScoreResp;
 import cn.com.qmth.examcloud.core.oe.student.api.response.CalcFaceBiopsyResultResp;
+import cn.com.qmth.examcloud.core.oe.student.api.response.CheckPaperInExamResp;
 import cn.com.qmth.examcloud.core.oe.student.base.utils.QuestionTypeUtil;
 import cn.com.qmth.examcloud.core.oe.student.dao.ExamFaceLivenessVerifyRepo;
 import cn.com.qmth.examcloud.core.oe.student.dao.ExamRecordDataRepo;
@@ -427,4 +429,16 @@ public class ExamRecordDataServiceImpl implements ExamRecordDataService {
         }
         examRecordDataRepo.updateExamRecordStatusById(status, id);
     }
+
+	@Override
+	public CheckPaperInExamResp checkPaperInExam(CheckPaperInExamReq req) {
+		Long id=examRecordDataRepo.getRecordIdByPaperId(req.getBasePaperId());
+		CheckPaperInExamResp res=new CheckPaperInExamResp();
+		if(id==null) {
+			res.setInExam(false);
+		}else {
+			res.setInExam(true);
+		}
+		return res;
+	}
 }