|
@@ -1,84 +1,303 @@
|
|
|
package cn.com.qmth.examcloud.core.oe.student.api.provider;
|
|
|
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
-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.response.CalcExamScoreResp;
|
|
|
-import cn.com.qmth.examcloud.core.oe.student.api.response.CalcFaceBiopsyResultResp;
|
|
|
+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.*;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.api.request.*;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.api.response.*;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.base.bean.ExamQuestion;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.base.bean.ExamRecordQuestions;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.bean.ExamRecordPaperStruct;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.dao.*;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.dao.entity.*;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.service.ExamRecordDataService;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.service.ExamRecordPaperStructService;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.service.ExamRecordQuestionsService;
|
|
|
+import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
|
|
|
+import cn.com.qmth.examcloud.web.support.ControllerSupport;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
-import cn.com.qmth.examcloud.core.oe.student.api.ExamRecordDataCloudService;
|
|
|
-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.response.GetExamRecordDataIdsResp;
|
|
|
-import cn.com.qmth.examcloud.core.oe.student.api.response.UpdateExamRecordDataBatchNumResp;
|
|
|
-import cn.com.qmth.examcloud.core.oe.student.service.ExamRecordDataService;
|
|
|
-import cn.com.qmth.examcloud.web.support.ControllerSupport;
|
|
|
-import io.swagger.annotations.Api;
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
|
|
|
@Api(tags = "考试记录接口")
|
|
|
@RestController
|
|
|
@RequestMapping("${$rmp.cloud.oe.student}/examRecordData")
|
|
|
-public class ExamRecordDataCloudServiceProvider extends ControllerSupport implements ExamRecordDataCloudService{
|
|
|
+public class ExamRecordDataCloudServiceProvider extends ControllerSupport implements ExamRecordDataCloudService {
|
|
|
+
|
|
|
|
|
|
-
|
|
|
- /**
|
|
|
- *
|
|
|
+ /**
|
|
|
+ *
|
|
|
*/
|
|
|
private static final long serialVersionUID = 6142107111834463854L;
|
|
|
@Autowired
|
|
|
- private ExamRecordDataService examRecordDataService;
|
|
|
-
|
|
|
- @Override
|
|
|
- @ApiOperation(value = "批量获取考试记录ID")
|
|
|
- @PostMapping("/getExamRecordDataIds")
|
|
|
- public GetExamRecordDataIdsResp getExamRecordDataIds(@RequestBody GetExamRecordDataIdsReq req) {
|
|
|
- GetExamRecordDataIdsResp res = new GetExamRecordDataIdsResp();
|
|
|
- List<Long> ids=examRecordDataService.getExamRecordDataIds(req);
|
|
|
- res.setExamRecordDataIds(ids);
|
|
|
- return res;
|
|
|
- }
|
|
|
-
|
|
|
+ private ExamRecordDataService examRecordDataService;
|
|
|
+ @Autowired
|
|
|
+ private ExamFaceLivenessVerifyRepo examFaceLivenessVerifyRepo;
|
|
|
+ @Autowired
|
|
|
+ private FaceBiopsyRepo faceBiopsyRepo;
|
|
|
+ @Autowired
|
|
|
+ private FaceBiopsyItemRepo faceBiopsyItemRepo;
|
|
|
+ @Autowired
|
|
|
+ private FaceBiopsyItemStepRepo faceBiopsyItemStepRepo;
|
|
|
+ @Autowired
|
|
|
+ private ExamRecordPaperStructService examRecordPaperStructService;
|
|
|
+ @Autowired
|
|
|
+ private ExamRecordQuestionsService examRecordQuestionsService;
|
|
|
+ @Autowired
|
|
|
+ private ExamRecordQuestionTempRepo examRecordQuestionTempRepo;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @ApiOperation(value = "批量获取考试记录ID")
|
|
|
+ @PostMapping("/getExamRecordDataIds")
|
|
|
+ public GetExamRecordDataIdsResp getExamRecordDataIds(@RequestBody GetExamRecordDataIdsReq req) {
|
|
|
+ GetExamRecordDataIdsResp res = new GetExamRecordDataIdsResp();
|
|
|
+ List<Long> ids = examRecordDataService.getExamRecordDataIds(req);
|
|
|
+ res.setExamRecordDataIds(ids);
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation(value = "批量修改考试记录batchNum")
|
|
|
@PostMapping("/updateBatchNum")
|
|
|
@Override
|
|
|
public UpdateExamRecordDataBatchNumResp updateExamRecordDataBatchNum(@RequestBody UpdateExamRecordDataBatchNumReq req) {
|
|
|
examRecordDataService.updateExamRecordDataBatchNum(req);
|
|
|
- UpdateExamRecordDataBatchNumResp res=new UpdateExamRecordDataBatchNumResp();
|
|
|
+ UpdateExamRecordDataBatchNumResp res = new UpdateExamRecordDataBatchNumResp();
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 计算活体检测结果
|
|
|
- *
|
|
|
- * @param req
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "计算活体检测结果")
|
|
|
- @PostMapping("/calcFaceBiopsyResult")
|
|
|
- @Override
|
|
|
- public CalcFaceBiopsyResultResp calcFaceBiopsyResult(@RequestBody CalcFaceBiopsyResultReq req) {
|
|
|
- return examRecordDataService.calcFaceBiopsyResult(req);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 计算考试分数
|
|
|
- *
|
|
|
- * @param req
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "计算考试分数")
|
|
|
- @PostMapping("/calcExamScore")
|
|
|
- @Override
|
|
|
- public CalcExamScoreResp calcExamScore(@RequestBody CalcExamScoreReq req) {
|
|
|
- return examRecordDataService.calcExamScore(req);
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 计算活体检测结果
|
|
|
+ *
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "计算活体检测结果")
|
|
|
+ @PostMapping("/calcFaceBiopsyResult")
|
|
|
+ @Override
|
|
|
+ public CalcFaceBiopsyResultResp calcFaceBiopsyResult(@RequestBody CalcFaceBiopsyResultReq req) {
|
|
|
+ return examRecordDataService.calcFaceBiopsyResult(req);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 计算考试分数
|
|
|
+ *
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "计算考试分数")
|
|
|
+ @PostMapping("/calcExamScore")
|
|
|
+ @Override
|
|
|
+ public CalcExamScoreResp calcExamScore(@RequestBody CalcExamScoreReq req) {
|
|
|
+ return examRecordDataService.calcExamScore(req);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取旧活体检测结果
|
|
|
+ *
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "获取旧活体检测结果")
|
|
|
+ @PostMapping("/getExamFaceLivenessVerifies")
|
|
|
+ @Override
|
|
|
+ public GetExamFaceLivenessVerifiesResp getExamFaceLivenessVerifies(@RequestBody GetExamFaceLivenessVerifiesReq req) {
|
|
|
+ List<ExamFaceLivenessVerifyEntity> entityList = examFaceLivenessVerifyRepo.findByExamRecordDataId(req.getExamRecordDataId());
|
|
|
+
|
|
|
+ List<ExamFaceLivenessVerifyBean> examFaceLivenessVerifyList = new ArrayList<>();
|
|
|
+
|
|
|
+ for (ExamFaceLivenessVerifyEntity entity : entityList) {
|
|
|
+ ExamFaceLivenessVerifyBean bean = new ExamFaceLivenessVerifyBean();
|
|
|
+ bean.setBizId(entity.getBizId());
|
|
|
+ bean.setError(entity.getError());
|
|
|
+ bean.setErrorMsg(entity.getErrorMsg());
|
|
|
+ bean.setExamRecordDataId(entity.getExamRecordDataId());
|
|
|
+ bean.setId(entity.getId());
|
|
|
+ bean.setOperateNum(entity.getOperateNum());
|
|
|
+ bean.setResultJson(entity.getResultJson());
|
|
|
+ bean.setStartTime(entity.getStartTime());
|
|
|
+ bean.setUsedTime(entity.getUsedTime());
|
|
|
+ if (null != entity.getVerifyResult()) {
|
|
|
+ bean.setVerifyResult(entity.getVerifyResult().name());
|
|
|
+ }
|
|
|
+
|
|
|
+ examFaceLivenessVerifyList.add(bean);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ GetExamFaceLivenessVerifiesResp resp = new GetExamFaceLivenessVerifiesResp();
|
|
|
+ resp.setExamFaceLivenessVerifis(examFaceLivenessVerifyList);
|
|
|
+
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取新活检
|
|
|
+ *
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "获取新活检")
|
|
|
+ @PostMapping("/getFaceBiopsy")
|
|
|
+ @Override
|
|
|
+ public GetFaceBiopsyResp getFaceBiopsy(@RequestBody GetFaceBiopsyReq req) {
|
|
|
+
|
|
|
+ FaceBiopsyEntity entity = faceBiopsyRepo.findByExamRecordDataId(req.getExamRecordDataId());
|
|
|
+
|
|
|
+ List<FaceBiopsyItemEntity> itemEntityList = faceBiopsyItemRepo.findByFaceBiopsyIdOrderByIdAsc(entity.getId());
|
|
|
+
|
|
|
+ List<FaceBiopsyItemBean> itemBeanList = new ArrayList<>();
|
|
|
+
|
|
|
+ for (FaceBiopsyItemEntity itemEntity : itemEntityList) {
|
|
|
+ FaceBiopsyItemBean itemBean = new FaceBiopsyItemBean();
|
|
|
+
|
|
|
+ itemBean.setCompleted(itemEntity.getCompleted());
|
|
|
+ itemBean.setErrorMsg(itemEntity.getErrorMsg());
|
|
|
+ itemBean.setExamRecordDataId(itemEntity.getExamRecordDataId());
|
|
|
+ itemBean.setFaceBiopsyId(itemEntity.getFaceBiopsyId());
|
|
|
+ itemBean.setFaceBiopsyItemSteps(null);
|
|
|
+ itemBean.setFaceBiopsyType(itemEntity.getFaceBiopsyType().name());
|
|
|
+ itemBean.setInFreezeTime(itemEntity.getInFreezeTime());
|
|
|
+ itemBean.setResult(itemEntity.getResult());
|
|
|
+
|
|
|
+ List<FaceBiopsyItemStepBean> itemStepBeanList = new ArrayList<>();
|
|
|
+
|
|
|
+ List<FaceBiopsyItemStepEntity> itemStepEntityList = faceBiopsyItemStepRepo.findByFaceBiopsyItemId(itemEntity.getId());
|
|
|
+
|
|
|
+ for (FaceBiopsyItemStepEntity itemStepEntity : itemStepEntityList) {
|
|
|
+
|
|
|
+ FaceBiopsyItemStepBean itemStepBean = new FaceBiopsyItemStepBean();
|
|
|
+
|
|
|
+ if (null != itemStepEntity.getAction()) {
|
|
|
+ itemStepBean.setAction(itemStepEntity.getAction().name());
|
|
|
+ }
|
|
|
+
|
|
|
+ itemStepBean.setActionStay(itemStepEntity.getActionStay());
|
|
|
+ itemStepBean.setErrorMsg(itemStepEntity.getErrorMsg());
|
|
|
+ itemStepBean.setExamRecordDataId(itemStepEntity.getExamRecordDataId());
|
|
|
+ itemStepBean.setFaceBiopsyItemId(itemStepEntity.getFaceBiopsyItemId());
|
|
|
+ itemStepBean.setResourceRelativePath(itemStepEntity.getResourceRelativePath());
|
|
|
+
|
|
|
+ if (null != itemStepEntity.getResourceType()) {
|
|
|
+ itemStepBean.setResourceType(itemStepEntity.getResourceType().name());
|
|
|
+ }
|
|
|
+
|
|
|
+ itemStepBean.setResult(itemStepEntity.getResult());
|
|
|
+
|
|
|
+ itemStepBeanList.add(itemStepBean);
|
|
|
+ }
|
|
|
+
|
|
|
+ itemBean.setFaceBiopsyItemSteps(itemStepBeanList);
|
|
|
+
|
|
|
+ itemBeanList.add(itemBean);
|
|
|
+ }
|
|
|
+
|
|
|
+ FaceBiopsyBean bean = new FaceBiopsyBean();
|
|
|
+ bean.setErrorMsg(entity.getErrorMsg());
|
|
|
+ bean.setExamRecordDataId(req.getExamRecordDataId());
|
|
|
+ bean.setResult(entity.getResult());
|
|
|
+ bean.setRootOrgId(entity.getRootOrgId());
|
|
|
+ bean.setVerifiedTimes(entity.getVerifiedTimes());
|
|
|
+
|
|
|
+ bean.setFaceBiopsyItems(itemBeanList);
|
|
|
+
|
|
|
+ GetFaceBiopsyResp resp = new GetFaceBiopsyResp();
|
|
|
+ resp.setFaceBiopsyBean(bean);
|
|
|
+
|
|
|
+ return resp;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取考试作答记录
|
|
|
+ *
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "获取考试作答记录")
|
|
|
+ @PostMapping("/getExamRecordQuestions")
|
|
|
+ @Override
|
|
|
+ public GetExamRecordQuestionsResp getExamRecordQuestions(@RequestBody GetExamRecordQuestionsReq req) {
|
|
|
+ ExamRecordQuestions examRecordQuestions = examRecordQuestionsService.getExamRecordQuestions(req.getExamRecordDataId());
|
|
|
+
|
|
|
+ if (null == examRecordQuestions) {
|
|
|
+ throw new StatusException("200002", "找不到该考试的作答记录");
|
|
|
+ }
|
|
|
+
|
|
|
+ GetExamRecordQuestionsResp resp = new GetExamRecordQuestionsResp();
|
|
|
+ resp.setExamRecordDataId(examRecordQuestions.getExamRecordDataId());
|
|
|
+ resp.setCreationTime(examRecordQuestions.getCreationTime());
|
|
|
+
|
|
|
+ List<StuExamQuestionBean> beanList = new ArrayList<>();
|
|
|
+ List<ExamQuestion> examQuestions = examRecordQuestions.getExamQuestions();
|
|
|
+
|
|
|
+ for (ExamQuestion examQuestion : examQuestions) {
|
|
|
+ StuExamQuestionBean bean = new StuExamQuestionBean();
|
|
|
+ bean.setInMongo(examQuestion.getIsInMongo());
|
|
|
+ bean.setExamQuestionTempId(examQuestion.getExamQuestionTempId());
|
|
|
+ bean.setExamRecordDataId(examQuestion.getExamRecordDataId());
|
|
|
+ bean.setMainNumber(examQuestion.getMainNumber());
|
|
|
+ bean.setQuestionId(examQuestion.getQuestionId());
|
|
|
+ bean.setOrder(examQuestion.getOrder());
|
|
|
+ bean.setQuestionScore(examQuestion.getQuestionScore());
|
|
|
+ bean.setQuestionType(examQuestion.getQuestionType());
|
|
|
+ bean.setCorrectAnswer(examQuestion.getCorrectAnswer());
|
|
|
+
|
|
|
+ //如果作答记录存在mongo中,需要从mongo中重新获取
|
|
|
+ if (null != examQuestion.getIsInMongo() && examQuestion.getIsInMongo()) {
|
|
|
+ ExamQuestionTempEntity examQuestionTempEntity =
|
|
|
+ GlobalHelper.getEntity(examRecordQuestionTempRepo, examQuestion.getExamQuestionTempId(), ExamQuestionTempEntity.class);
|
|
|
+ if (null == examQuestionTempEntity) {
|
|
|
+ throw new StatusException("200003","找不到试题作答结果");
|
|
|
+ }
|
|
|
+
|
|
|
+ bean.setStudentAnswer(examQuestionTempEntity.getStudentAnswer());
|
|
|
+ } else {
|
|
|
+ bean.setStudentAnswer(examQuestion.getStudentAnswer());
|
|
|
+ }
|
|
|
+
|
|
|
+ bean.setStudentScore(examQuestion.getStudentScore());
|
|
|
+ bean.setAnswer(examQuestion.getIsAnswer());
|
|
|
+ bean.setSign(examQuestion.getIsSign());
|
|
|
+ bean.setOptionPermutation(examQuestion.getOptionPermutation());
|
|
|
+ bean.setAudioPlayTimes(examQuestion.getAudioPlayTimes());
|
|
|
+ bean.setAnswerType(examQuestion.getAnswerType());
|
|
|
+
|
|
|
+ beanList.add(bean);
|
|
|
+ }
|
|
|
+
|
|
|
+ resp.setExamQuestions(beanList);
|
|
|
+
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取试卷结构
|
|
|
+ *
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "获取试卷结构")
|
|
|
+ @PostMapping("/getExamRecordPaperStruct")
|
|
|
+ @Override
|
|
|
+ public GetExamRecordPaperStructResp getExamRecordPaperStruct(@RequestBody GetExamRecordPaperStructReq req) {
|
|
|
+ ExamRecordPaperStruct examRecordPaperStruct = examRecordPaperStructService.getExamRecordPaperStruct(req.getExamRecordDataId());
|
|
|
+
|
|
|
+ if (null == examRecordPaperStruct) {
|
|
|
+ throw new StatusException("200001", "找不到该考试的试卷结构");
|
|
|
+ }
|
|
|
+
|
|
|
+ GetExamRecordPaperStructResp resp = new GetExamRecordPaperStructResp();
|
|
|
+ resp.setId(examRecordPaperStruct.getId());
|
|
|
+ resp.setDefaultPaper(examRecordPaperStruct.getDefaultPaper());
|
|
|
+
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
|
|
|
}
|