|
@@ -87,16 +87,15 @@ public class ExamCaptureController extends ControllerSupport {
|
|
fileUrl = UrlUtil.decode(fileUrl);
|
|
fileUrl = UrlUtil.decode(fileUrl);
|
|
|
|
|
|
if (this.isFaceApiLimitSeconds(user.getKey())) {
|
|
if (this.isFaceApiLimitSeconds(user.getKey())) {
|
|
- log.error("compareFaceSync outOfLimitSeconds...");
|
|
|
|
|
|
+ log.warn("compareFaceSync outOfLimitSeconds... studentId:{}", user.getUserId());
|
|
throw new StatusException("500503", "人脸验证太频繁,请稍后重试!");
|
|
throw new StatusException("500503", "人脸验证太频繁,请稍后重试!");
|
|
}
|
|
}
|
|
if (this.isFaceApiLimitMinutes(user.getKey())) {
|
|
if (this.isFaceApiLimitMinutes(user.getKey())) {
|
|
- log.error("compareFaceSync outOfLimitMinutes...");
|
|
|
|
|
|
+ log.warn("compareFaceSync outOfLimitMinutes... studentId:{}", user.getUserId());
|
|
throw new StatusException("500503", "人脸验证太频繁,请10分钟后重试!");
|
|
throw new StatusException("500503", "人脸验证太频繁,请10分钟后重试!");
|
|
}
|
|
}
|
|
|
|
|
|
CompareFaceSyncInfo compareFaceSyncInfo = examCaptureService.compareFaceSync(studentCache, fileUrl);
|
|
CompareFaceSyncInfo compareFaceSyncInfo = examCaptureService.compareFaceSync(studentCache, fileUrl);
|
|
- // CompareFaceSyncInfo compareFaceSyncInfo = examCaptureService.compareFaceSyncByFileUrl(user.getUserId(), baseFaceToken, fileUrl);
|
|
|
|
// log.warn("compareFaceSyncResult isPass = {}, fileUrl = {}, errorMsg = {}", compareFaceSyncInfo.getIsPass(), fileUrl, compareFaceSyncInfo.getErrorMsg());
|
|
// log.warn("compareFaceSyncResult isPass = {}, fileUrl = {}, errorMsg = {}", compareFaceSyncInfo.getIsPass(), fileUrl, compareFaceSyncInfo.getErrorMsg());
|
|
|
|
|
|
//将人脸同步比较的结果临时存储到redis中.开考后会清除
|
|
//将人脸同步比较的结果临时存储到redis中.开考后会清除
|
|
@@ -105,7 +104,8 @@ public class ExamCaptureController extends ControllerSupport {
|
|
compareFaceSyncInfo.setFileUrl(fileUrl);
|
|
compareFaceSyncInfo.setFileUrl(fileUrl);
|
|
compareFaceSyncInfo.setProcessTime(System.currentTimeMillis() - startTime);
|
|
compareFaceSyncInfo.setProcessTime(System.currentTimeMillis() - startTime);
|
|
|
|
|
|
- redisClient.set(CacheConstants.CACHE_OE_SYNC_FACE_COMPARE_RESULT + user.getUserId(), compareFaceSyncInfo, OeConstants.TIME_OUT_5_MINUTE);
|
|
|
|
|
|
+ String cacheKey = CacheConstants.CACHE_OE_SYNC_FACE_COMPARE_RESULT + user.getUserId();
|
|
|
|
+ redisClient.set(cacheKey, compareFaceSyncInfo, OeConstants.TIME_OUT_5_MINUTE);
|
|
return compareFaceSyncInfo;
|
|
return compareFaceSyncInfo;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -183,7 +183,7 @@ public class ExamCaptureController extends ControllerSupport {
|
|
|
|
|
|
@ApiOperation(value = "保存考试抓拍照片队列")
|
|
@ApiOperation(value = "保存考试抓拍照片队列")
|
|
@PostMapping("/uploadExamCapture")
|
|
@PostMapping("/uploadExamCapture")
|
|
- public String uploadExamCapture(@RequestBody SaveExamCaptureQueueInfo saveExamCaptureQueueInfo) {
|
|
|
|
|
|
+ public String uploadExamCapture(@RequestBody SaveExamCaptureQueueInfo req) {
|
|
User user = getAccessUser();
|
|
User user = getAccessUser();
|
|
|
|
|
|
ExamingSession examingSession = examingSessionService.getExamingSession(user.getUserId());
|
|
ExamingSession examingSession = examingSessionService.getExamingSession(user.getUserId());
|
|
@@ -193,43 +193,44 @@ public class ExamCaptureController extends ControllerSupport {
|
|
}
|
|
}
|
|
|
|
|
|
//参数校验
|
|
//参数校验
|
|
- if (saveExamCaptureQueueInfo == null) {
|
|
|
|
- throw new StatusException("301001", "对象不能为空");
|
|
|
|
|
|
+ if (req == null) {
|
|
|
|
+ throw new StatusException("301001", "抓拍内容不能为空");
|
|
}
|
|
}
|
|
|
|
|
|
- Long examRecordDataId = saveExamCaptureQueueInfo.getExamRecordDataId();
|
|
|
|
|
|
+ Long examRecordDataId = req.getExamRecordDataId();
|
|
if (null == examRecordDataId) {
|
|
if (null == examRecordDataId) {
|
|
throw new StatusException("301002", "examRecordDataId不能为空");
|
|
throw new StatusException("301002", "examRecordDataId不能为空");
|
|
}
|
|
}
|
|
|
|
|
|
ExamRecordData examRecordData = examRecordDataService.getExamRecordDataCache(examRecordDataId);
|
|
ExamRecordData examRecordData = examRecordDataService.getExamRecordDataCache(examRecordDataId);
|
|
if (null == examRecordData) {
|
|
if (null == examRecordData) {
|
|
- throw new StatusException("301004", "无效的考试记录id");
|
|
|
|
|
|
+ throw new StatusException("301004", "无效的考试记录");
|
|
}
|
|
}
|
|
|
|
+
|
|
//非考试中不允许上传图片
|
|
//非考试中不允许上传图片
|
|
if (ExamRecordStatus.EXAM_ING != examRecordData.getExamRecordStatus()) {
|
|
if (ExamRecordStatus.EXAM_ING != examRecordData.getExamRecordStatus()) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
- if (StringUtils.isBlank(saveExamCaptureQueueInfo.getFileUrl())) {
|
|
|
|
|
|
+ if (StringUtils.isBlank(req.getFileUrl())) {
|
|
throw new StatusException("301005", "fileUrl不能为空");
|
|
throw new StatusException("301005", "fileUrl不能为空");
|
|
}
|
|
}
|
|
|
|
|
|
//校验虚拟摄像头格式,必须 是Json数组,如果格式不正确,则置为null
|
|
//校验虚拟摄像头格式,必须 是Json数组,如果格式不正确,则置为null
|
|
- if (StringUtils.isNoneBlank(saveExamCaptureQueueInfo.getCameraInfos())) {
|
|
|
|
|
|
+ if (StringUtils.isNoneBlank(req.getCameraInfos())) {
|
|
try {
|
|
try {
|
|
- JSONArray jsonArray = new JSONArray(saveExamCaptureQueueInfo.getCameraInfos());
|
|
|
|
- if (jsonArray.length() == 0) {
|
|
|
|
- saveExamCaptureQueueInfo.setCameraInfos(null);
|
|
|
|
|
|
+ JSONArray jsonArray = new JSONArray(req.getCameraInfos());
|
|
|
|
+ if (jsonArray.isEmpty()) {
|
|
|
|
+ req.setCameraInfos(null);
|
|
}
|
|
}
|
|
} catch (JSONException e) {
|
|
} catch (JSONException e) {
|
|
- saveExamCaptureQueueInfo.setCameraInfos(null);
|
|
|
|
- LOGGER.error("ExamCaptureQueueController-uploadExamCapture-004:虚拟摄像头信息格式不正确", e);
|
|
|
|
|
|
+ req.setCameraInfos(null);
|
|
|
|
+ LOGGER.warn("虚拟摄像头信息格式不正确!" + req.getCameraInfos());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- validateUpyunSign(saveExamCaptureQueueInfo.getSignIdentifier(), saveExamCaptureQueueInfo.getFileUrl(), user.getUserId());
|
|
|
|
|
|
+ validateUpyunSign(req.getSignIdentifier(), req.getFileUrl(), user.getUserId());
|
|
|
|
|
|
- return examCaptureQueueService.saveExamCaptureQueue(saveExamCaptureQueueInfo, user.getUserId());
|
|
|
|
|
|
+ return examCaptureQueueService.saveExamCaptureQueue(req, user.getUserId());
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|