deason 6 år sedan
förälder
incheckning
9db3bf22db

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

@@ -17,38 +17,37 @@ public enum ExportType {
     /**
      * 试卷
      */
-    PAPER("试卷"),
+    PAPER(1, "试卷"),
     /**
      * 答案
      */
-    ANSWER("答案"),
+    ANSWER(2, "答案"),
     /**
      * 试卷结构(用于阅卷)
+     * 客观题/主观题结构
      */
-    STRUCT("试卷结构"),
-    /**
-     * 试卷结构-客观题
-     */
-    OBJECTIVE("客观题"),
-    /**
-     * 试卷结构-主观题
-     */
-    SUBJECTIVE("主观题"),
+    STRUCT(3, "试卷结构"),
     /**
      * 机考数据包
      */
-    COMPUTER_EXAM_PKG("机考数据包"),
+    COMPUTER_EXAM_PKG(4, "机考数据包"),
     /**
      * 分布式印刷数据包
      */
-    PRINT_EXAM_PKG("分布式印刷数据包");
+    PRINT_EXAM_PKG(5, "分布式印刷数据包");
 
+    private int id;
     private String title;
 
-    ExportType(String title) {
+    ExportType(int id, String title) {
+        this.id = id;
         this.title = title;
     }
 
+    public int getId() {
+        return id;
+    }
+
     public String getTitle() {
         return title;
     }

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

@@ -70,7 +70,8 @@ public class CoursePaperController extends ControllerSupport {
 
     @GetMapping("/export/batch")
     @ApiOperation(value = "批量导出")
-    public void exportBatch(@RequestBody ExportBatchReq req) throws Exception {
+    public void exportBatch(@RequestParam Long[] ids, @RequestParam Integer[] types) throws Exception {
+        ExportBatchReq req = new ExportBatchReq(ids, types);
         File file = coursePaperService.exportBatchCoursePaper(req);
         if (file != null) {
             super.exportFile(STRUCT_ZIP_NAME, file);
@@ -81,7 +82,8 @@ public class CoursePaperController extends ControllerSupport {
 
     @GetMapping("/export/all")
     @ApiOperation(value = "整体导出")
-    public void exportAll(@RequestBody ExportAllReq req) throws Exception {
+    public void exportAll(@RequestParam Long orgId, @RequestParam Long examId, @RequestParam Integer[] types) throws Exception {
+        ExportAllReq req = new ExportAllReq(orgId, examId, types);
         File file = coursePaperService.exportAllCoursePaper(req);
         if (file != null) {
             super.exportFile(STRUCT_ZIP_NAME, file);

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

@@ -8,6 +8,7 @@
 package cn.com.qmth.examcloud.core.print.service.bean.coursepaper;
 
 import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
+import cn.com.qmth.examcloud.core.print.enums.ExportType;
 
 /**
  * 整体导出(请求)
@@ -38,6 +39,20 @@ public class ExportAllReq implements JsonSerializable {
      */
     private Boolean needStruct;
 
+    public ExportAllReq(Long orgId, Long examId, Integer[] types) {
+        this.orgId = orgId;
+        this.examId = examId;
+        for (Integer type : types) {
+            if (ExportType.PAPER.getId() == type) {
+                this.needPaper = true;
+            } else if (ExportType.ANSWER.getId() == type) {
+                this.needAnswer = true;
+            } else if (ExportType.STRUCT.getId() == type) {
+                this.needStruct = true;
+            }
+        }
+    }
+
     public boolean required() {
         //至少选择一种
         if (getNeedPaper()) {
@@ -52,6 +67,10 @@ public class ExportAllReq implements JsonSerializable {
         return false;
     }
 
+    public ExportAllReq() {
+
+    }
+
     public Long getOrgId() {
         return orgId;
     }

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

@@ -8,7 +8,9 @@
 package cn.com.qmth.examcloud.core.print.service.bean.coursepaper;
 
 import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
+import cn.com.qmth.examcloud.core.print.enums.ExportType;
 
+import java.util.Arrays;
 import java.util.List;
 
 /**
@@ -36,6 +38,19 @@ public class ExportBatchReq implements JsonSerializable {
      */
     private Boolean needStruct;
 
+    public ExportBatchReq(Long[] ids, Integer[] types) {
+        this.ids = Arrays.asList(ids);
+        for (Integer type : types) {
+            if (ExportType.PAPER.getId() == type) {
+                this.needPaper = true;
+            } else if (ExportType.ANSWER.getId() == type) {
+                this.needAnswer = true;
+            } else if (ExportType.STRUCT.getId() == type) {
+                this.needStruct = true;
+            }
+        }
+    }
+
     public boolean required() {
         //至少选择一种
         if (getNeedPaper()) {
@@ -50,6 +65,10 @@ public class ExportBatchReq implements JsonSerializable {
         return false;
     }
 
+    public ExportBatchReq() {
+
+    }
+
     public List<Long> getIds() {
         return ids;
     }

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

@@ -235,17 +235,18 @@ public class CoursePaperServiceImpl implements CoursePaperService {
     public CoursePaperTotalInfo getPaperTotalByOrgIdAndExamId(Long orgId, Long examId) {
         Check.isNull(orgId, "学校ID不能为空!");
         Check.isNull(examId, "考试ID不能为空!");
-        //todo
 
-        return null;
+        //todo
+        return new CoursePaperTotalInfo();
     }
 
     @Override
     public void checkPaperStructure(Long examId, String paperId) {
         Check.isNull(examId, "考试ID不能为空!");
         Check.isEmpty(paperId, "试卷ID不能为空!");
-        //todo
 
+        //todo
+        throw new RuntimeException();
     }
 
     @Override

+ 2 - 0
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/QuestionStructureServiceImpl.java

@@ -76,6 +76,7 @@ public class QuestionStructureServiceImpl implements QuestionStructureService {
 
         Specification<ObjectiveQuestionStructure> spec = SpecUtils.buildSearchers(ObjectiveQuestionStructure.class, searches.build());
         List<ObjectiveQuestionStructure> list = objectiveQuestionStructureRepository.findAll(spec);
+        //todo
         return list;
     }
 
@@ -90,6 +91,7 @@ public class QuestionStructureServiceImpl implements QuestionStructureService {
 
         Specification<SubjectiveQuestionStructure> spec = SpecUtils.buildSearchers(SubjectiveQuestionStructure.class, searches.build());
         List<SubjectiveQuestionStructure> list = subjectiveQuestionStructureRepository.findAll(spec);
+        //todo
         return list;
     }