xiaofei 8 місяців тому
батько
коміт
dc52d55f37
31 змінених файлів з 195 додано та 289 видалено
  1. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamCardService.java
  2. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/GradePaperStructService.java
  3. 4 4
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/BasicExamStudentServiceImpl.java
  4. 20 31
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamCardServiceImpl.java
  5. 4 6
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamDetailServiceImpl.java
  6. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/GradePaperStructServiceImpl.java
  7. 2 4
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/OpenApiServiceImpl.java
  8. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/ImportLogicServiceImpl.java
  9. 2 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/PdfTaskLogicServiceImpl.java
  10. 2 2
      distributed-print/src/main/java/com/qmth/distributed/print/api/ExamCardController.java
  11. 2 1
      distributed-print/src/main/java/com/qmth/distributed/print/api/GradePaperStructController.java
  12. 18 14
      distributed-print/src/main/java/com/qmth/distributed/print/api/mark/MarkQuestionController.java
  13. 2 1
      distributed-print/src/main/java/com/qmth/distributed/print/api/mark/MarkTrackController.java
  14. 1 1
      distributed-print/src/main/java/com/qmth/distributed/print/api/obe/TCFinalScoreController.java
  15. 1 1
      distributed-print/src/main/java/com/qmth/distributed/print/api/obe/TCPaperStructController.java
  16. 9 0
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/dto/mark/score/StudentScoreDetailDto.java
  17. 20 0
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/entity/MarkQuestionAnswer.java
  18. 2 2
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/mapper/MarkStudentMapper.java
  19. 1 5
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/MarkPaperService.java
  20. 12 36
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/MarkQuestionService.java
  21. 5 5
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/MarkStudentService.java
  22. 2 2
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/ScanAnswerCardService.java
  23. 6 31
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkPaperServiceImpl.java
  24. 35 95
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkQuestionServiceImpl.java
  25. 14 19
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkStudentServiceImpl.java
  26. 3 4
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/ScanAnswerCardServiceImpl.java
  27. 6 2
      teachcloud-mark/src/main/resources/mapper/MarkQuestionAnswerMapper.xml
  28. 2 4
      teachcloud-mark/src/main/resources/mapper/MarkStudentMapper.xml
  29. 1 2
      teachcloud-obe/src/main/java/com/qmth/teachcloud/obe/service/impl/TCFinalScoreServiceImpl.java
  30. 2 2
      teachcloud-obe/src/main/java/com/qmth/teachcloud/obe/service/impl/TCPaperStructServiceImpl.java
  31. 13 10
      teachcloud-task/src/main/java/com/qmth/teachcloud/task/service/impl/PrintFinishServiceImpl.java

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamCardService.java

@@ -40,7 +40,7 @@ public interface ExamCardService extends IService<ExamCard> {
 
 
     void downloadCard(HttpServletResponse response, String id);
     void downloadCard(HttpServletResponse response, String id);
 
 
-    List<CardJpgResult> listCardImage(Long examId, String paperNumber, String paperType);
+    List<CardJpgResult> listCardImage(Long examId, String paperNumber, Integer serialNumber);
 
 
     ExamCard createJpgImage(ExamCard examCard);
     ExamCard createJpgImage(ExamCard examCard);
 
 

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/GradePaperStructService.java

@@ -82,5 +82,5 @@ public interface GradePaperStructService extends IService<GradePaperStruct> {
      * @param paperType        试卷类型
      * @param paperType        试卷类型
      * @param markQuestionList markQuestionList
      * @param markQuestionList markQuestionList
      */
      */
-    void updateExamCloudPaperStruct(Long schoolId, String paperNumber, String paperType, List<MarkQuestion> markQuestionList);
+    void updateExamCloudPaperStruct(Long schoolId, String paperNumber, String paperType, List<MarkQuestionAnswerVo> markQuestionList);
 }
 }

+ 4 - 4
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/BasicExamStudentServiceImpl.java

@@ -178,11 +178,11 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
                         continue;
                         continue;
                     }
                     }
                     // 更新扫描数据
                     // 更新扫描数据
-                    long count = markStudentService.countByExamIdAndPaperNumber(examId, paperNumber, null);
+                    long count = markStudentService.countByExamIdAndPaperNumber(examId, paperNumber);
                     if (count == 0) {
                     if (count == 0) {
                         markPaperService.deleteByExamIdAndPaperNumber(examId, paperNumber);
                         markPaperService.deleteByExamIdAndPaperNumber(examId, paperNumber);
                     } else {
                     } else {
-                        markPaperService.updateStudentCountByExamIdAndPaperNumberAndPaperType(examId, paperNumber, null);
+                        markPaperService.updateStudentCountByExamIdAndPaperNumber(examId, paperNumber);
                         markPaperService.updateUploadCount(examId, paperNumber, markStudentService.countUploadedByExamIdAndPaperNumber(examId, paperNumber));
                         markPaperService.updateUploadCount(examId, paperNumber, markStudentService.countUploadedByExamIdAndPaperNumber(examId, paperNumber));
                         markPaperService.updateAbsentCount(examId, paperNumber, markStudentService.countAbsentByExamIdAndPaperNumber(examId, paperNumber));
                         markPaperService.updateAbsentCount(examId, paperNumber, markStudentService.countAbsentByExamIdAndPaperNumber(examId, paperNumber));
                     }
                     }
@@ -450,7 +450,7 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
         Map<String, List<BasicExamStudent>> stringMap = basicExamStudentList.stream().filter(m -> StringUtils.isNotBlank(m.getPaperNumber())).collect(Collectors.groupingBy(BasicExamStudent::getPaperNumber));
         Map<String, List<BasicExamStudent>> stringMap = basicExamStudentList.stream().filter(m -> StringUtils.isNotBlank(m.getPaperNumber())).collect(Collectors.groupingBy(BasicExamStudent::getPaperNumber));
         for (Map.Entry<String, List<BasicExamStudent>> entry : stringMap.entrySet()) {
         for (Map.Entry<String, List<BasicExamStudent>> entry : stringMap.entrySet()) {
             BasicExamStudent basicExamStudent = entry.getValue().get(0);
             BasicExamStudent basicExamStudent = entry.getValue().get(0);
-            MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumberAndPaperType(examId, entry.getKey(), null);
+            MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(examId, entry.getKey());
             if (markPaper == null && ExamModelEnum.MODEL4.equals(basicExam.getExamModel())) {
             if (markPaper == null && ExamModelEnum.MODEL4.equals(basicExam.getExamModel())) {
                 String paperType = SystemConstant.DEFAULT_PAPER_TYPE_A;
                 String paperType = SystemConstant.DEFAULT_PAPER_TYPE_A;
                 markPaper = new MarkPaper(examId, basicExamStudent.getCourseId(), entry.getKey(), String.valueOf(SystemConstant.getDbUuid()), createId, 1, paperType);
                 markPaper = new MarkPaper(examId, basicExamStudent.getCourseId(), entry.getKey(), String.valueOf(SystemConstant.getDbUuid()), createId, 1, paperType);
@@ -463,7 +463,7 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
                 entry.getValue().forEach(m -> markStudentList.add(markStudentService.assembleByBasicExamStudent(m, finalMarkPaper, secretNumberSet)));
                 entry.getValue().forEach(m -> markStudentList.add(markStudentService.assembleByBasicExamStudent(m, finalMarkPaper, secretNumberSet)));
                 if (CollectionUtils.isNotEmpty(markStudentList)) {
                 if (CollectionUtils.isNotEmpty(markStudentList)) {
                     markStudentService.saveOrUpdateBatch(markStudentList);
                     markStudentService.saveOrUpdateBatch(markStudentList);
-                    markPaperService.updateStudentCountByExamIdAndPaperNumberAndPaperType(examId, entry.getKey(), markPaper.getPaperType());
+                    markPaperService.updateStudentCountByExamIdAndPaperNumber(examId, entry.getKey());
                     markPaperService.updateUploadCount(examId, entry.getKey(), markStudentService.countUploadedByExamIdAndPaperNumber(examId, entry.getKey()));
                     markPaperService.updateUploadCount(examId, entry.getKey(), markStudentService.countUploadedByExamIdAndPaperNumber(examId, entry.getKey()));
                 }
                 }
             }
             }

+ 20 - 31
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamCardServiceImpl.java

@@ -505,44 +505,33 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
     }
     }
 
 
     @Override
     @Override
-    public List<CardJpgResult> listCardImage(Long examId, String paperNumber, String paperType) {
-        ExamTask examTask = examTaskService.getOne(new QueryWrapper<ExamTask>().lambda()
-                .eq(ExamTask::getExamId, examId)
-                .eq(ExamTask::getPaperNumber, paperNumber));
-        if (examTask == null) {
-            return scanAnswerCardService.listPageImage(examId, paperNumber, paperType);
+    public List<CardJpgResult> listCardImage(Long examId, String paperNumber, Integer serialNumber) {
+        ExamTaskDetail examTaskDetail = examTaskDetailService.getByExamIdAndPaperNumberAndSerialNumber(examId, paperNumber, serialNumber);
+        if (examTaskDetail == null) {
+            return scanAnswerCardService.listPageImage(examId, paperNumber);
         }
         }
-        Long examTaskId = examTask.getId();
-        ExamTaskDetail examTaskDetail = examTaskDetailService.getOne(new QueryWrapper<ExamTaskDetail>().lambda()
-                .eq(ExamTaskDetail::getExamTaskId, examTaskId));
+
         List<CardJpgResult> cardJpgResultList = new ArrayList<>();
         List<CardJpgResult> cardJpgResultList = new ArrayList<>();
         if (Objects.nonNull(examTaskDetail) && Objects.nonNull(examTaskDetail.getPaperAttachmentIds())) {
         if (Objects.nonNull(examTaskDetail) && Objects.nonNull(examTaskDetail.getPaperAttachmentIds())) {
             List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetail.getPaperAttachmentIds());
             List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetail.getPaperAttachmentIds());
-            for (PaperInfoVo paperInfoVo : paperInfoVoList) {
-                if (!paperType.equals(paperInfoVo.getName())) {
-                    // 试卷类型不匹配跳过
-                    continue;
-                }
-                ExamCard examCard = this.getOne(new QueryWrapper<ExamCard>().lambda()
-                        .eq(ExamCard::getId, paperInfoVo.getCardId()));
-                if (examCard == null || StringUtils.isBlank(examCard.getJpgAttachment())) {
-                    return new ArrayList<>();
-                }
-
-                List<ConvertJpgStorage> convertJpgStorageList = JSONObject.parseArray(examCard.getJpgAttachment(), ConvertJpgStorage.class);
+            // AB卷共用同一份题卡
+            ExamCard examCard = this.getById(paperInfoVoList.get(0).getCardId());
+            if (examCard == null || StringUtils.isBlank(examCard.getJpgAttachment())) {
+                return Collections.emptyList();
+            }
 
 
-                cardJpgResultList.addAll(convertJpgStorageList.stream().flatMap(e -> {
-                    BasicAttachment basicAttachment = basicAttachmentService.getById(e.getAttachmentId());
+            List<ConvertJpgStorage> convertJpgStorageList = JSONObject.parseArray(examCard.getJpgAttachment(), ConvertJpgStorage.class);
+            cardJpgResultList.addAll(convertJpgStorageList.stream().flatMap(e -> {
+                BasicAttachment basicAttachment = basicAttachmentService.getById(e.getAttachmentId());
 
 
-                    CardJpgResult cardJpgResult = new CardJpgResult();
-                    cardJpgResult.setName(basicAttachment.getName());
-                    cardJpgResult.setIndex(e.getIndex());
-                    cardJpgResult.setPath(teachcloudCommonService.filePreview(basicAttachment.getPath()));
-                    return Stream.of(cardJpgResult);
-                }).collect(Collectors.toList()));
-            }
+                CardJpgResult cardJpgResult = new CardJpgResult();
+                cardJpgResult.setName(basicAttachment.getName());
+                cardJpgResult.setIndex(e.getIndex());
+                cardJpgResult.setPath(teachcloudCommonService.filePreview(basicAttachment.getPath()));
+                return Stream.of(cardJpgResult);
+            }).collect(Collectors.toList()));
         } else {
         } else {
-            return scanAnswerCardService.listPageImage(examId, paperNumber, paperType);
+            return scanAnswerCardService.listPageImage(examId, paperNumber);
         }
         }
         return cardJpgResultList;
         return cardJpgResultList;
     }
     }

+ 4 - 6
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamDetailServiceImpl.java

@@ -767,13 +767,13 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
                     markStudentService.removeByIds(examStudentIds);
                     markStudentService.removeByIds(examStudentIds);
                     // 当考务数据考生表中学生数量为0时,扫描表中学生数量大于0,说明从考生管理新增的考生未删除,则通过试卷编号全部删掉
                     // 当考务数据考生表中学生数量为0时,扫描表中学生数量大于0,说明从考生管理新增的考生未删除,则通过试卷编号全部删掉
                     if (examStudentService.countByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber()) == 0) {
                     if (examStudentService.countByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber()) == 0) {
-                        if (markStudentService.countByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber(), null) > 0) {
+                        if (markStudentService.countByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber()) > 0) {
                             markStudentService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
                             markStudentService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
                         }
                         }
                         // 考生数据全部删除时,还原已曝光卷型
                         // 考生数据全部删除时,还原已曝光卷型
                         examTaskDetailService.updateUnexposePaperType(examDetail.getExamId(), examDetailCourse.getPaperNumber(), examDetailCourse.getPaperType());
                         examTaskDetailService.updateUnexposePaperType(examDetail.getExamId(), examDetailCourse.getPaperNumber(), examDetailCourse.getPaperType());
                     }
                     }
