| | |
| | | Exam entity = baseMapper.selectById(form.getId()); |
| | | // 为空抛IllegalArgumentException,做全局异常处理 |
| | | Assert.notNull(entity, "记录不存在"); |
| | | // 判断考试状态 |
| | | if (! ExamStatusEnum.NOT_START.equals(entity.getStatus())) { |
| | | throw new RuntimeException("只能修改还未开始的考试"); |
| | | } |
| | | BeanUtils.copyProperties(form, entity); |
| | | entity.setStatus(ExamStatusEnum.getStatusByTime(form.getStartTime(), form.getEndTime(), null)); |
| | | baseMapper.updateById(entity); |
| | |
| | | //插入exam_paper_answer(成绩表) |
| | | ExamPaperScore examPaperScore = new ExamPaperScore(); |
| | | BeanUtils.copyProperties(examPaperMark,examPaperScore); |
| | | examPaperScore.setUserScore(new BigDecimal(examPaperMark.getScore())); |
| | | examPaperScore.setPaperScore(new BigDecimal(examPaperMark.getTotalScore())); |
| | | examPaperScore.setScore(new BigDecimal(examPaperMark.getScore())); |
| | | examPaperScore.setTotalScore(new BigDecimal(examPaperMark.getTotalScore())); |
| | | examPaperScore.setJudgeUser(userId); |
| | | examPaperScore.setCreateUser(examPaperMark.getUserId()); |
| | | examPaperScore.setAnswerTime(examPaperMark.getSubmitTime()); |
| | | examPaperScore.setUserId(examPaperMark.getUserId()); |
| | | examPaperScore.setSubmitTime(examPaperMark.getSubmitTime()); |
| | | examPaperScore.setPaperContent(JSON.toJSONString(examPaperMark.getTitleItems())); |
| | | long questionCorrect =0; |
| | | long questionCount=0; |