|
|
@@ -7,6 +7,7 @@ import com.arcsoft.face.enums.ErrorInfo;
|
|
|
import com.arcsoft.face.toolkit.ImageInfo;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import me.zhengjie.base.ResultCode;
|
|
|
import me.zhengjie.base.file.FaceMinioFileHandle;
|
|
|
import me.zhengjie.base.file.FileHandleVo;
|
|
|
@@ -35,6 +36,7 @@ import static com.arcsoft.face.toolkit.ImageFactory.getRGBData;
|
|
|
|
|
|
@Component
|
|
|
@RequiredArgsConstructor
|
|
|
+@Slf4j
|
|
|
public class NotaryDomainImpl implements NotaryDomain {
|
|
|
|
|
|
private final SysUserMapper userMapper;
|
|
|
@@ -104,7 +106,7 @@ public class NotaryDomainImpl implements NotaryDomain {
|
|
|
throw new RuntimeException(e);
|
|
|
}
|
|
|
if (!Img2Base64Util.generateImage(base64, base.getPath())) {
|
|
|
- System.err.println("base64转图片异常");
|
|
|
+ log.info("base64转图片异常");
|
|
|
return ResultCode.FACEAUTH_FAIL;
|
|
|
}
|
|
|
boolean redisFlag = (count != null && count >= 2);
|
|
|
@@ -121,11 +123,11 @@ public class NotaryDomainImpl implements NotaryDomain {
|
|
|
bank.setUserId(sysUserEntity.getUserId());
|
|
|
bank.setCompareImgId(fileInfo.getId());
|
|
|
userMapper.updateById(bank);
|
|
|
- System.err.println("银行客户经理人脸核身通过");
|
|
|
+ log.info("银行客户经理人脸核身通过");
|
|
|
redis.del(redisCount);
|
|
|
return ResultCode.SUCCESS;
|
|
|
}
|
|
|
- System.err.println("人脸核身失败");
|
|
|
+ log.info("客户经理人脸核身失败");
|
|
|
return ResultCode.LIVE_VIDEO_INVALID;
|
|
|
}
|
|
|
} else {
|
|
|
@@ -140,11 +142,11 @@ public class NotaryDomainImpl implements NotaryDomain {
|
|
|
userAxq.setId(userAXQInfoEntity.getId());
|
|
|
userAxq.setCompareImgId(fileInfo.getId());
|
|
|
userAXQInfoMapper.updateById(userAxq);
|
|
|
- System.err.println("当事人人脸核身通过");
|
|
|
+ log.info("当事人人脸核身通过");
|
|
|
redis.del(redisCount);
|
|
|
return ResultCode.SUCCESS;
|
|
|
}
|
|
|
- System.err.println("人脸核身失败");
|
|
|
+ log.info("当事人人脸核身失败");
|
|
|
return ResultCode.LIVE_VIDEO_INVALID;
|
|
|
}
|
|
|
}
|
|
|
@@ -158,7 +160,6 @@ public class NotaryDomainImpl implements NotaryDomain {
|
|
|
id = userAXQInfoEntity.getCompareImgId();
|
|
|
}
|
|
|
if (! compareImage(base, id,redisCount,count)) {
|
|
|
- System.err.println("人脸比对失败");
|
|
|
return ResultCode.LIVE_VIDEO_INVALID;
|
|
|
}
|
|
|
if (count != null) {
|
|
|
@@ -227,7 +228,7 @@ public class NotaryDomainImpl implements NotaryDomain {
|
|
|
float yaw = Math.abs(face3DAngleList.get(0).getYaw());
|
|
|
if (pitch > 10 || yaw > 10) {
|
|
|
//照片不符合标准
|
|
|
- System.err.println("图片不符合标准");
|
|
|
+ log.info("图片不符合标准");
|
|
|
return false;
|
|
|
}
|
|
|
//特征提取
|
|
|
@@ -260,8 +261,7 @@ public class NotaryDomainImpl implements NotaryDomain {
|
|
|
errorCode = faceEngine.compareFaceFeature(targetFaceFeature, sourceFaceFeature, faceSimilar);
|
|
|
//如果通过 上传文件 修改用户绑定id 如果没通过 返回null证明失败了
|
|
|
if (faceSimilar.getScore() > 0.8) {
|
|
|
- FileInfoEntity fileInfo = saveCompareImage(base);
|
|
|
- fileInfoMapper.insert(fileInfo);
|
|
|
+ log.info("人脸照片比对通过");
|
|
|
return true;
|
|
|
}
|
|
|
if (count == null) {
|
|
|
@@ -269,7 +269,7 @@ public class NotaryDomainImpl implements NotaryDomain {
|
|
|
} else {
|
|
|
redis.set(redisCount, count + 1, 30, TimeUnit.MINUTES);
|
|
|
}
|
|
|
- System.err.println("人脸照片比对未通过");
|
|
|
+ log.info("人脸照片比对未通过");;
|
|
|
return false;
|
|
|
}
|
|
|
|