deason 6 ani în urmă
părinte
comite
726f12cbab

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

@@ -10,6 +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.CoursePaperForm;
 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;
@@ -42,10 +43,17 @@ public class CoursePaperController extends ControllerSupport {
         return coursePaperService.getCoursePaperList(query);
     }
 
+    @PostMapping("/allot")
+    @ApiOperation(value = "(单个)分配待指定试卷")
+    public Result allotCoursePaper(@RequestBody CoursePaperForm form) {
+        coursePaperService.allotCoursePaper(form);
+        return success();
+    }
+
     @PostMapping("/allot/{orgId}/{examId}")
-    @ApiOperation(value = "分配待指定试卷")
+    @ApiOperation(value = "(整体)分配待指定试卷")
     public Result allotCoursePaper(@PathVariable Long orgId, @PathVariable Long examId) {
-        coursePaperService.allotCoursePaper(orgId, examId);
+        coursePaperService.allotCoursePapers(orgId, examId);
         return success();
     }
 

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

@@ -7,6 +7,7 @@
 
 package cn.com.qmth.examcloud.core.print.service;
 
+import cn.com.qmth.examcloud.core.print.service.bean.coursepaper.CoursePaperForm;
 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;
@@ -41,9 +42,14 @@ public interface CoursePaperService {
     void checkPaperStructure(Long examId, Long paperId);
 
     /**
-     * 分配待指定试卷
+     * (单个)分配待指定试卷
      */
-    void allotCoursePaper(Long orgId, Long examId);
+    void allotCoursePaper(CoursePaperForm form);
+
+    /**
+     * (整体)分配待指定试卷
+     */
+    void allotCoursePapers(Long orgId, Long examId);
 
     /**
      * 获取某学校考试的试卷数量情况

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

@@ -0,0 +1,79 @@
+/*
+ * *************************************************
+ * Copyright (c) 2018 QMTH. All Rights Reserved.
+ * Created by Deason on 2018-11-14 16:34:28.
+ * *************************************************
+ */
+
+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/13
+ */
+public class CoursePaperForm implements JsonSerializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 学校机构ID
+     */
+    private Long orgId;
+    /**
+     * 考试ID
+     */
+    private Long examId;
+    /**
+     * 课程ID
+     */
+    private Long courseId;
+    /**
+     * 试卷类型
+     */
+    private String paperType;
+    /**
+     * 试卷ID
+     */
+    private String paperId;
+
+    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 Long getCourseId() {
+        return courseId;
+    }
+
+    public void setCourseId(Long courseId) {
+        this.courseId = courseId;
+    }
+
+    public String getPaperType() {
+        return paperType;
+    }
+
+    public void setPaperType(String paperType) {
+        this.paperType = paperType;
+    }
+
+    public String getPaperId() {
+        return paperId;
+    }
+
+    public void setPaperId(String paperId) {
+        this.paperId = paperId;
+    }
+
+}

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

@@ -13,10 +13,7 @@ import cn.com.qmth.examcloud.core.print.common.utils.Check;
 import cn.com.qmth.examcloud.core.print.entity.CoursePaper;
 import cn.com.qmth.examcloud.core.print.repository.CoursePaperRepository;
 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 cn.com.qmth.examcloud.core.print.service.bean.coursepaper.*;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -48,7 +45,9 @@ public class CoursePaperServiceImpl implements CoursePaperService {
         SearchBuilder searches = new SearchBuilder();
         searches.eq("orgId", query.getOrgId());
         searches.eq("examId", query.getExamId());
-        searches.eq("courseId", query.getCourseId());
+        if (query.getCourseId() != null) {
+            searches.eq("courseId", query.getCourseId());
+        }
         Specification<CoursePaper> spec = SpecUtils.buildSearchers(CoursePaper.class, searches.build());
         List<CoursePaper> list = coursePaperRepository.findAll(spec);
         return CoursePaperConvert.ofList(list);
@@ -73,7 +72,12 @@ public class CoursePaperServiceImpl implements CoursePaperService {
     }
 
     @Override
-    public void allotCoursePaper(Long orgId, Long examId) {
+    public void allotCoursePaper(CoursePaperForm form) {
+
+    }
+
+    @Override
+    public void allotCoursePapers(Long orgId, Long examId) {
 
     }
 

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

@@ -35,6 +35,7 @@
 [${$rmp.ctrl.print}/course/statistic][/all/init][GET]
 
 [${$rmp.ctrl.print}/course/paper][/list][POST]
+[${$rmp.ctrl.print}/course/paper][/allot][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]