deason 6 gadi atpakaļ
vecāks
revīzija
40245ed4e4
12 mainītis faili ar 427 papildinājumiem un 2 dzēšanām
  1. 43 0
      examcloud-core-print-provider/src/main/java/cn/com/qmth/examcloud/core/print/api/controller/CoursePaperController.java
  2. 63 0
      examcloud-core-print-provider/src/main/java/cn/com/qmth/examcloud/core/print/api/controller/CourseStatisticController.java
  3. 20 0
      examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/CoursePaperService.java
  4. 21 0
      examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/CourseStatisticService.java
  5. 38 0
      examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/bean/coursepaper/CoursePaperConvert.java
  6. 64 0
      examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/bean/coursepaper/CoursePaperInfo.java
  7. 55 0
      examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/bean/coursepaper/CoursePaperQuery.java
  8. 57 0
      examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/bean/coursepaper/CoursePaperTotalInfo.java
  9. 1 1
      examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/bean/coursestatistic/CourseStatisticQuery.java
  10. 37 0
      examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/CoursePaperServiceImpl.java
  11. 21 0
      examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/CourseStatisticServiceImpl.java
  12. 7 1
      examcloud-core-print-starter/src/main/resources/security-exclusions.conf

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

@@ -0,0 +1,43 @@
+/*
+ * *************************************************
+ * Copyright (c) 2018 QMTH. All Rights Reserved.
+ * Created by Deason on 2018-11-13 16:34:46.
+ * *************************************************
+ */
+
+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.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 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 java.util.List;
+
+/**
+ * 课程试卷相关接口
+ *
+ * @author: fengdesheng
+ * @since: 2018/11/13
+ */
+@RestController
+@Api(tags = "课程试卷相关接口")
+@RequestMapping("${$rmp.ctrl.print}/course/paper")
+public class CoursePaperController extends ControllerSupport {
+    @Autowired
+    private CoursePaperService coursePaperService;
+
+    @PostMapping("/list")
+    @ApiOperation(value = "获取课程试卷列表")
+    public List<CoursePaperInfo> list(@RequestBody CoursePaperQuery query) {
+        return coursePaperService.getCoursePaperList(query);
+    }
+
+}

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

@@ -9,7 +9,9 @@ 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;
@@ -19,6 +21,9 @@ 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;
 
 /**
@@ -33,6 +38,8 @@ 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 = "获取课程统计信息列表(分页)")
@@ -47,6 +54,62 @@ 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();

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

@@ -7,15 +7,35 @@
 
 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 java.util.List;
+
 /**
  * @author: fengdesheng
  * @since: 2018/10/22
  */
 public interface CoursePaperService {
 
+    /**
+     * 获取课程试卷列表
+     */
+    List<CoursePaperInfo> getCoursePaperList(CoursePaperQuery query);
+
     /**
      * 同步更新课程名称信息
      */
     void syncCourseNameByCourseId(Long courseId, String courseName);
 
+    /**
+     * 下载考试结构
+     */
+    String downloadPaperStructure(Long examId, Long paperId);
+
+    /**
+     * 校验考试结构
+     */
+    void checkPaperStructure(Long examId, Long paperId);
+
 }

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

@@ -7,6 +7,7 @@
 
 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;
@@ -40,4 +41,24 @@ 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);
+
 }

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

@@ -0,0 +1,38 @@
+/*
+ * *************************************************
+ * Copyright (c) 2018 QMTH. All Rights Reserved.
+ * Created by Deason on 2018-11-13 16:49:32.
+ * *************************************************
+ */
+
+package cn.com.qmth.examcloud.core.print.service.bean.coursepaper;
+
+import cn.com.qmth.examcloud.core.print.entity.CoursePaper;
+import com.google.common.collect.Lists;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @author: fengdesheng
+ * @since: 2018/11/13
+ */
+public class CoursePaperConvert {
+
+    public static CoursePaperInfo of(CoursePaper coursePaper) {
+        CoursePaperInfo info = new CoursePaperInfo();
+        info.setCoursePaperId(coursePaper.getId());
+        info.setPaperId(coursePaper.getPaperId());
+        info.setPaperName(coursePaper.getPaperName());
+        info.setPaperP(coursePaper.getPaperP());
+        return info;
+    }
+
+    public static List<CoursePaperInfo> ofList(List<CoursePaper> entities) {
+        if (entities == null) {
+            return Lists.newArrayList();
+        }
+        return entities.stream().map(entity -> of(entity)).collect(Collectors.toList());
+    }
+
+}

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

@@ -0,0 +1,64 @@
+/*
+ * *************************************************
+ * Copyright (c) 2018 QMTH. All Rights Reserved.
+ * Created by Deason on 2018-11-13 16:39:06.
+ * *************************************************
+ */
+
+package cn.com.qmth.examcloud.core.print.service.bean.coursepaper;
+
+import java.io.Serializable;
+
+/**
+ * @author: fengdesheng
+ * @since: 2018/11/13
+ */
+public class CoursePaperInfo implements Serializable {
+    private static final long serialVersionUID = 1L;
+    private Long coursePaperId;
+    /**
+     * 试卷ID
+     */
+    private String paperId;
+    /**
+     * 试卷名称
+     */
+    private String paperName;
+    /**
+     * 试卷P数(1P为1面,1张纸为2P)
+     */
+    private Integer paperP;
+
+    public Long getCoursePaperId() {
+        return coursePaperId;
+    }
+
+    public void setCoursePaperId(Long coursePaperId) {
+        this.coursePaperId = coursePaperId;
+    }
+
+    public String getPaperId() {
+        return paperId;
+    }
+
+    public void setPaperId(String paperId) {
+        this.paperId = paperId;
+    }
+
+    public String getPaperName() {
+        return paperName;
+    }
+
+    public void setPaperName(String paperName) {
+        this.paperName = paperName;
+    }
+
+    public Integer getPaperP() {
+        return paperP;
+    }
+
+    public void setPaperP(Integer paperP) {
+        this.paperP = paperP;
+    }
+
+}

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

