From 8458e64aab474c0fc2f49ae4ff22fb11ce5cf6e2 Mon Sep 17 00:00:00 2001 From: “djh” <“3298565835@qq.com”> Date: 星期一, 11 十一月 2024 16:55:28 +0800 Subject: [PATCH] 批次新增学员查询条件,新增题目导入接口 --- exam-system/src/main/java/com/gkhy/exam/system/service/impl/ExStudentAnswerServiceImpl.java | 24 ++++++++++++++++-------- 1 files changed, 16 insertions(+), 8 deletions(-) diff --git a/exam-system/src/main/java/com/gkhy/exam/system/service/impl/ExStudentAnswerServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/system/service/impl/ExStudentAnswerServiceImpl.java index 775123e..e99ed18 100644 --- a/exam-system/src/main/java/com/gkhy/exam/system/service/impl/ExStudentAnswerServiceImpl.java +++ b/exam-system/src/main/java/com/gkhy/exam/system/service/impl/ExStudentAnswerServiceImpl.java @@ -1,9 +1,9 @@ package com.gkhy.exam.system.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gkhy.exam.common.enums.PaperStudentStateEnum; import com.gkhy.exam.common.exception.ApiException; import com.gkhy.exam.system.domain.ExPaperStudent; -import com.gkhy.exam.system.domain.ExQuestion; import com.gkhy.exam.system.domain.ExStudentAnswer; import com.gkhy.exam.system.mapper.ExPaperStudentMapper; import com.gkhy.exam.system.mapper.ExQuestionMapper; @@ -11,6 +11,8 @@ import com.gkhy.exam.system.service.ExStudentAnswerService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; + +import java.util.Objects; /** * <p> @@ -30,12 +32,18 @@ public int addStudentAnswer(ExStudentAnswer studentAnswer) { int row=0; validData(studentAnswer); - ExQuestion question=questionMapper.selectById(studentAnswer.getQuestionId()); - if(studentAnswer.getAnswer().equals(question.getAnswer())){ - studentAnswer.setPassed(1); - }else{ - studentAnswer.setPassed(0); - } +// ExQuestion question=questionMapper.selectById(studentAnswer.getQuestionId()); +// if(question.getQuestionType().equals(QuestionTypeEnum.EASY.getCode())){ +// studentAnswer.setPassed(StudentAnswerPassEnum.WAIT_REVIEW.getCode()); +// }else{ +// if(studentAnswer.getAnswer().equals(question.getAnswer())){ +// studentAnswer.setPassed(StudentAnswerPassEnum.CORRECT.getCode()); +// studentAnswer.setScore(); +// }else{ +// studentAnswer.setPassed(StudentAnswerPassEnum.ERROR.getCode()); +// studentAnswer.setScore(0); +// } +// } ExStudentAnswer existAnswer= baseMapper.getStudentAnswer(studentAnswer); if(existAnswer!=null){ studentAnswer.setId(existAnswer.getId()); @@ -51,7 +59,7 @@ public void validData(ExStudentAnswer studentAnswer){ ExPaperStudent paperStudent=paperStudentMapper.selectByPaperStudentId(new ExPaperStudent().setPaperId(studentAnswer.getPaperId()).setStudentId(studentAnswer.getStudentId())); - if(paperStudent.getCompleted()==1){ + if(!Objects.equals(paperStudent.getState(), PaperStudentStateEnum.WAIT_EXAM.getCode())){ throw new ApiException("考试已完成,不能再作答"); } -- Gitblit v1.9.2