|
|
@@ -74,6 +74,27 @@ public class FaceApi {
|
|
|
return ResultData.success(faceFeature.getFeatureData());
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @ApiOperation("检测是否是人脸")
|
|
|
+ @PostMapping("/detectFaces")
|
|
|
+ public ResultData detectFaces(@RequestParam("file") MultipartFile file) throws IOException {
|
|
|
+ File fileToFile = null;
|
|
|
+ try {
|
|
|
+ fileToFile = FileUtil.multipartFileToFile(file);
|
|
|
+ ImageInfo imageInfo = faceService.getImageInfo(fileToFile);
|
|
|
+ List<FaceInfo> faceInfos = faceService.faceDetect(imageInfo);
|
|
|
+ if(null==faceInfos || faceInfos.size()==0){
|
|
|
+ return ResultData.fail("请讲脸放到摄像头正中央!");
|
|
|
+ }
|
|
|
+ return ResultData.success(faceInfos);
|
|
|
+ } finally {
|
|
|
+ if (fileToFile != null) {
|
|
|
+ fileToFile.delete();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 人脸比较
|
|
|
*
|
|
|
@@ -118,12 +139,12 @@ public class FaceApi {
|
|
|
String userType=info.getUserType();
|
|
|
Integer isWhite=info.getIsWhite();
|
|
|
//如果是学生 或者白名单的老师 进二类页面
|
|
|
- if(userType.equals("22") || (userType.equals("11") && isWhite==0)){
|
|
|
+ if((StringUtils.isNotNull(userType) && userType.equals("22")) || (StringUtils.isNotNull(userType) && userType.equals("11") && isWhite==0)){
|
|
|
info.setPageType(2);
|
|
|
}
|
|
|
ResultData resultData =remoteDutyService.isAdminOrSafeUser(faceCompare.getLabId(),info.getUserId());
|
|
|
//一类首页对应身份为白名单老师、实验室负责人、安全责任人
|
|
|
- if(Integer.parseInt(String.valueOf(resultData.getData()))>0 || (userType.equals("11") && isWhite==1)){
|
|
|
+ if(Integer.parseInt(String.valueOf(resultData.getData()))>0 || (StringUtils.isNotNull(userType) && userType.equals("11") && isWhite==1)){
|
|
|
info.setPageType(1);
|
|
|
}
|
|
|
info.setFaceFeature(null);
|