| | |
| | | import com.mindskip.xzs.domain.other.ExamPaperAnswerUpdate; |
| | | import com.mindskip.xzs.domain.other.KeyValue; |
| | | import com.mindskip.xzs.domain.task.TaskItemAnswerObject; |
| | | import com.mindskip.xzs.domain.vo.ScoreTemplatesCountVO; |
| | | import com.mindskip.xzs.repository.ExamPaperAnswerMapper; |
| | | import com.mindskip.xzs.repository.ExamPaperMapper; |
| | | import com.mindskip.xzs.repository.QuestionMapper; |
| | |
| | | import com.mindskip.xzs.utility.ExamUtil; |
| | | import com.mindskip.xzs.utility.JsonUtil; |
| | | import com.mindskip.xzs.viewmodel.admin.paper.ExamPaperGradePageRequestVM; |
| | | import com.mindskip.xzs.viewmodel.admin.paper.ExamPaperGradeQuery; |
| | | import com.mindskip.xzs.viewmodel.student.exam.ExamPaperSubmitItemVM; |
| | | import com.mindskip.xzs.viewmodel.student.exam.ExamPaperSubmitVM; |
| | | import com.mindskip.xzs.viewmodel.student.exampaper.ExamPaperAnswerPageVM; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<ExamPaperAnswer> getByCreatUser(ScoreTemplatesCountVO scoreTemplatesCountVO) { |
| | | return PageHelper.startPage(scoreTemplatesCountVO.getPageIndex(), scoreTemplatesCountVO.getPageSize(), "id desc").doSelectPageInfo(() -> |
| | | examPaperAnswerMapper.getByCreatUser(scoreTemplatesCountVO)); |
| | | public PageInfo<ExamPaperAnswer> getByCreatUser(ExamPaperGradeQuery query) { |
| | | query.setFullTime(); |
| | | return PageHelper.startPage(query.getPageIndex(), query.getPageSize(), "id desc").doSelectPageInfo(() -> |
| | | examPaperAnswerMapper.getByCreatUser(query)); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> statistic(String examPaperId, String departmentId) { |
| | | // 获取原始数据 |
| | | Map<String, Object> histogram = examPaperAnswerMapper.histogram(examPaperId, departmentId); |
| | | Map<String, Object> pieChart = examPaperAnswerMapper.pieChart(examPaperId, departmentId); |
| | | // 初始化结果容器 |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | List<Map<String, Object>> score = new ArrayList<>(); |
| | | List<Map<String, Object>> age = new ArrayList<>(); |
| | | List<Map<String, Object>> examPeopleNum = new ArrayList<>(); |
| | | // 处理成绩与年龄分布 |
| | | histogram.forEach((k, v) -> { |
| | | Map<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put(k, v); |
| | | if (k.contains("score")) { |
| | | score.add(hashMap); |
| | | } |
| | | if (k.contains("age")) { |
| | | age.add(hashMap); |
| | | } |
| | | }); |
| | | // 处理参考人数(出席与缺席) |
| | | pieChart.forEach((k, v) -> { |
| | | Map<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put(k, v); |
| | | if ("totalAttended".equals(k)) { |
| | | examPeopleNum.add(hashMap); |
| | | } |
| | | if ("totalAbsent".equals(k)) { |
| | | examPeopleNum.add(hashMap); |
| | | } |
| | | }); |
| | | map.put("score", score); |
| | | map.put("age", age); |
| | | map.put("examPeopleNum", examPeopleNum); |
| | | return map; |
| | | } |
| | | } |