| | |
| | | Map<String, Object> map = new HashMap<>(4); |
| | | //1.查询当前人员当前考试的考试题目信息 |
| | | List<ExamSubjectChoicesVO> examSubjectChoicesVOSList = baseMapper.getExaminationSubjectList(examPaperVO); |
| | | |
| | | if (examSubjectChoicesVOSList.size()==0) { |
| | | examSubjectChoicesVOSList = baseMapper.queryRandomSubject(null); |
| | | List<ExamExaminationSubject> list = new ArrayList<>(); |
| | | examSubjectChoicesVOSList.forEach(examSubjectChoicesVO -> { |
| | | //新增个人对应每场考试成绩试卷 |
| | | ExamExaminationSubject ksxtSginup = new ExamExaminationSubject(); |
| | | ksxtSginup.setExaminationId(examPaperVO.getScoreId()); |
| | | ksxtSginup.setCategoryId(examSubjectChoicesVO.getChoicesType()); |
| | | ksxtSginup.setSubjectId(examSubjectChoicesVO.getId()); |
| | | //新增 |
| | | list.add(ksxtSginup); |
| | | //将题目答案设置为空字符串,不让前端看到 |
| | | examSubjectChoicesVO.setAnswer(""); |
| | | }); |
| | | //批量新增 |
| | | baseMapper.insertBatch(list); |
| | | } |
| | | //2.查询当前人员已答的题目信息 |
| | | ExamAnswerRecord examAnswerRecord = new ExamAnswerRecord(); |
| | | examAnswerRecord.setScoreId(examPaperVO.getScoreId()); |
| | | List<ExamAnswerRecord> examAnswerRecordList = examAnswerRecordService.list(Condition.getQueryWrapper(examAnswerRecord)); |
| | | |
| | | //3.查询正在答题的信息 |
| | | int count = examAnswerRecordList.size(); |
| | | int count = examAnswerRecordList.size(); |
| | | //查询下一题题目信息 |
| | | ExamSubjectChoicesVO examSubjectChoicesVO = new ExamSubjectChoicesVO(); |
| | | ExamSubjectChoices examSubjectChoices = new ExamSubjectChoices(); |
| | | if (count>0) { |
| | | if (count > 0) { |
| | | examSubjectChoices.setId(examSubjectChoicesVOSList.get(count).getId()); |
| | | examSubjectChoicesVO = examSubjectChoicesService.selectExamSubjectChoicesInfo(examSubjectChoices); |
| | | } |
| | | if (count==0) { |
| | | if (count == 0) { |
| | | examSubjectChoices.setId(examSubjectChoicesVOSList.get(0).getId()); |
| | | examSubjectChoicesVO = examSubjectChoicesService.selectExamSubjectChoicesInfo(examSubjectChoices); |
| | | } |
| | |
| | | ExamScore examScore = examScoreService.getById(examPaperVO.getScoreId()); |
| | | |
| | | //5.数据封装 |
| | | map.put("examSubjectChoicesVOSList",examSubjectChoicesVOSList); |
| | | map.put("examAnswerRecordList",examAnswerRecordList); |
| | | map.put("examSubjectChoicesVO",examSubjectChoicesVO); |
| | | map.put("examScore",examScore); |
| | | map.put("examSubjectChoicesVOSList", examSubjectChoicesVOSList); |
| | | map.put("examAnswerRecordList", examAnswerRecordList); |
| | | map.put("examSubjectChoicesVO", examSubjectChoicesVO); |
| | | map.put("examScore", examScore); |
| | | |
| | | //6.返回数据 |
| | | return map; |