|
|
@@ -5,6 +5,7 @@ import com.alibaba.fastjson2.util.DateUtils;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.google.common.collect.Maps;
|
|
|
import com.google.common.collect.Sets;
|
|
|
+import com.ruoyi.common.annotation.Excel;
|
|
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
import com.ruoyi.common.enums.ExamType;
|
|
|
import com.ruoyi.common.enums.UserRegStatus;
|
|
|
@@ -143,6 +144,9 @@ public class ExamService {
|
|
|
answerSheet.setSubjectId(learnPaper.getSubjectId());
|
|
|
answerSheet.setSubjectName(dzSubjectService.selectDzSubjectBySubjectId(learnPaper.getSubjectId()).getSubjectName());
|
|
|
}
|
|
|
+ if(null != examinee.getStats()) {
|
|
|
+ answerSheet.setStats(JSONObject.parseObject(examinee.getStats()));
|
|
|
+ }
|
|
|
return answerSheet;
|
|
|
}
|
|
|
|
|
|
@@ -173,18 +177,28 @@ public class ExamService {
|
|
|
|
|
|
List<LearnAnswer> answersList = Lists.newArrayList();
|
|
|
Integer wrongCount = 0;
|
|
|
+ Integer totalScore = 0;
|
|
|
+ Integer score = 0;
|
|
|
for(PaperVO.QuestionAnswer question : answerSheet.getQuestions()) {
|
|
|
if(CollectionUtils.isNotEmpty(question.getSubQuestions())) {
|
|
|
for(PaperVO.QuestionAnswer sq : question.getSubQuestions()) {
|
|
|
LearnAnswer answer = buildAnswer(answerSheet, questionMap, sq, answersList);
|
|
|
- if(answerSheet.getIsDone() && !answer.getState().equals(1)) {
|
|
|
- wrongCount++;
|
|
|
+ if(answerSheet.getIsDone()) {
|
|
|
+ totalScore += sq.getScore();
|
|
|
+ score += answer.getScore();
|
|
|
+ if(!answer.getState().equals(1)) {
|
|
|
+ wrongCount++;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
LearnAnswer answer = buildAnswer(answerSheet, questionMap, question, answersList);
|
|
|
- if(answerSheet.getIsDone() && !answer.getState().equals(1)) {
|
|
|
- wrongCount++;
|
|
|
+ if(answerSheet.getIsDone()) {
|
|
|
+ totalScore += question.getScore();
|
|
|
+ score += answer.getScore();
|
|
|
+ if(!answer.getState().equals(1)) {
|
|
|
+ wrongCount++;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -203,18 +217,30 @@ public class ExamService {
|
|
|
if(answerSheet.getIsDone()) {
|
|
|
upExaminee.setEndTime(new Date());
|
|
|
upExaminee.setState(ExamineeStatus.Commit.getVal());
|
|
|
+ upExaminee.setScore(score);
|
|
|
+ upExaminee.setScoreRate(score * 100 / totalScore);
|
|
|
upExaminee.setWrongCount(wrongCount);
|
|
|
+ learnExamineeMapper.updateLearnExaminee(upExaminee);
|
|
|
if(PaperType.Simulated.getVal().equals(exitExaminee.getPaperType())) {
|
|
|
+ List<JSONObject> paperStatList = learnExamineeMapper.selectExamRankingStats(upExaminee.getScore(), Lists.newArrayList(exitExaminee.getPaperId()));
|
|
|
+ JSONObject o = paperStatList.get(0);
|
|
|
+ Integer totalCount = o.getInteger("totalCount");
|
|
|
+ Integer maxScore = o.getInteger("maxScore");
|
|
|
+ Integer avgScore = o.getInteger("avgScore");
|
|
|
+ Integer lowCount = o.getInteger("lowCount");
|
|
|
JSONObject stats = new JSONObject();
|
|
|
- stats.put("score", 100);
|
|
|
- stats.put("rate", 50);
|
|
|
- stats.put("maxScore", 300);
|
|
|
- stats.put("averageScore", 100);
|
|
|
- stats.put("hitRate", 50);
|
|
|
+ stats.put("score", upExaminee.getScore());
|
|
|
+ stats.put("rate", upExaminee.getScoreRate());
|
|
|
+ stats.put("maxScore", maxScore);
|
|
|
+ stats.put("averageScore", avgScore);
|
|
|
+ stats.put("hitRate", lowCount * 100 / totalCount);
|
|
|
upExaminee.setStats(JSONObject.toJSONString(stats));
|
|
|
+ learnExamineeMapper.updateLearnExaminee(upExaminee);
|
|
|
}
|
|
|
+ } else {
|
|
|
+ learnExamineeMapper.updateLearnExaminee(upExaminee);
|
|
|
}
|
|
|
- learnExamineeMapper.updateLearnExaminee(upExaminee);
|
|
|
+
|
|
|
if(answerSheet.getIsDone()) {
|
|
|
// 关闭试卷
|
|
|
LearnPaper up = new LearnPaper();
|
|
|
@@ -307,6 +333,10 @@ public class ExamService {
|
|
|
answer.setMark(null != question.getIsMark() && question.getIsMark());
|
|
|
answer.setNotKnow(null != question.getIsNotKnow() && question.getIsNotKnow());
|
|
|
answer.setState(question.calcState(stdAnswer, answerSheet.getIsDone()));
|
|
|
+ if (answerSheet.getIsDone()) {
|
|
|
+ answer.setScore(answer.getState() == 1 ? stdAnswer.getScore() : 0);
|
|
|
+ answer.setScoreRate(answer.getScore() * 100 / stdAnswer.getScore());
|
|
|
+ }
|
|
|
return answer;
|
|
|
}
|
|
|
|
|
|
@@ -355,6 +385,7 @@ public class ExamService {
|
|
|
upUser.setEvalCounts(evalCountObj.toJSONString());
|
|
|
sysUserService.updateUserProfile(upUser);
|
|
|
|
|
|
+ existPaperIdSet.clear(); // TODO 临时清除重复检查
|
|
|
LearnPaper paper = getBestPaper(sysUser.getExamType(), plan, subjectId, existPaperIdSet);
|
|
|
examinee.setPaperId(paper.getId());
|
|
|
examinee.setState(ExamineeStatus.Sign.getVal());
|
|
|
@@ -483,7 +514,7 @@ public class ExamService {
|
|
|
answerSheet.setBeginTime(examinee.getBeginTime());
|
|
|
answerSheet.setDuration(examinee.getDuration());
|
|
|
if(StringUtils.isNotBlank(paper.getPaperInfo())) {
|
|
|
- answerSheet.setConditions(JSONObject.parseObject(paper.getPaperInfo(), AnswerSheet.PaperCond.class));
|
|
|
+ answerSheet.setPaperInfo(JSONObject.parseObject(paper.getPaperInfo(), AnswerSheet.PaperCond.class));
|
|
|
}
|
|
|
answerSheet.setScoringType("1");
|
|
|
answerSheet.setMode(0L);
|