Browse Source

成绩导出

xiatian 1 year ago
parent
commit
2143ef2d7e

+ 19 - 13
distributed-print/src/main/java/com/qmth/distributed/print/api/mark/MarkArchiveController.java

@@ -1,5 +1,6 @@
 package com.qmth.distributed.print.api.mark;
 
+import javax.servlet.http.HttpServletResponse;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
@@ -36,17 +37,22 @@ public class MarkArchiveController {
 	private MarkPaperService markPaperService;
 	@Autowired
 	private MarkStudentService markStudentService;
-	
-	
-    @ApiOperation(value = "成绩管理列表")
-    @RequestMapping(value = "score/list", method = RequestMethod.POST)
-    public Result scoreList(@Validated ArchiveScoreQuery query) {
-        return ResultUtil.ok(markPaperService.scoreList(query));
-    }
-    
-    @ApiOperation(value = "班级详情列表")
-    @RequestMapping(value = "student/list", method = RequestMethod.POST)
-    public Result studentList(@Validated ArchiveStudentQuery query) {
-        return ResultUtil.ok(markStudentService.studentList(query));
-    }
+
+	@ApiOperation(value = "成绩管理列表")
+	@RequestMapping(value = "score/list", method = RequestMethod.POST)
+	public Result scoreList(@Validated ArchiveScoreQuery query) {
+		return ResultUtil.ok(markPaperService.scoreList(query));
+	}
+
+	@ApiOperation(value = "班级详情列表")
+	@RequestMapping(value = "student/list", method = RequestMethod.POST)
+	public Result studentList(@Validated ArchiveStudentQuery query) {
+		return ResultUtil.ok(markStudentService.studentList(query));
+	}
+
+	@ApiOperation(value = "成绩导出")
+	@RequestMapping(value = "score/export", method = RequestMethod.POST)
+	public void scoreExport(@Validated ArchiveStudentQuery query, HttpServletResponse response) {
+		markStudentService.scoreExport(query, response);
+	}
 }

+ 11 - 18
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/bean/archivescore/ArchiveStudentVo.java

@@ -2,31 +2,24 @@ package com.qmth.teachcloud.mark.bean.archivescore;
 
 import java.util.List;
 
