deason %!s(int64=6) %!d(string=hai) anos
pai
achega
122d326d4f

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

@@ -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();
+    }
+
 }

+ 0 - 63
examcloud-core-print-provider/src/main/java/cn/com/qmth/examcloud/core/print/api/controller/CourseStatisticController.java

@@ -9,9 +9,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.CourseStatisticService;
-import cn.com.qmth.examcloud.core.print.service.bean.coursepaper.CoursePaperTotalInfo;
 import cn.com.qmth.examcloud.core.print.service.bean.coursestatistic.CourseRefreshForm;
 import cn.com.qmth.examcloud.core.print.service.bean.coursestatistic.CourseStatisticInfo;
 import cn.com.qmth.examcloud.core.print.service.bean.coursestatistic.CourseStatisticQuery;
@@ -21,9 +19,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.web.bind.annotation.*;
 
-import javax.servlet.http.HttpServletResponse;
-import java.io.Writer;
-
 import static cn.com.qmth.examcloud.core.print.common.Result.success;
 
 /**
@@ -38,8 +33,6 @@ import static cn.com.qmth.examcloud.core.print.common.Result.success;
 public class CourseStatisticController extends ControllerSupport {
     @Autowired
     private CourseStatisticService courseStatisticService;
-    @Autowired
-    private CoursePaperService coursePaperService;
 
     @PostMapping("/list")
     @ApiOperation(value = "获取课程统计信息列表(分页)")
@@ -54,62 +47,6 @@ public class CourseStatisticController extends ControllerSupport {
         return success();
     }
 
-    @PostMapping("/allot/paper/{orgId}/{examId}")
-    @ApiOperation(value = "分配待指定试卷")
-    public Result allotCoursePaper(@PathVariable Long orgId, @PathVariable Long examId) {
-        courseStatisticService.allotCoursePaper(orgId, examId);
-        return success();
-    }
-
-    @PostMapping("/paper/total/{orgId}/{examId}")
-    @ApiOperation(value = "获取某学校考试的试卷数量情况")
-    public CoursePaperTotalInfo paperTotal(@PathVariable Long orgId, @PathVariable Long examId) {
-        return courseStatisticService.getPaperTotalByOrgIdAndExamId(orgId, examId);
-    }
-
-    @PostMapping("/export/all/{orgId}/{examId}")
-    @ApiOperation(value = "整体导出(导出考试下所有试卷文件)")
-    public void exportAll(@PathVariable Long orgId, @PathVariable Long examId, HttpServletResponse response) throws Exception {
-        String downloadUrl = courseStatisticService.exportAllByOrgIdAndExamId(orgId, examId);
-        //todo
-        Writer out = response.getWriter();
-        out.write("ok");
-        out.close();
-    }
-
-    @PostMapping("/export/batch/{ids}")
-    @ApiOperation(value = "批量导出")
-    public void exportBatch(@PathVariable Long[] ids, HttpServletResponse response) throws Exception {
-        String downloadUrl = courseStatisticService.exportBatchByIds(ids);
-        //todo
-        Writer out = response.getWriter();
-        out.write("ok");
-        out.close();
-    }
-
-    /**
-     * 下载考试结构
-     */
-    @PostMapping("/download/paper/{examId}/{paperId}")
-    @ApiOperation(value = "下载考试结构")
-    public void downloadPaper(@PathVariable Long examId, @PathVariable Long paperId, HttpServletResponse response) throws Exception {
-        String downloadUrl = coursePaperService.downloadPaperStructure(examId, paperId);
-        //todo
-        Writer out = response.getWriter();
-        out.write("ok");
-        out.close();
-    }
-
-    /**
-     * 校验考试结构
-     */
-    @PostMapping("/check/paper/{examId}/{paperId}")
-    @ApiOperation(value = "校验考试结构")
-    public Result checkPaper(@PathVariable Long examId, @PathVariable Long paperId) {
-        coursePaperService.checkPaperStructure(examId, paperId);
-        return success();
-    }
-
     @GetMapping("/all/init")
     public Result init() {
         courseStatisticService.initAllCourseStatistic();

+ 23 - 1
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/CoursePaperService.java

@@ -9,7 +9,9 @@ package cn.com.qmth.examcloud.core.print.service;
 
 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 java.io.File;
 import java.util.List;
 
 /**
@@ -31,11 +33,31 @@ public interface CoursePaperService {
     /**
      * 下载考试结构
      */
-    String downloadPaperStructure(Long examId, Long paperId);
+    File downloadPaperStructure(Long examId, Long paperId);
 
     /**
      * 校验考试结构
      */
     void checkPaperStructure(Long examId, Long paperId);
 
+    /**
+     * 分配待指定试卷
+     */
+    void allotCoursePaper(Long orgId, Long examId);
+
+    /**
+     * 获取某学校考试的试卷数量情况
+     */
+    CoursePaperTotalInfo getPaperTotalByOrgIdAndExamId(Long orgId, Long examId);
+
+    /**
+     * 整体导出(导出考试下所有试卷文件)
+     */
+    File exportAllByOrgIdAndExamId(Long orgId, Long examId);
+
+    /**
+     * 批量导出
+     */
+    File exportBatchByIds(Long[] ids);
+
 }

+ 0 - 21
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/CourseStatisticService.java

