银行卡绑定
This commit is contained in:
parent
d557d6cb6b
commit
00b256f4f7
|
|
@ -101,6 +101,7 @@
|
||||||
<artifactId>swagger-bootstrap-ui</artifactId>
|
<artifactId>swagger-bootstrap-ui</artifactId>
|
||||||
<version>1.9.6</version>
|
<version>1.9.6</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--jsp支持 start -->
|
<!--jsp支持 start -->
|
||||||
|
|
||||||
<!-- html 支持 -->
|
<!-- html 支持 -->
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,10 @@ aliyun:
|
||||||
bucketname: czg-oss
|
bucketname: czg-oss
|
||||||
callback: ${parameter.domain}/manage/upload/ossCallback
|
callback: ${parameter.domain}/manage/upload/ossCallback
|
||||||
bankcard:
|
bankcard:
|
||||||
|
#旧地址 https://aliyun-bankcard4-verify.apistore.cn/bank4
|
||||||
bank-url: https://aliyun-bankcard4-verify.apistore.cn/bank4
|
bank-url: https://aliyun-bankcard4-verify.apistore.cn/bank4
|
||||||
app-code: 11cb746de2704f5482a40fd36ed8a1f1
|
app-code: 11cb746de2704f5482a40fd36ed2sg6u
|
||||||
|
SceneId: 3931001
|
||||||
|
|
||||||
#阿里MQTT参数配置
|
#阿里MQTT参数配置
|
||||||
mqtt:
|
mqtt:
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,10 @@ aliyun:
|
||||||
bucketname: czg-oss
|
bucketname: czg-oss
|
||||||
callback: ${parameter.domain}/manage/upload/ossCallback
|
callback: ${parameter.domain}/manage/upload/ossCallback
|
||||||
bankcard:
|
bankcard:
|
||||||
|
#旧地址 https://aliyun-bankcard4-verify.apistore.cn/bank4
|
||||||
bank-url: https://aliyun-bankcard4-verify.apistore.cn/bank4
|
bank-url: https://aliyun-bankcard4-verify.apistore.cn/bank4
|
||||||
app-code: 11cb746de2704f5482a40fd36ed8a1f1
|
app-code: 11cb746de2704f5482a40fd36ed2sg6u
|
||||||
|
SceneId: 3931001
|
||||||
|
|
||||||
#阿里MQTT参数配置
|
#阿里MQTT参数配置
|
||||||
mqtt:
|
mqtt:
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import javax.annotation.Generated;
|
||||||
|
|
||||||
@Generated(
|
@Generated(
|
||||||
value = "org.mapstruct.ap.MappingProcessor",
|
value = "org.mapstruct.ap.MappingProcessor",
|
||||||
date = "2023-01-29T10:16:06+0800",
|
date = "2023-01-30T11:00:04+0800",
|
||||||
comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_362 (Amazon.com Inc.)"
|
comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_362 (Amazon.com Inc.)"
|
||||||
)
|
)
|
||||||
public class BankCardConverterImpl implements BankCardConverter {
|
public class BankCardConverterImpl implements BankCardConverter {
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ import javax.annotation.Generated;
|
||||||
|
|
||||||
@Generated(
|
@Generated(
|
||||||
value = "org.mapstruct.ap.MappingProcessor",
|
value = "org.mapstruct.ap.MappingProcessor",
|
||||||
date = "2023-01-29T10:16:06+0800",
|
date = "2023-01-30T11:00:03+0800",
|
||||||
comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_362 (Amazon.com Inc.)"
|
comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_362 (Amazon.com Inc.)"
|
||||||
)
|
)
|
||||||
public class ConverterImpl implements Converter {
|
public class ConverterImpl implements Converter {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import javax.annotation.Generated;
|
||||||
|
|
||||||
@Generated(
|
@Generated(
|
||||||
value = "org.mapstruct.ap.MappingProcessor",
|
value = "org.mapstruct.ap.MappingProcessor",
|
||||||
date = "2023-01-29T10:16:06+0800",
|
date = "2023-01-30T11:00:03+0800",
|
||||||
comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_362 (Amazon.com Inc.)"
|
comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_362 (Amazon.com Inc.)"
|
||||||
)
|
)
|
||||||
public class ImgConverterImpl implements ImgConverter {
|
public class ImgConverterImpl implements ImgConverter {
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import javax.annotation.Generated;
|
||||||
|
|
||||||
@Generated(
|
@Generated(
|
||||||
value = "org.mapstruct.ap.MappingProcessor",
|
value = "org.mapstruct.ap.MappingProcessor",
|
||||||
date = "2023-01-29T10:16:06+0800",
|
date = "2023-01-30T11:00:03+0800",
|
||||||
comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_362 (Amazon.com Inc.)"
|
comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_362 (Amazon.com Inc.)"
|
||||||
)
|
)
|
||||||
public class MerchantBaseInfoConverterImpl implements MerchantBaseInfoConverter {
|
public class MerchantBaseInfoConverterImpl implements MerchantBaseInfoConverter {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import javax.annotation.Generated;
|
||||||
|
|
||||||
@Generated(
|
@Generated(
|
||||||
value = "org.mapstruct.ap.MappingProcessor",
|
value = "org.mapstruct.ap.MappingProcessor",
|
||||||
date = "2023-01-29T10:16:06+0800",
|
date = "2023-01-30T11:00:04+0800",
|
||||||
comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_362 (Amazon.com Inc.)"
|
comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_362 (Amazon.com Inc.)"
|
||||||
)
|
)
|
||||||
public class MerchantCashPlaceConverterImpl implements MerchantCashPlaceConverter {
|
public class MerchantCashPlaceConverterImpl implements MerchantCashPlaceConverter {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import javax.annotation.Generated;
|
||||||
|
|
||||||
@Generated(
|
@Generated(
|
||||||
value = "org.mapstruct.ap.MappingProcessor",
|
value = "org.mapstruct.ap.MappingProcessor",
|
||||||
date = "2023-01-29T10:16:06+0800",
|
date = "2023-01-30T11:00:03+0800",
|
||||||
comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_362 (Amazon.com Inc.)"
|
comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_362 (Amazon.com Inc.)"
|
||||||
)
|
)
|
||||||
public class MerchantStaffConverterImpl implements MerchantStaffConverter {
|
public class MerchantStaffConverterImpl implements MerchantStaffConverter {
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import javax.annotation.Generated;
|
||||||
|
|
||||||
@Generated(
|
@Generated(
|
||||||
value = "org.mapstruct.ap.MappingProcessor",
|
value = "org.mapstruct.ap.MappingProcessor",
|
||||||
date = "2023-01-29T10:16:06+0800",
|
date = "2023-01-30T11:00:03+0800",
|
||||||
comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_362 (Amazon.com Inc.)"
|
comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_362 (Amazon.com Inc.)"
|
||||||
)
|
)
|
||||||
public class UserAppConverterImpl implements UserAppConverter {
|
public class UserAppConverterImpl implements UserAppConverter {
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,12 @@
|
||||||
<version>1.1.2.RELEASE</version>
|
<version>1.1.2.RELEASE</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun</groupId>
|
||||||
|
<artifactId>cloudauth20200618</artifactId>
|
||||||
|
<version>2.0.3</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -18,6 +18,15 @@ public interface AliyunService extends IpLocationService {
|
||||||
* @return 校验结果
|
* @return 校验结果
|
||||||
*/
|
*/
|
||||||
void checkBankCorrect(String phone, String bankCardNo, String certNo, String realName);
|
void checkBankCorrect(String phone, String bankCardNo, String certNo, String realName);
|
||||||
|
/**
|
||||||
|
* 银行卡四要素(新)
|
||||||
|
* @param phone 手机号
|
||||||
|
* @param bankCardNo 银行卡号
|
||||||
|
* @param certNo 身份证号
|
||||||
|
* @param realName 姓名
|
||||||
|
* @return 校验结果
|
||||||
|
*/
|
||||||
|
void checkBankCorrectNow(String phone, String bankCardNo, String certNo, String realName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 银行卡四要素
|
* 银行卡四要素
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import cn.pluss.platform.util.HttpResult;
|
||||||
import cn.pluss.platform.util.HttpUtil;
|
import cn.pluss.platform.util.HttpUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.aliyun.cloudauth20200618.models.VerifyBankElementResponse;
|
||||||
import com.aliyuncs.DefaultAcsClient;
|
import com.aliyuncs.DefaultAcsClient;
|
||||||
import com.aliyuncs.IAcsClient;
|
import com.aliyuncs.IAcsClient;
|
||||||
import com.aliyuncs.auth.sts.AssumeRoleRequest;
|
import com.aliyuncs.auth.sts.AssumeRoleRequest;
|
||||||
|
|
@ -29,6 +30,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||||
|
import com.aliyun.tea.*;
|
||||||
|
import com.aliyun.cloudauth20200618.Client;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|
@ -49,6 +52,21 @@ public class AliyunServiceImpl implements AliyunService {
|
||||||
|
|
||||||
@Value("${aliyun.bankcard.bank-url}")
|
@Value("${aliyun.bankcard.bank-url}")
|
||||||
private String bankCheckUrl;
|
private String bankCheckUrl;
|
||||||
|
/**
|
||||||
|
*场景id
|
||||||
|
*/
|
||||||
|
@Value("${aliyun.bankcard.SceneId}")
|
||||||
|
private Long SceneId;
|
||||||
|
/**
|
||||||
|
* 阿里云key
|
||||||
|
*/
|
||||||
|
@Value("${aliyun.keyid}")
|
||||||
|
private String ACCESSKEYID;
|
||||||
|
/**
|
||||||
|
* 阿里云secret
|
||||||
|
*/
|
||||||
|
@Value("${aliyun.keysecret}")
|
||||||
|
private String ACCESSKEYSECRET;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 不好用
|
* 不好用
|
||||||
|
|
@ -104,15 +122,23 @@ public class AliyunServiceImpl implements AliyunService {
|
||||||
|
|
||||||
// 调用阿里云银行卡认证接口
|
// 调用阿里云银行卡认证接口
|
||||||
Map<String, String> headers = new HashMap<>();
|
Map<String, String> headers = new HashMap<>();
|
||||||
headers.put("Authorization", "APPCODE " + appCode);
|
// headers.put("Authorization", "APPCODE " + appCode);
|
||||||
Map<String, Object> querys = new HashMap<>();
|
Map<String, Object> querys = new HashMap<>();
|
||||||
querys.put("Mobile", phone);
|
querys.put("Mobile", phone);
|
||||||
querys.put("bankcard", bankCardNo);
|
// querys.put("bankcard", BankCardNo);
|
||||||
querys.put("cardNo", certNo);
|
//querys.put("cardNo", certNo);
|
||||||
querys.put("realName", realName);
|
// querys.put("realName", realName);
|
||||||
|
querys.put("Mode", "VERIFY_BANK_CARD");
|
||||||
|
querys.put("OuterOrderNo", appCode);
|
||||||
|
querys.put("BankCardNo", bankCardNo);
|
||||||
|
querys.put("IdName", realName);
|
||||||
|
querys.put("IdNo", certNo);
|
||||||
|
querys.put("SceneId", SceneId);
|
||||||
|
|
||||||
HttpResult response = null;
|
HttpResult response = null;
|
||||||
try {
|
try {
|
||||||
response = HttpUtil.doGet(bankCheckUrl, headers, querys);
|
// response = HttpUtil.doGet(bankCheckUrl, querys);
|
||||||
|
response = HttpUtil.doGet(bankCheckUrl, headers, querys);
|
||||||
log.info(response.toString());
|
log.info(response.toString());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
@ -135,7 +161,6 @@ public class AliyunServiceImpl implements AliyunService {
|
||||||
log.error("银行卡四要素检查:" + jsonObject.getString("reason"));
|
log.error("银行卡四要素检查:" + jsonObject.getString("reason"));
|
||||||
bank4Cache.setRemark(jsonObject.getString("reason"));
|
bank4Cache.setRemark(jsonObject.getString("reason"));
|
||||||
bank4Cache.setStatus(Bank4Cache.STATUS_FAIL);
|
bank4Cache.setStatus(Bank4Cache.STATUS_FAIL);
|
||||||
bank4CacheService.save(bank4Cache);
|
|
||||||
throw new MsgException("身份证、银行卡或预留手机号信息不正确");
|
throw new MsgException("身份证、银行卡或预留手机号信息不正确");
|
||||||
} else {
|
} else {
|
||||||
bank4Cache.setStatus(Bank4Cache.STATUS_PASS);
|
bank4Cache.setStatus(Bank4Cache.STATUS_PASS);
|
||||||
|
|
@ -143,6 +168,8 @@ public class AliyunServiceImpl implements AliyunService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void checkBankCorrect(String phone, String bankCardNo, String certNo, String realName, String errorMsg) {
|
public void checkBankCorrect(String phone, String bankCardNo, String certNo, String realName, String errorMsg) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -194,4 +221,71 @@ public class AliyunServiceImpl implements AliyunService {
|
||||||
throw new MsgException("无法获取oss上传凭证");
|
throw new MsgException("无法获取oss上传凭证");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static com.aliyun.cloudauth20200618.Client createClient(String accessKeyId, String accessKeySecret) throws Exception{
|
||||||
|
com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
|
||||||
|
// 必填,您的 AccessKey ID
|
||||||
|
.setAccessKeyId(accessKeyId)
|
||||||
|
// 必填,您的 AccessKey Secret
|
||||||
|
.setAccessKeySecret(accessKeySecret);
|
||||||
|
// 访问的域名
|
||||||
|
config.endpoint = "cloudauth.aliyuncs.com";
|
||||||
|
return new com.aliyun.cloudauth20200618.Client(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkBankCorrectNow(String phone, String bankCardNo, String certNo, String realName) {
|
||||||
|
// java.util.List<String> args = java.util.Arrays.asList(args_);
|
||||||
|
|
||||||
|
//com.aliyun.cloudauth20200618.Client client = Sample.createClient("accessKeyId", "accessKeySecret");
|
||||||
|
Client client = null;
|
||||||
|
try {
|
||||||
|
client = createClient(ACCESSKEYID,ACCESSKEYSECRET);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
com.aliyun.cloudauth20200618.models.VerifyBankElementRequest verifyBankElementRequest = new com.aliyun.cloudauth20200618.models.VerifyBankElementRequest()
|
||||||
|
.setMode("VERIFY_BANK_CARD")
|
||||||
|
.setBankCardNo(bankCardNo)
|
||||||
|
.setIdNo(certNo)
|
||||||
|
.setIdName(realName)
|
||||||
|
.setMobile(phone)
|
||||||
|
.setSceneId(SceneId)
|
||||||
|
.setOuterOrderNo(appCode);
|
||||||
|
|
||||||
|
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 复制代码运行请自行打印 API 的返回值
|
||||||
|
assert client != null;
|
||||||
|
VerifyBankElementResponse verifyBankElementResponse = client.verifyBankElementWithOptions(verifyBankElementRequest, runtime);
|
||||||
|
} catch (TeaException error) {
|
||||||
|
// 如有需要,请打印 error
|
||||||
|
com.aliyun.teautil.Common.assertAsString(error.message);
|
||||||
|
throw new MsgException("银行卡认证失败");
|
||||||
|
} catch (Exception _error) {
|
||||||
|
TeaException error = new TeaException(_error.getMessage(), _error);
|
||||||
|
// 如有需要,请打印 error
|
||||||
|
com.aliyun.teautil.Common.assertAsString(error.message);
|
||||||
|
throw new MsgException("银行卡认证失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// if (200 != response.getCode()) {
|
||||||
|
// if (403 == response.getCode()) {
|
||||||
|
// throw new MsgException("银行卡认证接口已欠费,请联系平台");
|
||||||
|
// } else {
|
||||||
|
// throw new MsgException("银行卡认证失败");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (!"0".equalsIgnoreCase(jsonObject.getString("error_code"))) {
|
||||||
|
// log.error("银行卡四要素检查:" + jsonObject.getString("reason"));
|
||||||
|
// bank4Cache.setRemark(jsonObject.getString("reason"));
|
||||||
|
// bank4Cache.setStatus(Bank4Cache.STATUS_FAIL);
|
||||||
|
// throw new MsgException("身份证、银行卡或预留手机号信息不正确");
|
||||||
|
// } else {
|
||||||
|
// bank4Cache.setStatus(Bank4Cache.STATUS_PASS);
|
||||||
|
// bank4CacheService.save(bank4Cache);
|
||||||
|
// }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1251,8 +1251,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||||
}
|
}
|
||||||
|
|
||||||
Notice notice = new Notice(1, 5, userApp);
|
Notice notice = new Notice(1, 5, userApp);
|
||||||
|
//TODO 银行卡认证先绕过四要素检测
|
||||||
try {
|
try {
|
||||||
aliyunService.checkBankCorrect(bankInfoDTO.getPhone(), bankInfoDTO.getBankCardNo(), idCard.getCertNo(), idCard.getCertName());
|
aliyunService.checkBankCorrectNow(bankInfoDTO.getPhone(), bankInfoDTO.getBankCardNo(), idCard.getCertNo(), idCard.getCertName());
|
||||||
} catch (MsgException e) {
|
} catch (MsgException e) {
|
||||||
notice = new Notice(1, 5, userApp);
|
notice = new Notice(1, 5, userApp);
|
||||||
notice.setConrtent("很遗憾你的银行卡认证未通过,请您核对信息后重新提交审核!");
|
notice.setConrtent("很遗憾你的银行卡认证未通过,请您核对信息后重新提交审核!");
|
||||||
|
|
@ -1303,9 +1304,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||||
uaService.updateById(userApp);
|
uaService.updateById(userApp);
|
||||||
|
|
||||||
// 调用极光通知推送
|
// 调用极光通知推送
|
||||||
List<String> alias = new ArrayList<>();
|
// List<String> alias = new ArrayList<>();
|
||||||
alias.add(userApp.getUserId().toString());
|
// alias.add(userApp.getUserId().toString());
|
||||||
generalPushUtil.sendAllPlatByAlias(alias, "银行卡认证通知", "审核通过", "1");
|
// generalPushUtil.sendAllPlatByAlias(alias, "银行卡认证通知", "审核通过", "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in New Issue