| | |
| | | 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.ExamPaperDataExportVO; |
| | | import com.mindskip.xzs.domain.vo.ExamPaperDataVO; |
| | | import com.mindskip.xzs.domain.vo.ExamPaperStatisticVO; |
| | | import com.mindskip.xzs.repository.ExamPaperAnswerMapper; |
| | | import com.mindskip.xzs.repository.ExamPaperMapper; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Integer selectAllCount() { |
| | | return examPaperAnswerMapper.selectAllCount(); |
| | | public Integer selectAllCount(List<Integer> deptIds) { |
| | | return examPaperAnswerMapper.selectAllCount(deptIds); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public Map<String, Object> statistic(ExamPaperStatisticVO examPaperStatisticVO) { |
| | | // 获取原始数据 |
| | | Map<String, Object> histogram = examPaperAnswerMapper.histogram(examPaperStatisticVO); |
| | | Map<String, Object> histogram; |
| | | ExamPaperDataExportVO examPaperDataExportVO; |
| | | if (Objects.equals(examPaperStatisticVO.getExamPaperType(), 7)) { |
| | | histogram = examPaperAnswerMapper.histogramByTemplate(examPaperStatisticVO); |
| | | examPaperDataExportVO = examPaperAnswerMapper.totalByTemplate(new ExamPaperDataVO().setId(examPaperStatisticVO.getExamPaperId()).setDeptIds(examPaperStatisticVO.getDepartmentId())); |
| | | } else { |
| | | histogram = examPaperAnswerMapper.histogram(examPaperStatisticVO); |
| | | examPaperDataExportVO = examPaperAnswerMapper.totalByPaper(new ExamPaperDataVO().setId(examPaperStatisticVO.getExamPaperId()).setDeptIds(examPaperStatisticVO.getDepartmentId())); |
| | | } |
| | | |
| | | // 不存在时填充0 |
| | | if (Objects.isNull(examPaperDataExportVO)) { |
| | | examPaperDataExportVO = new ExamPaperDataExportVO() |
| | | .setExamTotal(examPaperAnswerMapper.getExamTotal(examPaperStatisticVO)) |
| | | .setFactPeopleTotal(0) |
| | | .setAverageScore(BigDecimal.ZERO) |
| | | .setReferencePercentage(BigDecimal.ZERO); |
| | | } |
| | | |
| | | Map<String, Object> pieChart = examPaperAnswerMapper.pieChart(examPaperStatisticVO); |
| | | // 初始化结果容器 |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | |
| | | map.put("score", score); |
| | | map.put("age", age); |
| | | map.put("examPeopleNum", examPeopleNum); |
| | | map.put("total", examPaperDataExportVO); |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> data(ExamPaperDataVO examPaperDataVO) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | // 随机试卷 |
| | | if (Objects.equals(examPaperDataVO.getType(), 7)) { |
| | | map.put("data", examPaperAnswerMapper.dataByTemplate(examPaperDataVO)); |
| | | map.put("total", examPaperAnswerMapper.totalByTemplate(examPaperDataVO)); |
| | | } else { |
| | | map.put("data", examPaperAnswerMapper.dataByPaper(examPaperDataVO)); |
| | | map.put("total", examPaperAnswerMapper.totalByPaper(examPaperDataVO)); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public List<ExamPaperDataExportVO> dataExport(ExamPaperDataVO examPaperDataVO) { |
| | | // 随机试卷 |
| | | if (Objects.equals(examPaperDataVO.getType(), 7)) { |
| | | List<ExamPaperDataExportVO > dataByTemplate = examPaperAnswerMapper.dataByTemplate(examPaperDataVO); |
| | | ExamPaperDataExportVO totalByTemplate = examPaperAnswerMapper.totalByTemplate(examPaperDataVO); |
| | | dataByTemplate.add(0, totalByTemplate.setName("所有部门")); |
| | | return dataByTemplate; |
| | | } else { |
| | | List<ExamPaperDataExportVO > dataByPaper = examPaperAnswerMapper.dataByPaper(examPaperDataVO); |
| | | ExamPaperDataExportVO totalByPaper = examPaperAnswerMapper.totalByPaper(examPaperDataVO); |
| | | dataByPaper.add(0, totalByPaper.setName("所有部门")); |
| | | return dataByPaper; |
| | | } |
| | | } |
| | | } |