|
@@ -24,6 +24,8 @@ import cn.com.qmth.examcloud.support.helper.FaceBiopsyHelper;
|
|
import cn.com.qmth.examcloud.web.baidu.BaiduClient;
|
|
import cn.com.qmth.examcloud.web.baidu.BaiduClient;
|
|
import cn.com.qmth.examcloud.web.bootstrap.PropertyHolder;
|
|
import cn.com.qmth.examcloud.web.bootstrap.PropertyHolder;
|
|
import cn.com.qmth.examcloud.web.facepp.FaceppClient;
|
|
import cn.com.qmth.examcloud.web.facepp.FaceppClient;
|
|
|
|
+import cn.com.qmth.examcloud.web.filestorage.FileStorage;
|
|
|
|
+import cn.com.qmth.examcloud.web.filestorage.FileStorageUtil;
|
|
import cn.com.qmth.examcloud.web.redis.RedisClient;
|
|
import cn.com.qmth.examcloud.web.redis.RedisClient;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -38,6 +40,7 @@ import org.springframework.data.domain.Example;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
+import java.io.File;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -98,18 +101,13 @@ public class ExamCaptureServiceImpl implements ExamCaptureService {
|
|
captureLog.debug("[DISPOSE_FACE_COMPARE] face++人脸比对开始...");
|
|
captureLog.debug("[DISPOSE_FACE_COMPARE] face++人脸比对开始...");
|
|
|
|
|
|
//调用face++API执行人脸比对,得到返回结果
|
|
//调用face++API执行人脸比对,得到返回结果
|
|
- String backup = PropertyHolder.getString("$upyun.site.1.domain.backup");
|
|
|
|
- String main = PropertyHolder.getString("$upyun.site.1.domain");
|
|
|
|
JsonHttpResponseHolder jsonHttpResponseHolder = null;
|
|
JsonHttpResponseHolder jsonHttpResponseHolder = null;
|
|
try {
|
|
try {
|
|
jsonHttpResponseHolder = FaceppClient.getClient().
|
|
jsonHttpResponseHolder = FaceppClient.getClient().
|
|
compareWithTokenAndImageUrl(examCaptureQueue.getBaseFaceToken(),
|
|
compareWithTokenAndImageUrl(examCaptureQueue.getBaseFaceToken(),
|
|
- examCaptureQueue.getFileUrl(), examCaptureQueue.getFileUrl().replace(main, backup));
|
|
|
|
- /*//test code
|
|
|
|
- jsonHttpResponseHolder =new JsonHttpResponseHolder();
|
|
|
|
- jsonHttpResponseHolder.setStatusCode(200);
|
|
|
|
- jsonHttpResponseHolder.setRespBody(JSONObject.parseObject("{\"error_message\":\"API_NOT_FOUND\"}"));
|
|
|
|
-*/
|
|
|
|
|
|
+ FileStorageUtil.realPath(examCaptureQueue.getFileUrl()),
|
|
|
|
+ FileStorageUtil.realPathBackup(examCaptureQueue.getFileUrl()));
|
|
|
|
+
|
|
faceCompareResult = jsonHttpResponseHolder.getRespBody();
|
|
faceCompareResult = jsonHttpResponseHolder.getRespBody();
|
|
|
|
|
|
} catch (StatusException e) {
|
|
} catch (StatusException e) {
|
|
@@ -245,12 +243,11 @@ public class ExamCaptureServiceImpl implements ExamCaptureService {
|
|
captureLog.debug("[DISPOSE_BAIDUFACELIVENESS] 百度活体检测开始...");
|
|
captureLog.debug("[DISPOSE_BAIDUFACELIVENESS] 百度活体检测开始...");
|
|
|
|
|
|
//获取百度活检结果
|
|
//获取百度活检结果
|
|
- String backup = PropertyHolder.getString("$upyun.site.1.domain.backup");
|
|
|
|
- String main = PropertyHolder.getString("$upyun.site.1.domain");
|
|
|
|
JsonHttpResponseHolder jsonHttpResponseHolder = null;
|
|
JsonHttpResponseHolder jsonHttpResponseHolder = null;
|
|
try {
|
|
try {
|
|
- jsonHttpResponseHolder = BaiduClient.getClient().verifyFaceLiveness(examCaptureQueue.getFileUrl(),
|
|
|
|
- examCaptureQueue.getFileUrl().replace(main, backup));
|
|
|
|
|
|
+ jsonHttpResponseHolder = BaiduClient.getClient().
|
|
|
|
+ verifyFaceLiveness(FileStorageUtil.realPath(examCaptureQueue.getFileUrl()),
|
|
|
|
+ FileStorageUtil.realPathBackup(examCaptureQueue.getFileUrl()));
|
|
faceLivenessResultJson = jsonHttpResponseHolder.getRespBody();
|
|
faceLivenessResultJson = jsonHttpResponseHolder.getRespBody();
|
|
} catch (StatusException e) {
|
|
} catch (StatusException e) {
|
|
//如果错误码是901,902,903直接结束,不重试
|
|
//如果错误码是901,902,903直接结束,不重试
|
|
@@ -365,11 +362,10 @@ public class ExamCaptureServiceImpl implements ExamCaptureService {
|
|
JSONObject facePPResult = null;
|
|
JSONObject facePPResult = null;
|
|
JsonHttpResponseHolder jsonHttpResponseHolder = null;
|
|
JsonHttpResponseHolder jsonHttpResponseHolder = null;
|
|
try {
|
|
try {
|
|
- String backup = PropertyHolder.getString("$upyun.site.1.domain.backup");
|
|
|
|
- String main = PropertyHolder.getString("$upyun.site.1.domain");
|
|
|
|
jsonHttpResponseHolder = FaceppClient.getClient().
|
|
jsonHttpResponseHolder = FaceppClient.getClient().
|
|
compareWithTokenAndImageUrl(baseFaceToken,
|
|
compareWithTokenAndImageUrl(baseFaceToken,
|
|
- fileUrl, fileUrl.replace(main, backup));
|
|
|
|
|
|
+ FileStorageUtil.realPath(fileUrl),
|
|
|
|
+ FileStorageUtil.realPathBackup(fileUrl));
|
|
facePPResult = jsonHttpResponseHolder.getRespBody();
|
|
facePPResult = jsonHttpResponseHolder.getRespBody();
|
|
} catch (StatusException e) {
|
|
} catch (StatusException e) {
|
|
//如果错误码是801,802,803直接结束,不重试
|
|
//如果错误码是801,802,803直接结束,不重试
|