|
@@ -18,6 +18,7 @@ import cn.com.qmth.examcloud.support.cache.bean.CourseCacheBean;
|
|
|
import cn.com.qmth.examcloud.support.cache.bean.ExtractConfigPaperCacheBean;
|
|
|
import cn.com.qmth.examcloud.support.cache.bean.QuestionAnswerCacheBean;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -155,14 +156,14 @@ public class FixExamScoreServiceImpl implements FixExamScoreService {
|
|
|
}
|
|
|
|
|
|
// 计算成绩
|
|
|
- this.calcExamScore(examRecordData.getId(), examQuestions);
|
|
|
+ this.calcExamScore(examRecordData.getId(), examQuestions, req.getQuestionIds());
|
|
|
|
|
|
log.info("【重算成绩】结束!examRecordDataId:{} paperScore:{}", examRecordData.getId(),
|
|
|
examRecordData.getPaperScore());
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- private void calcExamScore(Long examRecordDataId, List<ExamQuestionEntity> examQuestions) {
|
|
|
+ private void calcExamScore(Long examRecordDataId, List<ExamQuestionEntity> examQuestions, String questionIds) {
|
|
|
int totalObjective = 0; // 客观题总数
|
|
|
int totalRightObjective = 0; // 客观题作答正确数
|
|
|
double objectiveScore = 0d; // 客观题得分
|
|
@@ -174,17 +175,24 @@ public class FixExamScoreServiceImpl implements FixExamScoreService {
|
|
|
}
|
|
|
|
|
|
totalObjective++;
|
|
|
+ if (curQuestion.getQuestionScore() == null) {
|
|
|
+ curQuestion.setQuestionScore(0d);
|
|
|
+ }
|
|
|
|
|
|
- // 计算得分
|
|
|
- String correctAnswer = curQuestion.getCorrectAnswer();
|
|
|
- String studentAnswer = curQuestion.getStudentAnswer();
|
|
|
- if (QuestionOptionHelper.isEqualAnswer(correctAnswer, studentAnswer)) {
|
|
|
- if (curQuestion.getQuestionScore() == null) {
|
|
|
- curQuestion.setQuestionScore(0d);
|
|
|
- }
|
|
|
-
|
|
|
+ if (StringUtils.isNotBlank(questionIds) && questionIds.contains(curQuestion.getQuestionId())) {
|
|
|
+ // 无论考生作答什么,直接给分的试题ID集合,多个英文逗号分隔
|
|
|
objectiveScore += curQuestion.getQuestionScore();
|
|
|
totalRightObjective++;
|
|
|
+ log.warn("【重算成绩】questionId:{} 直接给分:{}", curQuestion.getQuestionId(),
|
|
|
+ curQuestion.getQuestionScore());
|
|
|
+ } else {
|
|
|
+ // 匹配正确答案和考生作答,计算得分
|
|
|
+ String correctAnswer = curQuestion.getCorrectAnswer();
|
|
|
+ String studentAnswer = curQuestion.getStudentAnswer();
|
|
|
+ if (QuestionOptionHelper.isEqualAnswer(correctAnswer, studentAnswer)) {
|
|
|
+ objectiveScore += curQuestion.getQuestionScore();
|
|
|
+ totalRightObjective++;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|