wangliang 4 éve
szülő
commit
556468ef40

+ 8 - 2
themis-backend/src/main/java/com/qmth/themis/backend/api/TIeInvigilateController.java

@@ -287,6 +287,12 @@ public class TIeInvigilateController {
             MqTagEnum mqTagEnum = null;
             if (Objects.equals(type, FinishTypeEnum.INTERRUPT)) {
                 mqTagEnum = MqTagEnum.OE_MONITOR_FINISH;
+                recordIdList.forEach(s -> {
+                    Integer breachStatus = Objects.nonNull(ExamRecordCacheUtil.getBreachStatus(Long.parseLong(s))) ? ExamRecordCacheUtil.getBreachStatus(Long.parseLong(s)) : 1;
+                    if (Objects.nonNull(breachStatus) && breachStatus.intValue() == 1) {
+                        throw new BusinessException("只有标记为违纪的考生才能强制交卷");
+                    }
+                });
             } else if (Objects.equals(type, FinishTypeEnum.BREACH)) {
                 mqTagEnum = MqTagEnum.OE_WARNING_FINISH;
             } else {
@@ -432,8 +438,8 @@ public class TIeInvigilateController {
                     ExamRecordCacheUtil.setBreachStatus(s.getExamRecordId(), 1, true);
                 });
             }
-            for(TEExamBreachLog eb:teExamBreachLogList){
-            	teExamBreachLogService.saveOrUpdate(eb);
+            for (TEExamBreachLog eb : teExamBreachLogList) {
+                teExamBreachLogService.saveOrUpdate(eb);
             }
         }
         return ResultUtil.ok(Collections.singletonMap("success", true));

+ 5 - 7
themis-business/src/main/java/com/qmth/themis/business/service/impl/WarningServiceImpl.java

@@ -73,7 +73,7 @@ public class WarningServiceImpl implements WarningService {
                     TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, warningEnum.getLevel().get(1), WarningLevelEnum.valueOf(warningEnum.getLevel().get(1)).getTitle(), warningEnum, photoUrl);
                     tIeInvigilateWarnInfoService.saveOrUpdate(tIeInvigilateWarnInfo);
                     this.setWarningCount(recordId);
-                    this.setPhotoUrls(map, photoUrl, tIeInvigilateWarnInfo, examStudentCacheBean, recordId);
+                    this.setPhotoUrls(map, tIeInvigilateWarnInfo, examStudentCacheBean, recordId);
                 }
             }
         } else if (faceCount <= 0) {//未检测到人脸
@@ -85,7 +85,7 @@ public class WarningServiceImpl implements WarningService {
                     TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, warningEnum.getLevel().get(0), WarningLevelEnum.valueOf(warningEnum.getLevel().get(0)).getTitle(), warningEnum, photoUrl);
                     tIeInvigilateWarnInfoService.saveOrUpdate(tIeInvigilateWarnInfo);
                     this.setWarningCount(recordId);
-                    this.setPhotoUrls(map, photoUrl, tIeInvigilateWarnInfo, examStudentCacheBean, recordId);
+                    this.setPhotoUrls(map, tIeInvigilateWarnInfo, examStudentCacheBean, recordId);
                 }
             }
         }
@@ -115,13 +115,13 @@ public class WarningServiceImpl implements WarningService {
                 TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, warningEnum.getLevel().get(0), WarningLevelEnum.valueOf(warningEnum.getLevel().get(0)).getTitle(), warningEnum, photoUrl);
                 tIeInvigilateWarnInfoService.saveOrUpdate(tIeInvigilateWarnInfo);
                 this.setWarningCount(recordId);
-                this.setPhotoUrls(map, photoUrl, tIeInvigilateWarnInfo, examStudentCacheBean, recordId);
+                this.setPhotoUrls(map, tIeInvigilateWarnInfo, examStudentCacheBean, recordId);
             }
             if (count >= teConfig.getTotalFaceCompareErrorCount()) {
                 TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, warningEnum.getLevel().get(1), WarningLevelEnum.valueOf(warningEnum.getLevel().get(1)).getTitle(), warningEnum, photoUrl);
                 tIeInvigilateWarnInfoService.saveOrUpdate(tIeInvigilateWarnInfo);
                 this.setWarningCount(recordId);
