deason há 6 anos atrás
pai
commit
6b9fccea68

+ 2 - 11
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/ExamQuestionStructureService.java

@@ -20,27 +20,18 @@ public interface ExamQuestionStructureService {
 
     /**
      * 保存试卷试题结构
-     *
-     * @param examId
-     * @param paperId
      */
     void savePaperQuestionStructure(Long examId, String paperId);
 
     /**
      * 获取客观题结构
-     *
-     * @param examId
-     * @param paperId
      */
-    List<ObjectiveQuestionStructure> getObjectiveQuestionStructureList(Long examId, String paperId);
+    List<ObjectiveQuestionStructure> getObjectiveQuestionStructureList(Long orgId, Long examId, String paperId, String paperType);
 
     /**
      * 获取主观题结构
-     *
-     * @param examId
-     * @param paperId
      */
-    List<SubjectiveQuestionStructure> getSubjectiveQuestionStructureList(Long examId, String paperId);
+    List<SubjectiveQuestionStructure> getSubjectiveQuestionStructureList(Long examId, String paperId, String paperType);
 
     /**
      * 同步更新课程名称信息

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

@@ -360,11 +360,11 @@ public class CoursePaperServiceImpl implements CoursePaperService {
 
             if (needStruct) {
                 //客观题结构
-                List<ObjectiveQuestionStructure> objectives = examQuestionStructureService.getObjectiveQuestionStructureList(paper.getExamId(), paper.getPaperId());
+                List<ObjectiveQuestionStructure> objectives = examQuestionStructureService.getObjectiveQuestionStructureList(statistic.getOrgId(), statistic.getExamId(), paper.getPaperId(), statistic.getPaperType());
                 allObjectives.addAll(objectives);
 
                 //主观题结构
-                List<SubjectiveQuestionStructure> subjectives = examQuestionStructureService.getSubjectiveQuestionStructureList(paper.getExamId(), paper.getPaperId());
+                List<SubjectiveQuestionStructure> subjectives = examQuestionStructureService.getSubjectiveQuestionStructureList(statistic.getExamId(), paper.getPaperId(), statistic.getPaperType());
                 allSubjectives.addAll(subjectives);
             }
 

+ 25 - 3
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/QuestionStructureServiceImpl.java

@@ -15,8 +15,11 @@ import cn.com.qmth.examcloud.core.print.entity.SubjectiveQuestionStructure;
 import cn.com.qmth.examcloud.core.print.repository.ObjectiveQuestionStructureRepository;
 import cn.com.qmth.examcloud.core.print.repository.SubjectiveQuestionStructureRepository;
 import cn.com.qmth.examcloud.core.print.service.ExamQuestionStructureService;
+import cn.com.qmth.examcloud.core.print.service.ExamStructureService;
 import cn.com.qmth.examcloud.core.print.service.StatisticService;
 import cn.com.qmth.examcloud.core.print.service.bean.examquestionstructure.ExamQuestionStructureInfo;
+import cn.com.qmth.examcloud.core.print.service.bean.examstructure.ExamStructureInfo;
+import com.google.common.collect.Lists;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -39,6 +42,8 @@ public class QuestionStructureServiceImpl implements ExamQuestionStructureServic
     @Autowired
     private SubjectiveQuestionStructureRepository subjectiveQuestionStructureRepository;
     @Autowired
+    private ExamStructureService examStructureService;
+    @Autowired
     private StatisticService statisticService;
 
     @Override
@@ -79,7 +84,7 @@ public class QuestionStructureServiceImpl implements ExamQuestionStructureServic
     }
 
     @Override
-    public List<ObjectiveQuestionStructure> getObjectiveQuestionStructureList(Long examId, String paperId) {
+    public List<ObjectiveQuestionStructure> getObjectiveQuestionStructureList(Long orgId, Long examId, String paperId, String paperType) {
         Check.isNull(examId, "考试ID不能为空!");
         Check.isEmpty(paperId, "试卷ID不能为空!");
 
@@ -89,12 +94,23 @@ public class QuestionStructureServiceImpl implements ExamQuestionStructureServic
 
         Specification<ObjectiveQuestionStructure> spec = SpecUtils.buildSearchers(ObjectiveQuestionStructure.class, searches.build());
         List<ObjectiveQuestionStructure> list = objectiveQuestionStructureRepository.findAll(spec);
+        if (list == null || list.isEmpty()) {
+            return Lists.newArrayList();
+        }
+
+        //获取考试结构设置的客观题数量
+        ExamStructureInfo info = examStructureService.getExamStructure(orgId, examId);
+
+        for (ObjectiveQuestionStructure structure : list) {
+            structure.setPaperType(paperType);//补全信息
+        }
+
         //todo
         return list;
     }
 
     @Override
-    public List<SubjectiveQuestionStructure> getSubjectiveQuestionStructureList(Long examId, String paperId) {
+    public List<SubjectiveQuestionStructure> getSubjectiveQuestionStructureList(Long examId, String paperId, String paperType) {
         Check.isNull(examId, "考试ID不能为空!");
         Check.isEmpty(paperId, "试卷ID不能为空!");
 
@@ -104,7 +120,13 @@ public class QuestionStructureServiceImpl implements ExamQuestionStructureServic
 
         Specification<SubjectiveQuestionStructure> spec = SpecUtils.buildSearchers(SubjectiveQuestionStructure.class, searches.build());
         List<SubjectiveQuestionStructure> list = subjectiveQuestionStructureRepository.findAll(spec);
-        //todo
+        if (list == null || list.isEmpty()) {
+            return Lists.newArrayList();
+        }
+
+        for (SubjectiveQuestionStructure structure : list) {
+            structure.setPaperType(paperType);//补全信息
+        }
         return list;
     }