-                    if (markStudentService.countByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber(), null) == 0) {
+                    if (markStudentService.countByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber()) == 0) {
                         markPaperService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
                         markPaperService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
                         markPaperPackageService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
                         markPaperPackageService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
                         markQuestionService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
                         markQuestionService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
@@ -782,9 +782,7 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
                         markUserClassService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
                         markUserClassService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
                     } else {
                     } else {
                         markPaperPackageService.deleteByExamIdAndPaperNumberAndPackageCode(examDetail.getExamId(), examDetailCourse.getPaperNumber(), examDetail.getPackageCode());
                         markPaperPackageService.deleteByExamIdAndPaperNumberAndPackageCode(examDetail.getExamId(), examDetailCourse.getPaperNumber(), examDetail.getPackageCode());
-                        for (String paperType : examDetailCourse.getPaperType().split(",")) {
-                            markPaperService.updateStudentCountByExamIdAndPaperNumberAndPaperType(examDetail.getExamId(), examDetailCourse.getPaperNumber(), paperType);
-                        }
+                        markPaperService.updateStudentCountByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
                     }
                     }
                     if (markPaperService.getByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber()) != null) {
                     if (markPaperService.getByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber()) != null) {
                         // 清空考生管理中卷型
                         // 清空考生管理中卷型
@@ -1080,7 +1078,7 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
         BasicExamRule basicExamRule = basicExamRuleService.getBySchoolId(examPrintPlan.getSchoolId());
         BasicExamRule basicExamRule = basicExamRuleService.getBySchoolId(examPrintPlan.getSchoolId());
         Optional<EnumResult> optional = basicExamRule.getRequiredFieldList().stream().filter(m -> RequiredFieldsEnum.EXAM_PLACE.getCode().equals(m.getCode()) && m.getEnable()).findFirst();
         Optional<EnumResult> optional = basicExamRule.getRequiredFieldList().stream().filter(m -> RequiredFieldsEnum.EXAM_PLACE.getCode().equals(m.getCode()) && m.getEnable()).findFirst();
         Map<String, List<BasicExamStudent>> examDetailMap;
         Map<String, List<BasicExamStudent>> examDetailMap;
-        if(optional.isPresent()){
+        if (optional.isPresent()) {
             examDetailMap = basicExamStudentList.stream().collect(Collectors.groupingBy(m -> m.getExamPlace().concat(m.getExamRoom()).concat(m.getExamStartTime().toString()).concat(m.getExamEndTime().toString())));
             examDetailMap = basicExamStudentList.stream().collect(Collectors.groupingBy(m -> m.getExamPlace().concat(m.getExamRoom()).concat(m.getExamStartTime().toString()).concat(m.getExamEndTime().toString())));
         } else {
         } else {
             examDetailMap = basicExamStudentList.stream().collect(Collectors.groupingBy(m -> m.getExamRoom().concat(m.getExamStartTime().toString()).concat(m.getExamEndTime().toString())));
             examDetailMap = basicExamStudentList.stream().collect(Collectors.groupingBy(m -> m.getExamRoom().concat(m.getExamStartTime().toString()).concat(m.getExamEndTime().toString())));

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/GradePaperStructServiceImpl.java

@@ -248,7 +248,7 @@ public class GradePaperStructServiceImpl extends ServiceImpl<GradePaperStructMap
 
 
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
     @Override
     @Override
-    public void updateExamCloudPaperStruct(Long schoolId, String paperNumber, String paperType, List<MarkQuestion> markQuestionList) {
+    public void updateExamCloudPaperStruct(Long schoolId, String paperNumber, String paperType, List<MarkQuestionAnswerVo> markQuestionList) {
         // 更新试卷结构参数的云阅卷试卷结构
         // 更新试卷结构参数的云阅卷试卷结构
         if (CollectionUtils.isEmpty(markQuestionList)) {
         if (CollectionUtils.isEmpty(markQuestionList)) {
             throw ExceptionResultEnum.ERROR.exception("知学知考试卷结构异常");
             throw ExceptionResultEnum.ERROR.exception("知学知考试卷结构异常");

+ 2 - 4
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/OpenApiServiceImpl.java

@@ -200,14 +200,12 @@ public class OpenApiServiceImpl implements OpenApiService {
 
 
         // 试卷结构
         // 试卷结构
         // 客观题架构
         // 客观题架构
-        List<MarkQuestion> os = markQuestionService.listByExamIdAndPaperNumberAndPaperType(examId, paperNumber,
-                paperType, true);
+        List<MarkQuestion> os = markQuestionService.listByExamIdAndPaperNumberAndObjective(examId, paperNumber, true);
         final String link = SystemConstant.HYPHEN;
         final String link = SystemConstant.HYPHEN;
         Set<String> osk = os.stream().map(e -> e.getMainNumber() + link + e.getSubNumber()).collect(Collectors.toSet());
         Set<String> osk = os.stream().map(e -> e.getMainNumber() + link + e.getSubNumber()).collect(Collectors.toSet());
 
 
         // 主观题结构
         // 主观题结构
-        List<MarkQuestion> ss = markQuestionService.listByExamIdAndPaperNumberAndPaperType(examId, paperNumber,
-                paperType, false);
+        List<MarkQuestion> ss = markQuestionService.listByExamIdAndPaperNumberAndObjective(examId, paperNumber, false);
 
 
         return markStudentIPage.getRecords().stream().flatMap(e -> {
         return markStudentIPage.getRecords().stream().flatMap(e -> {
             ExamStudentScore examStudentScore = new ExamStudentScore();
             ExamStudentScore examStudentScore = new ExamStudentScore();

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/ImportLogicServiceImpl.java

@@ -1049,7 +1049,7 @@ public class ImportLogicServiceImpl implements ImportLogicService {
                         .eq(MarkQuestion::getPaperNumber, k).eq(MarkQuestion::getObjective, true));
                         .eq(MarkQuestion::getPaperNumber, k).eq(MarkQuestion::getObjective, true));
                 // 保存客观题
                 // 保存客观题
                 markQuestionService.saveBatch(v);
                 markQuestionService.saveBatch(v);
-                markQuestionService.updateMarkPaperScore(examId, k, null);
+                markQuestionService.updateMarkPaperScore(examId, k);
             });
             });
             // 更改试卷结构状态为已提交
             // 更改试卷结构状态为已提交
             Set<String> paperNumberSet = markQuestionMap.keySet();
             Set<String> paperNumberSet = markQuestionMap.keySet();

+ 2 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/PdfTaskLogicServiceImpl.java

@@ -185,7 +185,7 @@ public class PdfTaskLogicServiceImpl implements PdfTaskLogicService {
     public void updateAssignPaperType(TBTaskPdf tbTaskPdf, CreatePdfDto createPdfDto) {
     public void updateAssignPaperType(TBTaskPdf tbTaskPdf, CreatePdfDto createPdfDto) {
         try {
         try {
             for (ExamDetailCourse examDetailCourse : createPdfDto.getExamDetailCourseList()) {
             for (ExamDetailCourse examDetailCourse : createPdfDto.getExamDetailCourseList()) {
-                ExamTaskAssignPaperType examTaskAssignPaperType = examTaskAssignPaperTypeService.extractPaperType(tbTaskPdf, examDetailCourse);
+//                ExamTaskAssignPaperType examTaskAssignPaperType = examTaskAssignPaperTypeService.extractPaperType(tbTaskPdf, examDetailCourse);
                 ExamTaskDetail examTaskDetail = createPdfUtil.extractPaperType(tbTaskPdf, examDetailCourse);
                 ExamTaskDetail examTaskDetail = createPdfUtil.extractPaperType(tbTaskPdf, examDetailCourse);
                 List<ExamStudent> examStudentList = examStudentService.listByExamDetailCourseId(examDetailCourse.getId());
                 List<ExamStudent> examStudentList = examStudentService.listByExamDetailCourseId(examDetailCourse.getId());
                 // 考生实际关联试卷类型
                 // 考生实际关联试卷类型
@@ -213,6 +213,7 @@ public class PdfTaskLogicServiceImpl implements PdfTaskLogicService {
                     relatePaperTypes.addAll(paperTypes);
                     relatePaperTypes.addAll(paperTypes);
                 }
                 }
 
 
+                examDetailCourse.setSerialNumber(examTaskDetail.getSerialNumber());
                 examDetailCourse.setPaperType(String.join(",", relatePaperTypes));
                 examDetailCourse.setPaperType(String.join(",", relatePaperTypes));
                 examDetailCourseService.updateById(examDetailCourse);
                 examDetailCourseService.updateById(examDetailCourse);
 
 

+ 2 - 2
distributed-print/src/main/java/com/qmth/distributed/print/api/ExamCardController.java

@@ -195,8 +195,8 @@ public class ExamCardController {
     @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = Result.class)})
     @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = Result.class)})
     public Result listCardImage(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
     public Result listCardImage(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
                                 @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber,
                                 @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber,
-                                @ApiParam(value = "试卷类型", required = true) @RequestParam String paperType) {
-        return ResultUtil.ok(examCardService.listCardImage(examId, paperNumber, paperType));
+                                @ApiParam(value = "备用卷", required = true) @RequestParam Integer serialNumber) {
+        return ResultUtil.ok(examCardService.listCardImage(examId, paperNumber, serialNumber));
     }
     }
 
 
     /**
     /**

+ 2 - 1
distributed-print/src/main/java/com/qmth/distributed/print/api/GradePaperStructController.java

@@ -13,6 +13,7 @@ import com.qmth.teachcloud.common.enums.log.OperationTypeEnum;
 import com.qmth.teachcloud.common.util.Result;
 import com.qmth.teachcloud.common.util.Result;
 import com.qmth.teachcloud.common.util.ResultUtil;
 import com.qmth.teachcloud.common.util.ResultUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
+import com.qmth.teachcloud.mark.dto.mark.MarkQuestionAnswerVo;
 import com.qmth.teachcloud.mark.service.MarkQuestionService;
 import com.qmth.teachcloud.mark.service.MarkQuestionService;
 import io.swagger.annotations.*;
 import io.swagger.annotations.*;
 import org.springframework.validation.BindingResult;
 import org.springframework.validation.BindingResult;
@@ -121,7 +122,7 @@ public class GradePaperStructController {
             throw ExceptionResultEnum.ERROR.exception("缺少试卷编号");
             throw ExceptionResultEnum.ERROR.exception("缺少试卷编号");
         }
         }
         SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
         SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
-        List<MarkQuestion> markQuestionList = markQuestionService.listByExamIdAndPaperNumberAndPaperType(examId,
+        List<MarkQuestionAnswerVo> markQuestionList = markQuestionService.listQuestionAnswerByExamIdAndPaperNumberAndPaperType(examId,
                 paperNumber, paperType, null);
                 paperNumber, paperType, null);
         gradePaperStructService.updateExamCloudPaperStruct(requestUser.getSchoolId(), paperNumber, paperType,
         gradePaperStructService.updateExamCloudPaperStruct(requestUser.getSchoolId(), paperNumber, paperType,
                 markQuestionList);
                 markQuestionList);

+ 18 - 14
distributed-print/src/main/java/com/qmth/distributed/print/api/mark/MarkQuestionController.java

@@ -17,9 +17,11 @@ import com.qmth.teachcloud.common.util.Result;
 import com.qmth.teachcloud.common.util.ResultUtil;
 import com.qmth.teachcloud.common.util.ResultUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import com.qmth.teachcloud.mark.dto.mark.setting.MarkQuestionDto;
 import com.qmth.teachcloud.mark.dto.mark.setting.MarkQuestionDto;
+import com.qmth.teachcloud.mark.entity.MarkPaper;
 import com.qmth.teachcloud.mark.entity.MarkQuestionAnswer;
 import com.qmth.teachcloud.mark.entity.MarkQuestionAnswer;
 import com.qmth.teachcloud.mark.params.MarkObjectiveQuestionParams;
 import com.qmth.teachcloud.mark.params.MarkObjectiveQuestionParams;
 import com.qmth.teachcloud.mark.params.MarkQuestionParams;
 import com.qmth.teachcloud.mark.params.MarkQuestionParams;
+import com.qmth.teachcloud.mark.service.MarkPaperService;
 import com.qmth.teachcloud.mark.service.MarkQuestionAnswerService;
 import com.qmth.teachcloud.mark.service.MarkQuestionAnswerService;
 import com.qmth.teachcloud.mark.service.MarkQuestionService;
 import com.qmth.teachcloud.mark.service.MarkQuestionService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
@@ -57,6 +59,8 @@ public class MarkQuestionController extends BaseController {
     @Resource
     @Resource
     private ExamTaskDetailService examTaskDetailService;
     private ExamTaskDetailService examTaskDetailService;
     @Resource
     @Resource
+    private MarkPaperService markPaperService;
+    @Resource
     private ExamCardService examCardService;
     private ExamCardService examCardService;
 
 
     /**
     /**
@@ -65,10 +69,10 @@ public class MarkQuestionController extends BaseController {
     @ApiOperation(value = "查询")
     @ApiOperation(value = "查询")
     @RequestMapping(value = "/list", method = RequestMethod.POST)
     @RequestMapping(value = "/list", method = RequestMethod.POST)
     public Result list(@ApiParam(value = "考试ID", required = true) @RequestParam Long examId,
     public Result list(@ApiParam(value = "考试ID", required = true) @RequestParam Long examId,
-                       @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber,
-                       @ApiParam(value = "备用卷", required = true) @RequestParam Integer serialNumber) {
+                       @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) {
         boolean canCreate = false;
         boolean canCreate = false;
-        ExamTaskDetail examTaskDetail = examTaskDetailService.findByExamIdAndPaperNumberAndSerialNumber(examId, paperNumber, serialNumber);
+        MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(examId, paperNumber);
+        ExamTaskDetail examTaskDetail = examTaskDetailService.findByExamIdAndPaperNumberAndSerialNumber(examId, paperNumber, markPaper.getSerialNumber());
         if (examTaskDetail == null) {
         if (examTaskDetail == null) {
             canCreate = true;
             canCreate = true;
         } else {
         } else {
@@ -83,7 +87,7 @@ public class MarkQuestionController extends BaseController {
                 }
                 }
             }
             }
         }
         }
-        MarkQuestionDto markQuestionDto = markQuestionService.pageQuestionsByExamIdAndPaperNumberAndSerialNumberAndPaperType(examId, paperNumber, examTaskDetail.getSerialNumber(), examTaskDetail.getPaperType());
+        MarkQuestionDto markQuestionDto = markQuestionService.pageQuestionsByExamIdAndPaperNumber(examId, paperNumber);
         markQuestionDto.setCanCreate(canCreate);
         markQuestionDto.setCanCreate(canCreate);
         return ResultUtil.ok(markQuestionDto);
         return ResultUtil.ok(markQuestionDto);
     }
     }
@@ -106,9 +110,8 @@ public class MarkQuestionController extends BaseController {
     @ApiOperation(value = "客观题标答查询")
     @ApiOperation(value = "客观题标答查询")
     @RequestMapping(value = "/objective/list", method = RequestMethod.POST)
     @RequestMapping(value = "/objective/list", method = RequestMethod.POST)
     public Result listObjective(@ApiParam(value = "考试ID", required = true) @RequestParam Long examId,
     public Result listObjective(@ApiParam(value = "考试ID", required = true) @RequestParam Long examId,
-                                @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber,
-                                @ApiParam(value = "试卷类型", required = true) @RequestParam String paperType) {
-        List<MarkQuestionAnswer> markQuestionAnswerList = markQuestionAnswerService.listByExamIdAndPaperNumberAndPaperType(examId, paperNumber, paperType);
+                                @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) {
+        List<MarkQuestionAnswer> markQuestionAnswerList = markQuestionAnswerService.listByExamIdAndPaperNumberAndPaperType(examId, paperNumber, null);
         return ResultUtil.ok(markQuestionAnswerList);
         return ResultUtil.ok(markQuestionAnswerList);
     }
     }
 
 
@@ -129,10 +132,10 @@ public class MarkQuestionController extends BaseController {
     @ApiOperation(value = "客观题模板导出")
     @ApiOperation(value = "客观题模板导出")
     @RequestMapping(value = "/objective/export", method = RequestMethod.POST)
     @RequestMapping(value = "/objective/export", method = RequestMethod.POST)
     public Result objectiveExport(@ApiParam(value = "考试ID", required = true) @RequestParam String examId,
     public Result objectiveExport(@ApiParam(value = "考试ID", required = true) @RequestParam String examId,
-            @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber, HttpServletResponse response)
+                                  @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber,
+                                  @ApiParam(value = "卷型") @RequestParam(defaultValue = SystemConstant.DEFAULT_PAPER_TYPE_A) String paperType, HttpServletResponse response)
             throws Exception {
             throws Exception {
-        markQuestionService.objectiveAnswerSettingModelExport(SystemConstant.convertIdToLong(examId), paperNumber,
-                response);
+        markQuestionService.objectiveAnswerSettingModelExport(SystemConstant.convertIdToLong(examId), paperNumber, paperType, response);
         return ResultUtil.ok();
         return ResultUtil.ok();
     }
     }
 
 
@@ -142,9 +145,10 @@ public class MarkQuestionController extends BaseController {
     @ApiOperation(value = "客观题标答导入")
     @ApiOperation(value = "客观题标答导入")
     @RequestMapping(value = "/objective/import", method = RequestMethod.POST)
     @RequestMapping(value = "/objective/import", method = RequestMethod.POST)
     @OperationLogDetail(operationType = OperationTypeEnum.IMPORT, detail = "客观题标答导入操作,考试ID:{{examId}}、试卷编号:{{paperNumber}}")
     @OperationLogDetail(operationType = OperationTypeEnum.IMPORT, detail = "客观题标答导入操作,考试ID:{{examId}}、试卷编号:{{paperNumber}}")
-    public Result objectiveImport(@ApiParam(value = "考试ID", required = true) @RequestParam String examId,
-            @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber,
-            @ApiParam(value = "标答excel文件",required = true) @RequestParam MultipartFile file) throws Exception {
+    public Result objectiveImport(@ApiParam(value = "考试ID", required = true) @RequestParam Long examId,
+                                  @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber,
+                                  @ApiParam(value = "卷型") @RequestParam(defaultValue = SystemConstant.DEFAULT_PAPER_TYPE_A) String paperType,
+                                  @ApiParam(value = "标答excel文件", required = true) @RequestParam MultipartFile file) throws Exception {
         String md5 = ServletUtil.getRequestMd5();
         String md5 = ServletUtil.getRequestMd5();
         String fileMd5 = DigestUtils.md5Hex(file.getBytes());
         String fileMd5 = DigestUtils.md5Hex(file.getBytes());
         log.info("fileMd5:{}", fileMd5);
         log.info("fileMd5:{}", fileMd5);
@@ -152,7 +156,7 @@ public class MarkQuestionController extends BaseController {
         if (!Objects.equals(fileMd5, md5)) {
         if (!Objects.equals(fileMd5, md5)) {
             throw ExceptionResultEnum.MD5_EQUALS_FALSE.exception();
             throw ExceptionResultEnum.MD5_EQUALS_FALSE.exception();
         }
         }
-        markQuestionService.objectiveAnswerSettingImport(SystemConstant.convertIdToLong(examId), paperNumber, file);
+        markQuestionService.objectiveAnswerSettingImport(examId, paperNumber, paperType, file);
         return ResultUtil.ok();
         return ResultUtil.ok();
     }
     }
 
 

+ 2 - 1
distributed-print/src/main/java/com/qmth/distributed/print/api/mark/MarkTrackController.java

@@ -73,10 +73,11 @@ public class MarkTrackController {
                 if (StringUtils.isNotBlank(scanAnswerCard.getContent())) {
                 if (StringUtils.isNotBlank(scanAnswerCard.getContent())) {
                     ExamCard examCard = new ExamCard();
                     ExamCard examCard = new ExamCard();
                     examCard.setContent(scanAnswerCard.getContent());
                     examCard.setContent(scanAnswerCard.getContent());
+                    return ResultUtil.ok(examCard);
                 } else {
                 } else {
                     // 自定义卡格式,取电子卡格式的cardId
                     // 自定义卡格式,取电子卡格式的cardId
                     if (scanAnswerCard.getCardId() == null) {
                     if (scanAnswerCard.getCardId() == null) {
-                        List<ScanAnswerCard> scanAnswerCardList = scanAnswerCardService.listByExamIdAndCoursePaperIdAndPaperTypeAndSource(scanAnswerCard.getExamId(), scanAnswerCard.getCoursePaperId(), scanAnswerCard.getPaperType(), CardSource.WEB);
+                        List<ScanAnswerCard> scanAnswerCardList = scanAnswerCardService.listByExamIdAndCoursePaperIdAndSource(scanAnswerCard.getExamId(), scanAnswerCard.getCoursePaperId(), CardSource.WEB);
                         if (CollectionUtils.isNotEmpty(scanAnswerCardList)) {
                         if (CollectionUtils.isNotEmpty(scanAnswerCardList)) {
                             return ResultUtil.ok(examCardService.getById(scanAnswerCardList.get(0).getCardId()));
                             return ResultUtil.ok(examCardService.getById(scanAnswerCardList.get(0).getCardId()));
                         }
                         }

+ 1 - 1
distributed-print/src/main/java/com/qmth/distributed/print/api/obe/TCFinalScoreController.java

@@ -101,7 +101,7 @@ public class TCFinalScoreController {
         List<ExcelField> excelFieldList = new ArrayList<>();
         List<ExcelField> excelFieldList = new ArrayList<>();
         excelFieldList.addAll(new ArrayList<>(Arrays.asList(new ExcelField("studentCode", "学号", true), new ExcelField("name", "姓名", true), new ExcelField("score", "成绩", true))));
         excelFieldList.addAll(new ArrayList<>(Arrays.asList(new ExcelField("studentCode", "学号", true), new ExcelField("name", "姓名", true), new ExcelField("score", "成绩", true))));
         if (Objects.isNull(tcPaperStruct) || Objects.isNull(tcPaperStruct.getPaperStruct())) {
         if (Objects.isNull(tcPaperStruct) || Objects.isNull(tcPaperStruct.getPaperStruct())) {
-            List<MarkQuestion> markQuestionList = markQuestionService.listQuestionByExamIdAndPaperNumberAndPaperType(examId, paperNumber, null);
+            List<MarkQuestion> markQuestionList = markQuestionService.listQuestionByExamIdAndPaperNumber(examId, paperNumber);
             if (CollectionUtils.isEmpty(markQuestionList)) {
             if (CollectionUtils.isEmpty(markQuestionList)) {
                 throw ExceptionResultEnum.ERROR.exception("未找到试卷结构");
                 throw ExceptionResultEnum.ERROR.exception("未找到试卷结构");
             }
             }

+ 1 - 1
distributed-print/src/main/java/com/qmth/distributed/print/api/obe/TCPaperStructController.java

@@ -208,7 +208,7 @@ public class TCPaperStructController {
         List<PaperStructDimensionResult> paperStructDimensionResultList = null;
         List<PaperStructDimensionResult> paperStructDimensionResultList = null;
         TCPaperStruct tcPaperStruct = tcPaperStructService.queryPaperStruct(cultureProgramId, courseId, paperNumber);
         TCPaperStruct tcPaperStruct = tcPaperStructService.queryPaperStruct(cultureProgramId, courseId, paperNumber);
         if (Objects.isNull(tcPaperStruct) || (Objects.isNull(tcPaperStruct.getPaperStruct()) && Objects.isNull(tcPaperStruct.getPaperStructDimension()))) {
         if (Objects.isNull(tcPaperStruct) || (Objects.isNull(tcPaperStruct.getPaperStruct()) && Objects.isNull(tcPaperStruct.getPaperStructDimension()))) {
-            List<MarkQuestion> markQuestionList = markQuestionService.listQuestionByExamIdAndPaperNumberAndPaperType(examId, paperNumber, null);
+            List<MarkQuestion> markQuestionList = markQuestionService.listQuestionByExamIdAndPaperNumber(examId, paperNumber);
             if (CollectionUtils.isEmpty(markQuestionList)) {
             if (CollectionUtils.isEmpty(markQuestionList)) {
                 throw ExceptionResultEnum.ERROR.exception("未找到试卷结构");
                 throw ExceptionResultEnum.ERROR.exception("未找到试卷结构");
             }
             }

+ 9 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/dto/mark/score/StudentScoreDetailDto.java

@@ -22,6 +22,7 @@ public class StudentScoreDetailDto {
     private String courseCode;
     private String courseCode;
     private String courseName;
     private String courseName;
     private String paperNumber;
     private String paperNumber;
+    private String paperType;
     private String studentName;
     private String studentName;
     private String studentCode;
     private String studentCode;
     private String secretNumber;
     private String secretNumber;
@@ -106,6 +107,14 @@ public class StudentScoreDetailDto {
         this.paperNumber = paperNumber;
         this.paperNumber = paperNumber;
     }
     }
 
 
+    public String getPaperType() {
+        return paperType;
+    }
+
+    public void setPaperType(String paperType) {
+        this.paperType = paperType;
+    }
+
     public String getStudentName() {
     public String getStudentName() {
         return studentName;
         return studentName;
     }
     }

+ 20 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/entity/MarkQuestionAnswer.java

@@ -56,6 +56,10 @@ public class MarkQuestionAnswer extends BaseEntity implements Serializable {
     private String mainTitle;
     private String mainTitle;
     @TableField(exist = false)
     @TableField(exist = false)
     private Double totalScore;
     private Double totalScore;
+    @TableField(exist = false)
+    private Integer optionCount;
+    @TableField(exist = false)
+    private Integer questionType;
     public MarkQuestionAnswer() {
     public MarkQuestionAnswer() {
     }
     }
 
 
@@ -108,6 +112,14 @@ public class MarkQuestionAnswer extends BaseEntity implements Serializable {
         this.subNumber = subNumber;
         this.subNumber = subNumber;
     }
     }
 
 
+    public Integer getOptionCount() {
+        return optionCount;
+    }
+
+    public void setOptionCount(Integer optionCount) {
+        this.optionCount = optionCount;
+    }
+
     public String getAnswer() {
     public String getAnswer() {
         return answer;
         return answer;
     }
     }
@@ -148,6 +160,14 @@ public class MarkQuestionAnswer extends BaseEntity implements Serializable {
         this.totalScore = totalScore;
         this.totalScore = totalScore;
     }
     }
 
 
+    public Integer getQuestionType() {
+        return questionType;
+    }
+
+    public void setQuestionType(Integer questionType) {
+        this.questionType = questionType;
+    }
+
     @Override
     @Override
     public String toString() {
     public String toString() {
         return "MarkQuestionAnswer{" +
         return "MarkQuestionAnswer{" +

+ 2 - 2
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/mapper/MarkStudentMapper.java

@@ -116,7 +116,7 @@ public interface MarkStudentMapper extends BaseMapper<MarkStudent> {
 
 
     BasicTeachClazz getBasicTeachClazzById(Long clazzId);
     BasicTeachClazz getBasicTeachClazzById(Long clazzId);
 
 
-    Integer maxCardNumber(@Param("examId") Long examId, @Param("paperNumber") String paperNumber, @Param("paperType") String paperType);
+    Integer maxCardNumber(@Param("examId") Long examId, @Param("paperNumber") String paperNumber);
 
 
     MarkStudent selectByExamIdAndCoursePaperIdAndStudentCode(@Param("examId") Long examId, @Param("coursePaperId") String coursePaperId, @Param("studentCode") String studentCode);
     MarkStudent selectByExamIdAndCoursePaperIdAndStudentCode(@Param("examId") Long examId, @Param("coursePaperId") String coursePaperId, @Param("studentCode") String studentCode);
 
 
@@ -124,7 +124,7 @@ public interface MarkStudentMapper extends BaseMapper<MarkStudent> {
 
 
     IPage<MarkStudentVo> listMarkStudentVo(@Param("page") Page<MarkStudentVo> page, @Param("markStudentQuery") MarkStudentQuery markStudentQuery);
     IPage<MarkStudentVo> listMarkStudentVo(@Param("page") Page<MarkStudentVo> page, @Param("markStudentQuery") MarkStudentQuery markStudentQuery);
 
 
-    int countOmrAbsentStudent(@Param("examId") Long examId, @Param("paperNumber") String paperNumber, @Param("paperType") String paperType, @Param("isOmrAbsentConfirm") boolean isOmrAbsentConfirm,
+    int countOmrAbsentStudent(@Param("examId") Long examId, @Param("paperNumber") String paperNumber, @Param("isOmrAbsentConfirm") boolean isOmrAbsentConfirm,
             @Param("teachClassName") String teachClassName);
             @Param("teachClassName") String teachClassName);
 
 
     void updateBasicExamStudentStatus(@Param("status") String status, @Param("basicStudentId") Long basicStudentId);
     void updateBasicExamStudentStatus(@Param("status") String status, @Param("basicStudentId") Long basicStudentId);

+ 1 - 5
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/MarkPaperService.java

@@ -34,10 +34,6 @@ public interface MarkPaperService extends IService<MarkPaper> {
     IPage<MarkSettingDto> listPaperSetting(Long examId, Long openCollegeId, Long courseId, String paperNumber, Boolean groupStatus, Integer pageNumber, Integer pageSize);
     IPage<MarkSettingDto> listPaperSetting(Long examId, Long openCollegeId, Long courseId, String paperNumber, Boolean groupStatus, Integer pageNumber, Integer pageSize);
 
 
     MarkPaper getByExamIdAndPaperNumber(Long examId, String paperNumber);
     MarkPaper getByExamIdAndPaperNumber(Long examId, String paperNumber);
-
-    MarkPaper getByExamIdAndPaperNumberAndPaperType(Long examId, String paperNumber, String paperType);
-    MarkPaper getByExamIdAndPaperNumberAndSerialNumber(Long examId, String paperNumber, Integer serialNumber);
-
     void savePaperSetting(MarkPaper markPaper);
     void savePaperSetting(MarkPaper markPaper);
 
 
     void saveBatchPaperSetting(MarkPaperSettingParam markPaperSettingParam);
     void saveBatchPaperSetting(MarkPaperSettingParam markPaperSettingParam);
@@ -78,7 +74,7 @@ public interface MarkPaperService extends IService<MarkPaper> {
 
 
     int countByPropositionTeacherId(boolean status);
     int countByPropositionTeacherId(boolean status);
 
 
-    void updateStudentCountByExamIdAndPaperNumberAndPaperType(Long examId, String paperNumber, String paperType);
+    void updateStudentCountByExamIdAndPaperNumber(Long examId, String paperNumber);
     void updateStudentCountByExamIdAndPaperNumberAndSerialNumber(Long examId, String paperNumber, Integer serialNumber);
     void updateStudentCountByExamIdAndPaperNumberAndSerialNumber(Long examId, String paperNumber, Integer serialNumber);
 
 
     SettingDto getSetting(Long examId, String paperNumber);
     SettingDto getSetting(Long examId, String paperNumber);

+ 12 - 36
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/MarkQuestionService.java

@@ -32,52 +32,26 @@ public interface MarkQuestionService extends IService<MarkQuestion> {
 
 
     /**
     /**
      * 查询指定卷型完整试卷结构
      * 查询指定卷型完整试卷结构
+     *
      * @param examId
      * @param examId
      * @param paperNumber
      * @param paperNumber
      * @return
      * @return
      */
      */
     List<MarkQuestion> listQuestionByExamIdAndPaperNumber(Long examId, String paperNumber);
     List<MarkQuestion> listQuestionByExamIdAndPaperNumber(Long examId, String paperNumber);
-    /**
-     * 查询指定卷型完整试卷结构
-     * @param examId
-     * @param paperNumber
-     * @param paperType
-     * @return
-     */
-    List<MarkQuestion> listQuestionByExamIdAndPaperNumberAndPaperType(Long examId, String paperNumber, String paperType);
-    List<MarkQuestion> listQuestionByExamIdAndPaperNumberAndPaperType(Long examId, String paperNumber, String paperType, Boolean objective);
-
-    /**
-     * 查询主观题结构
-     * @param examId
-     * @param paperNumber
-     * @param serialNumber
-     * @return
-     */
-    List<MarkQuestion> listQuestionByExamIdAndPaperNumberAndSerialNumberAndObjectiveFalse(Long examId, String paperNumber, Integer serialNumber);
-
-    /**
-     * 查询指定卷型客观题结构
-     * @param examId
-     * @param paperNumber
-     * @param serialNumber
-     * @param paperType
-     * @return
-     */
-    List<MarkQuestion> listQuestionByExamIdAndPaperNumberAndSerialNumberAndPaperTypeAndObjectiveTrue(Long examId, String paperNumber, Integer serialNumber, String paperType);
 
 
     void saveQuestions(MarkQuestionParams markQuestionParams);
     void saveQuestions(MarkQuestionParams markQuestionParams);
 
 
     List<MarkQuestion> listQuestionByExamIdAndPaperNumberAndGroupNumber(Long examId, String paperNumber, Integer number,
     List<MarkQuestion> listQuestionByExamIdAndPaperNumberAndGroupNumber(Long examId, String paperNumber, Integer number,
-            Boolean isObjective);
+                                                                        Boolean isObjective);
 
 
     /**
     /**
      * 客观题标答模板导出
      * 客观题标答模板导出
      *
      *
      * @param examId      考试id
      * @param examId      考试id
      * @param paperNumber 试卷编号
      * @param paperNumber 试卷编号
+     * @param paperType
      */
      */
-    void objectiveAnswerSettingModelExport(Long examId, String paperNumber, HttpServletResponse response)
+    void objectiveAnswerSettingModelExport(Long examId, String paperNumber, String paperType, HttpServletResponse response)
             throws Exception;
             throws Exception;
 
 
     /**
     /**
@@ -85,9 +59,10 @@ public interface MarkQuestionService extends IService<MarkQuestion> {
      *
      *
      * @param examId      考试id
      * @param examId      考试id
      * @param paperNumber 试卷编号
      * @param paperNumber 试卷编号
+     * @param paperType
      * @param file        excel文件
      * @param file        excel文件
      */
      */
-    void objectiveAnswerSettingImport(Long examId, String paperNumber, MultipartFile file) throws Exception;
+    void objectiveAnswerSettingImport(Long examId, String paperNumber, String paperType, MultipartFile file) throws Exception;
 
 
     void saveObjectiveQuestions(MarkObjectiveQuestionParams markObjectiveQuestionParams);
     void saveObjectiveQuestions(MarkObjectiveQuestionParams markObjectiveQuestionParams);
 
 
@@ -101,14 +76,14 @@ public interface MarkQuestionService extends IService<MarkQuestion> {
 
 
     List<MarkQuestion> listByExamIdAndPaperNumberAndPaperIndexAndPageIndex(Long examId, String paperNumber, Integer paperIndex, Integer pageIndex, boolean isObjective);
     List<MarkQuestion> listByExamIdAndPaperNumberAndPaperIndexAndPageIndex(Long examId, String paperNumber, Integer paperIndex, Integer pageIndex, boolean isObjective);
 
 
-    MarkQuestionDto pageQuestionsByExamIdAndPaperNumberAndSerialNumberAndPaperType(Long examId, String paperNumber, Integer serialNumber, String paperType);
+    MarkQuestionDto pageQuestionsByExamIdAndPaperNumber(Long examId, String paperNumber);
 
 
     void updateGroupNumberByExamIdAndPaperNumberAndGroupNumber(Integer newGroupNumber, Long examId, String paperNumber,
     void updateGroupNumberByExamIdAndPaperNumberAndGroupNumber(Integer newGroupNumber, Long examId, String paperNumber,
-            Integer groupNumber);
+                                                               Integer groupNumber);
 
 
     long countByExamIdAndPaperNumberAndObjectiveAndGroupNumberIsNull(Long examId, String paperNumber, boolean objective);
     long countByExamIdAndPaperNumberAndObjectiveAndGroupNumberIsNull(Long examId, String paperNumber, boolean objective);
 
 
-    List<MarkQuestion> listByExamIdAndPaperNumberAndPaperType(Long examId, String paperNumber, String paperType, Boolean objective);
+    List<MarkQuestion> listByExamIdAndPaperNumberAndObjective(Long examId, String paperNumber, Boolean objective);
 
 
     void deleteByExamIdAndPaperNumber(Long examId, String paperNumber);
     void deleteByExamIdAndPaperNumber(Long examId, String paperNumber);
 
 
@@ -117,9 +92,10 @@ public interface MarkQuestionService extends IService<MarkQuestion> {
      *
      *
      * @param examId      考试id
      * @param examId      考试id
      * @param paperNumber 试卷编号
      * @param paperNumber 试卷编号
-     * @param paperType   试卷类型
      */
      */
-    void updateMarkPaperScore(Long examId, String paperNumber, String paperType);
+    void updateMarkPaperScore(Long examId, String paperNumber);
 
 
     List<MarkQuestionAnswerVo> listQuestionAnswerByExamIdAndPaperNumberAndPaperType(Long examId, String paperNumber, String paperType, Boolean objective);
     List<MarkQuestionAnswerVo> listQuestionAnswerByExamIdAndPaperNumberAndPaperType(Long examId, String paperNumber, String paperType, Boolean objective);
+
+    List<MarkQuestion> listByExamIdAndPaperNumber(Long examId, String paperNumber);
 }
 }

+ 5 - 5
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/MarkStudentService.java

@@ -148,7 +148,7 @@ public interface MarkStudentService extends IService<MarkStudent> {
 
 
     UpdateTimeVo omrEdit(Long userId, OmrEditDomain domain);
     UpdateTimeVo omrEdit(Long userId, OmrEditDomain domain);
 
 
-    long countByExamIdAndPaperNumber(Long examId, String paperNumber, String paperType);
+    long countByExamIdAndPaperNumber(Long examId, String paperNumber);
 
 
     long countByExamIdAndPaperNumberAndSerialNumber(Long examId, String paperNumber, Integer serialNumber);
     long countByExamIdAndPaperNumberAndSerialNumber(Long examId, String paperNumber, Integer serialNumber);
 
 
@@ -174,9 +174,9 @@ public interface MarkStudentService extends IService<MarkStudent> {
 
 
     void updateCheckInfo(Long studentId, Long userId);
     void updateCheckInfo(Long studentId, Long userId);
 
 
-    int countOmrAbsentStudent(Long examId, String paperNumber, String paperType, boolean isOmrAbsentConfirm);
+    int countOmrAbsentStudent(Long examId, String paperNumber, boolean isOmrAbsentConfirm);
 
 
-    int countOmrAbsentStudent(Long examId, String paperNumber, String paperType, boolean isOmrAbsentConfirm, String teachClassName);
+    int countOmrAbsentStudent(Long examId, String paperNumber, boolean isOmrAbsentConfirm, String teachClassName);
 
 
     void scoreReportDownload(MultipartFile file, HttpServletResponse response);
     void scoreReportDownload(MultipartFile file, HttpServletResponse response);
 
 
@@ -200,7 +200,7 @@ public interface MarkStudentService extends IService<MarkStudent> {
 
 
     List<MarkStudent> listScanCollegeByExamIdAndCourseCodeAndCoursePaperId(Long examId, Long courseId, String coursePaperId, String status, DataPermissionRule dpr);
     List<MarkStudent> listScanCollegeByExamIdAndCourseCodeAndCoursePaperId(Long examId, Long courseId, String coursePaperId, String status, DataPermissionRule dpr);
 
 
-    int countUnexistByExamIdAndPaperNumberAndPaperType(Long examId, String paperNumber, String paperType);
+    int countUnexistByExamIdAndPaperNumber(Long examId, String paperNumber);
 
 
     void updateStudentAnswer(@NotNull Long studentId);
     void updateStudentAnswer(@NotNull Long studentId);
 
 
@@ -216,7 +216,7 @@ public interface MarkStudentService extends IService<MarkStudent> {
 
 
     void deleteByBasicStudentId(List<Long> basicExamStudentIds);
     void deleteByBasicStudentId(List<Long> basicExamStudentIds);
 
 
-    Integer maxCardNumber(Long examId, String paperNumber, String paperType);
+    Integer maxCardNumber(Long examId, String paperNumber);
 
 
     void scoreDownload(ArchiveStudentQuery query, HttpServletResponse response);
     void scoreDownload(ArchiveStudentQuery query, HttpServletResponse response);
 
 

+ 2 - 2
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/ScanAnswerCardService.java

@@ -44,7 +44,7 @@ public interface ScanAnswerCardService extends IService<ScanAnswerCard> {
 
 
     void deleteByExamIdAndPaperNumber(Long examId, String paperNumber);
     void deleteByExamIdAndPaperNumber(Long examId, String paperNumber);
 
 
-    List<CardJpgResult> listPageImage(Long examId, String paperNumber, String paperType);
+    List<CardJpgResult> listPageImage(Long examId, String paperNumber);
 
 
-    List<ScanAnswerCard> listByExamIdAndCoursePaperIdAndPaperTypeAndSource(Long examId, String coursePaperId, String paperType, CardSource source);
+    List<ScanAnswerCard> listByExamIdAndCoursePaperIdAndSource(Long examId, String coursePaperId, CardSource source);
 }
 }

+ 6 - 31
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkPaperServiceImpl.java

@@ -139,28 +139,6 @@ public class MarkPaperServiceImpl extends ServiceImpl<MarkPaperMapper, MarkPaper
         return this.getOne(queryWrapper);
         return this.getOne(queryWrapper);
     }
     }
 
 
-    @Override
-    public MarkPaper getByExamIdAndPaperNumberAndPaperType(Long examId, String paperNumber, String paperType) {
-        QueryWrapper<MarkPaper> queryWrapper = new QueryWrapper<>();
-        LambdaQueryWrapper<MarkPaper> lambda = queryWrapper.lambda();
-        lambda.eq(MarkPaper::getExamId, examId)
-                .eq(MarkPaper::getPaperNumber, paperNumber);
-        if (StringUtils.isNotBlank(paperType)) {
-            lambda.eq(MarkPaper::getPaperType, paperType);
-        }
-        return this.getOne(queryWrapper);
-    }
-
-    @Override
-    public MarkPaper getByExamIdAndPaperNumberAndSerialNumber(Long examId, String paperNumber, Integer serialNumber) {
-        QueryWrapper<MarkPaper> queryWrapper = new QueryWrapper<>();
-        LambdaQueryWrapper<MarkPaper> lambda = queryWrapper.lambda();
-        lambda.eq(MarkPaper::getExamId, examId)
-                .eq(MarkPaper::getPaperNumber, paperNumber)
-                .eq(MarkPaper::getSerialNumber, serialNumber);
-        return this.getOne(queryWrapper);
-    }
-
     @Transactional
     @Transactional
     @Override
     @Override
     public void savePaperSetting(MarkPaper markPaper) {
     public void savePaperSetting(MarkPaper markPaper) {
@@ -271,12 +249,12 @@ public class MarkPaperServiceImpl extends ServiceImpl<MarkPaperMapper, MarkPaper
                         continue;
                         continue;
                     }
                     }
                     // 未全部扫描,不能结束
                     // 未全部扫描,不能结束
-                    if (markStudentService.countUnexistByExamIdAndPaperNumberAndPaperType(examId, paperNumber, markPaper.getPaperType()) > 0) {
+                    if (markStudentService.countUnexistByExamIdAndPaperNumber(examId, paperNumber) > 0) {
                         stringJoiner.add(courseInfo + "有考生未扫描未核对,请在扫描客户端进行确认操作后再结束阅卷");
                         stringJoiner.add(courseInfo + "有考生未扫描未核对,请在扫描客户端进行确认操作后再结束阅卷");
                         continue;
                         continue;
                     }
                     }
                     // 识别缺考未确认完,不能结束
                     // 识别缺考未确认完,不能结束
-                    if (markStudentService.countOmrAbsentStudent(examId, paperNumber, markPaper.getPaperType(), false) > 0) {
+                    if (markStudentService.countOmrAbsentStudent(examId, paperNumber, false) > 0) {
                         stringJoiner.add(courseInfo + "识别缺考记录未核对,请在扫描客户端进行确认操作后再结束阅卷");
                         stringJoiner.add(courseInfo + "识别缺考记录未核对,请在扫描客户端进行确认操作后再结束阅卷");
                         continue;
                         continue;
                     }
                     }
@@ -346,7 +324,7 @@ public class MarkPaperServiceImpl extends ServiceImpl<MarkPaperMapper, MarkPaper
         // 没有主观题,不校验考生评卷
         // 没有主观题,不校验考生评卷
         if (CollectionUtils.isNotEmpty(markQuestionSubjectiveList)) {
         if (CollectionUtils.isNotEmpty(markQuestionSubjectiveList)) {
             // 识别缺考未确认完,不能结束
             // 识别缺考未确认完,不能结束
-            if (markStudentService.countOmrAbsentStudent(examId, paperNumber, markPaper.getPaperType(), false, teachClassName) > 0) {
+            if (markStudentService.countOmrAbsentStudent(examId, paperNumber, false, teachClassName) > 0) {
                 throw ExceptionResultEnum.ERROR.exception(courseInfo + "请登录扫描客户端完成缺考检查待处理任务");
                 throw ExceptionResultEnum.ERROR.exception(courseInfo + "请登录扫描客户端完成缺考检查待处理任务");
             }
             }
             // 人工绑定未做完,不能结束
             // 人工绑定未做完,不能结束
@@ -452,16 +430,13 @@ public class MarkPaperServiceImpl extends ServiceImpl<MarkPaperMapper, MarkPaper
     }
     }
 
 
     @Override
     @Override
-    public void updateStudentCountByExamIdAndPaperNumberAndPaperType(Long examId, String paperNumber, String paperType) {
-        long count = markStudentService.countByExamIdAndPaperNumber(examId, paperNumber, paperType);
+    public void updateStudentCountByExamIdAndPaperNumber(Long examId, String paperNumber) {
+        long count = markStudentService.countByExamIdAndPaperNumber(examId, paperNumber);
         UpdateWrapper<MarkPaper> updateWrapper = new UpdateWrapper<>();
         UpdateWrapper<MarkPaper> updateWrapper = new UpdateWrapper<>();
         LambdaUpdateWrapper<MarkPaper> lambda = updateWrapper.lambda();
         LambdaUpdateWrapper<MarkPaper> lambda = updateWrapper.lambda();
         lambda.set(MarkPaper::getStudentCount, count)
         lambda.set(MarkPaper::getStudentCount, count)
                 .eq(MarkPaper::getExamId, examId)
                 .eq(MarkPaper::getExamId, examId)
                 .eq(MarkPaper::getPaperNumber, paperNumber);
                 .eq(MarkPaper::getPaperNumber, paperNumber);
-        if (StringUtils.isNotBlank(paperType)) {
-            lambda.eq(MarkPaper::getPaperType, paperType);
-        }
         this.update(updateWrapper);
         this.update(updateWrapper);
     }
     }
 
 
@@ -647,7 +622,7 @@ public class MarkPaperServiceImpl extends ServiceImpl<MarkPaperMapper, MarkPaper
                 }
                 }
 
 
                 // 主观题已分组,跳过导入
                 // 主观题已分组,跳过导入
-                List<MarkQuestion> markQuestionList = markQuestionService.listByExamIdAndPaperNumberAndPaperType(examId, markPaper.getPaperNumber(), markPaper.getPaperType(), false);
+                List<MarkQuestion> markQuestionList = markQuestionService.listByExamIdAndPaperNumberAndObjective(examId, markPaper.getPaperNumber(), false);
                 if (CollectionUtils.isNotEmpty(markQuestionList) && markQuestionList.stream().filter(m -> m.getGroupNumber() != null).count() > 1) {
                 if (CollectionUtils.isNotEmpty(markQuestionList) && markQuestionList.stream().filter(m -> m.getGroupNumber() != null).count() > 1) {
                     continue;
                     continue;
                 }
                 }

+ 35 - 95
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkQuestionServiceImpl.java

@@ -76,65 +76,6 @@ public class MarkQuestionServiceImpl extends ServiceImpl<MarkQuestionMapper, Mar
         return this.list(queryWrapper);
         return this.list(queryWrapper);
     }
     }
 
 
-    @Override
-    public List<MarkQuestion> listQuestionByExamIdAndPaperNumberAndPaperType(Long examId, String paperNumber, String paperType) {
-        QueryWrapper<MarkQuestion> queryWrapper = new QueryWrapper<>();
-        LambdaQueryWrapper<MarkQuestion> lambdaQueryWrapper = queryWrapper.lambda();
-        lambdaQueryWrapper.eq(MarkQuestion::getExamId, examId)
-                .eq(MarkQuestion::getPaperNumber, paperNumber)
-                .and(m -> m.isNull(MarkQuestion::getPaperType).or().eq(MarkQuestion::getPaperType, paperType));
-        lambdaQueryWrapper.orderByAsc(MarkQuestion::getMainNumber)
-                .orderByAsc(MarkQuestion::getSubNumber);
-        return this.list(queryWrapper);
-    }
-
-    @Override
-    public List<MarkQuestion> listQuestionByExamIdAndPaperNumberAndPaperType(Long examId, String paperNumber, String paperType, Boolean objective) {
-        if (objective == null) {
-            throw ExceptionResultEnum.ERROR.exception("objective参数必传");
-        }
-        QueryWrapper<MarkQuestion> queryWrapper = new QueryWrapper<>();
-        LambdaQueryWrapper<MarkQuestion> lambdaQueryWrapper = queryWrapper.lambda();
-        lambdaQueryWrapper.eq(MarkQuestion::getExamId, examId)
-                .eq(MarkQuestion::getPaperNumber, paperNumber);
-        if (objective) {
-            if (StringUtils.isBlank(paperType)) {
-                throw ExceptionResultEnum.ERROR.exception("查询客观题时,卷型必传");
-            }
-            lambdaQueryWrapper.eq(MarkQuestion::getPaperType, paperType);
-        } else {
-            lambdaQueryWrapper.isNull(MarkQuestion::getPaperType);
-        }
-        lambdaQueryWrapper.orderByAsc(MarkQuestion::getMainNumber)
-                .orderByAsc(MarkQuestion::getSubNumber);
-        return this.list(queryWrapper);
-    }
-
-    @Override
-    public List<MarkQuestion> listQuestionByExamIdAndPaperNumberAndSerialNumberAndObjectiveFalse(Long examId, String paperNumber, Integer serialNumber) {
-        QueryWrapper<MarkQuestion> queryWrapper = new QueryWrapper<>();
-        LambdaQueryWrapper<MarkQuestion> lambdaQueryWrapper = queryWrapper.lambda();
-        lambdaQueryWrapper.eq(MarkQuestion::getExamId, examId)
-                .eq(MarkQuestion::getPaperNumber, paperNumber)
-                .eq(MarkQuestion::getObjective, false);
-        lambdaQueryWrapper.orderByAsc(MarkQuestion::getMainNumber)
-                .orderByAsc(MarkQuestion::getSubNumber);
-        return this.list(queryWrapper);
-    }
-
-    @Override
-    public List<MarkQuestion> listQuestionByExamIdAndPaperNumberAndSerialNumberAndPaperTypeAndObjectiveTrue(Long examId, String paperNumber, Integer serialNumber, String paperType) {
-        QueryWrapper<MarkQuestion> queryWrapper = new QueryWrapper<>();
-        LambdaQueryWrapper<MarkQuestion> lambdaQueryWrapper = queryWrapper.lambda();
-        lambdaQueryWrapper.eq(MarkQuestion::getExamId, examId)
-                .eq(MarkQuestion::getPaperNumber, paperNumber)
-                .eq(MarkQuestion::getPaperType, paperType)
-                .eq(MarkQuestion::getObjective, true);
-        lambdaQueryWrapper.orderByAsc(MarkQuestion::getMainNumber)
-                .orderByAsc(MarkQuestion::getSubNumber);
-        return this.list(queryWrapper);
-    }
-
     @Transactional
     @Transactional
     @Override
     @Override
     public void saveQuestions(MarkQuestionParams markQuestionParams) {
     public void saveQuestions(MarkQuestionParams markQuestionParams) {
@@ -206,7 +147,6 @@ public class MarkQuestionServiceImpl extends ServiceImpl<MarkQuestionMapper, Mar
                         // 客观题变主观题
                         // 客观题变主观题
                         if (markQuestion.getObjective() && !question.getObjective()) {
                         if (markQuestion.getObjective() && !question.getObjective()) {
                             // 清除判分策略
                             // 清除判分策略
-                            markQuestion.setOptionCount(0);
                             markQuestionAnswerService.deleteByExamIdAndPaperNumberAndMainNumberAndSubNumber(examId, paperNumber, markQuestion.getMainNumber(), markQuestion.getSubNumber());
                             markQuestionAnswerService.deleteByExamIdAndPaperNumberAndMainNumberAndSubNumber(examId, paperNumber, markQuestion.getMainNumber(), markQuestion.getSubNumber());
                         }
                         }
                         // 客观题
                         // 客观题
@@ -259,7 +199,7 @@ public class MarkQuestionServiceImpl extends ServiceImpl<MarkQuestionMapper, Mar
             this.saveOrUpdateBatch(saveOrUpdateList);
             this.saveOrUpdateBatch(saveOrUpdateList);
         }
         }
         // 更新客观题满分、主观题满分、总分
         // 更新客观题满分、主观题满分、总分
-        List<MarkQuestion> markQuestions = this.listQuestionByExamIdAndPaperNumberAndPaperType(examId, paperNumber, null);
+        List<MarkQuestion> markQuestions = this.listQuestionByExamIdAndPaperNumber(examId, paperNumber);
         Double objectiveScore = markQuestions.stream().filter(m -> m.getObjective()).collect(Collectors.summingDouble(m -> m.getTotalScore()));
         Double objectiveScore = markQuestions.stream().filter(m -> m.getObjective()).collect(Collectors.summingDouble(m -> m.getTotalScore()));
         Double subjectiveScore = markQuestions.stream().filter(m -> !m.getObjective()).collect(Collectors.summingDouble(m -> m.getTotalScore()));
         Double subjectiveScore = markQuestions.stream().filter(m -> !m.getObjective()).collect(Collectors.summingDouble(m -> m.getTotalScore()));
         Double totalScore = markQuestions.stream().collect(Collectors.summingDouble(m -> m.getTotalScore()));
         Double totalScore = markQuestions.stream().collect(Collectors.summingDouble(m -> m.getTotalScore()));
@@ -312,32 +252,29 @@ public class MarkQuestionServiceImpl extends ServiceImpl<MarkQuestionMapper, Mar
     }
     }
 
 
     @Override
     @Override
-    public void objectiveAnswerSettingModelExport(Long examId, String paperNumber, HttpServletResponse response)
+    public void objectiveAnswerSettingModelExport(Long examId, String paperNumber, String paperType, HttpServletResponse response)
             throws Exception {
             throws Exception {
-        List<ObjectiveAnswerDto> datasource = this.listQuestionByExamIdAndPaperNumberAndGroupNumber(examId, paperNumber,
-                null, true).stream().flatMap(e -> {
+        List<MarkQuestionAnswerVo> datasource = this.listQuestionAnswerByExamIdAndPaperNumberAndPaperType(examId, paperNumber,
+                paperType, true);
+        List<ObjectiveAnswerDto> objectiveAnswerDtoList = datasource.stream().flatMap(e -> {
             ObjectiveAnswerDto dto = new ObjectiveAnswerDto();
             ObjectiveAnswerDto dto = new ObjectiveAnswerDto();
             dto.setMainNumber(String.valueOf(e.getMainNumber()));
             dto.setMainNumber(String.valueOf(e.getMainNumber()));
             dto.setSubNumber(String.valueOf(e.getSubNumber()));
             dto.setSubNumber(String.valueOf(e.getSubNumber()));
             dto.setMainTitle(e.getMainTitle());
             dto.setMainTitle(e.getMainTitle());
-            // todo 2024-10-16
-//            dto.setAnswer(e.getAnswer());
+            dto.setAnswer(e.getAnswer());
             return Stream.of(dto);
             return Stream.of(dto);
         }).collect(Collectors.toList());
         }).collect(Collectors.toList());
 
 
         // 生成excel文件
         // 生成excel文件
-        ExcelUtil.excelExport("客观题标答模板", ObjectiveAnswerDto.class, datasource, response);
+        ExcelUtil.excelExport("客观题标答模板", ObjectiveAnswerDto.class, objectiveAnswerDtoList, response);
     }
     }
 
 
     @Transactional
     @Transactional
     @Override
     @Override
-    public void objectiveAnswerSettingImport(Long examId, String paperNumber, MultipartFile file) throws Exception {
-        List<MarkQuestion> willEditList = new ArrayList<>();
+    public void objectiveAnswerSettingImport(Long examId, String paperNumber, String paperType, MultipartFile file) throws Exception {
         // 试卷结构
         // 试卷结构
-        List<MarkQuestion> datasource = this.listQuestionByExamIdAndPaperNumberAndGroupNumber(examId, paperNumber, null,
-                true);
-        ExcelResult<ObjectiveAnswerDto> excelResult = ConvertUtil.analyzeExcel(file.getInputStream(), ObjectiveAnswerDto.class,
-                false, 0);
+        List<MarkQuestionAnswer> datasource = markQuestionAnswerService.listByExamIdAndPaperNumberAndPaperType(examId, paperNumber, paperType);
+        ExcelResult<ObjectiveAnswerDto> excelResult = ConvertUtil.analyzeExcel(file.getInputStream(), ObjectiveAnswerDto.class, false, 0);
         if (!excelResult.isSuccess()) {
         if (!excelResult.isSuccess()) {
             throw ExceptionResultEnum.ERROR.exception(excelResult.getErrorMsg());
             throw ExceptionResultEnum.ERROR.exception(excelResult.getErrorMsg());
         }
         }
@@ -348,10 +285,11 @@ public class MarkQuestionServiceImpl extends ServiceImpl<MarkQuestionMapper, Mar
             logicErrorList.add("试卷结构试题数量和导入文件中的试题数量不一致");
             logicErrorList.add("试卷结构试题数量和导入文件中的试题数量不一致");
         }
         }
         Set<String> questionNumberSet = new HashSet<>();
         Set<String> questionNumberSet = new HashSet<>();
+        Map<String, MarkQuestion> markQuestionMap = this.listQuestionByExamIdAndPaperNumber(examId, paperNumber).stream().collect(Collectors.toMap(k -> k.getMainNumber() + SystemConstant.HYPHEN + k.getSubNumber(), v -> v));
         // 构建题号-试题结构map
         // 构建题号-试题结构map
-        Map<String, MarkQuestion> markQuestionMap = datasource.stream()
-                .collect(Collectors.toMap(k -> k.getMainNumber() + SystemConstant.HYPHEN + k.getSubNumber(), v -> v));
+        Map<String, MarkQuestionAnswer> markQuestionAnswerMapMap = datasource.stream().collect(Collectors.toMap(k -> k.getMainNumber() + SystemConstant.HYPHEN + k.getSubNumber(), v -> v));
 
 
+        List<MarkQuestionAnswer> willEditList = new ArrayList<>();
         for (int i = 0; i < objectiveAnswerDtoList.size(); i++) {
         for (int i = 0; i < objectiveAnswerDtoList.size(); i++) {
             int rowIndex = i + 2;
             int rowIndex = i + 2;
             ObjectiveAnswerDto cell = objectiveAnswerDtoList.get(i);
             ObjectiveAnswerDto cell = objectiveAnswerDtoList.get(i);
@@ -368,17 +306,16 @@ public class MarkQuestionServiceImpl extends ServiceImpl<MarkQuestionMapper, Mar
                 rowException.add("题号和前面重复");
                 rowException.add("题号和前面重复");
             } else {
             } else {
                 questionNumberSet.add(key);
                 questionNumberSet.add(key);
-                if (markQuestionMap.containsKey(key)) {
-                    MarkQuestion markQuestion = markQuestionMap.get(key);
-                    // todo 2024-10-16
-//                    markQuestion.setAnswer(exAnswer);
+                if (markQuestionAnswerMapMap.containsKey(key)) {
+                    MarkQuestionAnswer markQuestion = markQuestionAnswerMapMap.get(key);
+                    markQuestion.setAnswer(exAnswer);
                     willEditList.add(markQuestion);
                     willEditList.add(markQuestion);
                     String mainTitle = markQuestion.getMainTitle();
                     String mainTitle = markQuestion.getMainTitle();
                     if (!Objects.equals(exMainTitle, mainTitle)) {
                     if (!Objects.equals(exMainTitle, mainTitle)) {
                         rowException.add(String.format("大题名称[%s]错误", exMainTitle));
                         rowException.add(String.format("大题名称[%s]错误", exMainTitle));
                     } else {
                     } else {
-                        Integer questionType = markQuestion.getQuestionType();
-                        Integer optionCount = markQuestion.getOptionCount();
+                        Integer questionType = markQuestionMap.get(key).getQuestionType();
+                        Integer optionCount = markQuestionMap.get(key).getOptionCount();
                         List<String> optionScope = new ArrayList<>();
                         List<String> optionScope = new ArrayList<>();
                         try {
                         try {
                             for (int j = 1; j <= optionCount; j++) {
                             for (int j = 1; j <= optionCount; j++) {
@@ -442,7 +379,7 @@ public class MarkQuestionServiceImpl extends ServiceImpl<MarkQuestionMapper, Mar
         if (CollectionUtils.isNotEmpty(logicErrorList)) {
         if (CollectionUtils.isNotEmpty(logicErrorList)) {
             throw ExceptionResultEnum.ERROR.exception(String.join(";\n", logicErrorList));
             throw ExceptionResultEnum.ERROR.exception(String.join(";\n", logicErrorList));
         }
         }
-        this.saveOrUpdateBatch(willEditList);
+        markQuestionAnswerService.saveOrUpdateBatch(willEditList);
     }
     }
 
 
     @Transactional
     @Transactional
@@ -526,11 +463,11 @@ public class MarkQuestionServiceImpl extends ServiceImpl<MarkQuestionMapper, Mar
     }
     }
 
 
     @Override
     @Override
-    public MarkQuestionDto pageQuestionsByExamIdAndPaperNumberAndSerialNumberAndPaperType(Long examId, String paperNumber, Integer serialNumber, String paperType) {
+    public MarkQuestionDto pageQuestionsByExamIdAndPaperNumber(Long examId, String paperNumber) {
         MarkQuestionDto markQuestionDto = new MarkQuestionDto();
         MarkQuestionDto markQuestionDto = new MarkQuestionDto();
-        MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumberAndSerialNumber(examId, paperNumber, serialNumber);
+        MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(examId, paperNumber);
         // 试卷结构,默认只取A卷
         // 试卷结构,默认只取A卷
-        List<MarkQuestion> markQuestionList = this.listQuestionByExamIdAndPaperNumberAndPaperType(examId, paperNumber, SystemConstant.DEFAULT_PAPER_TYPE_A);
+        List<MarkQuestion> markQuestionList = this.listQuestionByExamIdAndPaperNumber(examId, paperNumber);
         markQuestionDto.setQuestionSubmit(markPaper.getQuestionStatus());
         markQuestionDto.setQuestionSubmit(markPaper.getQuestionStatus());
         markQuestionDto.setObjectiveSubmit(markQuestionAnswerService.countByExamIdAndPaperNumber(examId, paperNumber) > 0);
         markQuestionDto.setObjectiveSubmit(markQuestionAnswerService.countByExamIdAndPaperNumber(examId, paperNumber) > 0);
         markQuestionDto.setQuestions(markQuestionList);
         markQuestionDto.setQuestions(markQuestionList);
@@ -558,17 +495,12 @@ public class MarkQuestionServiceImpl extends ServiceImpl<MarkQuestionMapper, Mar
     }
     }
 
 
     @Override
     @Override
-    public List<MarkQuestion> listByExamIdAndPaperNumberAndPaperType(Long examId, String paperNumber, String paperType, Boolean objective) {
+    public List<MarkQuestion> listByExamIdAndPaperNumberAndObjective(Long examId, String paperNumber, Boolean objective) {
         QueryWrapper<MarkQuestion> queryWrapper = new QueryWrapper<>();
         QueryWrapper<MarkQuestion> queryWrapper = new QueryWrapper<>();
         LambdaQueryWrapper<MarkQuestion> lambdaQueryWrapper = queryWrapper.lambda();
         LambdaQueryWrapper<MarkQuestion> lambdaQueryWrapper = queryWrapper.lambda();
         lambdaQueryWrapper.eq(MarkQuestion::getExamId, examId)
         lambdaQueryWrapper.eq(MarkQuestion::getExamId, examId)
-                .eq(MarkQuestion::getPaperNumber, paperNumber);
-        if (StringUtils.isNotBlank(paperType)) {
-            lambdaQueryWrapper.eq(MarkQuestion::getPaperType, paperType);
-        }
-        if (objective != null) {
-            lambdaQueryWrapper.eq(MarkQuestion::getObjective, objective);
-        }
+                .eq(MarkQuestion::getPaperNumber, paperNumber)
+                .eq(MarkQuestion::getObjective, objective);
         lambdaQueryWrapper.orderByAsc(MarkQuestion::getMainNumber)
         lambdaQueryWrapper.orderByAsc(MarkQuestion::getMainNumber)
                 .orderByAsc(MarkQuestion::getSubNumber);
                 .orderByAsc(MarkQuestion::getSubNumber);
         return this.list(queryWrapper);
         return this.list(queryWrapper);
@@ -584,8 +516,8 @@ public class MarkQuestionServiceImpl extends ServiceImpl<MarkQuestionMapper, Mar
 
 
     @Transactional
     @Transactional
     @Override
     @Override
-    public void updateMarkPaperScore(Long examId, String paperNumber, String paperType) {
-        List<MarkQuestion> markQuestions = this.listQuestionByExamIdAndPaperNumberAndPaperType(examId, paperNumber, paperType);
+    public void updateMarkPaperScore(Long examId, String paperNumber) {
+        List<MarkQuestion> markQuestions = this.listQuestionByExamIdAndPaperNumber(examId, paperNumber);
         Double objectiveScore = markQuestions.stream().filter(MarkQuestion::getObjective)
         Double objectiveScore = markQuestions.stream().filter(MarkQuestion::getObjective)
                 .mapToDouble(MarkQuestion::getTotalScore).sum();
                 .mapToDouble(MarkQuestion::getTotalScore).sum();
         Double subjectiveScore = markQuestions.stream().filter(m -> !m.getObjective())
         Double subjectiveScore = markQuestions.stream().filter(m -> !m.getObjective())
@@ -604,4 +536,12 @@ public class MarkQuestionServiceImpl extends ServiceImpl<MarkQuestionMapper, Mar
     public List<MarkQuestionAnswerVo> listQuestionAnswerByExamIdAndPaperNumberAndPaperType(Long examId, String paperNumber, String paperType, Boolean objective) {
     public List<MarkQuestionAnswerVo> listQuestionAnswerByExamIdAndPaperNumberAndPaperType(Long examId, String paperNumber, String paperType, Boolean objective) {
         return this.baseMapper.listQuestionAnswerByExamIdAndPaperNumberAndPaperType(examId, paperNumber, paperType, objective);
         return this.baseMapper.listQuestionAnswerByExamIdAndPaperNumberAndPaperType(examId, paperNumber, paperType, objective);
     }
     }
+
+    @Override
+    public List<MarkQuestion> listByExamIdAndPaperNumber(Long examId, String paperNumber) {
+        QueryWrapper<MarkQuestion> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(MarkQuestion::getExamId, examId)
+                .eq(MarkQuestion::getPaperNumber, paperNumber);
+        return this.list(queryWrapper);
+    }
 }
 }

+ 14 - 19
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkStudentServiceImpl.java

@@ -581,7 +581,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
                     // 不开启卷型默认A卷 正常
                     // 不开启卷型默认A卷 正常
                     paperType = "A";
                     paperType = "A";
                 } else {
                 } else {
-                    if (Objects.isNull(paperTypeResult)){
+                    if (Objects.isNull(paperTypeResult)) {
                         // 卷型为空 (正常不会出现这种情况)
                         // 卷型为空 (正常不会出现这种情况)
                         throw ExceptionResultEnum.ERROR.exception("开启卷型的试卷未检测到识别的卷型");
                         throw ExceptionResultEnum.ERROR.exception("开启卷型的试卷未检测到识别的卷型");
                     }
                     }
@@ -1068,13 +1068,10 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
     }
     }
 
 
     @Override
     @Override
-    public long countByExamIdAndPaperNumber(Long examId, String paperNumber, String paperType) {
+    public long countByExamIdAndPaperNumber(Long examId, String paperNumber) {
         QueryWrapper<MarkStudent> queryWrapper = new QueryWrapper<>();
         QueryWrapper<MarkStudent> queryWrapper = new QueryWrapper<>();
         LambdaQueryWrapper<MarkStudent> lambda = queryWrapper.lambda();
         LambdaQueryWrapper<MarkStudent> lambda = queryWrapper.lambda();
         lambda.eq(MarkStudent::getExamId, examId).eq(MarkStudent::getPaperNumber, paperNumber);
         lambda.eq(MarkStudent::getExamId, examId).eq(MarkStudent::getPaperNumber, paperNumber);
-        if (StringUtils.isNotBlank(paperType)) {
-            lambda.eq(MarkStudent::getPaperType, paperType);
-        }
         return this.count(queryWrapper);
         return this.count(queryWrapper);
     }
     }
 
 
@@ -1426,17 +1423,17 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
     }
     }
 
 
     @Override
     @Override
-    public int countOmrAbsentStudent(Long examId, String paperNumber, String paperType, boolean isOmrAbsentConfirm) {
+    public int countOmrAbsentStudent(Long examId, String paperNumber, boolean isOmrAbsentConfirm) {
         QueryWrapper<MarkStudent> queryWrapper = new QueryWrapper<>();
         QueryWrapper<MarkStudent> queryWrapper = new QueryWrapper<>();
         queryWrapper.lambda().eq(MarkStudent::getExamId, examId).eq(MarkStudent::getPaperNumber, paperNumber)
         queryWrapper.lambda().eq(MarkStudent::getExamId, examId).eq(MarkStudent::getPaperNumber, paperNumber)
-                .eq(MarkStudent::getPaperType, paperType).eq(MarkStudent::getOmrAbsent, true)
+                .eq(MarkStudent::getOmrAbsent, true)
                 .eq(MarkStudent::getOmrAbsentChecked, isOmrAbsentConfirm);
                 .eq(MarkStudent::getOmrAbsentChecked, isOmrAbsentConfirm);
         return this.count(queryWrapper);
         return this.count(queryWrapper);
     }
     }
 
 
     @Override
     @Override
-    public int countOmrAbsentStudent(Long examId, String paperNumber, String paperType, boolean isOmrAbsentConfirm, String teachClassName) {
-        return this.baseMapper.countOmrAbsentStudent(examId, paperNumber, paperType, isOmrAbsentConfirm, teachClassName);
+    public int countOmrAbsentStudent(Long examId, String paperNumber, boolean isOmrAbsentConfirm, String teachClassName) {
+        return this.baseMapper.countOmrAbsentStudent(examId, paperNumber, isOmrAbsentConfirm, teachClassName);
     }
     }
 
 
     @Override
     @Override
@@ -1538,7 +1535,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
     }
     }
 
 
     private void fillObjective(ScoreReportVo ret, List<ArchiveStudentVo> studentList, Long examId, String paperNumber) {
     private void fillObjective(ScoreReportVo ret, List<ArchiveStudentVo> studentList, Long examId, String paperNumber) {
-        List<MarkQuestion> qs = markQuestionService.listByExamIdAndPaperNumberAndPaperType(examId, paperNumber, null, true);
+        List<MarkQuestion> qs = markQuestionService.listByExamIdAndPaperNumberAndObjective(examId, paperNumber, true);
         Map<String, QuestionVo> map = new HashMap<>();
         Map<String, QuestionVo> map = new HashMap<>();
         List<QuestionVo> list = new ArrayList<>();
         List<QuestionVo> list = new ArrayList<>();
         for (ArchiveStudentVo s : studentList) {
         for (ArchiveStudentVo s : studentList) {
@@ -1607,8 +1604,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
         // 试卷结构数据
         // 试卷结构数据
         Map<String, QuestionVo> mainQuestionMap = new HashMap<>();
         Map<String, QuestionVo> mainQuestionMap = new HashMap<>();
 
 
-        List<MarkQuestion> questionDatasource = markQuestionService.listByExamIdAndPaperNumberAndPaperType(examId,
-                paperNumber, null, null);
+        List<MarkQuestion> questionDatasource = markQuestionService.listByExamIdAndPaperNumber(examId, paperNumber);
         for (MarkQuestion question : questionDatasource) {
         for (MarkQuestion question : questionDatasource) {
             Integer mainNumber = question.getMainNumber();
             Integer mainNumber = question.getMainNumber();
             String key = getMainQuestionMapKey(mainNumber, question.getObjective());
             String key = getMainQuestionMapKey(mainNumber, question.getObjective());
@@ -1806,12 +1802,11 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
     }
     }
 
 
     @Override
     @Override
-    public int countUnexistByExamIdAndPaperNumberAndPaperType(Long examId, String paperNumber, String paperType) {
+    public int countUnexistByExamIdAndPaperNumber(Long examId, String paperNumber) {
         MarkStudent markStudent = new MarkStudent();
         MarkStudent markStudent = new MarkStudent();
         markStudent.setExamId(examId);
         markStudent.setExamId(examId);
         markStudent.setPaperNumber(paperNumber);
         markStudent.setPaperNumber(paperNumber);
         markStudent.setScanStatus(ScanStatus.UNEXIST);
         markStudent.setScanStatus(ScanStatus.UNEXIST);
-        markStudent.setPaperType(paperType);
         markStudent.setMarkPaperStatus(MarkPaperStatus.FORMAL.name());
         markStudent.setMarkPaperStatus(MarkPaperStatus.FORMAL.name());
         return baseMapper.selectCountByQuery(markStudent, null);
         return baseMapper.selectCountByQuery(markStudent, null);
     }
     }
@@ -1849,8 +1844,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
         }
         }
 
 
         List<MarkStudentVo> markStudentList = this.listByExamIdAndPaperNumberAndNotAbsent(examId, paperNumber);
         List<MarkStudentVo> markStudentList = this.listByExamIdAndPaperNumberAndNotAbsent(examId, paperNumber);
-        List<MarkQuestion> objectiveQuestionList = markQuestionService.listByExamIdAndPaperNumberAndPaperType(examId, paperNumber, null, true);
-        List<MarkQuestion> subjectiveQuestionList = markQuestionService.listByExamIdAndPaperNumberAndPaperType(examId, paperNumber, null, false);
+        List<MarkQuestion> objectiveQuestionList = markQuestionService.listByExamIdAndPaperNumberAndObjective(examId, paperNumber, true);
+        List<MarkQuestion> subjectiveQuestionList = markQuestionService.listByExamIdAndPaperNumberAndObjective(examId, paperNumber, false);
         List<MarkStudentScoreVo> markStudentScoreVoList = new ArrayList<>();
         List<MarkStudentScoreVo> markStudentScoreVoList = new ArrayList<>();
         for (MarkStudentVo markStudent : markStudentList) {
         for (MarkStudentVo markStudent : markStudentList) {
             MarkStudentScoreVo markStudentScoreVo = new MarkStudentScoreVo();
             MarkStudentScoreVo markStudentScoreVo = new MarkStudentScoreVo();
@@ -1998,7 +1993,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
             if (MarkPaperStatus.FINISH.equals(markPaper.getStatus())) {
             if (MarkPaperStatus.FINISH.equals(markPaper.getStatus())) {
                 throw ExceptionResultEnum.ERROR.exception("试卷编号[" + markPaper.getPaperNumber() + "]已结束阅卷,不允许新增考生");
                 throw ExceptionResultEnum.ERROR.exception("试卷编号[" + markPaper.getPaperNumber() + "]已结束阅卷,不允许新增考生");
             }
             }
-            markStudent = new MarkStudent(SystemConstant.getDbUuid(), basicExamStudent.getExamId(), basicExamStudent.getId(), basicExamStudent.getCourseId(), basicExamStudent.getPaperNumber(), markPaper.getCoursePaperId(),markPaper.getSerialNumber(), markPaper.getPaperType(), basicExamStudent.getStudentCode(), "", basicExamStudent.getExamPlace(), basicExamStudent.getExamRoom(), basicExamStudent.getExamStartTime(), basicExamStudent.getExamEndTime(), markPaper.getUserId());
+            markStudent = new MarkStudent(SystemConstant.getDbUuid(), basicExamStudent.getExamId(), basicExamStudent.getId(), basicExamStudent.getCourseId(), basicExamStudent.getPaperNumber(), markPaper.getCoursePaperId(), markPaper.getSerialNumber(), markPaper.getPaperType(), basicExamStudent.getStudentCode(), "", basicExamStudent.getExamPlace(), basicExamStudent.getExamRoom(), basicExamStudent.getExamStartTime(), basicExamStudent.getExamEndTime(), markPaper.getUserId());
             if (markStudent.getSecretNumber() == null) {
             if (markStudent.getSecretNumber() == null) {
                 markStudent.randomSecretNumber();
                 markStudent.randomSecretNumber();
                 while (secretNumberSet.contains(markStudent.getSecretNumber())
                 while (secretNumberSet.contains(markStudent.getSecretNumber())
@@ -2044,8 +2039,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
     }
     }
 
 
     @Override
     @Override
-    public Integer maxCardNumber(Long examId, String paperNumber, String paperType) {
-        return this.baseMapper.maxCardNumber(examId, paperNumber, paperType);
+    public Integer maxCardNumber(Long examId, String paperNumber) {
+        return this.baseMapper.maxCardNumber(examId, paperNumber);
     }
     }
 
 
     @Override
     @Override

+ 3 - 4
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/ScanAnswerCardServiceImpl.java

@@ -283,9 +283,9 @@ public class ScanAnswerCardServiceImpl extends ServiceImpl<ScanAnswerCardMapper,
     }
     }
 
 
     @Override
     @Override
-    public List<CardJpgResult> listPageImage(Long examId, String paperNumber, String paperType) {
+    public List<CardJpgResult> listPageImage(Long examId, String paperNumber) {
         List<CardJpgResult> cardJpgResultList = new ArrayList<>();
         List<CardJpgResult> cardJpgResultList = new ArrayList<>();
-        Integer maxCardNumber = markStudentService.maxCardNumber(examId, paperNumber, paperType);
+        Integer maxCardNumber = markStudentService.maxCardNumber(examId, paperNumber);
         if (maxCardNumber != null) {
         if (maxCardNumber != null) {
             ScanAnswerCard scanAnswerCard = this.findByExamAndNumber(examId, maxCardNumber);
             ScanAnswerCard scanAnswerCard = this.findByExamAndNumber(examId, maxCardNumber);
             if (scanAnswerCard != null && StringUtils.isNotBlank(scanAnswerCard.getAdapteUri())) {
             if (scanAnswerCard != null && StringUtils.isNotBlank(scanAnswerCard.getAdapteUri())) {
@@ -311,11 +311,10 @@ public class ScanAnswerCardServiceImpl extends ServiceImpl<ScanAnswerCardMapper,
     }
     }
 
 
     @Override
     @Override
-    public List<ScanAnswerCard> listByExamIdAndCoursePaperIdAndPaperTypeAndSource(Long examId, String coursePaperId, String paperType, CardSource source) {
+    public List<ScanAnswerCard> listByExamIdAndCoursePaperIdAndSource(Long examId, String coursePaperId, CardSource source) {
         QueryWrapper<ScanAnswerCard> queryWrapper = new QueryWrapper<>();
         QueryWrapper<ScanAnswerCard> queryWrapper = new QueryWrapper<>();
         queryWrapper.lambda().eq(ScanAnswerCard::getExamId, examId)
         queryWrapper.lambda().eq(ScanAnswerCard::getExamId, examId)
                 .eq(ScanAnswerCard::getCoursePaperId, coursePaperId)
                 .eq(ScanAnswerCard::getCoursePaperId, coursePaperId)
-                .eq(ScanAnswerCard::getPaperType, paperType)
                 .eq(ScanAnswerCard::getSource, source);
                 .eq(ScanAnswerCard::getSource, source);
         return this.list(queryWrapper);
         return this.list(queryWrapper);
     }
     }

+ 6 - 2
teachcloud-mark/src/main/resources/mapper/MarkQuestionAnswerMapper.xml

@@ -20,7 +20,7 @@
     <select id="listByExamIdAndPaperNumberAndPaperType"
     <select id="listByExamIdAndPaperNumberAndPaperType"
             resultType="com.qmth.teachcloud.mark.entity.MarkQuestionAnswer">
             resultType="com.qmth.teachcloud.mark.entity.MarkQuestionAnswer">
         SELECT
         SELECT
-            mqa.*, mq.main_title, mq.total_score
+            mqa.*, mq.main_title, mq.total_score, mq.question_type, mq.option_count
         FROM
         FROM
             (SELECT
             (SELECT
                  *
                  *
@@ -36,8 +36,12 @@
                  mark_question_answer
                  mark_question_answer
              WHERE
              WHERE
                  exam_id = #{examId} AND paper_number = #{paperNumber}
                  exam_id = #{examId} AND paper_number = #{paperNumber}
-               AND paper_type = #{paperType}) mqa ON mq.main_number = mqa.main_number
+               <if test="paperType != null">
+                   AND paper_type = #{paperType}
+               </if>
+               ) mqa ON mq.main_number = mqa.main_number
                 AND mq.sub_number = mqa.sub_number
                 AND mq.sub_number = mqa.sub_number
+                ORDER BY mqa.paper_type, mq.main_number, mq.sub_number
     </select>
     </select>
 
 
 </mapper>
 </mapper>

+ 2 - 4
teachcloud-mark/src/main/resources/mapper/MarkStudentMapper.xml

@@ -46,6 +46,7 @@
         bc.code courseCode,
         bc.code courseCode,
         bc.name courseName,
         bc.name courseName,
         ms.paper_number paperNumber,
         ms.paper_number paperNumber,
+        ms.paper_type paperType,
         bes.student_name studentName,
         bes.student_name studentName,
         bes.student_code studentCode,
         bes.student_code studentCode,
         bes.college_name collegeName,
         bes.college_name collegeName,
@@ -829,7 +830,7 @@
         select * from basic_teach_clazz where id = #{clazzId}
         select * from basic_teach_clazz where id = #{clazzId}
     </select>
     </select>
     <select id="maxCardNumber" resultType="java.lang.Integer">
     <select id="maxCardNumber" resultType="java.lang.Integer">
-        select max(card_number) from mark_student where exam_id = #{examId} and paper_number = #{paperNumber} and paper_type = #{paperType} and card_number is not null
+        select max(card_number) from mark_student where exam_id = #{examId} and paper_number = #{paperNumber} and card_number is not null
     </select>
     </select>
     <select id="selectByExamIdAndCoursePaperIdAndStudentCode"
     <select id="selectByExamIdAndCoursePaperIdAndStudentCode"
             resultType="com.qmth.teachcloud.mark.entity.MarkStudent">
             resultType="com.qmth.teachcloud.mark.entity.MarkStudent">
@@ -913,9 +914,6 @@
             </if>
             </if>
             <if test="paperNumber != null and paperNumber != ''">
             <if test="paperNumber != null and paperNumber != ''">
                 and ms.paper_number = #{paperNumber}
                 and ms.paper_number = #{paperNumber}
-            </if>
-            <if test="paperType != null and paperType != ''">
-                and ms.paper_type = #{paperType}
             </if>
             </if>
                 and ms.omr_absent = true
                 and ms.omr_absent = true
             <if test="isOmrAbsentConfirm != null and isOmrAbsentConfirm != '' or isOmrAbsentConfirm == 0">
             <if test="isOmrAbsentConfirm != null and isOmrAbsentConfirm != '' or isOmrAbsentConfirm == 0">

+ 1 - 2
teachcloud-obe/src/main/java/com/qmth/teachcloud/obe/service/impl/TCFinalScoreServiceImpl.java

@@ -325,11 +325,10 @@ public class TCFinalScoreServiceImpl extends ServiceImpl<TCFinalScoreMapper, TCF
      * @param paperNumber
      * @param paperNumber
      * @param cultureProgramId
      * @param cultureProgramId
      * @return
      * @return
-     * @throws IOException
      */
      */
     @Override
     @Override
     @Transactional
     @Transactional
-    public Map<String, String> finalScoreSync(Long examId, Long courseId, String paperNumber, Long cultureProgramId) throws IOException {
+    public Map<String, String> finalScoreSync(Long examId, Long courseId, String paperNumber, Long cultureProgramId) {
         Map<String, String> messageMap = new LinkedHashMap<>();
         Map<String, String> messageMap = new LinkedHashMap<>();
         try {
         try {
             SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
             SysUser sysUser = (SysUser) ServletUtil.getRequestUser();

+ 2 - 2
teachcloud-obe/src/main/java/com/qmth/teachcloud/obe/service/impl/TCPaperStructServiceImpl.java

@@ -239,7 +239,7 @@ public class TCPaperStructServiceImpl extends ServiceImpl<TCPaperStructMapper, T
                     paperStructDtoList = SDFrame.read(paperStructDtoList).sortDesc(Sorter.sortDescBy(PaperStructDto::getMainNumber).sortDesc(PaperStructDto::getMainNumber)).toLists();
                     paperStructDtoList = SDFrame.read(paperStructDtoList).sortDesc(Sorter.sortDescBy(PaperStructDto::getMainNumber).sortDesc(PaperStructDto::getMainNumber)).toLists();
                     paperStructDbList = paperStructDtoList.stream().map(e -> e.getMainNumber() + "_" + e.getSubNumber() + "_" + e.getScore()).collect(Collectors.toList());
                     paperStructDbList = paperStructDtoList.stream().map(e -> e.getMainNumber() + "_" + e.getSubNumber() + "_" + e.getScore()).collect(Collectors.toList());
                 } else {
                 } else {
-                    List<MarkQuestion> markQuestionList = markQuestionService.listQuestionByExamIdAndPaperNumberAndPaperType(examId, paperNumber, null);
+                    List<MarkQuestion> markQuestionList = markQuestionService.listQuestionByExamIdAndPaperNumber(examId, paperNumber);
                     if (CollectionUtils.isEmpty(markQuestionList)) {
                     if (CollectionUtils.isEmpty(markQuestionList)) {
                         throw ExceptionResultEnum.ERROR.exception("未找到试卷结构");
                         throw ExceptionResultEnum.ERROR.exception("未找到试卷结构");
                     }
                     }
@@ -256,7 +256,7 @@ public class TCPaperStructServiceImpl extends ServiceImpl<TCPaperStructMapper, T
                 ObeCourseWeightResult obeCourseWeightResult = trBasicInfoService.findCourseWeightResultRmi(obeCourseOutline.getId(), true);
                 ObeCourseWeightResult obeCourseWeightResult = trBasicInfoService.findCourseWeightResultRmi(obeCourseOutline.getId(), true);
                 paperStructDimensionResultList = SDFrame.read(paperStructDimensionResultList).sortDesc(Sorter.sortDescBy(PaperStructDimensionResult::getMainNumber).sortDesc(PaperStructDimensionResult::getMainNumber)).toLists();
                 paperStructDimensionResultList = SDFrame.read(paperStructDimensionResultList).sortDesc(Sorter.sortDescBy(PaperStructDimensionResult::getMainNumber).sortDesc(PaperStructDimensionResult::getMainNumber)).toLists();
                 tcPaperStruct = new TCPaperStruct(examId, cultureProgramId, courseId, markPaper.getCourseCode(), markPaper.getCourseName(), paperNumber, JacksonUtil.parseJson(paperStructDimensionResultList), sysUser.getId(), obeCourseWeightResult.getDimensionSign());
                 tcPaperStruct = new TCPaperStruct(examId, cultureProgramId, courseId, markPaper.getCourseCode(), markPaper.getCourseName(), paperNumber, JacksonUtil.parseJson(paperStructDimensionResultList), sysUser.getId(), obeCourseWeightResult.getDimensionSign());
-                List<MarkQuestion> markQuestionList = markQuestionService.listQuestionByExamIdAndPaperNumberAndPaperType(examId, paperNumber, null);
+                List<MarkQuestion> markQuestionList = markQuestionService.listQuestionByExamIdAndPaperNumber(examId, paperNumber);
                 if (CollectionUtils.isEmpty(markQuestionList)) {
                 if (CollectionUtils.isEmpty(markQuestionList)) {
                     throw ExceptionResultEnum.ERROR.exception("未找到试卷结构");
                     throw ExceptionResultEnum.ERROR.exception("未找到试卷结构");
                 }
                 }

+ 13 - 10
teachcloud-task/src/main/java/com/qmth/teachcloud/task/service/impl/PrintFinishServiceImpl.java

@@ -89,7 +89,7 @@ public class PrintFinishServiceImpl implements PrintFinishService {
     @Override
     @Override
     public void insertMarkPaper(ExamDetailCourseInitMarkDto dto, List<PaperInfoVo> paperInfoVos) {
     public void insertMarkPaper(ExamDetailCourseInitMarkDto dto, List<PaperInfoVo> paperInfoVos) {
         try {
         try {
-            MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumberAndSerialNumber(dto.getExamId(), dto.getPaperNumber(), dto.getSerialNumber());
+            MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(dto.getExamId(), dto.getPaperNumber());
             if (markPaper == null) {
             if (markPaper == null) {
                 MarkPaper insertMarkPaper = new MarkPaper(dto.getExamId(), dto.getCourseId(), dto.getPaperNumber(), dto.getCoursePaperId(), dto.getCreateId(), dto.getSerialNumber(), dto.getPaperType());
                 MarkPaper insertMarkPaper = new MarkPaper(dto.getExamId(), dto.getCourseId(), dto.getPaperNumber(), dto.getCoursePaperId(), dto.getCreateId(), dto.getSerialNumber(), dto.getPaperType());
                 if (CollectionUtils.isNotEmpty(paperInfoVos)) {
                 if (CollectionUtils.isNotEmpty(paperInfoVos)) {
@@ -164,6 +164,7 @@ public class PrintFinishServiceImpl implements PrintFinishService {
                 if (examCard.getPaperId() != null) {
                 if (examCard.getPaperId() != null) {
                     this.insertPaperAnswerFile(dto.getExamId(), dto.getPaperNumber(), dto.getSerialNumber(), examCard.getPaperId());
                     this.insertPaperAnswerFile(dto.getExamId(), dto.getPaperNumber(), dto.getSerialNumber(), examCard.getPaperId());
                 }
                 }
+                // 自动保存题卡遮盖区
                 this.updateMarkSheetConfig(dto, examCard.getContent());
                 this.updateMarkSheetConfig(dto, examCard.getContent());
             }
             }
         }
         }
@@ -272,14 +273,16 @@ public class PrintFinishServiceImpl implements PrintFinishService {
                     markQuestions.add(markQuestion);
                     markQuestions.add(markQuestion);
 
 
                     // 保存客观题数据
                     // 保存客观题数据
-                    for (String paperType : markPaper.getPaperTypeList()) {
-                        MarkQuestionAnswer markQuestionAnswer = new MarkQuestionAnswer(examId, paperNumber, paperType, struct.getMainNumber(), struct.getSubNumber());
-                        if (StringUtils.isNotBlank(struct.getAnswer())) {
-                            // 客观题有标答时,给分策略默认为全对给分
-                            markQuestionAnswer.setAnswer(struct.getAnswer());
-                            markQuestionAnswer.setObjectivePolicy(ObjectivePolicy.NONE);
+                    if (struct.getObjective()) {
+                        for (String paperType : markPaper.getPaperTypeList()) {
+                            MarkQuestionAnswer markQuestionAnswer = new MarkQuestionAnswer(examId, paperNumber, paperType, struct.getMainNumber(), struct.getSubNumber());
+                            if (StringUtils.isNotBlank(struct.getAnswer())) {
+                                // 客观题有标答时,给分策略默认为全对给分
+                                markQuestionAnswer.setAnswer(struct.getAnswer());
+                                markQuestionAnswer.setObjectivePolicy(ObjectivePolicy.NONE);
+                            }
+                            markQuestionAnswers.add(markQuestionAnswer);
                         }
                         }
-                        markQuestionAnswers.add(markQuestionAnswer);
                     }
                     }
                 }
                 }
                 markQuestionService.saveBatch(markQuestions);
                 markQuestionService.saveBatch(markQuestions);
@@ -292,7 +295,7 @@ public class PrintFinishServiceImpl implements PrintFinishService {
 
 
     @Override
     @Override
     public void insertPaperAnswerFile(Long examId, String paperNumber, Integer serialNumber, Long paperId) {
     public void insertPaperAnswerFile(Long examId, String paperNumber, Integer serialNumber, Long paperId) {
-        MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumberAndSerialNumber(examId, paperNumber, serialNumber);
+        MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(examId, paperNumber);
         if (markPaper != null) {
         if (markPaper != null) {
             ExamTaskPaperData examTaskPaperData = examTaskPaperDataService.selectByMultiId(new ExamTaskPaperData(examId, paperNumber, paperId));
             ExamTaskPaperData examTaskPaperData = examTaskPaperDataService.selectByMultiId(new ExamTaskPaperData(examId, paperNumber, paperId));
             if (examTaskPaperData != null && examTaskPaperData.getAnswerPdfAttachmentId() != null) {
             if (examTaskPaperData != null && examTaskPaperData.getAnswerPdfAttachmentId() != null) {
@@ -321,7 +324,7 @@ public class PrintFinishServiceImpl implements PrintFinishService {
 
 
     @Override
     @Override
     public void updateMarkSheetConfig(ExamDetailCourseInitMarkDto dto, String content) {
     public void updateMarkSheetConfig(ExamDetailCourseInitMarkDto dto, String content) {
-        MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumberAndPaperType(dto.getExamId(), dto.getPaperNumber(), dto.getPaperType());
+        MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(dto.getExamId(), dto.getPaperNumber());
         if (markPaper != null && (StringUtils.isEmpty(markPaper.getSheetConfig()) || CollectionUtils.isEmpty(JSON.parseArray(markPaper.getSheetConfig(), JSONObject.class)))) {
         if (markPaper != null && (StringUtils.isEmpty(markPaper.getSheetConfig()) || CollectionUtils.isEmpty(JSON.parseArray(markPaper.getSheetConfig(), JSONObject.class)))) {
             UpdateWrapper<MarkPaper> updateWrapper = new UpdateWrapper<>();
             UpdateWrapper<MarkPaper> updateWrapper = new UpdateWrapper<>();
             updateWrapper.lambda().set(MarkPaper::getSheetConfig, CardParseUtils.parseAreaInfo(content)).eq(MarkPaper::getId, markPaper.getId());
             updateWrapper.lambda().set(MarkPaper::getSheetConfig, CardParseUtils.parseAreaInfo(content)).eq(MarkPaper::getId, markPaper.getId());