|
@@ -8,19 +8,21 @@
|
|
|
package cn.com.qmth.examcloud.core.print.api.controller;
|
|
|
|
|
|
import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
|
|
|
+import cn.com.qmth.examcloud.core.print.common.Result;
|
|
|
import cn.com.qmth.examcloud.core.print.service.CoursePaperService;
|
|
|
import cn.com.qmth.examcloud.core.print.service.bean.coursepaper.CoursePaperInfo;
|
|
|
import cn.com.qmth.examcloud.core.print.service.bean.coursepaper.CoursePaperQuery;
|
|
|
+import cn.com.qmth.examcloud.core.print.service.bean.coursepaper.CoursePaperTotalInfo;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.io.File;
|
|
|
import java.util.List;
|
|
|
|
|
|
+import static cn.com.qmth.examcloud.core.print.common.Result.success;
|
|
|
+
|
|
|
/**
|
|
|
* 课程试卷相关接口
|
|
|
*
|
|
@@ -40,4 +42,57 @@ public class CoursePaperController extends ControllerSupport {
|
|
|
return coursePaperService.getCoursePaperList(query);
|
|
|
}
|
|
|
|
|
|
+ @PostMapping("/allot/{orgId}/{examId}")
|
|
|
+ @ApiOperation(value = "分配待指定试卷")
|
|
|
+ public Result allotCoursePaper(@PathVariable Long orgId, @PathVariable Long examId) {
|
|
|
+ coursePaperService.allotCoursePaper(orgId, examId);
|
|
|
+ return success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/total/{orgId}/{examId}")
|
|
|
+ @ApiOperation(value = "获取某学校考试的试卷数量情况")
|
|
|
+ public CoursePaperTotalInfo paperTotal(@PathVariable Long orgId, @PathVariable Long examId) {
|
|
|
+ return coursePaperService.getPaperTotalByOrgIdAndExamId(orgId, examId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/export/all/{orgId}/{examId}")
|
|
|
+ @ApiOperation(value = "整体导出(导出考试下所有试卷文件)")
|
|
|
+ public void exportAll(@PathVariable Long orgId, @PathVariable Long examId) throws Exception {
|
|
|
+ File file = coursePaperService.exportAllByOrgIdAndExamId(orgId, examId);
|
|
|
+ final String fileName = "structures.zip";
|
|
|
+ //super.exportFile(fileName, file);
|
|
|
+ super.exportFile(fileName, new byte[]{});
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/export/batch/{ids}")
|
|
|
+ @ApiOperation(value = "批量导出")
|
|
|
+ public void exportBatch(@PathVariable Long[] ids) throws Exception {
|
|
|
+ File file = coursePaperService.exportBatchByIds(ids);
|
|
|
+ final String fileName = "papers.zip";
|
|
|
+ //super.exportFile(fileName, file);
|
|
|
+ super.exportFile(fileName, new byte[]{});
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 下载考试结构
|
|
|
+ */
|
|
|
+ @GetMapping("/download/structure/{examId}/{paperId}")
|
|
|
+ @ApiOperation(value = "下载考试结构")
|
|
|
+ public void downloadPaperStructure(@PathVariable Long examId, @PathVariable Long paperId) throws Exception {
|
|
|
+ File file = coursePaperService.downloadPaperStructure(examId, paperId);
|
|
|
+ final String fileName = "paper.zip";
|
|
|
+ //super.exportFile(fileName, file);
|
|
|
+ super.exportFile(fileName, new byte[]{});
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 校验考试结构
|
|
|
+ */
|
|
|
+ @PostMapping("/check/structure/{examId}/{paperId}")
|
|
|
+ @ApiOperation(value = "校验考试结构")
|
|
|
+ public Result checkPaperStructure(@PathVariable Long examId, @PathVariable Long paperId) {
|
|
|
+ coursePaperService.checkPaperStructure(examId, paperId);
|
|
|
+ return success();
|
|
|
+ }
|
|
|
+
|
|
|
}
|