@@ -7,7 +7,6 @@
 
 package cn.com.qmth.examcloud.core.print.service;
 
-import cn.com.qmth.examcloud.core.print.service.bean.coursepaper.CoursePaperTotalInfo;
 import cn.com.qmth.examcloud.core.print.service.bean.coursestatistic.CourseRefreshForm;
 import cn.com.qmth.examcloud.core.print.service.bean.coursestatistic.CourseStatisticInfo;
 import cn.com.qmth.examcloud.core.print.service.bean.coursestatistic.CourseStatisticQuery;
@@ -41,24 +40,4 @@ public interface CourseStatisticService {
      */
     void syncCourseNameByCourseId(Long courseId, String courseName);
 
-    /**
-     * 分配待指定试卷
-     */
-    void allotCoursePaper(Long orgId, Long examId);
-
-    /**
-     * 获取某学校考试的试卷数量情况
-     */
-    CoursePaperTotalInfo getPaperTotalByOrgIdAndExamId(Long orgId, Long examId);
-
-    /**
-     * 整体导出(导出考试下所有试卷文件)
-     */
-    String exportAllByOrgIdAndExamId(Long orgId, Long examId);
-
-    /**
-     * 批量导出
-     */
-    String exportBatchByIds(Long[] ids);
-
 }

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

@@ -16,6 +16,7 @@ import cn.com.qmth.examcloud.core.print.service.CoursePaperService;
 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 org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -23,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.jpa.domain.Specification;
 import org.springframework.stereotype.Service;
 
+import java.io.File;
 import java.util.List;
 
 /**
@@ -61,7 +63,7 @@ public class CoursePaperServiceImpl implements CoursePaperService {
     }
 
     @Override
-    public String downloadPaperStructure(Long examId, Long paperId) {
+    public File downloadPaperStructure(Long examId, Long paperId) {
         return null;
     }
 
@@ -70,4 +72,24 @@ public class CoursePaperServiceImpl implements CoursePaperService {
 
     }
 
+    @Override
+    public void allotCoursePaper(Long orgId, Long examId) {
+
+    }
+
+    @Override
+    public CoursePaperTotalInfo getPaperTotalByOrgIdAndExamId(Long orgId, Long examId) {
+        return null;
+    }
+
+    @Override
+    public File exportAllByOrgIdAndExamId(Long orgId, Long examId) {
+        return null;
+    }
+
+    @Override
+    public File exportBatchByIds(Long[] ids) {
+        return null;
+    }
+
 }

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

@@ -19,7 +19,6 @@ import cn.com.qmth.examcloud.core.print.service.CommonService;
 import cn.com.qmth.examcloud.core.print.service.CourseStatisticService;
 import cn.com.qmth.examcloud.core.print.service.bean.common.ExamCourseInfo;
 import cn.com.qmth.examcloud.core.print.service.bean.common.ExamInfo;
-import cn.com.qmth.examcloud.core.print.service.bean.coursepaper.CoursePaperTotalInfo;
 import cn.com.qmth.examcloud.core.print.service.bean.coursestatistic.CourseRefreshForm;
 import cn.com.qmth.examcloud.core.print.service.bean.coursestatistic.CourseStatisticConvert;
 import cn.com.qmth.examcloud.core.print.service.bean.coursestatistic.CourseStatisticInfo;
@@ -107,26 +106,6 @@ public class CourseStatisticServiceImpl implements CourseStatisticService {
         }
     }
 
-    @Override
-    public void allotCoursePaper(Long orgId, Long examId) {
-
-    }
-
-    @Override
-    public CoursePaperTotalInfo getPaperTotalByOrgIdAndExamId(Long orgId, Long examId) {
-        return null;
-    }
-
-    @Override
-    public String exportAllByOrgIdAndExamId(Long orgId, Long examId) {
-        return null;
-    }
-
-    @Override
-    public String exportBatchByIds(Long[] ids) {
-        return null;
-    }
-
     private void syncCourseStatisticList(List<ExamCourseInfo> examCourses) {
         if (examCourses == null || examCourses.isEmpty()) {
             return;

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

@@ -25,13 +25,13 @@
 [${$rmp.ctrl.print}/course/statistic][/list][POST]
 [${$rmp.ctrl.print}/course/statistic][/init][POST]
 [${$rmp.ctrl.print}/course/statistic][/all/init][GET]
-[${$rmp.ctrl.print}/course/statistic][/allot/paper/{orgId}/{examId}][POST]
-[${$rmp.ctrl.print}/course/statistic][/paper/total/{orgId}/{examId}][POST]
-[${$rmp.ctrl.print}/course/statistic][/export/all/{orgId}/{examId}][POST]
-[${$rmp.ctrl.print}/course/statistic][/export/batch/{ids}][POST]
-[${$rmp.ctrl.print}/course/statistic][/download/paper/{examId}/{paperId}][POST]
-[${$rmp.ctrl.print}/course/statistic][/check/paper/{examId}/{paperId}][POST]
 [${$rmp.ctrl.print}/course/paper][/list][POST]
+[${$rmp.ctrl.print}/course/paper][/allot/{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}/project/template][/{orgId}/{examId}][POST]
 [${$rmp.ctrl.print}/project/template][/save][POST]
 [${$rmp.ctrl.print}/project/template][/{id}][POST]