|
@@ -199,7 +199,7 @@ public class ExamCaptureServiceImpl implements ExamCaptureService {
|
|
|
if (faceCompareResult.containsKey("confidence")) {
|
|
|
examCaptureQueue.setPass(calculateFaceCompareIsPass(faceCompareResult));
|
|
|
examCaptureQueue.setStranger(calculateFaceCompareIsStranger(examCaptureQueue.getExamRecordDataId(),
|
|
|
- examCaptureQueue.getStudentId(),faceCompareResult));
|
|
|
+ examCaptureQueue.getStudentId(), faceCompareResult));
|
|
|
//更新队列状态为face++比对完成
|
|
|
examCaptureQueue.setStatus(ExamCaptureQueueStatus.PROCESS_FACE_COMPARE_COMPLETE);
|
|
|
disposeFaceCompareSuccessful(examCaptureQueue);
|
|
@@ -368,7 +368,7 @@ public class ExamCaptureServiceImpl implements ExamCaptureService {
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public void saveExamCaptureSyncCompareResult(Long studentId,Long examRecordDataId) {
|
|
|
+ public void saveExamCaptureSyncCompareResult(Long studentId, Long examRecordDataId) {
|
|
|
String syncCopareResultkey = Constants.FACE_SYNC_COMPARE_RESULT_PREFIX + studentId;
|
|
|
CompareFaceSyncInfo compareFaceSyncInfo =
|
|
|
redisClient.get(syncCopareResultkey, CompareFaceSyncInfo.class);
|
|
@@ -478,7 +478,7 @@ public class ExamCaptureServiceImpl implements ExamCaptureService {
|
|
|
errMsg.contains(Constants.FACE_COMPARE_AUTHORIZATION_ERROR)) {
|
|
|
compareFaceSyncInfo.setExistsSystemError(true);
|
|
|
}
|
|
|
- compareFaceSyncInfo.setErrorMsg(facePPResult.toString());
|
|
|
+ compareFaceSyncInfo.setErrorMsg("facePP called failed : " + facePPResult.toString());
|
|
|
return compareFaceSyncInfo;
|
|
|
} else {
|
|
|
compareFaceSyncInfo.setFaceCompareResult(facePPResult.toString());
|
|
@@ -487,12 +487,22 @@ public class ExamCaptureServiceImpl implements ExamCaptureService {
|
|
|
JSONObject thresholdsJsonObject = facePPResult.getJSONObject("thresholds");
|
|
|
double le4 = thresholdsJsonObject.getDouble("1e-4");
|
|
|
JSONArray face2Array = facePPResult.getJSONArray("faces2");
|
|
|
- compareFaceSyncInfo.setIsStranger(face2Array.size() > 1);//是否有陌生人
|
|
|
- compareFaceSyncInfo.setIsPass(confidence >= le4);//是否通过
|
|
|
- compareFaceSyncInfo.setErrorMsg(confidence >= le4 ? null : "confidence<le4");
|
|
|
+ boolean hasStranger = face2Array.size() > 1;
|
|
|
+ compareFaceSyncInfo.setIsStranger(hasStranger);//是否有陌生人
|
|
|
+ boolean isPass = confidence >= le4;
|
|
|
+ compareFaceSyncInfo.setIsPass(isPass);//是否通过
|
|
|
+ String errorMsg = null;
|
|
|
+ if (hasStranger && !isPass) {
|
|
|
+ errorMsg = "检测过程中相片非本人,且存在多人脸";
|
|
|
+ } else if (hasStranger) {
|
|
|
+ errorMsg = "检测过程中多人脸失败";
|
|
|
+ } else if (isPass) {
|
|
|
+ errorMsg = "检测过程中相片非本人";
|
|
|
+ }
|
|
|
+ compareFaceSyncInfo.setErrorMsg(errorMsg);
|
|
|
} else {
|
|
|
compareFaceSyncInfo.setIsPass(false);
|
|
|
- compareFaceSyncInfo.setErrorMsg(facePPResult.toString());
|
|
|
+ compareFaceSyncInfo.setErrorMsg("未检测到人脸");
|
|
|
}
|
|
|
return compareFaceSyncInfo;
|
|
|
}
|
|
@@ -536,7 +546,7 @@ public class ExamCaptureServiceImpl implements ExamCaptureService {
|
|
|
* @return
|
|
|
* @throws JSONException
|
|
|
*/
|
|
|
- private boolean calculateFaceCompareIsStranger(Long examRecordDataId,Long studentId, JSONObject jsonObject) {
|
|
|
+ private boolean calculateFaceCompareIsStranger(Long examRecordDataId, Long studentId, JSONObject jsonObject) {
|
|
|
JSONArray face2Array = jsonObject.getJSONArray("faces2");
|
|
|
//添加是否有陌生人开关功能
|
|
|
ExamRecordPropertyCacheBean examRecordPropertyCache = CacheHelper.getExamRecordProperty(examRecordDataId);
|