Jelajahi Sumber

Merge branch 'dev' into release
1

wangliang 4 tahun lalu
induk
melakukan
f03ce9a0f1

+ 39 - 34
themis-mq/src/main/java/com/qmth/themis/mq/service/impl/MqLogicServiceImpl.java

@@ -335,23 +335,25 @@ public class MqLogicServiceImpl implements MqLogicService {
         Long time = (Long) param.get("time");
         String exception = (String) param.get("exception");
         faceVerifyHistoryService.save(id, recordId, type, photoUrl, faceCount, similarity, realness, time, exception);
-        VerifyExceptionEnum warningEnum = VerifyExceptionEnum.valueOf(exception);
-        WarningDto warningDto = new WarningDto(warningEnum, faceCount, realness, recordId, photoUrl);
-        Long examStudentId = ExamRecordCacheUtil.getExamStudentId(recordId);
-        ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
-        if (Objects.equals(VerifyExceptionEnum.NONE, warningEnum)) {//无异常,往考生日志表里插一条
-            JSONObject jsonObject = new JSONObject();
-            jsonObject.put(PhotoTypeEnum.FACE_VERIFY_PHOTO.name(), photoUrl);
-            TEExamStudentLog teExamStudentLog = new TEExamStudentLog(type, ExamTypeEnum.valueOf(type).getCode(), jsonObject.toJSONString(), examStudentCacheBean.getStudentId(), examStudentCacheBean.getId(), recordId);
-            teExamStudentLogService.saveOrUpdate(teExamStudentLog);
-        } else {
-            if (Objects.equals(VerifyExceptionEnum.FACE_COUNT_ERROR, warningEnum)) {//人脸数量异常
-                warningService.faceCountError(warningDto);
-            } else if (Objects.equals(VerifyExceptionEnum.FACE_COMPARE_ERROR, warningEnum)) {//人脸比对异常
-                warningService.faceCompareError(warningDto);
+        if (Objects.equals(type.toUpperCase(), ExamTypeEnum.IN_PROCESS.name())) {
+            VerifyExceptionEnum warningEnum = VerifyExceptionEnum.valueOf(exception);
+            WarningDto warningDto = new WarningDto(warningEnum, faceCount, realness, recordId, photoUrl);
+            Long examStudentId = ExamRecordCacheUtil.getExamStudentId(recordId);
+            ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
+            if (Objects.equals(VerifyExceptionEnum.NONE, warningEnum)) {//无异常,往考生日志表里插一条
+                JSONObject jsonObject = new JSONObject();
+                jsonObject.put(PhotoTypeEnum.FACE_VERIFY_PHOTO.name(), photoUrl);
+                TEExamStudentLog teExamStudentLog = new TEExamStudentLog(type, ExamTypeEnum.valueOf(type).getCode(), jsonObject.toJSONString(), examStudentCacheBean.getStudentId(), examStudentCacheBean.getId(), recordId);
+                teExamStudentLogService.saveOrUpdate(teExamStudentLog);
             } else {
-                if (realness.intValue() == 0) {//真实性异常
-                    warningService.realnessError(warningDto);
+                if (Objects.equals(VerifyExceptionEnum.FACE_COUNT_ERROR, warningEnum)) {//人脸数量异常
+                    warningService.faceCountError(warningDto);
+                } else if (Objects.equals(VerifyExceptionEnum.FACE_COMPARE_ERROR, warningEnum)) {//人脸比对异常
+                    warningService.faceCompareError(warningDto);
+                } else {
+                    if (realness.intValue() == 0) {//真实性异常
+                        warningService.realnessError(warningDto);
+                    }
                 }
             }
         }
@@ -382,24 +384,27 @@ public class MqLogicServiceImpl implements MqLogicService {
         Long finishTime = (Long) param.get("finishTime");
         String exception = (String) param.get("exception");
         livenessVerifyHistoryService.save(id, recordId, type, actions, retry, startTime, finishTime, exception);
-        VerifyExceptionEnum warningEnum = VerifyExceptionEnum.valueOf(exception);
-        JSONArray jsonArray = JSONArray.parseArray(actions);
-        Long examStudentId = ExamRecordCacheUtil.getExamStudentId(recordId);
-        ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
-        for (int i = 0; i < jsonArray.size(); i++) {
-            JSONObject jsonObject = jsonArray.getJSONObject(i);
-            if (Objects.equals(VerifyExceptionEnum.NONE, warningEnum)) {//无异常,往考生日志表里插一条
-                JSONObject object = new JSONObject();
-                object.put(PhotoTypeEnum.LIVENESS_VERIFY_PHOTO.name(), String.valueOf(jsonObject.get("photoUrl")));
-                TEExamStudentLog teExamStudentLog = new TEExamStudentLog(type, LivenessTypeEnum.valueOf(type).getTitle(), object.toJSONString(), examStudentCacheBean.getStudentId(), examStudentCacheBean.getId(), recordId);
-                teExamStudentLogService.saveOrUpdate(teExamStudentLog);
-            } else {
-                if (Objects.equals(VerifyExceptionEnum.FACE_COUNT_ERROR, warningEnum)) {//人脸数量异常
-                    warningService.faceCountError(new WarningDto(warningEnum, Integer.parseInt(String.valueOf(jsonObject.get("faceCount"))), null, recordId, String.valueOf(jsonObject.get("photoUrl"))));
-                } else if (Objects.equals(VerifyExceptionEnum.FACE_COMPARE_ERROR, warningEnum)) {//人脸比对异常
-                    warningService.faceCompareError(new WarningDto(warningEnum, null, null, recordId, String.valueOf(jsonObject.get("photoUrl")))); }
-            }
-        }
+//        if (Objects.equals(type.toUpperCase(), ExamTypeEnum.IN_PROCESS.name())) {
+//            VerifyExceptionEnum warningEnum = VerifyExceptionEnum.valueOf(exception);
+//            JSONArray jsonArray = JSONArray.parseArray(actions);
+//            Long examStudentId = ExamRecordCacheUtil.getExamStudentId(recordId);
+//            ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
+//            for (int i = 0; i < jsonArray.size(); i++) {
+//                JSONObject jsonObject = jsonArray.getJSONObject(i);
+//                if (Objects.equals(VerifyExceptionEnum.NONE, warningEnum)) {//无异常,往考生日志表里插一条
+//                    JSONObject object = new JSONObject();
+//                    object.put(PhotoTypeEnum.LIVENESS_VERIFY_PHOTO.name(), String.valueOf(jsonObject.get("photoUrl")));
+//                    TEExamStudentLog teExamStudentLog = new TEExamStudentLog(type, LivenessTypeEnum.valueOf(type).getTitle(), object.toJSONString(), examStudentCacheBean.getStudentId(), examStudentCacheBean.getId(), recordId);
+//                    teExamStudentLogService.saveOrUpdate(teExamStudentLog);
+//                } else {
+//                    if (Objects.equals(VerifyExceptionEnum.FACE_COUNT_ERROR, warningEnum)) {//人脸数量异常
+//                        warningService.faceCountError(new WarningDto(warningEnum, Integer.parseInt(String.valueOf(jsonObject.get("faceCount"))), null, recordId, String.valueOf(jsonObject.get("photoUrl"))));
+//                    } else if (Objects.equals(VerifyExceptionEnum.FACE_COMPARE_ERROR, warningEnum)) {//人脸比对异常
+//                        warningService.faceCompareError(new WarningDto(warningEnum, null, null, recordId, String.valueOf(jsonObject.get("photoUrl"))));
+//                    }
+//                }
+//            }
+//        }
         mqDto.setAck(SystemConstant.STANDARD_ACK_TYPE);
         TMRocketMessage tmRocketMessage = gson.fromJson(gson.toJson(mqDto), TMRocketMessage.class);
         tmRocketMessage.setBody(JacksonUtil.parseJson(tmRocketMessage.getBody()));