deason 6 years ago
parent
commit
89ff6614ba

+ 1 - 1
examcloud-core-print-dao/src/main/java/cn/com/qmth/examcloud/core/print/repository/CoursePaperRepository.java

@@ -24,6 +24,6 @@ public interface CoursePaperRepository extends JpaRepository<CoursePaper, Long>,
     @Query("UPDATE CoursePaper SET courseName=:courseName WHERE courseId=:courseId")
     int updateCourseNameByCourseId(@Param("courseId") Long courseId, @Param("courseName") String courseName);
 
-    CoursePaper findByExamIdAndPaperId(Long examId, String paperId);
+    CoursePaper findByPaperId(String paperId);
 
 }

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

@@ -40,7 +40,7 @@ public class CoursePaperController extends ControllerSupport {
 
     @PostMapping("/list")
     @ApiOperation(value = "获取课程试卷列表")
-    public List<CoursePaperInfo> list(@RequestBody CoursePaperQuery query) {
+    public List<CoursePaperLessInfo> list(@RequestBody CoursePaperQuery query) {
         return coursePaperService.getCoursePaperList(query);
     }
 

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

@@ -20,9 +20,9 @@ import java.util.List;
 public interface CoursePaperService {
 
     /**
-     * 获取课程试卷列表
+     * 获取课程试卷(简要)信息列表
      */
-    List<CoursePaperInfo> getCoursePaperList(CoursePaperQuery query);
+    List<CoursePaperLessInfo> getCoursePaperList(CoursePaperQuery query);
 
     /**
      * 同步更新课程名称信息
@@ -54,13 +54,11 @@ public interface CoursePaperService {
 
     /**
      * 批量导出(导出试卷、答案、试卷结构等文件)
-     * 机考数据包(暂不支持)
      */
     File exportBatchCoursePaper(ExportBatchReq req);
 
     /**
      * 整体导出(导出试卷、答案、试卷结构等文件)
-     * 机考数据包(暂不支持)
      */
     File exportAllCoursePaper(ExportAllReq req);
 

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

@@ -87,7 +87,7 @@ public interface PrintingProjectService {
     List<ExamInfo> getExamList(Long orgId);
 
     /**
-     * 获取印刷项目的简要信息列表
+     * 获取印刷项目的(简要)信息列表
      */
     List<PrintingProjectLessInfo> getPrintingProjectLessInfoList();
 

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

@@ -19,8 +19,8 @@ import java.util.stream.Collectors;
  */
 public class CoursePaperConvert {
 
-    public static CoursePaperInfo of(CoursePaper coursePaper) {
-        CoursePaperInfo info = new CoursePaperInfo();
+    public static CoursePaperLessInfo of(CoursePaper coursePaper) {
+        CoursePaperLessInfo info = new CoursePaperLessInfo();
         info.setCoursePaperId(coursePaper.getId());
         info.setPaperId(coursePaper.getPaperId());
         info.setPaperName(coursePaper.getPaperName());
@@ -28,7 +28,7 @@ public class CoursePaperConvert {
         return info;
     }
 
-    public static List<CoursePaperInfo> ofList(List<CoursePaper> entities) {
+    public static List<CoursePaperLessInfo> ofList(List<CoursePaper> entities) {
         if (entities == null) {
             return Lists.newArrayList();
         }

+ 3 - 1
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/bean/coursepaper/CoursePaperInfo.java → examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/bean/coursepaper/CoursePaperLessInfo.java

@@ -10,10 +10,12 @@ 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 {
+public class CoursePaperLessInfo implements Serializable {
     private static final long serialVersionUID = 1L;
     private Long coursePaperId;
     /**

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

@@ -63,7 +63,7 @@ public class CoursePaperServiceImpl implements CoursePaperService {
     private String QUESTION_URL_PREFIX;//题库访问地址前缀
 
     @Override
-    public List<CoursePaperInfo> getCoursePaperList(CoursePaperQuery query) {
+    public List<CoursePaperLessInfo> getCoursePaperList(CoursePaperQuery query) {
         Check.isNull(query, "查询参数不能为空!");
         Check.isNull(query.getOrgId(), "学校ID不能为空!");
         Check.isNull(query.getExamId(), "考试ID不能为空!");
@@ -127,7 +127,7 @@ public class CoursePaperServiceImpl implements CoursePaperService {
             throw new StatusException(PRT_CODE_400, "试卷页数不能为空!");
         }
 
-        CoursePaper oldCoursePaper = coursePaperRepository.findByExamIdAndPaperId(coursePaper.getExamId(), coursePaper.getPaperId());
+        CoursePaper oldCoursePaper = coursePaperRepository.findByPaperId(coursePaper.getPaperId());
         if (oldCoursePaper != null) {
             //存在则修改
             oldCoursePaper.setPaperName(coursePaper.getPaperName());
@@ -195,11 +195,12 @@ public class CoursePaperServiceImpl implements CoursePaperService {
     }
 
     /**
+     * (整体)分配待指定试卷
      * 选定学校和考试后,为该考试下的所有待分配课程随机分配试卷
      * 当题库传输过来的试卷数量不足时,会提示试卷数不足的课程名称(代码)
      * 当题库传输过来的试卷数量≥需求时,每种试卷类型随机分配
-     * 随机分配后的“课程代码+类型”其试卷状态变为"已有"
-     * 试卷状态:已有、无、待指定三种,显示为“待指定”时,点击时弹出试卷制定框
+     * 随机分配后的“课程代码 + 类型”其试卷状态变为"已有"
+     * 试卷状态:已有、无、未指定三种,显示为“未指定”时,点击时弹出试卷制定框
      */
     @Override
     public void allotAllCoursePaper(Long orgId, Long examId) {
@@ -212,7 +213,7 @@ public class CoursePaperServiceImpl implements CoursePaperService {
         Specification<CourseStatistic> spec = SpecUtils.buildSearchers(CourseStatistic.class, searches.build());
         List<CourseStatistic> statistics = courseStatisticRepository.findAll(spec);
         if (statistics == null || statistics.isEmpty()) {
-            log.debug("No course paper need to allot.");
+            log.warn("No course paper need to allot.");
             return;
         }
 
@@ -222,7 +223,7 @@ public class CoursePaperServiceImpl implements CoursePaperService {
         //获取考试课程下的试卷列表
         List<CoursePaper> coursePapers = this.getCoursePapers(orgId, examId);
 
-        //按课程封装试卷列表
+        //按课程封装试卷列表 Map<courseId, List<CoursePaper>>
         Map<Long, List<CoursePaper>> maps = new HashMap<>();
         for (CoursePaper coursePaper : coursePapers) {
             List<CoursePaper> papers = maps.get(coursePaper.getCourseId());
@@ -311,9 +312,9 @@ public class CoursePaperServiceImpl implements CoursePaperService {
         Check.isFalse(req.required(), "至少选择一种导出内容!");
 
         SearchBuilder searches = new SearchBuilder();
-        searches.eq("paperStatus", PaperStatus.已有.getIndex());
         searches.eq("orgId", req.getOrgId());
         searches.eq("examId", req.getExamId());
+        searches.eq("paperStatus", PaperStatus.已有.getIndex());
         Specification<CourseStatistic> spec = SpecUtils.buildSearchers(CourseStatistic.class, searches.build());
 
         List<CourseStatistic> statistics = courseStatisticRepository.findAll(spec);