| | |
| | | import org.redisson.misc.Hash; |
| | | import org.springblade.core.log.exception.ServiceException; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.modules.apply.entity.Apply; |
| | | import org.springblade.modules.exam.entity.ExamAnswerRecord; |
| | | import org.springblade.modules.exam.entity.ExamPaper; |
| | | import org.springblade.modules.exam.entity.ExamScore; |
| | | import org.springblade.modules.exam.entity.ExamSubjectChoices; |
| | | import org.springblade.modules.exam.service.ExamPaperService; |
| | | import org.springblade.modules.exam.service.ExamSubjectChoicesService; |
| | | import org.springblade.modules.exam.vo.ExamResultVO; |
| | | import org.springblade.modules.exam.vo.ExamSubjectChoicesVO; |
| | | import org.springblade.modules.simulateexam.entity.SimulateExamAnswerRecord; |
| | | import org.springblade.modules.simulateexam.entity.SimulateExamRecord; |
| | |
| | | import org.springblade.modules.simulateexam.service.SimulateExamAnswerRecordService; |
| | | import org.springblade.modules.simulateexam.service.SimulateExamRecordService; |
| | | import org.springblade.modules.simulateexam.vo.SimulateExamRecordVO; |
| | | import org.springblade.modules.simulateexam.vo.SimulateExamScoreVO; |
| | | import org.springblade.modules.system.entity.User; |
| | | import org.springblade.modules.system.service.IUserService; |
| | | import org.springblade.modules.system.vo.UserVO; |
| | | import org.springblade.modules.training.entity.TrainingRegistration; |
| | | import org.springblade.modules.vip.entity.VipTopic; |
| | | import org.springblade.modules.vip.service.VipTopicService; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.lang.reflect.Array; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | List<ExamSubjectChoicesVO> radioRandomSubjectList = examPaperService.queryRandomSubjectList(radio,25); |
| | | List<ExamSubjectChoicesVO> checkboxRandomSubjectList = examPaperService.queryRandomSubjectList(checkbox,10); |
| | | List<ExamSubjectChoicesVO> judgeRandomSubjectList = examPaperService.queryRandomSubjectList(judge,20); |
| | | // List<ExamSubjectChoicesVO> sortRandomSubjectList = examPaperService.queryRandomSubjectList(sort,5); |
| | | List<ExamSubjectChoicesVO> sortRandomSubjectList = examPaperService.queryRandomSubjectList(sort,5); |
| | | |
| | | //合并集合数据 |
| | | choicesVOList.addAll(radioRandomSubjectList); |
| | | choicesVOList.addAll(checkboxRandomSubjectList); |
| | | choicesVOList.addAll(judgeRandomSubjectList); |
| | | // choicesVOList.addAll(sortRandomSubjectList); |
| | | choicesVOList.addAll(sortRandomSubjectList); |
| | | |
| | | //取出考试id |
| | | List<Long> longList = choicesVOList.stream().map(ExamSubjectChoicesVO::getId).collect(Collectors.toList()); |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 提交考试 |
| | | * @param simulateExamScore 模拟考试成绩信息对象 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Object saveSimulateExam(SimulateExamScoreVO simulateExamScore) { |
| | | //取出考试结果 |
| | | if (simulateExamScore.getExamResultVOS().size() > 0) { |
| | | List<ExamResultVO> examResultVOS = simulateExamScore.getExamResultVOS(); |
| | | //查询模拟考试信息 |
| | | SimulateExamRecord simulateExamRecord = this.getById(simulateExamScore.getSimulateExamId()); |
| | | int count = 0; |
| | | //计算考试得分,并存入考试答题记录 |
| | | for (ExamResultVO examResultVO : examResultVOS) { |
| | | SimulateExamAnswerRecord answerRecord = new SimulateExamAnswerRecord(); |
| | | answerRecord.setSimulateExamId(simulateExamScore.getSimulateExamId()); |
| | | answerRecord.setSubjectChoicesId(examResultVO.getSubjectChoicesId()); |
| | | answerRecord.setAnswerOption(examResultVO.getValue()); |
| | | answerRecord.setAnswerScore(examResultVO.getGrade()); |
| | | if (examResultVO.getGrade() > 0) { |
| | | answerRecord.setAnswerResult(1); |
| | | } else { |
| | | answerRecord.setAnswerResult(2); |
| | | } |
| | | count = count + examResultVO.getGrade(); |
| | | answerRecord.setAnswerTime(new Date()); |
| | | //新增 |
| | | simulateExamAnswerRecordService.save(answerRecord); |
| | | } |
| | | //设置总分 |
| | | simulateExamRecord.setScore(count); |
| | | //更新模拟考试信息 |
| | | this.updateById(simulateExamRecord); |
| | | //返回 |
| | | return true; |
| | | } |
| | | //返回结果 |
| | | return false; |
| | | } |
| | | } |