|
|
|
@ -23,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import java.text.NumberFormat; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Arrays; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.concurrent.CompletableFuture; |
|
|
|
@ -318,6 +319,7 @@ public class EvaluationRecordServiceImpl extends ServiceImpl<EvaluationRecordDao |
|
|
|
|
String userAnswer) { |
|
|
|
|
//1、根据当前传递的evaluationRecordId和currentQuestionSortNo查询当前试题
|
|
|
|
|
EvaluationQuestionVO evaluationQuestionVO = evaluationQuestionDao.selectByInfo(evaluationRecordId, currentQuestionSortNo); |
|
|
|
|
|
|
|
|
|
if (evaluationQuestionVO == null) { |
|
|
|
|
ExceptionCast.cast(CommonCode.INVALID_PARAM); |
|
|
|
|
} |
|
|
|
@ -325,6 +327,19 @@ public class EvaluationRecordServiceImpl extends ServiceImpl<EvaluationRecordDao |
|
|
|
|
Integer questionPoints = evaluationQuestionVO.getQuestionPoints(); |
|
|
|
|
//正确答案
|
|
|
|
|
String answer = evaluationQuestionVO.getAnswer(); |
|
|
|
|
|
|
|
|
|
String userString = ""; |
|
|
|
|
String answerString = ""; |
|
|
|
|
char[] arr = userAnswer.toCharArray(); |
|
|
|
|
Arrays.sort(arr); |
|
|
|
|
for (char a : arr){ |
|
|
|
|
userString = userString + String.valueOf(a); |
|
|
|
|
} |
|
|
|
|
char[] array = answer.toCharArray(); |
|
|
|
|
Arrays.sort(array); |
|
|
|
|
for (char b : array){ |
|
|
|
|
answerString = answerString + String.valueOf(b); |
|
|
|
|
} |
|
|
|
|
//修改当前试题状态
|
|
|
|
|
//记录用户的答案
|
|
|
|
|
//判断当前试题正误
|
|
|
|
@ -333,13 +348,14 @@ public class EvaluationRecordServiceImpl extends ServiceImpl<EvaluationRecordDao |
|
|
|
|
evaluationQuestion.setId(evaluationQuestionVO.getId()); |
|
|
|
|
evaluationQuestion.setUserAnswer(userAnswer); |
|
|
|
|
//如果用户答案为空,则设置状态为未作,设为错,得分设为0
|
|
|
|
|
if (StringUtils.isEmpty(userAnswer)) { |
|
|
|
|
// if (StringUtils.isEmpty(userAnswer)) {
|
|
|
|
|
if (StringUtils.isEmpty(userString)) { |
|
|
|
|
evaluationQuestion.setQuestionStatus(Constant.QuestionStatus.NOT_MADE.getType()); |
|
|
|
|
evaluationQuestion.setIsTure(Constant.QuestionIsTure.FALSE.getType()); |
|
|
|
|
evaluationQuestion.setQuestionScore(0); |
|
|
|
|
} else { |
|
|
|
|
evaluationQuestion.setQuestionStatus(Constant.QuestionStatus.MADE.getType()); |
|
|
|
|
if (!answer.equals(userAnswer)) { |
|
|
|
|
if (!answerString.equals(userString)) { |
|
|
|
|
evaluationQuestion.setIsTure(Constant.QuestionIsTure.FALSE.getType()); |
|
|
|
|
evaluationQuestion.setQuestionScore(0); |
|
|
|
|
} else { |
|
|
|
|