| | |
| | | import com.mindskip.xzs.domain.ExamPaperSubject; |
| | | import com.mindskip.xzs.domain.Subject; |
| | | import com.mindskip.xzs.domain.exam.ExamPaperAnswerObject; |
| | | 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.service.ExamPaperAnswerService; |
| | |
| | | import com.mindskip.xzs.utility.DateTimeUtil; |
| | | import com.mindskip.xzs.utility.ExamUtil; |
| | | import com.mindskip.xzs.utility.PageInfoHelper; |
| | | import com.mindskip.xzs.utility.excel.ExcelUtils; |
| | | import com.mindskip.xzs.viewmodel.admin.paper.ExamPaperAnswerPageRequestVM; |
| | | import com.mindskip.xzs.viewmodel.student.exampaper.ExamPaperAnswerPageResponseVM; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | |
| | | public RestResponse<Map<String, Object>> data(@RequestBody ExamPaperDataVO examPaperDataVO) { |
| | | return RestResponse.ok(examPaperAnswerService.data(examPaperDataVO)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/export", method = RequestMethod.GET) |
| | | public void export(Integer id, Integer type, HttpServletResponse response) { |
| | | List<ExamPaperDataExportVO> list = examPaperAnswerService.dataExport(new ExamPaperDataVO().setId(id).setType(type)); |
| | | ExcelUtils.export(response, "分数统计", list, ExamPaperDataExportVO.class); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.mindskip.xzs.domain.vo; |
| | | |
| | | import com.alibaba.excel.annotation.write.style.ContentRowHeight; |
| | | import com.mindskip.xzs.utility.excel.ExcelExport; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author gonghl |
| | | * @since 2024/5/24 |
| | | */ |
| | | |
| | | @Data |
| | | @Accessors(chain = true) |
| | | public class ExamPaperDataExportVO { |
| | | |
| | | private Integer id; |
| | | |
| | | @ExcelExport("部门名称") |
| | | private String name; |
| | | |
| | | @ExcelExport("参考人数") |
| | | private Integer factPeopleTotal; |
| | | |
| | | @ExcelExport("参考人数百分比") |
| | | private BigDecimal referencePercentage; |
| | | |
| | | @ExcelExport("平均分") |
| | | private BigDecimal averageScore; |
| | | |
| | | @ExcelExport("总考试次数") |
| | | private Integer examTotal; |
| | | |
| | | } |
| | |
| | | import com.mindskip.xzs.domain.ExamTemplatesUserCount; |
| | | import com.mindskip.xzs.domain.ScoreTemplatesUserCount; |
| | | import com.mindskip.xzs.domain.other.KeyValue; |
| | | import com.mindskip.xzs.domain.vo.ExamPaperDataVO; |
| | | import com.mindskip.xzs.domain.vo.ExamPaperStatisticVO; |
| | | import com.mindskip.xzs.domain.vo.ExamTemplatesVO; |
| | | import com.mindskip.xzs.domain.vo.TeamplatesUserExcelVO; |
| | | import com.mindskip.xzs.domain.vo.*; |
| | | import com.mindskip.xzs.viewmodel.admin.exam.ExamPaperEditRequestVM; |
| | | import com.mindskip.xzs.viewmodel.admin.paper.ExamPaperGradePageRequestVM; |
| | | import com.mindskip.xzs.viewmodel.admin.paper.ExamPaperGradeQuery; |
| | |
| | | |
| | | Map<String, Object> pieChart(ExamPaperStatisticVO examPaperStatisticVO); |
| | | |
| | | List<Map<String, Object>> dataByTemplate(ExamPaperDataVO examPaperDataVO); |
| | | List<ExamPaperDataExportVO> dataByTemplate(ExamPaperDataVO examPaperDataVO); |
| | | |
| | | Map<String, Object> totalByTemplate(ExamPaperDataVO examPaperDataVO); |
| | | ExamPaperDataExportVO totalByTemplate(ExamPaperDataVO examPaperDataVO); |
| | | |
| | | List<Map<String, Object>> dataByPaper(ExamPaperDataVO examPaperDataVO); |
| | | List<ExamPaperDataExportVO> dataByPaper(ExamPaperDataVO examPaperDataVO); |
| | | |
| | | Map<String, Object> totalByPaper(ExamPaperDataVO examPaperDataVO); |
| | | ExamPaperDataExportVO totalByPaper(ExamPaperDataVO examPaperDataVO); |
| | | } |
| | |
| | | |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.mindskip.xzs.domain.*; |
| | | 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.viewmodel.admin.paper.ExamPaperGradePageRequestVM; |
| | |
| | | Map<String, Object> statistic(ExamPaperStatisticVO examPaperStatisticVO); |
| | | |
| | | Map<String, Object> data(ExamPaperDataVO examPaperDataVO); |
| | | |
| | | List<ExamPaperDataExportVO> dataExport(ExamPaperDataVO examPaperDataVO); |
| | | } |
| | |
| | | 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; |
| | |
| | | if (Objects.equals(examPaperDataVO.getType(), 7)) { |
| | | map.put("data", examPaperAnswerMapper.dataByTemplate(examPaperDataVO)); |
| | | map.put("total", examPaperAnswerMapper.totalByTemplate(examPaperDataVO)); |
| | | } |
| | | // 普通试卷 |
| | | else { |
| | | } 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; |
| | | } |
| | | } |
| | | } |
| | |
| | | </foreach> |
| | | </insert> |
| | | |
| | | <select id="dataByTemplate" resultType="java.util.Map" parameterType="com.mindskip.xzs.domain.vo.ExamPaperDataVO"> |
| | | <select id="dataByTemplate" resultType="com.mindskip.xzs.domain.vo.ExamPaperDataExportVO" parameterType="com.mindskip.xzs.domain.vo.ExamPaperDataVO"> |
| | | SELECT |
| | | a.id, |
| | | a.name, |
| | |
| | | a.id, a.name |
| | | </select> |
| | | |
| | | <select id="totalByTemplate" resultType="java.util.Map" parameterType="com.mindskip.xzs.domain.vo.ExamPaperDataVO"> |
| | | <select id="totalByTemplate" resultType="com.mindskip.xzs.domain.vo.ExamPaperDataExportVO" parameterType="com.mindskip.xzs.domain.vo.ExamPaperDataVO"> |
| | | SELECT |
| | | (SELECT (SELECT count(*) FROM t_exam_paper) + (SELECT count(*) FROM t_exam_templates)) as examTotal, -- 总考试次数 |
| | | COUNT(DISTINCT c.create_user) as factPeopleTotal, -- 参考人数 |
| | |
| | | a.id |
| | | </select> |
| | | |
| | | <select id="dataByPaper" resultType="java.util.Map" parameterType="com.mindskip.xzs.domain.vo.ExamPaperDataVO"> |
| | | <select id="dataByPaper" resultType="com.mindskip.xzs.domain.vo.ExamPaperDataExportVO" parameterType="com.mindskip.xzs.domain.vo.ExamPaperDataVO"> |
| | | SELECT |
| | | a.id, |
| | | a.name, |
| | |
| | | a.id, a.name |
| | | </select> |
| | | |
| | | <select id="totalByPaper" resultType="java.util.Map" parameterType="com.mindskip.xzs.domain.vo.ExamPaperDataVO"> |
| | | <select id="totalByPaper" resultType="com.mindskip.xzs.domain.vo.ExamPaperDataExportVO" parameterType="com.mindskip.xzs.domain.vo.ExamPaperDataVO"> |
| | | SELECT |
| | | (SELECT (SELECT count(*) FROM t_exam_paper) + (SELECT count(*) FROM t_exam_templates)) as examTotal, -- 总考试次数 |
| | | count(DISTINCT b.create_user) AS factPeopleTotal, -- 参考数 |