| | |
| | | throw new RuntimeException("只能修改还未开始的考试"); |
| | | } |
| | | BeanUtils.copyProperties(form, entity); |
| | | entity.setStatus(ExamStatusEnum.getStatusByTime(form.getStartTime(), form.getEndTime(), null)); |
| | | entity.setStatus(ExamStatusEnum.getStatusByTime(form.getStartTime(), form.getEndTime(), new Date())); |
| | | // 如果修改成功发送mq消息 |
| | | if (baseMapper.updateById(entity) > 0) { |
| | | this.sendMQ(entity, entity.getUpdateVersion()); |
| | |
| | | item.setExamPaperId(null); |
| | | } |
| | | }); |
| | | // |
| | | return Result.ok().data(page.getRecords()).total(page.getTotal()); |
| | | } |
| | | |
| | |
| | | .one(); |
| | | if (Objects.nonNull(hasJoin)) { |
| | | // 允许提交后继续作答 |
| | | // if(ExamSubmitTempStatusEnum.finish.equals(hasJoin.getStatus())){ |
| | | // throw new RuntimeException("您已提交试卷,请勿重复作答"); |
| | | // } |
| | | if(ExamSubmitTempStatusEnum.finish.equals(hasJoin.getStatus())){ |
| | | throw new RuntimeException("您已提交试卷,请勿重复作答"); |
| | | } |
| | | StartExamVO startExamVO = new StartExamVO(); |
| | | startExamVO.setExamName(exam.getExamName()); |
| | | startExamVO.setId(hasJoin.getExamId()); |
| | |
| | | ExamSubmitTemp one = new LambdaQueryChainWrapper<>(examSubmitTempMapper) |
| | | .eq(ExamSubmitTemp::getExamId, submitData.getId()) |
| | | .eq(ExamSubmitTemp::getUserId, webContext.getCurrentUser().getId()) |
| | | .eq(ExamSubmitTemp::getDeleted, 0) |
| | | .one(); |
| | | |
| | | if (Objects.nonNull(one)) { |
| | |
| | | for (PaperFixQuestionVO titleItem : titleItems) { |
| | | for (DoQuestionVO doQuestionVO : titleItem.getQuestionList()) { |
| | | Integer questionId = doQuestionVO.getId(); |
| | | Optional<QuestionAnswerCopyVO> first = answerList.stream().filter(answer -> questionId.equals(answer.getId())).findFirst(); |
| | | if (first.isPresent()) { |
| | | QuestionAnswerCopyVO answerCopyVO = first.get(); |
| | | doQuestionVO.setQuestionAnswer(answerCopyVO.getCorrect()); |
| | | doQuestionVO.setAnalyze(answerCopyVO.getAnalyze()); |
| | | doQuestionVO.setDifficult(answerCopyVO.getDifficult()); |
| | | if(questionId!=null) { |
| | | Optional<QuestionAnswerCopyVO> first = answerList.stream().filter(answer -> questionId.equals(answer.getId())).findFirst(); |
| | | if (first.isPresent()) { |
| | | QuestionAnswerCopyVO answerCopyVO = first.get(); |
| | | doQuestionVO.setQuestionAnswer(answerCopyVO.getCorrect()); |
| | | doQuestionVO.setAnalyze(answerCopyVO.getAnalyze()); |
| | | doQuestionVO.setDifficult(answerCopyVO.getDifficult()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 作废 |
| | | * |
| | | * @param examId |
| | | * @param id |
| | | * @return {@link Result } |
| | | * @author |
| | | */ |
| | |
| | | Date currentTime = new Date(); |
| | | Date startTime = examInfo.getStartTime(); |
| | | Date endTime = examInfo.getEndTime(); |
| | | if (currentTime.before(startTime)) { |
| | | examInfo.setStatus(ExamStatusEnum.NOT_START); |
| | | } else if (currentTime.after(startTime) && currentTime.before(endTime)) { |
| | | examInfo.setStatus(ExamStatusEnum.ING); |
| | | } else { |
| | | examInfo.setStatus(ExamStatusEnum.FINISHED); |
| | | } |
| | | ExamStatusEnum statusByTime = ExamStatusEnum.getStatusByTime(startTime, endTime, currentTime); |
| | | examInfo.setStatus(statusByTime); |
| | | // 修改当前的考试状态 |
| | | new LambdaUpdateChainWrapper<>(examMapper) |
| | | .eq(Exam::getId, id) |