-import io.swagger.annotations.ApiModelProperty;
+import com.qmth.teachcloud.common.annotation.ExcelProperty;
 
 public class ArchiveStudentVo {
 	private Long id;
 
-    @ApiModelProperty(value = "科目代码")
-    private String courseCode;
-
-    @ApiModelProperty(value = "科目名称")
-    private String courseName;
-
-
-    @ApiModelProperty(value = "学号")
-    private String studentCode;
-
-    @ApiModelProperty(value = "姓名")
+	@ExcelProperty(name = "学生姓名", width = 20, index = 1)
     private String studentName;
-
-
-    @ApiModelProperty(value = "学院")
+	@ExcelProperty(name = "学号", width = 20, index = 2)
+    private String studentCode;
+	@ExcelProperty(name = "学院", width = 20, index = 3)
     private String college;
-
-    @ApiModelProperty(value = "班级")
+	@ExcelProperty(name = "班级", width = 20, index = 4)
     private String className;
-    
+	@ExcelProperty(name = "课程代码", width = 20, index = 5)
+    private String courseCode;
+	@ExcelProperty(name = "课程名称", width = 20, index = 6)
+    private String courseName;
+	@ExcelProperty(name = "成绩", width = 20, index = 7)
     private Double totalScore;
     
     private List<String> sheetUrls;

+ 3 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/MarkStudentService.java

@@ -2,6 +2,7 @@ package com.qmth.teachcloud.mark.service;
 
 import java.util.List;
 
+import javax.servlet.http.HttpServletResponse;
 import javax.validation.constraints.NotNull;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -103,4 +104,6 @@ public interface MarkStudentService extends IService<MarkStudent> {
     void saveSubjectiveInspectedTask(MarkHeaderResult markResult);
 
 	List<ArchiveStudentVo> studentList(ArchiveStudentQuery query);
+
+	void scoreExport(ArchiveStudentQuery query, HttpServletResponse response);
 }

+ 57 - 18
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkStudentServiceImpl.java

@@ -1,5 +1,22 @@
 package com.qmth.teachcloud.mark.service.impl;
 
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.constraints.NotNull;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@@ -18,6 +35,7 @@ import com.qmth.teachcloud.common.enums.mark.MarkPaperStatus;
 import com.qmth.teachcloud.common.enums.mark.SubjectiveStatus;
 import com.qmth.teachcloud.common.enums.scan.ConditionType;
 import com.qmth.teachcloud.common.service.TeachcloudCommonService;
+import com.qmth.teachcloud.common.util.ExcelUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import com.qmth.teachcloud.mark.bean.UpdateTimeVo;
 import com.qmth.teachcloud.mark.bean.archivescore.ArchiveStudentQuery;
@@ -25,7 +43,11 @@ import com.qmth.teachcloud.mark.bean.archivescore.ArchiveStudentVo;
 import com.qmth.teachcloud.mark.bean.archivescore.ScanPaperPageVo;
 import com.qmth.teachcloud.mark.bean.omredit.OmrEditDomain;
 import com.qmth.teachcloud.mark.bean.omredit.OmrEditPaper;
-import com.qmth.teachcloud.mark.bean.scananswer.*;
+import com.qmth.teachcloud.mark.bean.scananswer.AnswerPageVo;
+import com.qmth.teachcloud.mark.bean.scananswer.AnswerPaperVo;
+import com.qmth.teachcloud.mark.bean.scananswer.AnswerQueryDomain;
+import com.qmth.teachcloud.mark.bean.scananswer.AnswerQueryVo;
+import com.qmth.teachcloud.mark.bean.scananswer.StudentPaperVo;
 import com.qmth.teachcloud.mark.bean.scanexaminfo.CheckTask;
 import com.qmth.teachcloud.mark.bean.scanexaminfo.ScanExamCheckInfoVo;
 import com.qmth.teachcloud.mark.bean.scanexaminfo.ScanExamInfoVo;
@@ -34,8 +56,18 @@ import com.qmth.teachcloud.mark.bean.student.StudentQuery;
 import com.qmth.teachcloud.mark.bean.student.StudentVo;
 import com.qmth.teachcloud.mark.dto.mark.ScoreInfo;
 import com.qmth.teachcloud.mark.dto.mark.manage.Task;
-import com.qmth.teachcloud.mark.dto.mark.score.*;
-import com.qmth.teachcloud.mark.entity.*;
+import com.qmth.teachcloud.mark.dto.mark.score.SheetUrlDto;
+import com.qmth.teachcloud.mark.dto.mark.score.StudentObjectiveAnswerDto;
+import com.qmth.teachcloud.mark.dto.mark.score.StudentObjectiveDetailDto;
+import com.qmth.teachcloud.mark.dto.mark.score.StudentPaperDetailDto;
+import com.qmth.teachcloud.mark.dto.mark.score.StudentScoreDetailDto;
+import com.qmth.teachcloud.mark.entity.MarkPaper;
+import com.qmth.teachcloud.mark.entity.MarkStudent;
+import com.qmth.teachcloud.mark.entity.MarkUserGroup;
+import com.qmth.teachcloud.mark.entity.ScanAnswerCard;
+import com.qmth.teachcloud.mark.entity.ScanPaper;
+import com.qmth.teachcloud.mark.entity.ScanPaperPage;
+import com.qmth.teachcloud.mark.entity.ScanStudentPaper;
 import com.qmth.teachcloud.mark.enums.ExamStatus;
 import com.qmth.teachcloud.mark.enums.LockType;
 import com.qmth.teachcloud.mark.enums.OmrTaskStatus;
@@ -43,23 +75,20 @@ import com.qmth.teachcloud.mark.lock.LockService;
 import com.qmth.teachcloud.mark.mapper.MarkStudentMapper;
 import com.qmth.teachcloud.mark.params.MarkHeaderGroupResult;
 import com.qmth.teachcloud.mark.params.MarkHeaderResult;
-import com.qmth.teachcloud.mark.service.*;
+import com.qmth.teachcloud.mark.service.MarkPaperService;
+import com.qmth.teachcloud.mark.service.MarkQuestionService;
+import com.qmth.teachcloud.mark.service.MarkService;
+import com.qmth.teachcloud.mark.service.MarkStudentService;
+import com.qmth.teachcloud.mark.service.MarkUserGroupService;
+import com.qmth.teachcloud.mark.service.ScanAnswerCardService;
+import com.qmth.teachcloud.mark.service.ScanOmrTaskService;
+import com.qmth.teachcloud.mark.service.ScanPackageService;
+import com.qmth.teachcloud.mark.service.ScanPaperPageService;
+import com.qmth.teachcloud.mark.service.ScanPaperService;
+import com.qmth.teachcloud.mark.service.ScanStudentPaperService;
+import com.qmth.teachcloud.mark.service.TaskService;
 import com.qmth.teachcloud.mark.utils.BatchGetDataUtil;
 import com.qmth.teachcloud.mark.utils.ScoreCalculateUtil;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import javax.annotation.Resource;
-import javax.validation.constraints.NotNull;
-import java.text.DecimalFormat;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -761,4 +790,14 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
 			vo.setSheetUrls(map.get(vo.getId()));
 		}
 	}
+
+	@Override
+	public void scoreExport(ArchiveStudentQuery query, HttpServletResponse response) {
+		List<ArchiveStudentVo> ret = baseMapper.studentList(query);
+		try {
+			ExcelUtil.excelExport("成绩导出", ArchiveStudentVo.class, ret, response);
+		} catch (Exception e) {
+			throw new RuntimeException(e);
+		}
+	}
 }