Commit bc003539 authored by fangxinjiang's avatar fangxinjiang

check update

parent 8765e70f
...@@ -30,7 +30,7 @@ public class ChecksUtil { ...@@ -30,7 +30,7 @@ public class ChecksUtil {
private static final String API_URL = "https://api.253.com/open/idcard/id-card-auth"; private static final String API_URL = "https://api.253.com/open/idcard/id-card-auth";
private static final String API_URL_MOBILE = "https://api.253.com/open/unn/batch-ucheck"; private static final String API_URL_MOBILE = "https://api.253.com/open/unn/batch-ucheck";
private static final String API_URL_BANK_NO ="https://api.253.com/open/bankcard/card-auth"; private static final String API_URL_BANK_NO ="https://api.253.com/open/bankcard/card-auth";
private static final String API_URL_BANK_NO_THREE ="https://api.253.com/open/bankcard/card-two-auth"; private static final String API_URL_BANK_NO_TWO ="https://api.253.com/open/bankcard/card-two-auth";
private static JsonParser jsonParser = new JsonParser(); private static JsonParser jsonParser = new JsonParser();
public static void checkIdCard(TCheckIdCard checkIdCard, boolean canCheck) { public static void checkIdCard(TCheckIdCard checkIdCard, boolean canCheck) {
...@@ -63,24 +63,19 @@ public class ChecksUtil { ...@@ -63,24 +63,19 @@ public class ChecksUtil {
* @Description 银行卡四要素标准版 校验 * @Description 银行卡四要素标准版 校验
* @Date 17:50 2022/6/20 * @Date 17:50 2022/6/20
* @param name 姓名 是 [string] * @param name 姓名 是 [string]
* @param idNum 身份证号码,限单个 是 [string]
* @param cardNo 银行卡号,限单个 是 [string] * @param cardNo 银行卡号,限单个 是 [string]
* @param mobile 银行预留手机号,仅支持国内11位号码
**/ **/
public static R<TCheckBankNo> checkBankNo(String name, String idNum, String cardNo, String mobile, boolean canCheck) { public static R<TCheckBankNo> checkBankNoTwo(String name, String cardNo, boolean canCheck) {
if (canCheck) { if (canCheck) {
// 1.调用身份信息校验api // 1.调用身份信息校验api
return checkBankNoMethod(name,idNum,cardNo,mobile); return checkBankNoTwoMethod(name,cardNo);
} else { } else {
return R.failed(ChecksConstants.NACOS_CHECK_CONFIG_ERROR); return R.failed(ChecksConstants.NACOS_CHECK_CONFIG_ERROR);
} }
} }
private static R<TCheckBankNo> checkBankNoMethod(String name, private static R<TCheckBankNo> checkBankNoTwoMethod(String name, String cardNo) {
String idNum, final JsonObject jsonObject = ChecksUtil.invokeBankNoTwoAuth(name,cardNo);
String cardNo,
String mobile) {
final JsonObject jsonObject = ChecksUtil.invokeBankNo(name,idNum,cardNo,mobile);
TCheckBankNo checkBankNo = new TCheckBankNo(); TCheckBankNo checkBankNo = new TCheckBankNo();
// 2.处理返回结果 // 2.处理返回结果
if (jsonObject != null) { if (jsonObject != null) {
...@@ -102,7 +97,6 @@ public class ChecksUtil { ...@@ -102,7 +97,6 @@ public class ChecksUtil {
checkBankNo.setRemark(getJsonElementValue(resJson.getAsJsonObject().get(ChecksConstants.REMARK))); checkBankNo.setRemark(getJsonElementValue(resJson.getAsJsonObject().get(ChecksConstants.REMARK)));
checkBankNo.setType(CommonConstants.ONE_STRING); checkBankNo.setType(CommonConstants.ONE_STRING);
checkBankNo.setName(name); checkBankNo.setName(name);
checkBankNo.setIdNum(idNum);
} }
} else { } else {
// 记录错误日志,正式项目中请换成log打印 // 记录错误日志,正式项目中请换成log打印
...@@ -233,4 +227,14 @@ public class ChecksUtil { ...@@ -233,4 +227,14 @@ public class ChecksUtil {
// 解析json,并返回结果 // 解析json,并返回结果
return jsonParser.parse(result).getAsJsonObject(); return jsonParser.parse(result).getAsJsonObject();
} }
private static JsonObject invokeBankNoTwoAuth(String name,String cardNo) {
Map<String, String> params = new HashMap<>();
params.put(ChecksConstants.APP_ID, APP_ID);
params.put(ChecksConstants.APP_KEY, APP_KEY_IDCARD);
params.put(ChecksConstants.NAME, name);
String result = HttpUtils.post(API_URL_BANK_NO_TWO, params);
// 解析json,并返回结果
return jsonParser.parse(result).getAsJsonObject();
}
} }
...@@ -121,6 +121,6 @@ public class TCheckBankNoController { ...@@ -121,6 +121,6 @@ public class TCheckBankNoController {
@Inner @Inner
@PostMapping("/inner/checkBankNo" ) @PostMapping("/inner/checkBankNo" )
public CheckBankNoVo checkBankNoInner(@RequestBody TCheckBankNo checkBankNo) { public CheckBankNoVo checkBankNoInner(@RequestBody TCheckBankNo checkBankNo) {
return tCheckBankNoService.checkBankNo(checkBankNo.getName(),checkBankNo.getIdNum(),checkBankNo.getBankNo(),checkBankNo.getMobile()); return tCheckBankNoService.checkBankNoTwo(checkBankNo.getName(),checkBankNo.getBankNo());
} }
} }
...@@ -30,5 +30,5 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R; ...@@ -30,5 +30,5 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
*/ */
public interface TCheckBankNoService extends IService<TCheckBankNo> { public interface TCheckBankNoService extends IService<TCheckBankNo> {
CheckBankNoVo checkBankNo(String name, String idNum, String cardNo, String mobile); CheckBankNoVo checkBankNoTwo(String name, String cardNo);
} }
...@@ -45,10 +45,10 @@ public class TCheckBankNoServiceImpl extends ServiceImpl<TCheckBankNoMapper, TCh ...@@ -45,10 +45,10 @@ public class TCheckBankNoServiceImpl extends ServiceImpl<TCheckBankNoMapper, TCh
private final TCanCheckService canCheckService; private final TCanCheckService canCheckService;
@Override @Override
public CheckBankNoVo checkBankNo(String name, String idNum, String cardNo, String mobile) { public CheckBankNoVo checkBankNoTwo(String name, String cardNo) {
R<TCheckBankNo> res; R<TCheckBankNo> res;
CheckBankNoVo vo = new CheckBankNoVo(); CheckBankNoVo vo = new CheckBankNoVo();
if (Common.isEmpty(name) || Common.isEmpty(idNum) || Common.isEmpty(cardNo)){ if (Common.isEmpty(name) || Common.isEmpty(cardNo)){
vo.setRes(R.failed(MsgUtils.getMessage(ErrorCodes.CHECKS_BANK_NO_REQUEST_PARAM_ERROR))); vo.setRes(R.failed(MsgUtils.getMessage(ErrorCodes.CHECKS_BANK_NO_REQUEST_PARAM_ERROR)));
return vo; return vo;
} }
...@@ -56,13 +56,12 @@ public class TCheckBankNoServiceImpl extends ServiceImpl<TCheckBankNoMapper, TCh ...@@ -56,13 +56,12 @@ public class TCheckBankNoServiceImpl extends ServiceImpl<TCheckBankNoMapper, TCh
TCheckBankNo checkBankNo = baseMapper.selectOne(Wrappers.<TCheckBankNo>query().lambda() TCheckBankNo checkBankNo = baseMapper.selectOne(Wrappers.<TCheckBankNo>query().lambda()
.eq(TCheckBankNo::getBankNo,cardNo) .eq(TCheckBankNo::getBankNo,cardNo)
.eq(TCheckBankNo::getName,name) .eq(TCheckBankNo::getName,name)
.eq(TCheckBankNo::getIdNum,idNum)
.last(CommonConstants.LAST_ONE_SQL)); .last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(checkBankNo)){ if (Common.isNotNull(checkBankNo)){
vo.setRes(R.ok(checkBankNo)); vo.setRes(R.ok(checkBankNo));
return vo; return vo;
} }
R<TCheckBankNo> resR = ChecksUtil.checkBankNo(name,idNum,cardNo,mobile,canCheckService.getCanCheck()); R<TCheckBankNo> resR = ChecksUtil.checkBankNoTwo(name,cardNo,canCheckService.getCanCheck());
if (Common.isNotNull(resR) && Common.isNotNull(resR.getData())){ if (Common.isNotNull(resR) && Common.isNotNull(resR.getData())){
baseMapper.insert(resR.getData()); baseMapper.insert(resR.getData());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment