|
@@ -290,13 +290,22 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
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);
|
|
|
- if (Objects.equals(VerifyExceptionEnum.FACE_COUNT_ERROR, warningEnum)) {//人脸数量异常
|
|
|
- warningService.faceCountError(warningDto);
|
|
|
- } else if (Objects.equals(VerifyExceptionEnum.FACE_COMPARE_ERROR, warningEnum)) {//人脸比对异常
|
|
|
- warningService.faceCompareError(warningDto);
|
|
|
+ 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);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
mqDto.setAck(SystemConstant.STANDARD_ACK_TYPE);
|
|
@@ -328,10 +337,19 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
livenessVerifyHistoryService.save(id, recordId, type, actions, retry, startTime, finishTime, exception);
|
|
|
VerifyExceptionEnum warningEnum = VerifyExceptionEnum.valueOf(exception);
|
|
|
JSONObject jsonObject = JSONObject.parseObject(actions);
|
|
|
- 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"))));
|
|
|
+ Long examStudentId = ExamRecordCacheUtil.getExamStudentId(recordId);
|
|
|
+ ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
|
|
|
+ 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);
|
|
@@ -454,46 +472,33 @@ public class MqLogicServiceImpl implements MqLogicService {
|
|
|
Long l = ((System.currentTimeMillis() - clientLastSyncTime.getTime()) / 1000);
|
|
|
diff = l.intValue();
|
|
|
}
|
|
|
-
|
|
|
Long examStudentId = ExamRecordCacheUtil.getExamStudentId(recordId);
|
|
|
ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
|
|
|
- Integer leftBreakResumeCount = Objects.isNull(ExamRecordCacheUtil.getLeftBreakResumeCount(recordId)) ? 0 : ExamRecordCacheUtil.getLeftBreakResumeCount(recordId);
|
|
|
- leftBreakResumeCount--;
|
|
|
- leftBreakResumeCount = leftBreakResumeCount <= 0 ? 0 : leftBreakResumeCount;
|
|
|
- if (leftBreakResumeCount <= 0) {
|
|
|
- Integer durationSeconds = Objects.isNull(ExamRecordCacheUtil.getDurationSeconds(recordId)) ? 0 : ExamRecordCacheUtil.getDurationSeconds(recordId);
|
|
|
- teExamService.finish(examStudentCacheBean.getStudentId(), recordId, FinishTypeEnum.AUTO.name(), durationSeconds);
|
|
|
- } else {
|
|
|
- //先查询之前的断点记录
|
|
|
- QueryWrapper<TOeExamBreakHistory> tOeExamBreakHistoryQueryWrapper = new QueryWrapper<>();
|
|
|
- tOeExamBreakHistoryQueryWrapper.lambda().eq(TOeExamBreakHistory::getExamRecordId, recordId);
|
|
|
- List<TOeExamBreakHistory> tOeExamBreakHistoryList = tOeExamBreakHistoryService.list(tOeExamBreakHistoryQueryWrapper);
|
|
|
- //删除历史断点缓存
|
|
|
- if (Objects.nonNull(tOeExamBreakHistoryList) && tOeExamBreakHistoryList.size() > 0) {
|
|
|
- tOeExamBreakHistoryList.forEach(s -> {
|
|
|
- redisUtil.delete(RedisKeyHelper.examBreakCacheKey(s.getId()));
|
|
|
- });
|
|
|
- }
|
|
|
- //增加断点记录
|
|
|
- TOeExamBreakHistory tOeExamBreakHistory = new TOeExamBreakHistory(recordId, new Date(), exceptionEnum, exceptionEnum.name());
|
|
|
- tOeExamBreakHistoryService.save(tOeExamBreakHistory);
|
|
|
- redisUtil.setForHash(RedisKeyHelper.examBreakCacheKey(tOeExamBreakHistory.getId()), SimpleBeanUtil.objectToMap(tOeExamBreakHistory));
|
|
|
-
|
|
|
- ExamRecordCacheUtil.setLastBreakId(recordId, tOeExamBreakHistory.getId());
|
|
|
- ExamRecordCacheUtil.setStatus(recordId, ExamRecordStatusEnum.RESUME_PREPARE);
|
|
|
- ExamRecordCacheUtil.setLastBreakTime(recordId);
|
|
|
- ExamRecordCacheUtil.setLeftBreakResumeCount(recordId, leftBreakResumeCount);
|
|
|
- ExamRecordCacheUtil.setLastStartTime(recordId);
|
|
|
- UpdateWrapper<TOeExamRecord> tOeExamRecordUpdateWrapper = new UpdateWrapper<>();
|
|
|
- tOeExamRecordUpdateWrapper.lambda().set(TOeExamRecord::getLastBreakId, tOeExamBreakHistory.getId())
|
|
|
- .set(TOeExamRecord::getStatus, ExamRecordStatusEnum.RESUME_PREPARE)
|
|
|
- .set(TOeExamRecord::getLastBreakTime, ExamRecordCacheUtil.getLastBreakTime(recordId))
|
|
|
- .set(TOeExamRecord::getLeftBreakResumeCount, leftBreakResumeCount)
|
|
|
- .set(TOeExamRecord::getLastStartTime, ExamRecordCacheUtil.getLastStartTime(recordId))
|
|
|
- .eq(TOeExamRecord::getId, recordId);
|
|
|
- examRecordService.update(tOeExamRecordUpdateWrapper);
|
|
|
- teExamStudentLogService.saveStudentLogInfo(SystemOperationEnum.RESUME_PREPARE.name(), SystemOperationEnum.RESUME_PREPARE.getCode(), SystemOperationEnum.RESUME_PREPARE.getCode(), examStudentCacheBean.getStudentId(), examStudentId, recordId);
|
|
|
+
|
|
|
+ //先查询之前的断点记录
|
|
|
+ QueryWrapper<TOeExamBreakHistory> tOeExamBreakHistoryQueryWrapper = new QueryWrapper<>();
|
|
|
+ tOeExamBreakHistoryQueryWrapper.lambda().eq(TOeExamBreakHistory::getExamRecordId, recordId);
|
|
|
+ List<TOeExamBreakHistory> tOeExamBreakHistoryList = tOeExamBreakHistoryService.list(tOeExamBreakHistoryQueryWrapper);
|
|
|
+ //删除历史断点缓存
|
|
|
+ if (Objects.nonNull(tOeExamBreakHistoryList) && tOeExamBreakHistoryList.size() > 0) {
|
|
|
+ tOeExamBreakHistoryList.forEach(s -> {
|
|
|
+ redisUtil.delete(RedisKeyHelper.examBreakCacheKey(s.getId()));
|
|
|
+ });
|
|
|
}
|
|
|
+ //增加断点记录
|
|
|
+ TOeExamBreakHistory tOeExamBreakHistory = new TOeExamBreakHistory(ExamRecordCacheUtil.getLastBreakId(recordId), recordId, new Date(), exceptionEnum, exceptionEnum.name());
|
|
|
+ tOeExamBreakHistoryService.save(tOeExamBreakHistory);
|
|
|
+ redisUtil.setForHash(RedisKeyHelper.examBreakCacheKey(tOeExamBreakHistory.getId()), SimpleBeanUtil.objectToMap(tOeExamBreakHistory));
|
|
|
+
|
|
|
+ UpdateWrapper<TOeExamRecord> tOeExamRecordUpdateWrapper = new UpdateWrapper<>();
|
|
|
+ tOeExamRecordUpdateWrapper.lambda().set(TOeExamRecord::getLastBreakId, tOeExamBreakHistory.getId())
|
|
|
+ .set(TOeExamRecord::getStatus, ExamRecordStatusEnum.RESUME_PREPARE)
|
|
|
+ .set(TOeExamRecord::getLastBreakTime, ExamRecordCacheUtil.getLastBreakTime(recordId))
|
|
|
+ .set(TOeExamRecord::getLeftBreakResumeCount, ExamRecordCacheUtil.getLeftBreakResumeCount(recordId))
|
|
|
+ .set(TOeExamRecord::getLastStartTime, ExamRecordCacheUtil.getLastStartTime(recordId))
|
|
|
+ .eq(TOeExamRecord::getId, recordId);
|
|
|
+ examRecordService.update(tOeExamRecordUpdateWrapper);
|
|
|
+ teExamStudentLogService.saveStudentLogInfo(SystemOperationEnum.RESUME_PREPARE.name(), SystemOperationEnum.RESUME_PREPARE.getCode(), SystemOperationEnum.RESUME_PREPARE.getCode(), examStudentCacheBean.getStudentId(), examStudentId, recordId);
|
|
|
|
|
|
//增加异常日志
|
|
|
Long examId = ExamRecordCacheUtil.getExamId(recordId);
|