|
|
@@ -154,35 +154,38 @@ public class FaceOcrServiceImpl implements IFaceOcrService {
|
|
|
if(Validator.isEmpty(face[0].getFaceQualityInfo().getCompleteness())){
|
|
|
throw new CustomException("照片五官不达标");
|
|
|
}
|
|
|
- FaceQualityCompleteness completeness = face[0].getFaceQualityInfo().getCompleteness();
|
|
|
- if (ObjectUtils.isNull(completeness.getEyebrow()) || completeness.getEyebrow() < 80){
|
|
|
- throw new CustomException("请勿遮挡眉毛");
|
|
|
- }
|
|
|
- if (ObjectUtils.isNull(completeness.getEye()) || completeness.getEye() < 80){
|
|
|
- throw new CustomException("请勿遮挡眼睛");
|
|
|
- }
|
|
|
- if (ObjectUtils.isNull(completeness.getNose()) || completeness.getNose() < 60){
|
|
|
- throw new CustomException("请勿遮挡鼻子");
|
|
|
- }
|
|
|
- if (ObjectUtils.isNull(completeness.getCheek()) || completeness.getCheek() < 70){
|
|
|
- throw new CustomException("请勿遮挡脸颊");
|
|
|
- }
|
|
|
- if (ObjectUtils.isNull(completeness.getMouth()) || completeness.getMouth() < 50){
|
|
|
- throw new CustomException("请勿遮挡嘴巴");
|
|
|
- }
|
|
|
- if (ObjectUtils.isNull(completeness.getChin()) || completeness.getChin() < 60){
|
|
|
- throw new CustomException("请勿遮挡下巴");
|
|
|
- }
|
|
|
- if (imageWidth * 0.55 < face[0].getWidth()){
|
|
|
- throw new CustomException("人脸与摄像头距离太近,请把摄像头或手机离脸远一些再拍照!");
|
|
|
- }
|
|
|
- if (imageHeight * 0.85 < (face[0].getY()+face[0].getHeight())){
|
|
|
- throw new CustomException("照片的人脸太下,请拍照时把两肩拍出来!");
|
|
|
- }
|
|
|
- if(face[0].getX()<0|| face[0].getY()<0
|
|
|
- || (face[0].getX() + face[0].getWidth()) > imageWidth)
|
|
|
- {
|
|
|
- throw new CustomException("请保证人脸全部在照片范围内!");
|
|
|
+ Integer photoSign = iUserService.getBusinessPhotoSign(bo.getOrderGoodsId());
|
|
|
+ if (photoSign == 1){
|
|
|
+ FaceQualityCompleteness completeness = face[0].getFaceQualityInfo().getCompleteness();
|
|
|
+ if (ObjectUtils.isNull(completeness.getEyebrow()) || completeness.getEyebrow() < 80){
|
|
|
+ throw new CustomException("请勿遮挡眉毛");
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNull(completeness.getEye()) || completeness.getEye() < 80){
|
|
|
+ throw new CustomException("请勿遮挡眼睛");
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNull(completeness.getNose()) || completeness.getNose() < 60){
|
|
|
+ throw new CustomException("请勿遮挡鼻子");
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNull(completeness.getCheek()) || completeness.getCheek() < 70){
|
|
|
+ throw new CustomException("请勿遮挡脸颊");
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNull(completeness.getMouth()) || completeness.getMouth() < 50){
|
|
|
+ throw new CustomException("请勿遮挡嘴巴");
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNull(completeness.getChin()) || completeness.getChin() < 60){
|
|
|
+ throw new CustomException("请勿遮挡下巴");
|
|
|
+ }
|
|
|
+ if (imageWidth * 0.55 < face[0].getWidth()){
|
|
|
+ throw new CustomException("人脸与摄像头距离太近,请把摄像头或手机离脸远一些再拍照!");
|
|
|
+ }
|
|
|
+ if (imageHeight * 0.85 < (face[0].getY()+face[0].getHeight())){
|
|
|
+ throw new CustomException("照片的人脸太下,请拍照时把两肩拍出来!");
|
|
|
+ }
|
|
|
+ if(face[0].getX()<0|| face[0].getY()<0
|
|
|
+ || (face[0].getX() + face[0].getWidth()) > imageWidth)
|
|
|
+ {
|
|
|
+ throw new CustomException("请保证人脸全部在照片范围内!");
|
|
|
+ }
|
|
|
}
|
|
|
}catch (TencentCloudSDKException e){
|
|
|
throw new CustomException("人脸检测错误:"+e.getMessage());
|