| | |
| | | import com.ycl.jxkg.domain.ExamPaperAnswerInfo; |
| | | import com.ycl.jxkg.domain.entity.*; |
| | | import com.ycl.jxkg.domain.other.KeyValue; |
| | | import com.ycl.jxkg.domain.vo.admin.exam.ClassExamScoreInfoVO; |
| | | import com.ycl.jxkg.domain.vo.admin.exam.ExamPaperInfoVO; |
| | | import com.ycl.jxkg.domain.vo.admin.paper.ExamPaperAnswerPageRequestVO; |
| | | import com.ycl.jxkg.domain.vo.admin.paper.UserAnswerPageRequestVO; |
| | | import com.ycl.jxkg.domain.vo.student.exam.ExamPaperSubmitItemVO; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | examPaperScoreMapper.pageUser(model)); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public Result queryMaxAndMinScore(Integer id) { |
| | | List<ExamPaperScore> list = new ArrayList<>(); |
| | | public Result<ExamPaperInfoVO> getExamPaperInfo(Integer id) { |
| | | ExamPaperInfoVO result = new ExamPaperInfoVO(); |
| | | // 查询考试信息 |
| | | ExamPaperAnswerPageRequestVO model = new ExamPaperAnswerPageRequestVO(); |
| | | model.setExamId(id); |
| | | // 最高分、最低分 |
| | | ExamPaperScore max = examPaperScoreMapper.selectOne(new LambdaQueryWrapper<>(ExamPaperScore.class) |
| | | .eq(ExamPaperScore::getExamId, id) |
| | | .orderByDesc(ExamPaperScore::getTotalScore) |
| | | .last("limit 1")); |
| | | list.add(max); |
| | | if (null != max) { |
| | | result.setHighestScore(max.getTotalScore()); |
| | | ExamPaperScore min = examPaperScoreMapper.selectOne(new LambdaQueryWrapper<>(ExamPaperScore.class) |
| | | .eq(ExamPaperScore::getExamId, id) |
| | | .orderByAsc(ExamPaperScore::getTotalScore) |
| | | .last("limit 1")); |
| | | list.add(min); |
| | | // 判断max和min是否为同一条数据 |
| | | if (null != min && !max.getId().equals(min.getId())) { |
| | | result.setLowestScore(min.getTotalScore()); |
| | | }else { |
| | | result.setLowestScore(BigDecimal.valueOf(0)); |
| | | } |
| | | }else { |
| | | result.setHighestScore(BigDecimal.valueOf(0)); |
| | | result.setLowestScore(BigDecimal.valueOf(0)); |
| | | } |
| | | return Result.ok(list); |
| | | // 查询班级学员名称及考试成绩 |
| | | List<ClassExamScoreInfoVO> info = examPaperScoreMapper.getClassExamScoreInfo(id); |
| | | result.setTotalUserCount(info.size()); |
| | | ClassExamScoreInfoVO classExamScoreInfoVO = info.get(0); |
| | | result.setLackUserCount(classExamScoreInfoVO.getLackUserCount()); |
| | | result.setUserNames(info.stream().map(item -> item.getRealName()).collect(Collectors.toList())); |
| | | result.setUserScores(info.stream().map(item -> item.getTotalScore()).collect(Collectors.toList())); |
| | | return Result.ok(result); |
| | | } |
| | | } |