@@ -0,0 +1,55 @@
+/*
+ * *************************************************
+ * Copyright (c) 2018 QMTH. All Rights Reserved.
+ * Created by Deason on 2018-11-13 16:41: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 CoursePaperQuery implements JsonSerializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 学校机构ID
+     */
+    private Long orgId;
+    /**
+     * 考试ID
+     */
+    private Long examId;
+    /**
+     * 课程ID
+     */
+    private Long courseId;
+
+    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;
+    }
+
+}

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

@@ -0,0 +1,57 @@
+/*
+ * *************************************************
+ * Copyright (c) 2018 QMTH. All Rights Reserved.
+ * Created by Deason on 2018-11-13 16:40:16.
+ * *************************************************
+ */
+
+package cn.com.qmth.examcloud.core.print.service.bean.coursepaper;
+
+import java.io.Serializable;
+
+/**
+ * 试卷数量情况
+ *
+ * @author: fengdesheng
+ * @since: 2018/11/13
+ */
+public class CoursePaperTotalInfo implements Serializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 试卷总数
+     */
+    private Integer allNum;
+    /**
+     * 已有试卷数
+     */
+    private Integer existNum;
+    /**
+     * 缺少试卷数
+     */
+    private Integer missNum;
+
+    public Integer getAllNum() {
+        return allNum != null ? allNum : 0;
+    }
+
+    public void setAllNum(Integer allNum) {
+        this.allNum = allNum;
+    }
+
+    public Integer getExistNum() {
+        return existNum != null ? existNum : 0;
+    }
+
+    public void setExistNum(Integer existNum) {
+        this.existNum = existNum;
+    }
+
+    public Integer getMissNum() {
+        return missNum != null ? missNum : 0;
+    }
+
+    public void setMissNum(Integer missNum) {
+        this.missNum = missNum;
+    }
+
+}

+ 1 - 1
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/bean/coursestatistic/CourseStatisticQuery.java

@@ -29,7 +29,7 @@ public class CourseStatisticQuery extends PageQuery implements JsonSerializable
      */
     private Long courseId;
     /**
-     * 试卷ID
+     * 试卷名称
      */
     private String paperName;
     /**

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

@@ -7,14 +7,24 @@
 
 package cn.com.qmth.examcloud.core.print.service.impl;
 
+import cn.com.qmth.examcloud.core.print.common.jpa.SearchBuilder;
+import cn.com.qmth.examcloud.core.print.common.jpa.SpecUtils;
+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 org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.jpa.domain.Specification;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * @author: fengdesheng
  * @since: 2018/10/17
@@ -25,6 +35,23 @@ public class CoursePaperServiceImpl implements CoursePaperService {
     @Autowired
     private CoursePaperRepository coursePaperRepository;
 
+    @Override
+    public List<CoursePaperInfo> getCoursePaperList(CoursePaperQuery query) {
+        Check.isNull(query, "查询参数不能为空!");
+        Check.isEmpty(query.getOrgId(), "学校ID不能为空!");
+        Check.isEmpty(query.getExamId(), "考试ID不能为空!");
+        Check.isEmpty(query.getCourseId(), "课程ID不能为空!");
+
+        //查询条件
+        SearchBuilder searches = new SearchBuilder();
+        searches.eq("orgId", query.getOrgId());
+        searches.eq("examId", query.getExamId());
+        searches.eq("courseId", query.getCourseId());
+        Specification<CoursePaper> spec = SpecUtils.buildSearchers(CoursePaper.class, searches.build());
+        List<CoursePaper> list = coursePaperRepository.findAll(spec);
+        return CoursePaperConvert.ofList(list);
+    }
+
     @Override
     public void syncCourseNameByCourseId(Long courseId, String courseName) {
         if (courseId == null || StringUtils.isBlank(courseName)) {
@@ -33,4 +60,14 @@ public class CoursePaperServiceImpl implements CoursePaperService {
         coursePaperRepository.updateCourseNameByCourseId(courseId, courseName);
     }
 
+    @Override
+    public String downloadPaperStructure(Long examId, Long paperId) {
+        return null;
+    }
+
+    @Override
+    public void checkPaperStructure(Long examId, Long paperId) {
+
+    }
+
 }

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

@@ -19,6 +19,7 @@ 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;
@@ -106,6 +107,26 @@ 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;

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

@@ -25,10 +25,16 @@
 [${$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}/project/template][/{orgId}/{examId}][POST]
 [${$rmp.ctrl.print}/project/template][/save][POST]
 [${$rmp.ctrl.print}/project/template][/{id}][POST]
-
 [${$rmp.ctrl.print}/examStructure][/list][POST]
 [${$rmp.ctrl.print}/examStructure][/save][POST]
 [${$rmp.ctrl.print}/examStructure][/findOne][POST]