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