xiatian 7 місяців тому
батько
коміт
b3d1420a7b

+ 22 - 13
src/main/java/cn/com/qmth/scancentral/service/impl/StudentServiceImpl.java

@@ -1337,7 +1337,7 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, StudentEntity> i
         student.setAnswer(getCetAnswer(structs, pages, student.getSubjectCode()));
         AnswerCardEntity card = getCard(cardMap, student.getExamId(), student.getCardNumber());
         Set<String> sliceSet = new LinkedHashSet<>();
-        setCardStatus(student, card, pages, pmap);
+        setCardStatus(paperTypeBarcodeContents, student, card, pages, pmap);
         int index = 0;
         for (PaperPageCetVo p : pages) {
             if (CollectionUtils.isNotEmpty(p.getSlicePath())) {
@@ -1394,13 +1394,13 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, StudentEntity> i
         return card;
     }
 
-    private void setCardStatus(ExportCetVo student, AnswerCardEntity card, List<PaperPageCetVo> pages,
-            Map<Long, PaperCetVo> pmap) {
+    private void setCardStatus(List<String> paperTpeCodes, ExportCetVo student, AnswerCardEntity card,
+            List<PaperPageCetVo> pages, Map<Long, PaperCetVo> pmap) {
         int subject = Integer.valueOf(student.getSubjectCode());
         if (subject > 2) {
             setCardStatusSmall(student, card, pages, pmap);
         } else {
-            setCardStatusCet(student, card, pages, pmap);
+            setCardStatusCet(paperTpeCodes, student, card, pages, pmap);
         }
     }
 
@@ -1419,14 +1419,14 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, StudentEntity> i
         student.setCardSecond(0);
     }
 
-    private void setCardStatusCet(ExportCetVo student, AnswerCardEntity card, List<PaperPageCetVo> pages,
-            Map<Long, PaperCetVo> pmap) {
+    private void setCardStatusCet(List<String> paperTpeCodes, ExportCetVo student, AnswerCardEntity card,
+            List<PaperPageCetVo> pages, Map<Long, PaperCetVo> pmap) {
         if (card.getPaperCount() == 1) {
             PaperPageCetVo p = pages.get(0);
             if (ExamStatus.ABSENT.equals(student.getExamStatus())) {
                 if (pmap.get(p.getPaperId()).getQuestionFilled()) {
                     student.setCardFirst(1);
-                } else if (isPaperTypeValid(p.getPaperType())) {
+                } else if (isPaperTypeValid(paperTpeCodes, p.getPaperType())) {
                     student.setCardFirst(7);
                 } else if (isPaperTypeEmpty(p.getPaperType())) {
                     student.setCardFirst(0);
@@ -1434,7 +1434,7 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, StudentEntity> i
                     student.setCardFirst(7);
                 }
             } else {
-                if (isPaperTypeValid(p.getPaperType())) {
+                if (isPaperTypeValid(paperTpeCodes, p.getPaperType())) {
                     student.setCardFirst(0);
                 } else {
                     student.setCardFirst(7);
@@ -1452,7 +1452,7 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, StudentEntity> i
             if (ExamStatus.ABSENT.equals(student.getExamStatus())) {
                 if (pmap.get(fp.getPaperId()).getQuestionFilled()) {
                     student.setCardFirst(1);
-                } else if (isPaperTypeValid(fp.getPaperType())) {
+                } else if (isPaperTypeValid(paperTpeCodes, fp.getPaperType())) {
                     student.setCardFirst(7);
                 } else if (isPaperTypeEmpty(fp.getPaperType())) {
                     student.setCardFirst(0);
@@ -1460,7 +1460,10 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, StudentEntity> i
                     student.setCardFirst(7);
                 }
             } else {
-                if (isPaperTypeValid(fp.getPaperType())) {
+                if ("考生94".equals(student.getName())) {
+                    System.out.println();
+                }
+                if (isPaperTypeValid(paperTpeCodes, fp.getPaperType())) {
                     student.setCardFirst(0);
                 } else {
                     student.setCardFirst(7);
@@ -1469,7 +1472,7 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, StudentEntity> i
             if (ExamStatus.ABSENT.equals(student.getExamStatus())) {
                 if (pmap.get(sp.getPaperId()).getQuestionFilled()) {
                     student.setCardSecond(1);
-                } else if (isPaperTypeValid(fp.getPaperType())) {
+                } else if (isPaperTypeValid(paperTpeCodes, fp.getPaperType())) {
                     student.setCardSecond(7);
                 } else if (isPaperTypeEmpty(fp.getPaperType())) {
                     student.setCardSecond(0);
@@ -1477,7 +1480,7 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, StudentEntity> i
                     student.setCardSecond(7);
                 }
             } else {
-                if (isPaperTypeValid(fp.getPaperType())) {
+                if (isPaperTypeValid(paperTpeCodes, fp.getPaperType())) {
                     student.setCardSecond(0);
                 } else {
                     student.setCardSecond(7);
@@ -1499,7 +1502,7 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, StudentEntity> i
         return false;
     }
 
-    private boolean isPaperTypeValid(StringResult sr) {
+    private boolean isPaperTypeValid(List<String> paperTpeCodes, StringResult sr) {
         if (sr == null) {
             return false;
         }
@@ -1509,6 +1512,12 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, StudentEntity> i
         if ("#".equals(sr.getResult()) || "?".equals(sr.getResult())) {
             return false;
         }
+        if (CollectionUtils.isEmpty(paperTpeCodes)) {
+            return false;
+        }
+        if (!paperTpeCodes.contains(sr.getResult())) {
+            return false;
+        }
         return true;
     }