| | |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.base.SystemCode; |
| | | import com.ycl.jxkg.context.WebContext; |
| | | import com.ycl.jxkg.domain.base.AbsVo; |
| | | import com.ycl.jxkg.domain.entity.*; |
| | | import com.ycl.jxkg.domain.exam.PaperFixQuestionDTO; |
| | | import com.ycl.jxkg.domain.exam.PaperQuestion; |
| | |
| | | entity.setStatus(ExamStatusEnum.getStatusByTime(form.getStartTime(), form.getEndTime(), null)); |
| | | // 如果修改成功发送mq消息 |
| | | if (baseMapper.updateById(entity) > 0) { |
| | | this.sendMQ(entity, entity.getUpdateVersion() + 1); |
| | | this.sendMQ(entity, entity.getUpdateVersion()); |
| | | } |
| | | return Result.ok("修改成功"); |
| | | } |
| | |
| | | .eq(ExamSubmitTemp::getUserId, webContext.getCurrentUser().getId()) |
| | | .one(); |
| | | if (Objects.nonNull(hasJoin)) { |
| | | //TODO:开发环境先关闭 |
| | | // if(ExamSubmitTempStatusEnum.finish.equals(hasJoin.getStatus())){ |
| | | // throw new RuntimeException("您已提交试卷,请勿重复作答"); |
| | | // } |
| | | StartExamVO startExamVO = new StartExamVO(); |
| | | startExamVO.setExamName(exam.getExamName()); |
| | | startExamVO.setId(hasJoin.getExamId()); |
| | |
| | | doQuestionVO.setQuestionType(item.getQuestionType()); |
| | | //增加题目分数 |
| | | doQuestionVO.setQuestionScore(question.getScore()); |
| | | |
| | | // 题目副本 |
| | | QuestionAnswerCopyVO copy = new QuestionAnswerCopyVO(); |
| | | copy.setId(question.getId()); |
| | | copy.setAnalyze(question.getAnalyze()); |
| | | copy.setDifficult(question.getDifficult()); |
| | | //填空的答案在Json里 |
| | | if (QuestionTypeEnum.GapFilling.getCode().equals(item.getQuestionType())) { |
| | | List<String> gapAnswer = new ArrayList<>(); |
| | | for (QuestionItemObject questionItemObject : question.getItems()) { |
| | | gapAnswer.add(questionItemObject.getContent()); |
| | | } |
| | | copy.setCorrect(String.join(ANSWER_SPLIT, gapAnswer)); |
| | | } else { |
| | | copy.setCorrect(question.getCorrect()); |
| | | } |
| | | questionAnswerCopyVOList.add(copy); |
| | | |
| | | // 填空题需要抹除content(因为是答案) |
| | | if (QuestionTypeEnum.GapFilling.getCode().equals(doQuestionVO.getQuestionType())) { |
| | | question.getItems().stream().forEach(option -> { |
| | |
| | | doQuestionVO.setId(question.getId()); |
| | | doQuestionVO.setOriginalFile(question.getOriginalFile()); |
| | | doQuestionVO.setAudioFile(question.getAudioFile()); |
| | | |
| | | // 题目副本 |
| | | QuestionAnswerCopyVO copy = new QuestionAnswerCopyVO(); |
| | | copy.setId(question.getId()); |
| | | copy.setAnalyze(question.getAnalyze()); |
| | | copy.setDifficult(question.getDifficult()); |
| | | //填空的答案在Json里 |
| | | if (QuestionTypeEnum.GapFilling.getCode().equals(item.getQuestionType())) { |
| | | List<String> gapAnswer = new ArrayList<>(); |
| | | for (QuestionItemObject questionItemObject : doQuestionVO.getQuestionItemList()) { |
| | | gapAnswer.add(questionItemObject.getContent()); |
| | | } |
| | | copy.setCorrect(String.join(ANSWER_SPLIT, gapAnswer)); |
| | | } else { |
| | | copy.setCorrect(question.getCorrect()); |
| | | } |
| | | questionAnswerCopyVOList.add(copy); |
| | | |
| | | return doQuestionVO; |
| | | }).collect(Collectors.toList()); |
| | | if (ExamPaperTypeEnum.RandomOrder.getCode().equals(examPaper.getPaperType())) { |
| | |
| | | |
| | | @Override |
| | | public Result addTime(AddTimeForm form) { |
| | | if (! websocketServer.checkUserOnline(form.getUserId())) { |
| | | throw new RuntimeException("该学员不在线,无法执行该操作"); |
| | | } |
| | | WebsocketDataVO websocket = new WebsocketDataVO(); |
| | | websocket.setCommend(WebsocketCommendEnum.DELAYED.getCommend()); |
| | | websocket.setCommend(WebsocketCommendEnum.DELAYED.getCommand()); |
| | | BigDecimal sed = BigDecimal.valueOf(60).multiply(form.getAddTimeM()); |
| | | form.setAddTimeM(sed); |
| | | websocket.setData(form); |
| | | // 发送websocket消息 |
| | | websocketServer.sendOneMessage(form.getUserId(), JSON.toJSONString(form)); |
| | |
| | | |
| | | @Override |
| | | public Result forceSubmit(ForceSubmitForm form) { |
| | | if (! websocketServer.checkUserOnline(form.getUserId())) { |
| | | throw new RuntimeException("该学员不在线,无法执行该操作"); |
| | | } |
| | | WebsocketDataVO websocket = new WebsocketDataVO(); |
| | | websocket.setCommend(WebsocketCommendEnum.FORCE_SUBMIT.getCommend()); |
| | | websocket.setCommend(WebsocketCommendEnum.FORCE_SUBMIT.getCommand()); |
| | | websocket.setData(form); |
| | | // 发送websocket消息 |
| | | websocketServer.sendOneMessage(form.getUserId(), JSON.toJSONString(form)); |