deason 6 years ago
parent
commit
6e1cbe1015

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

@@ -59,11 +59,13 @@ public interface CoursePaperService {
 
     /**
      * 批量导出(导出试卷、答案、试卷结构等文件)
+     * 机考数据包(暂不支持)
      */
     File exportBatchCoursePaper(ExportBatchReq req);
 
     /**
      * 整体导出(导出试卷、答案、试卷结构等文件)
+     * 机考数据包(暂不支持)
      */
     File exportAllCoursePaper(ExportAllReq req);
 

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

@@ -38,6 +38,20 @@ public class ExportAllReq implements JsonSerializable {
      */
     private Boolean needStruct;
 
+    public boolean required() {
+        //至少选择一种
+        if (getNeedPaper()) {
+            return true;
+        }
+        if (getNeedAnswer()) {
+            return true;
+        }
+        if (getNeedStruct()) {
+            return true;
+        }
+        return false;
+    }
+
     public Long getOrgId() {
         return orgId;
     }

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

@@ -44,6 +44,20 @@ public class ExportBatchReq implements JsonSerializable {
      */
     private Boolean needStruct;
 
+    public boolean required() {
+        //至少选择一种
+        if (getNeedPaper()) {
+            return true;
+        }
+        if (getNeedAnswer()) {
+            return true;
+        }
+        if (getNeedStruct()) {
+            return true;
+        }
+        return false;
+    }
+
     public Long getOrgId() {
         return orgId;
     }

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

@@ -237,12 +237,21 @@ public class CoursePaperServiceImpl implements CoursePaperService {
 
     @Override
     public File exportBatchCoursePaper(ExportBatchReq req) {
+        Check.isNull(req, "参数不能为空!");
+        Check.isNull(req.getOrgId(), "学校ID不能为空!");
+        Check.isNull(req.getExamId(), "考试ID不能为空!");
+        Check.isNull(req.required(), "至少选择一种导出内容!");
+        Check.isEmpty(req.getPaperIds(), "至少选择一门课程!");
         //todo
         return null;
     }
 
     @Override
     public File exportAllCoursePaper(ExportAllReq req) {
+        Check.isNull(req, "参数不能为空!");
+        Check.isNull(req.getOrgId(), "学校ID不能为空!");
+        Check.isNull(req.getExamId(), "考试ID不能为空!");
+        Check.isNull(req.required(), "至少选择一种导出内容!");
         //todo
         return null;
     }

+ 11 - 11
examcloud-core-print-starter/src/test/java/cn/com/qmth/examcloud/core/print/test/CoursePaperServiceTest.java

@@ -22,7 +22,7 @@ public class CoursePaperServiceTest extends BaseTest {
 
     @Test
     public void test() throws Exception {
-        coursePaperService.syncCourseNameByCourseId(262L, "测试课程");
+        coursePaperService.syncCourseNameByCourseId(18L, "测试课程");
     }
 
     @Test
@@ -31,26 +31,26 @@ public class CoursePaperServiceTest extends BaseTest {
         Long coursePaperId = 1L;
         //coursePaperService.allotCoursePaper(courseStatisticId, coursePaperId);
 
-        Long orgId = 7L;
-        Long examId = 60L;
+        Long orgId = 27L;
+        Long examId = 21L;
         coursePaperService.allotAllCoursePaper(orgId, examId);
     }
 
     @Test
     public void syncCoursePaperTest() throws Exception {
         CoursePaper coursePaper = new CoursePaper();
-        coursePaper.setOrgId(1L);
-        coursePaper.setExamId(1L);
-        coursePaper.setCourseId(1L);
+        coursePaper.setOrgId(27L);
+        coursePaper.setExamId(21L);
+        coursePaper.setCourseId(18L);
         coursePaper.setCourseCode("123456");
         coursePaper.setCourseName("测试课程");
-        coursePaper.setPaperId("abc");
+        coursePaper.setPaperId("xyz");
         coursePaper.setPaperName("测试试卷");
         coursePaper.setPaperP(5);
-        coursePaper.setPaperWordUrl("aaa");
-        coursePaper.setAnswerWordUrl("bbb");
-        coursePaper.setPaperPdfUrl("xxx");
-        coursePaper.setAnswerPdfUrl("yyy");
+        coursePaper.setPaperWordUrl("https://ecs-test-static.qmth.com.cn/ecs-print/test/demo.docx");
+        coursePaper.setAnswerWordUrl("https://ecs-test-static.qmth.com.cn/ecs-print/test/demo.docx");
+        coursePaper.setPaperPdfUrl("https://ecs-test-static.qmth.com.cn/ecs-print/test/demo.pdf");
+        coursePaper.setAnswerPdfUrl("https://ecs-test-static.qmth.com.cn/ecs-print/test/demo.pdf");
         coursePaperService.syncCoursePaper(coursePaper);
     }