|
|
@@ -387,7 +387,7 @@ public class EvalDataAnalysisServiceImpl implements EvalDataAnalysisService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<FormatQuestion> getStudentQuestionsList(int userId, List<String> types){
|
|
|
+ public List<FormatQuestion> getStudentQuestionsListByType(int userId, List<String> types){
|
|
|
List<FormatQuestion> questionList = new ArrayList<>();
|
|
|
List<EvalExamRecord> evalExamRecordList = evalExamRecordDao.findByUserId(userId);
|
|
|
Map<String,Double> res = new HashMap<>();
|
|
|
@@ -431,6 +431,70 @@ public class EvalDataAnalysisServiceImpl implements EvalDataAnalysisService {
|
|
|
continue;
|
|
|
}
|
|
|
// System.out.println(errorQuestions.get(questionId));
|
|
|
+// System.out.println(question.getQuestionScore());
|
|
|
+ //如果做过相同的题目,则取最高分
|
|
|
+ DecimalFormat df = new DecimalFormat("#.00");
|
|
|
+ //当前题目的得分比值
|
|
|
+ Double scorePercent = errorQuestions.get(questionId)/questionAndScore.get(questionId);
|
|
|
+ //如果res里已经有当前的questionId,说明这道题已经做过了,判断是否需要更新信息
|
|
|
+ if(res.containsKey(questionId)){
|
|
|
+ scorePercent = Math.max(scorePercent,res.get(questionId));
|
|
|
+ //只有当得分/总分比当前值更大的时候才需要更新
|
|
|
+ if(scorePercent > res.get(questionId)){
|
|
|
+ for(FormatQuestion formatQuestion : questionList){
|
|
|
+ if(formatQuestion.getQuestionId().equals(questionId)){
|
|
|
+ formatQuestion.setScore(errorQuestions.get(questionId));
|
|
|
+ formatQuestion.setTotalScore(questionAndScore.get(questionId));
|
|
|
+ formatQuestion.setExamId(evalExamRecord.getExamId());
|
|
|
+ formatQuestion.setTime(evalExamRecord.getSubmitTime());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {//如果没有做过,则新建一个FormatQuestion
|
|
|
+ FormatQuestion formatQuestion = new FormatQuestion();
|
|
|
+ formatQuestion.setQuestionId(questionId);
|
|
|
+ formatQuestion.setQuestionVO(questionVO);
|
|
|
+ formatQuestion.setKnows(questionVO.getKnowledgeId());
|
|
|
+ formatQuestion.setScore(errorQuestions.get(questionId));
|
|
|
+ formatQuestion.setTotalScore(questionAndScore.get(questionId));
|
|
|
+ formatQuestion.setExamId(evalExamRecord.getExamId());
|
|
|
+ formatQuestion.setTime(evalExamRecord.getSubmitTime());
|
|
|
+ questionList.add(formatQuestion);
|
|
|
+ }
|
|
|
+ res.put(questionId,Double.valueOf(df.format(scorePercent)));
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return questionList;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<FormatQuestion> getStudentQuestions(int userId){
|
|
|
+ List<FormatQuestion> questionList = new ArrayList<>();
|
|
|
+ List<EvalExamRecord> evalExamRecordList = evalExamRecordDao.findByUserId(userId);
|
|
|
+ Map<String,Double> res = new HashMap<>();
|
|
|
+
|
|
|
+ for(EvalExamRecord evalExamRecord : evalExamRecordList){
|
|
|
+ Optional<EvalExamInfo> result = evalExamInfoDao.findById(evalExamRecord.getExamId());
|
|
|
+ if(!result.isPresent()){
|
|
|
+ System.out.println("找不到对应考试信息");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ EvalExamInfo evalExamInfo = evalExamInfoDao.findById(evalExamRecord.getExamId()).get();
|
|
|
+
|
|
|
+
|
|
|
+ //获得题目ID和题目分数的对应关系
|
|
|
+ Map<String,Double> questionAndScore = evalExamInfo.getQuestionAndScore();
|
|
|
+ Map<String,Double> errorQuestions = evalExamRecord.getErrorQuestions();
|
|
|
+ for(String questionId : errorQuestions.keySet()){
|
|
|
+ QuestionVO questionVO = questionService.getQuestionById(questionId);
|
|
|
+
|
|
|
+ //如果题目分数为0,则跳过不做分析
|
|
|
+ if(questionAndScore.get(questionId) == 0){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+// System.out.println(errorQuestions.get(questionId));
|
|
|
// System.out.println(question.getQuestionScore());
|
|
|
//如果做过相同的题目,则取最高分
|
|
|
DecimalFormat df = new DecimalFormat("#.00");
|