|
@@ -55,22 +55,30 @@ public class ExamStatisticController extends ControllerSupport {
|
|
|
@GetMapping("/overview/for/course/export")
|
|
|
@ApiOperation(value = "统计概况(课程)导出Excel")
|
|
|
public void overviewForCourseExport(@RequestParam Long examId, @RequestParam(required = false) Long courseId) throws Exception {
|
|
|
- List<ExamStatisticInfo> list = examStatisticService.overviewForCourse(examId, courseId);
|
|
|
+ ExamStatisticInfo examOverview = examStatisticService.overviewForExam(examId);
|
|
|
+
|
|
|
+ List<ExamStatisticInfo> list = new ArrayList<>();
|
|
|
+ if (examOverview.getExamId() != null) {
|
|
|
+ list.add(examOverview);
|
|
|
+ list.addAll(examStatisticService.overviewForCourse(examId, courseId));
|
|
|
+ }
|
|
|
|
|
|
List<Object[]> lines = new ArrayList<>();
|
|
|
for (ExamStatisticInfo info : list) {
|
|
|
- lines.add(new Object[]{info.getCourseName(), info.getCourseCode(), info.getAllCount(), info.getFinishCount()
|
|
|
- , info.getUnFinishCount(), info.getUnFinishRate(), info.getPassScoreCount()
|
|
|
- , info.getPassScoreRate(), info.getGoodScoreCount(), info.getGoodScoreRate(),
|
|
|
+ lines.add(new Object[]{info.getExamId(), info.getExamName(), info.getCourseName(), info.getCourseCode(),
|
|
|
+ info.getAllCount(), info.getFinishCount(), info.getUnFinishCount(), info.getUnFinishRate(),
|
|
|
+ info.getPassScoreCount(), info.getPassScoreRate(), info.getGoodScoreCount(), info.getGoodScoreRate(),
|
|
|
info.getIllegalityCount(), info.getIllegalityRate()});
|
|
|
}
|
|
|
|
|
|
String filePath = systemConfig.getTempDataDir() + File.separator + System.currentTimeMillis() + ".xlsx";
|
|
|
File file = new File(filePath);
|
|
|
|
|
|
- ExcelWriter.write(new String[]{"课程名称", "课程代码", "应考人数", "实考人数", "缺考人数", "缺考率", "及格人数", "及格率", "优秀人数", "优秀率", "违纪人数", "违纪率"},
|
|
|
- new Class[]{String.class, String.class, Integer.class, Integer.class, Integer.class, Double.class,
|
|
|
- Integer.class, Double.class, Integer.class, Double.class, Integer.class, Double.class},
|
|
|
+ ExcelWriter.write(new String[]{"考试ID", "考试名称", "课程名称", "课程代码", "应考人数", "实考人数", "缺考人数", "缺考率",
|
|
|
+ "及格人数", "及格率", "优秀人数", "优秀率", "违纪人数", "违纪率"},
|
|
|
+ new Class[]{Long.class, String.class, String.class, String.class, Integer.class, Integer.class,
|
|
|
+ Integer.class, Double.class, Integer.class, Double.class, Integer.class, Double.class,
|
|
|
+ Integer.class, Double.class},
|
|
|
lines, new File(filePath));
|
|
|
|
|
|
exportFile("课程统计.xlsx", file);
|
|
@@ -81,21 +89,30 @@ public class ExamStatisticController extends ControllerSupport {
|
|
|
@GetMapping("/overview/for/org/export")
|
|
|
@ApiOperation(value = "统计概况(学习中心)导出Excel")
|
|
|
public void overviewForOrgExport(@RequestParam Long examId, @RequestParam(required = false) Long orgId) throws Exception {
|
|
|
- List<ExamStatisticInfo> list = examStatisticService.overviewForOrg(examId, orgId);
|
|
|
+ ExamStatisticInfo examOverview = examStatisticService.overviewForExam(examId);
|
|
|
+
|
|
|
+ List<ExamStatisticInfo> list = new ArrayList<>();
|
|
|
+ if (examOverview.getExamId() != null) {
|
|
|
+ list.add(examOverview);
|
|
|
+ list.addAll(examStatisticService.overviewForOrg(examId, orgId));
|
|
|
+ }
|
|
|
|
|
|
List<Object[]> lines = new ArrayList<>();
|
|
|
for (ExamStatisticInfo info : list) {
|
|
|
- lines.add(new Object[]{info.getOrgName(), info.getAllCount(), info.getFinishCount()
|
|
|
- , info.getUnFinishCount(), info.getUnFinishRate(), info.getPassScoreCount()
|
|
|
- , info.getPassScoreRate(), info.getGoodScoreCount(), info.getGoodScoreRate()});
|
|
|
+ lines.add(new Object[]{info.getExamId(), info.getExamName(), info.getOrgName(),
|
|
|
+ info.getAllCount(), info.getFinishCount(), info.getUnFinishCount(), info.getUnFinishRate(),
|
|
|
+ info.getPassScoreCount(), info.getPassScoreRate(), info.getGoodScoreCount(), info.getGoodScoreRate(),
|
|
|
+ info.getIllegalityCount(), info.getIllegalityRate()});
|
|
|
}
|
|
|
|
|
|
String filePath = systemConfig.getTempDataDir() + File.separator + System.currentTimeMillis() + ".xlsx";
|
|
|
File file = new File(filePath);
|
|
|
|
|
|
- ExcelWriter.write(new String[]{"学习中心", "应考人数", "实考人数", "缺考人数", "缺考率", "及格人数", "及格率", "优秀人数", "优秀率", "违纪人数", "违纪率"},
|
|
|
- new Class[]{String.class, Integer.class, Integer.class, Integer.class, Double.class,
|
|
|
- Integer.class, Double.class, Integer.class, Double.class, Integer.class, Double.class},
|
|
|
+ ExcelWriter.write(new String[]{"考试ID", "考试名称", "学习中心", "应考人数", "实考人数", "缺考人数", "缺考率",
|
|
|
+ "及格人数", "及格率", "优秀人数", "优秀率", "违纪人数", "违纪率"},
|
|
|
+ new Class[]{Long.class, String.class, String.class, Integer.class, Integer.class, Integer.class,
|
|
|
+ Double.class, Integer.class, Double.class, Integer.class, Double.class,
|
|
|
+ Integer.class, Double.class},
|
|
|
lines, new File(filePath));
|
|
|
|
|
|
exportFile("学习中心统计.xlsx", file);
|