|
@@ -0,0 +1,67 @@
|
|
|
+package cn.com.qmth.examcloud.app.controller;
|
|
|
+
|
|
|
+import cn.com.qmth.examcloud.app.model.CaptureInfo;
|
|
|
+import cn.com.qmth.examcloud.app.model.Result;
|
|
|
+import cn.com.qmth.examcloud.app.service.FaceVerifyService;
|
|
|
+import cn.com.qmth.examcloud.web.support.ControllerSupport;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import static cn.com.qmth.examcloud.app.model.Constants.PARAM_APP_KEY;
|
|
|
+import static cn.com.qmth.examcloud.app.model.Constants.PARAM_APP_TOKEN;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("${$rmp}/v2/face/verify")
|
|
|
+@Api(tags = "人脸识别、比对验证相关接口")
|
|
|
+public class FaceVerifyController extends ControllerSupport {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private FaceVerifyService faceVerifyService;
|
|
|
+
|
|
|
+ @ApiOperation(value = "是否开启人脸验证接口")
|
|
|
+ @PostMapping("/faceCheckEnabled/{examId}")
|
|
|
+ public Result faceCheckEnabled(@RequestHeader(name = PARAM_APP_KEY) String key,
|
|
|
+ @RequestHeader(name = PARAM_APP_TOKEN) String token,
|
|
|
+ @PathVariable Long examId) throws Exception {
|
|
|
+ return faceVerifyService.faceCheckEnabled(key, token, examId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "获取照片的云存储签名接口", notes = "拿到签名后,将抓拍照片上传至云存储")
|
|
|
+ @PostMapping("/getPhotoSign")
|
|
|
+ public Result getPhotoSign(@RequestHeader(name = PARAM_APP_KEY) String key,
|
|
|
+ @RequestHeader(name = PARAM_APP_TOKEN) String token,
|
|
|
+ @ApiParam(value = "文件后缀:png、jpg") @RequestParam String fileSuffix,
|
|
|
+ @ApiParam(value = "文件MD5") @RequestParam(required = false) String fileMd5) throws Exception {
|
|
|
+ return faceVerifyService.getPhotoSign(key, token, fileSuffix, fileMd5);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "执行人脸识别接口")
|
|
|
+ @PostMapping("/compare")
|
|
|
+ public Result compare(@RequestHeader(name = PARAM_APP_KEY) String key,
|
|
|
+ @RequestHeader(name = PARAM_APP_TOKEN) String token,
|
|
|
+ @ApiParam(value = "文件访问地址") @RequestParam String fileUrl,
|
|
|
+ @ApiParam(value = "照片签名标识") @RequestParam(required = false) String signIdentifier) throws Exception {
|
|
|
+ return faceVerifyService.compare(key, token, fileUrl, signIdentifier);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "保存抓拍照片信息接口")
|
|
|
+ @PostMapping("/saveCaptureInfo")
|
|
|
+ public Result saveCaptureInfo(@RequestHeader(name = PARAM_APP_KEY) String key,
|
|
|
+ @RequestHeader(name = PARAM_APP_TOKEN) String token,
|
|
|
+ @RequestBody CaptureInfo captureInfo) throws Exception {
|
|
|
+ return faceVerifyService.saveCaptureInfo(key, token, captureInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "获取抓拍照片比对结果接口")
|
|
|
+ @PostMapping("/getCaptureResult")
|
|
|
+ public Result getCaptureResult(@RequestHeader(name = PARAM_APP_KEY) String key,
|
|
|
+ @RequestHeader(name = PARAM_APP_TOKEN) String token,
|
|
|
+ @ApiParam(value = "考试记录ID") @RequestParam Long examRecordDataId,
|
|
|
+ @ApiParam(value = "文件名") @RequestParam String fileName) throws Exception {
|
|
|
+ return faceVerifyService.getCaptureResult(key, token, examRecordDataId, fileName);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|