deason 6 years ago
parent
commit
820f8117d9

+ 1 - 1
examcloud-core-print-dao/src/main/java/cn/com/qmth/examcloud/core/print/entity/ObjectiveQuestionStructure.java

@@ -88,7 +88,7 @@ public class ObjectiveQuestionStructure extends IdEntity {
     /**
      * 小题分数
      */
-    @Excel(name = "小题分数", orderNum = "8")
+    @Excel(name = "分数", orderNum = "8")
     private Double unitScore;
 
     public Long getExamId() {

+ 19 - 17
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/ExamStructureServiceImpl.java

@@ -49,6 +49,7 @@ public class ExamStructureServiceImpl implements ExamStructureService {
     @Override
     public Page<ExamStructureInfo> getExamStructureList(ExamStructureQuery query) {
         Check.isNull(query, "查询参数不能为空!");
+
         //查询条件
         SearchBuilder searches = new SearchBuilder();
         if (query.getOrgId() != null) {
@@ -58,10 +59,13 @@ public class ExamStructureServiceImpl implements ExamStructureService {
             searches.eq("examId", query.getExamId());
         }
         Specification<ExamStructure> spec = SpecUtils.buildSearchers(ExamStructure.class, searches.build());
+
         //排序条件
         OrderBuilder orders = new OrderBuilder().desc("id");
+
         //分页条件
         Pageable pageable = SpecUtils.buildPageable(query.getPageNo(), query.getPageSize(), orders.build());
+
         Page<ExamStructure> page = examStructureRepository.findAll(spec, pageable);
         return ExamStructureConvert.ofPage(page);
     }
@@ -70,6 +74,7 @@ public class ExamStructureServiceImpl implements ExamStructureService {
     public ExamStructureInfo getExamStructure(Long orgId, Long examId) {
         Check.isEmpty(orgId, "学校ID不能为空!");
         Check.isEmpty(examId, "考试ID不能为空!");
+
         ExamStructure entity = examStructureRepository.findByOrgIdAndExamId(orgId, examId);
         if (entity == null) {
             return null;
@@ -91,28 +96,29 @@ public class ExamStructureServiceImpl implements ExamStructureService {
         Check.isNull(questionStructure.getBoolQuestionTotal(), "判断题数量不能为空!");
 
         ExamStructure entity = ExamStructureConvert.of(info);
+
+        //默认为"传统考试"类型
         entity.setExamType(ExamType.TRADITION.name());
         examStructureRepository.save(entity);
     }
 
     @Override
     public void cloneExamStructure(ExamStructureInfo info) {
-        //数据校验
         Check.isNull(info.getOrgId(), "原学校ID不能为空!");
         Check.isNull(info.getExamId(), "原考试ID不能为空!");
-        Check.isNull(info.getNewOrgId(), "学校ID不能为空!");
-        Check.isBlank(info.getNewOrgName(), "学校名称不能为空!");
-        Check.isNull(info.getExamId(), "新考试ID不能为空!");
-        Check.isBlank(info.getNewExamName(), "考试名称不能为空!");
+        Check.isNull(info.getNewOrgId(), "目标学校ID不能为空!");
+        Check.isBlank(info.getNewOrgName(), "目标学校名称不能为空!");
+        Check.isNull(info.getNewExamId(), "目标考试ID不能为空!");
+        Check.isBlank(info.getNewExamName(), "目标考试名称不能为空!");
 
         ExamStructure newStructure = examStructureRepository.findByOrgIdAndExamId(info.getNewOrgId(), info.getNewExamId());
         if (newStructure != null) {
-            throw new StatusException(PRT_CODE_500, "学校考试下已有结构信息,不可复用!");
+            throw new StatusException(PRT_CODE_500, "目标学校考试下已有结构信息,不可复用!");
         }
 
         ExamStructure oldStructure = examStructureRepository.findByOrgIdAndExamId(info.getOrgId(), info.getExamId());
         if (oldStructure == null) {
-            throw new StatusException(PRT_CODE_500, "原结构信息不存在!");
+            throw new StatusException(PRT_CODE_500, "原考试结构信息不存在!");
         }
 
         newStructure = new ExamStructure();
@@ -152,23 +158,19 @@ public class ExamStructureServiceImpl implements ExamStructureService {
             throw new StatusException(PRT_CODE_500, "当前考试尚未创建考试结构!");
         }
 
-        //考试结构设置的客观题数量
+        //获取考试结构设置的客观题数量
         //ExamQuestionStructure questionStructure = new JsonMapper().fromJson(entity.getStruct(), ExamQuestionStructure.class);
 
-        //校验考试结构中单选题数量
+        //校验考试结构中单选题、多选题、判断题的数量
         /*long singleChoiceSize = objectiveQuestionStructureRepository.countByExamIdAndPaperIdAndQuestionType(examId, paperId, QuesStructType.SINGLE_ANSWER_QUESTION.name());
         if (singleChoiceSize > questionStructure.getSingleChoiceTotal()) {
             throw new StatusException(PRT_CODE_500, String.format("考试结构中%s题数量小于试卷题目数量,需重新设置!", QuesStructType.SINGLE_ANSWER_QUESTION.getTitle()));
-        }*/
-
-        //校验考试结构中的多选题数量
-        /*long multipleChoiceSize = objectiveQuestionStructureRepository.countByExamIdAndPaperIdAndQuestionType(examId, paperId, QuesStructType.MULTIPLE_ANSWER_QUESTION.name());
+        }
+        long multipleChoiceSize = objectiveQuestionStructureRepository.countByExamIdAndPaperIdAndQuestionType(examId, paperId, QuesStructType.MULTIPLE_ANSWER_QUESTION.name());
         if (multipleChoiceSize > questionStructure.getMultipleChoiceTotal()) {
             throw new StatusException(PRT_CODE_500, String.format("考试结构中%s题数量小于试卷题目数量,需重新设置!", QuesStructType.MULTIPLE_ANSWER_QUESTION.getTitle()));
-        }*/
-
-        //校验考试结构中的判断题数量
-        /*long boolQuestionSize = objectiveQuestionStructureRepository.countByExamIdAndPaperIdAndQuestionType(examId, paperId, QuesStructType.BOOL_ANSWER_QUESTION.name());
+        }
+        long boolQuestionSize = objectiveQuestionStructureRepository.countByExamIdAndPaperIdAndQuestionType(examId, paperId, QuesStructType.BOOL_ANSWER_QUESTION.name());
         if (boolQuestionSize > questionStructure.getBoolQuestionTotal()) {
             throw new StatusException(PRT_CODE_500, String.format("考试结构中%s题数量小于试卷题目数量,需重新设置!", QuesStructType.BOOL_ANSWER_QUESTION.getTitle()));
         }*/