|
|
@@ -61,11 +61,11 @@ public class AliController {
|
|
|
aliService.notify(request);
|
|
|
}
|
|
|
|
|
|
- @ApiOperation("身份证二要素核验")
|
|
|
+ @ApiOperation("证件二要素核验(身份证走阿里核验,护照等非身份证证件跳过核验)")
|
|
|
@ApiOperationSupport(order = 2)
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "name", value = "姓名", dataType = "String", paramType = "query", required = true),
|
|
|
- @ApiImplicitParam(name = "idCard", value = "身份证号", dataType = "String", paramType = "query", required = true),
|
|
|
+ @ApiImplicitParam(name = "idCard", value = "证件号(身份证号或护照号等)", dataType = "String", paramType = "query", required = true),
|
|
|
@ApiImplicitParam(name = "appType", value = "端区分(0:用户, 1:商家)", dataType = "Integer", paramType = "query", required = true, defaultValue = "0")
|
|
|
})
|
|
|
@GetMapping("/getIdInfo")
|
|
|
@@ -74,14 +74,18 @@ public class AliController {
|
|
|
String normalizedIdCard = idCard == null ? null : idCard.trim().toUpperCase();
|
|
|
log.info("AliController.getIdInfo?name={}&idCard={}", normalizedName, normalizedIdCard);
|
|
|
if (appType == 0) {
|
|
|
- // 根据身份证查询未注销用户:同一身份证只能实名一个账号
|
|
|
+ // 根据证件号查询未注销用户:同一证件只能实名一个账号
|
|
|
int size = lifeUserService.count(new LambdaQueryWrapper<LifeUser>()
|
|
|
.eq(LifeUser::getIdCard, normalizedIdCard)
|
|
|
.eq(LifeUser::getLogoutFlag, 0));
|
|
|
if (size > 0) {
|
|
|
- return R.fail("该身份证已实名认证过");
|
|
|
+ return R.fail("该证件已实名认证过");
|
|
|
}
|
|
|
}
|
|
|
+ if (!isChineseIdCard(normalizedIdCard)) {
|
|
|
+ log.info("AliController.getIdInfo 非中国大陆身份证,跳过二要素核验 idCard={}", normalizedIdCard);
|
|
|
+ return R.success("身份验证成功");
|
|
|
+ }
|
|
|
if (aliPayConfig.getIdInfo(normalizedName, normalizedIdCard)) {
|
|
|
return R.success("身份验证成功");
|
|
|
}
|
|
|
@@ -91,6 +95,15 @@ public class AliController {
|
|
|
return R.fail("身份证号码与姓名不一致,请检查后重新填写");
|
|
|
}
|
|
|
|
|
|
+ /** 是否为中国大陆居民身份证号(18位或15位) */
|
|
|
+ private static boolean isChineseIdCard(String idCard) {
|
|
|
+ if (idCard == null || idCard.isEmpty()) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return idCard.matches("^[1-9]\\d{5}(18|19|20)\\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\\d|3[01])\\d{3}[\\dX]$")
|
|
|
+ || idCard.matches("^\\d{15}$");
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation("单笔转账接口")
|
|
|
@ApiOperationSupport(order = 3)
|
|
|
@ApiImplicitParams({@ApiImplicitParam(name = "name", value = "收款人姓名", dataType = "String", paramType = "query", required = true),
|