deason 6 år sedan
förälder
incheckning
2540e4bcd0

+ 56 - 0
examcloud-core-print-dao/src/main/java/cn/com/qmth/examcloud/core/print/enums/ExportType.java

@@ -0,0 +1,56 @@
+/*
+ * *************************************************
+ * Copyright (c) 2018 QMTH. All Rights Reserved.
+ * Created by Deason on 2018-11-20 13:52:45.
+ * *************************************************
+ */
+
+package cn.com.qmth.examcloud.core.print.enums;
+
+/**
+ * 导出文件类型
+ *
+ * @author: fengdesheng
+ * @since: 2018/11/20
+ */
+public enum ExportType {
+    /**
+     * 试卷
+     */
+    PAPER("试卷"),
+    /**
+     * 答案
+     */
+    ANSWER("答案"),
+    /**
+     * 试卷结构(用于阅卷)
+     */
+    STRUCT("试卷结构"),
+    /**
+     * 试卷结构-客观题
+     */
+    OBJECTIVE("客观题"),
+    /**
+     * 试卷结构-主观题
+     */
+    SUBJECTIVE("主观题"),
+    /**
+     * 机考数据包
+     */
+    COMPUTER_EXAM_PKG("机考数据包"),
+    /**
+     * 分布式印刷数据包
+     */
+    PRINT_EXAM_PKG("分布式印刷数据包");
+
+    private String title;
+
+    ExportType(String title) {
+        this.title = title;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+}

+ 14 - 31
examcloud-core-print-provider/src/main/java/cn/com/qmth/examcloud/core/print/api/controller/CoursePaperController.java

@@ -10,9 +10,7 @@ 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 cn.com.qmth.examcloud.core.print.service.bean.coursepaper.*;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -62,44 +60,29 @@ public class CoursePaperController extends ControllerSupport {
         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);//todo
-        super.exportFile(fileName, new byte[]{});
+    @PostMapping("/check/structure/{examId}/{paperId}")
+    @ApiOperation(value = "校验考试结构")
+    public Result checkPaperStructure(@PathVariable Long examId, @PathVariable String paperId) {
+        coursePaperService.checkPaperStructure(examId, paperId);
+        return success();
     }
 
-    @GetMapping("/export/batch/{ids}")
+    @GetMapping("/export/batch")
     @ApiOperation(value = "批量导出")
-    public void exportBatch(@PathVariable Long[] ids) throws Exception {
-        File file = coursePaperService.exportBatchByIds(ids);
+    public void exportBatch(@RequestBody ExportBatchReq req) throws Exception {
+        File file = coursePaperService.exportBatchCoursePaper(req);
         final String fileName = "papers.zip";
         //super.exportFile(fileName, file);//todo
         super.exportFile(fileName, new byte[]{});
     }
 
-    /**
-     * 下载考试结构
-     */
-    @GetMapping("/download/structure/{examId}/{paperId}")
-    @ApiOperation(value = "下载考试结构")
-    public void downloadPaperStructure(@PathVariable Long examId, @PathVariable String paperId) throws Exception {
-        File file = coursePaperService.downloadPaperStructure(examId, paperId);
-        final String fileName = "paper.zip";
+    @GetMapping("/export/all")
+    @ApiOperation(value = "整体导出")
+    public void exportAll(@RequestBody ExportAllReq req) throws Exception {
+        File file = coursePaperService.exportAllCoursePaper(req);
+        final String fileName = "structures.zip";
         //super.exportFile(fileName, file);//todo
         super.exportFile(fileName, new byte[]{});
     }
 
-    /**
-     * 校验考试结构
-     */
-    @PostMapping("/check/structure/{examId}/{paperId}")
-    @ApiOperation(value = "校验考试结构")
-    public Result checkPaperStructure(@PathVariable Long examId, @PathVariable String paperId) {
-        coursePaperService.checkPaperStructure(examId, paperId);
-        return success();
-    }
-
 }

+ 10 - 17
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/CoursePaperService.java

@@ -8,9 +8,7 @@
 package cn.com.qmth.examcloud.core.print.service;
 
 import cn.com.qmth.examcloud.core.print.entity.CoursePaper;
-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 cn.com.qmth.examcloud.core.print.service.bean.coursepaper.*;
 
 import java.io.File;
 import java.util.List;
@@ -36,16 +34,6 @@ public interface CoursePaperService {
      */
     void syncCoursePaper(CoursePaper coursePaper);
 
-    /**
-     * 下载考试结构
-     */
-    File downloadPaperStructure(Long examId, String paperId);
-
-    /**
-     * 校验考试结构
-     */
-    void checkPaperStructure(Long examId, String paperId);
-
     /**
      * (单个)分配待指定试卷
      *
@@ -65,13 +53,18 @@ public interface CoursePaperService {
     CoursePaperTotalInfo getPaperTotalByOrgIdAndExamId(Long orgId, Long examId);
 
     /**
-     * 整体导出(导出考试下所有试卷文件)
+     * 校验考试结构
+     */
+    void checkPaperStructure(Long examId, String paperId);
+
+    /**
+     * 批量导出(导出试卷、答案、试卷结构等文件)
      */
-    File exportAllByOrgIdAndExamId(Long orgId, Long examId);
+    File exportBatchCoursePaper(ExportBatchReq req);
 
     /**
-     * 批量导出
+     * 整体导出(导出试卷、答案、试卷结构等文件)
      */
-    File exportBatchByIds(Long[] ids);
+    File exportAllCoursePaper(ExportAllReq req);
 
 }

+ 81 - 0
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/bean/coursepaper/ExportAllReq.java

@@ -0,0 +1,81 @@
+/*
+ * *************************************************
+ * Copyright (c) 2018 QMTH. All Rights Reserved.
+ * Created by Deason on 2018-11-20 14:16:22.
+ * *************************************************
+ */
+
+package cn.com.qmth.examcloud.core.print.service.bean.coursepaper;
+
+import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
+
+/**
+ * 整体导出(请求)
+ *
+ * @author: fengdesheng
+ * @since: 2018/11/01
+ */
+public class ExportAllReq implements JsonSerializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 学校机构ID
+     */
+    private Long orgId;
+    /**
+     * 考试ID
+     */
+    private Long examId;
+    /**
+     * 是否需要导出试卷
+     */
+    private Boolean needPaper;
+    /**
+     * 是否需要导出答案
+     */
+    private Boolean needAnswer;
+    /**
+     * 是否需要导出试卷结构
+     */
+    private Boolean needStruct;
+
+    public Long getOrgId() {
+        return orgId;
+    }
+
+    public void setOrgId(Long orgId) {
+        this.orgId = orgId;
+    }
+
+    public Long getExamId() {
+        return examId;
+    }
+
+    public void setExamId(Long examId) {
+        this.examId = examId;
+    }
+
+    public Boolean getNeedPaper() {
+        return needPaper != null ? needPaper : false;
+    }
+
+    public void setNeedPaper(Boolean needPaper) {
+        this.needPaper = needPaper;
+    }
+
+    public Boolean getNeedAnswer() {
+        return needAnswer != null ? needAnswer : false;
+    }
+
+    public void setNeedAnswer(Boolean needAnswer) {
+        this.needAnswer = needAnswer;
+    }
+
+    public Boolean getNeedStruct() {
+        return needStruct != null ? needStruct : false;
+    }
+
+    public void setNeedStruct(Boolean needStruct) {
+        this.needStruct = needStruct;
+    }
+
+}

+ 95 - 0
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/bean/coursepaper/ExportBatchReq.java

@@ -0,0 +1,95 @@
+/*
+ * *************************************************
+ * Copyright (c) 2018 QMTH. All Rights Reserved.
+ * Created by Deason on 2018-11-20 14:22:20.
+ * *************************************************
+ */
+
+package cn.com.qmth.examcloud.core.print.service.bean.coursepaper;
+
+import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
+
+import java.util.List;
+
+/**
+ * 批量导出(请求)
+ *
+ * @author: fengdesheng
+ * @since: 2018/11/01
+ */
+public class ExportBatchReq implements JsonSerializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 学校机构ID
+     */
+    private Long orgId;
+    /**
+     * 考试ID
+     */
+    private Long examId;
+    /**
+     * 试卷ID列表
+     */
+    private List<String> paperIds;
+    /**
+     * 是否需要导出试卷
+     */
+    private Boolean needPaper;
+    /**
+     * 是否需要导出答案
+     */
+    private Boolean needAnswer;
+    /**
+     * 是否需要导出试卷结构
+     */
+    private Boolean needStruct;
+
+    public Long getOrgId() {
+        return orgId;
+    }
+
+    public void setOrgId(Long orgId) {
+        this.orgId = orgId;
+    }
+
+    public Long getExamId() {
+        return examId;
+    }
+
+    public void setExamId(Long examId) {
+        this.examId = examId;
+    }
+
+    public List<String> getPaperIds() {
+        return paperIds;
+    }
+
+    public void setPaperIds(List<String> paperIds) {
+        this.paperIds = paperIds;
+    }
+
+    public Boolean getNeedPaper() {
+        return needPaper != null ? needPaper : false;
+    }
+
+    public void setNeedPaper(Boolean needPaper) {
+        this.needPaper = needPaper;
+    }
+
+    public Boolean getNeedAnswer() {
+        return needAnswer != null ? needAnswer : false;
+    }
+
+    public void setNeedAnswer(Boolean needAnswer) {
+        this.needAnswer = needAnswer;
+    }
+
+    public Boolean getNeedStruct() {
+        return needStruct != null ? needStruct : false;
+    }
+
+    public void setNeedStruct(Boolean needStruct) {
+        this.needStruct = needStruct;
+    }
+
+}