-                this.setPhotoUrls(map, photoUrl, tIeInvigilateWarnInfo, examStudentCacheBean, recordId);
+                this.setPhotoUrls(map, tIeInvigilateWarnInfo, examStudentCacheBean, recordId);
             }
         }
     }
@@ -192,18 +192,16 @@ public class WarningServiceImpl implements WarningService {
      * 设置图片集合
      *
      * @param map
-     * @param photoUrl
      * @param tIeInvigilateWarnInfo
      * @param examStudentCacheBean
      * @param recordId
      */
-    public void setPhotoUrls(Map<String, Object> map, String photoUrl, TIeInvigilateWarnInfo tIeInvigilateWarnInfo, ExamStudentCacheBean examStudentCacheBean, Long recordId) {
+    public void setPhotoUrls(Map<String, Object> map, TIeInvigilateWarnInfo tIeInvigilateWarnInfo, ExamStudentCacheBean examStudentCacheBean, Long recordId) {
         List<String> photoUrls = new ArrayList();
         if (Objects.nonNull(map.get("photoUrls")) && !Objects.equals(map.get("photoUrls"), "")) {
             String[] s = String.valueOf(map.get("photoUrls")).split(",");
             Collections.addAll(photoUrls, s);
         }
-        photoUrls.add(photoUrl);
         JSONObject jsonObject = new JSONObject();
         jsonObject.put("PHOTOS", photoUrls);
         jsonObject.put("MIN_CREATE_TIME", map.get("createTime"));

+ 26 - 7
themis-mq/src/main/java/com/qmth/themis/mq/service/impl/MqLogicServiceImpl.java

@@ -357,7 +357,10 @@ public class MqLogicServiceImpl implements MqLogicService {
                         if (count >= teConfig.getMultipleFaceCountError()) {
                             ExamRecordCacheUtil.setMultipleFaceCountErrorRandom(recordId, String.valueOf(UUID.randomUUID()).replaceAll("-", ""));
                             ExamRecordCacheUtil.setMultipleFaceCountErrorNum(recordId, 0);
-                            warningService.faceCountError(warningDto);
+                            Integer breachStatus = Objects.nonNull(ExamRecordCacheUtil.getBreachStatus(recordId)) ? ExamRecordCacheUtil.getBreachStatus(recordId) : 1;
+                            if (Objects.nonNull(breachStatus) && breachStatus.intValue() == 1) {
+                                warningService.faceCountError(warningDto);
+                            }
                         }
                     } else if (faceCount <= 0) {
                         String noFaceRandom = ExamRecordCacheUtil.getNoFaceCountErrorRandom(recordId);
@@ -372,7 +375,10 @@ public class MqLogicServiceImpl implements MqLogicService {
                         if (count >= teConfig.getNoFaceCountError()) {
                             ExamRecordCacheUtil.setNoFaceCountErrorRandom(recordId, String.valueOf(UUID.randomUUID()).replaceAll("-", ""));
                             ExamRecordCacheUtil.setNoFaceCountErrorNum(recordId, 0);
-                            warningService.faceCountError(warningDto);
+                            Integer breachStatus = Objects.nonNull(ExamRecordCacheUtil.getBreachStatus(recordId)) ? ExamRecordCacheUtil.getBreachStatus(recordId) : 1;
+                            if (Objects.nonNull(breachStatus) && breachStatus.intValue() == 1) {
+                                warningService.faceCountError(warningDto);
+                            }
                         }
                     }
                 } else if (Objects.equals(VerifyExceptionEnum.FACE_COMPARE_ERROR, warningEnum)) {//人脸比对异常
@@ -388,11 +394,15 @@ public class MqLogicServiceImpl implements MqLogicService {
                     if (count >= teConfig.getTotalFaceCompareErrorCount()) {
                         ExamRecordCacheUtil.setFaceCompareErrorRandom(recordId, String.valueOf(UUID.randomUUID()).replaceAll("-", ""));
                         ExamRecordCacheUtil.setFaceCompareErrorNum(recordId, 0);
-                        warningService.faceCountError(warningDto);
+                        Integer breachStatus = Objects.nonNull(ExamRecordCacheUtil.getBreachStatus(recordId)) ? ExamRecordCacheUtil.getBreachStatus(recordId) : 1;
+                        if (Objects.nonNull(breachStatus) && breachStatus.intValue() == 1) {
+                            warningService.faceCompareError(warningDto);
+                        }
                     }
                 } else {
                     faceVerifyHistoryService.save(id, recordId, type, photoUrl, faceCount, similarity, realness, time, exception, null);
-                    if (realness.intValue() == 0) {//真实性异常
+                    Integer breachStatus = Objects.nonNull(ExamRecordCacheUtil.getBreachStatus(recordId)) ? ExamRecordCacheUtil.getBreachStatus(recordId) : 1;
+                    if (realness.intValue() == 0 && Objects.nonNull(breachStatus) && breachStatus.intValue() == 1) {//真实性异常
                         warningService.realnessError(warningDto);
                     }
                 }
@@ -472,7 +482,10 @@ public class MqLogicServiceImpl implements MqLogicService {
                             if (count >= teConfig.getMultipleFaceCountError()) {
                                 ExamRecordCacheUtil.setMultipleFaceCountErrorRandom(recordId, String.valueOf(UUID.randomUUID()).replaceAll("-", ""));
                                 ExamRecordCacheUtil.setMultipleFaceCountErrorNum(recordId, 0);
-                                warningService.faceCountError(warningDto);
+                                Integer breachStatus = Objects.nonNull(ExamRecordCacheUtil.getBreachStatus(recordId)) ? ExamRecordCacheUtil.getBreachStatus(recordId) : 1;
+                                if (Objects.nonNull(breachStatus) && breachStatus.intValue() == 1) {
+                                    warningService.faceCountError(warningDto);
+                                }
                             }
                         } else if (faceCount <= 0) {
                             String noFaceRandom = ExamRecordCacheUtil.getNoFaceCountErrorRandom(recordId);
@@ -487,7 +500,10 @@ public class MqLogicServiceImpl implements MqLogicService {
                             if (count >= teConfig.getNoFaceCountError()) {
                                 ExamRecordCacheUtil.setNoFaceCountErrorRandom(recordId, String.valueOf(UUID.randomUUID()).replaceAll("-", ""));
                                 ExamRecordCacheUtil.setNoFaceCountErrorNum(recordId, 0);
-                                warningService.faceCountError(warningDto);
+                                Integer breachStatus = Objects.nonNull(ExamRecordCacheUtil.getBreachStatus(recordId)) ? ExamRecordCacheUtil.getBreachStatus(recordId) : 1;
+                                if (Objects.nonNull(breachStatus) && breachStatus.intValue() == 1) {
+                                    warningService.faceCountError(warningDto);
+                                }
                             }
                         }
                     } else if (Objects.equals(VerifyExceptionEnum.FACE_COMPARE_ERROR, warningEnum)) {//人脸比对异常
@@ -504,7 +520,10 @@ public class MqLogicServiceImpl implements MqLogicService {
                         if (count >= teConfig.getTotalFaceCompareErrorCount()) {
                             ExamRecordCacheUtil.setFaceCompareErrorRandom(recordId, String.valueOf(UUID.randomUUID()).replaceAll("-", ""));
                             ExamRecordCacheUtil.setFaceCompareErrorNum(recordId, 0);
-                            warningService.faceCountError(warningDto);
+                            Integer breachStatus = Objects.nonNull(ExamRecordCacheUtil.getBreachStatus(recordId)) ? ExamRecordCacheUtil.getBreachStatus(recordId) : 1;
+                            if (Objects.nonNull(breachStatus) && breachStatus.intValue() == 1) {
+                                warningService.faceCompareError(warningDto);
+                            }
                         }
                     }
                 }