+ 8 - 17
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/CoursePaperServiceImpl.java

@@ -18,10 +18,7 @@ import cn.com.qmth.examcloud.core.print.repository.CoursePaperRepository;
 import cn.com.qmth.examcloud.core.print.repository.CourseStatisticRepository;
 import cn.com.qmth.examcloud.core.print.service.CoursePaperService;
 import cn.com.qmth.examcloud.core.print.service.QuestionStructureService;
-import cn.com.qmth.examcloud.core.print.service.bean.coursepaper.CoursePaperConvert;
-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 cn.com.qmth.examcloud.core.print.service.bean.coursepaper.*;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -138,17 +135,6 @@ public class CoursePaperServiceImpl implements CoursePaperService {
         courseStatisticRepository.save(statistics);
     }
 
-    @Override
-    public File downloadPaperStructure(Long examId, String paperId) {
-        //todo
-        return null;
-    }
-
-    @Override
-    public void checkPaperStructure(Long examId, String paperId) {
-        //todo
-    }
-
     @Transactional
     public void allotCoursePaper(Long courseStatisticId, Long coursePaperId) {
         Check.isEmpty(courseStatisticId, "课程统计ID不能为空!");
@@ -245,13 +231,18 @@ public class CoursePaperServiceImpl implements CoursePaperService {
     }
 
     @Override
-    public File exportAllByOrgIdAndExamId(Long orgId, Long examId) {
+    public void checkPaperStructure(Long examId, String paperId) {
+        //todo
+    }
+
+    @Override
+    public File exportBatchCoursePaper(ExportBatchReq req) {
         //todo
         return null;
     }
 
     @Override
-    public File exportBatchByIds(Long[] ids) {
+    public File exportAllCoursePaper(ExportAllReq req) {
         //todo
         return null;
     }

+ 2 - 3
examcloud-core-print-starter/src/main/resources/security-exclusions.conf

@@ -38,10 +38,9 @@
 [${$rmp.ctrl.print}/course/paper][/allot/{courseStatisticId}/{coursePaperId}][POST]
 [${$rmp.ctrl.print}/course/paper][/allot/all/{orgId}/{examId}][POST]
 [${$rmp.ctrl.print}/course/paper][/total/{orgId}/{examId}][POST]
-[${$rmp.ctrl.print}/course/paper][/export/all/{orgId}/{examId}][GET]
-[${$rmp.ctrl.print}/course/paper][/export/batch/{ids}][GET]
-[${$rmp.ctrl.print}/course/paper][/download/structure/{examId}/{paperId}][GET]
 [${$rmp.ctrl.print}/course/paper][/check/structure/{examId}/{paperId}][POST]
+[${$rmp.ctrl.print}/course/paper][/export/batch][GET]
+[${$rmp.ctrl.print}/course/paper][/export/all][GET]
 
 [${$rmp.ctrl.print}/project/template][/{orgId}/{examId}][POST]
 [${$rmp.ctrl.print}/project/template][/save][POST]