提交修改
This commit is contained in:
parent
35852c761f
commit
46dfc2be06
@ -327,9 +327,8 @@ public class ApiConstants {
|
||||
|
||||
|
||||
|
||||
public static final String bankcard_verification_2 = "bankcard_verification_2";
|
||||
public static final String bankcard_verification_3 = "bankcard_verification_3";
|
||||
public static final String bankcard_verification_4 = "bankcard_verification_4";
|
||||
public static final String mobile_verification_3 = "mobile_verification_3";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,54 @@
|
||||
package com.heyu.api.data.dao.api;
|
||||
/**
|
||||
* <p>
|
||||
* 账户表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author quyixiao
|
||||
* @since 2025-04-19
|
||||
*/
|
||||
import com.heyu.api.data.entity.api.ApiMobileMetaEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.lz.mybatis.plugin.annotations.LIMIT;
|
||||
import com.lz.mybatis.plugin.annotations.Plus;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@Mapper
|
||||
public interface ApiMobileMetaDao extends BaseMapper<ApiMobileMetaEntity> {
|
||||
|
||||
|
||||
ApiMobileMetaEntity selectApiMobileMetaById(@Param("id")Long id);
|
||||
|
||||
|
||||
Long insertApiMobileMeta(ApiMobileMetaEntity apiMobileMeta);
|
||||
|
||||
|
||||
Long insertOrUpdateApiMobileMeta(ApiMobileMetaEntity apiMobileMeta);
|
||||
|
||||
|
||||
int updateApiMobileMetaById(ApiMobileMetaEntity apiMobileMeta);
|
||||
|
||||
|
||||
int updateCoverApiMobileMetaById(ApiMobileMetaEntity apiMobileMeta);
|
||||
|
||||
|
||||
int deleteApiMobileMetaById(@Param("id")Long id);
|
||||
|
||||
|
||||
@LIMIT
|
||||
ApiMobileMetaEntity selectApiMobileMetaByMobileRealNameChannelEnableStatus(String mobile, String realName, String channel,Integer enableStatus);
|
||||
|
||||
|
||||
|
||||
|
||||
@LIMIT
|
||||
ApiMobileMetaEntity selectApiMobileMetaByMobileRealNameIdCardNumberChannelEnableStatus(String mobile, String realName,String idCardNumber, String channel,Integer enableStatus);
|
||||
|
||||
|
||||
|
||||
|
||||
int updateApiMobileMetaUseCountById(@Plus Long useCount, Long id);
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,239 @@
|
||||
package com.heyu.api.data.entity.api;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.lz.mybatis.plugin.annotations.AS;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;import java.util.Date;
|
||||
/**
|
||||
*账户表
|
||||
* @author quyixiao
|
||||
* @since 2025-04-19
|
||||
*/
|
||||
|
||||
@Data
|
||||
@TableName("api_mobile_meta")
|
||||
public class ApiMobileMetaEntity implements java.io.Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public final static String CLASS_NAME ="com.heyu.api.data.entity.api.ApiMobileMetaEntity:";
|
||||
|
||||
public final static String all = CLASS_NAME + "*";
|
||||
public final static String id_ = CLASS_NAME + "id"; // 主键id
|
||||
public final static String is_delete = CLASS_NAME + "is_delete"; // 是否删除:0 否 1 删除
|
||||
public final static String create_time = CLASS_NAME + "create_time"; // 创建时间
|
||||
public final static String modify_time = CLASS_NAME + "modify_time"; // 修改时间
|
||||
public final static String mobile_ = CLASS_NAME + "mobile"; // 身份证
|
||||
public final static String real_name = CLASS_NAME + "real_name"; // 真实姓名
|
||||
public final static String id_card_number = CLASS_NAME + "id_card_number"; // 身份证号码
|
||||
public final static String api_result = CLASS_NAME + "api_result"; // 结果
|
||||
public final static String channel_ = CLASS_NAME + "channel"; // 渠道
|
||||
public final static String use_count = CLASS_NAME + "use_count"; // 使用次数
|
||||
public final static String enable_status = CLASS_NAME + "enable_status"; // 0 不可用,1 可用
|
||||
//主键id
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
//是否删除:0 否 1 删除
|
||||
private Integer isDelete;
|
||||
//创建时间
|
||||
private Date createTime;
|
||||
//修改时间
|
||||
private Date modifyTime;
|
||||
//身份证
|
||||
private String mobile;
|
||||
//真实姓名
|
||||
private String realName;
|
||||
//身份证号码
|
||||
private String idCardNumber;
|
||||
//结果
|
||||
private String apiResult;
|
||||
//渠道
|
||||
private String channel;
|
||||
//使用次数
|
||||
private Long useCount;
|
||||
//0 不可用,1 可用
|
||||
private Integer enableStatus;
|
||||
/**
|
||||
* 主键id
|
||||
* @return
|
||||
*/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
/**
|
||||
* 主键id
|
||||
* @param id
|
||||
*/
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否删除:0 否 1 删除
|
||||
* @return
|
||||
*/
|
||||
public Integer getIsDelete() {
|
||||
return isDelete;
|
||||
}
|
||||
/**
|
||||
* 是否删除:0 否 1 删除
|
||||
* @param isDelete
|
||||
*/
|
||||
public void setIsDelete(Integer isDelete) {
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
* @return
|
||||
*/
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
/**
|
||||
* 创建时间
|
||||
* @param createTime
|
||||
*/
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
* @return
|
||||
*/
|
||||
public Date getModifyTime() {
|
||||
return modifyTime;
|
||||
}
|
||||
/**
|
||||
* 修改时间
|
||||
* @param modifyTime
|
||||
*/
|
||||
public void setModifyTime(Date modifyTime) {
|
||||
this.modifyTime = modifyTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 身份证
|
||||
* @return
|
||||
*/
|
||||
public String getMobile() {
|
||||
return mobile;
|
||||
}
|
||||
/**
|
||||
* 身份证
|
||||
* @param mobile
|
||||
*/
|
||||
public void setMobile(String mobile) {
|
||||
this.mobile = mobile;
|
||||
}
|
||||
|
||||
/**
|
||||
* 真实姓名
|
||||
* @return
|
||||
*/
|
||||
public String getRealName() {
|
||||
return realName;
|
||||
}
|
||||
/**
|
||||
* 真实姓名
|
||||
* @param realName
|
||||
*/
|
||||
public void setRealName(String realName) {
|
||||
this.realName = realName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 身份证号码
|
||||
* @return
|
||||
*/
|
||||
public String getIdCardNumber() {
|
||||
return idCardNumber;
|
||||
}
|
||||
/**
|
||||
* 身份证号码
|
||||
* @param idCardNumber
|
||||
*/
|
||||
public void setIdCardNumber(String idCardNumber) {
|
||||
this.idCardNumber = idCardNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* 结果
|
||||
* @return
|
||||
*/
|
||||
public String getApiResult() {
|
||||
return apiResult;
|
||||
}
|
||||
/**
|
||||
* 结果
|
||||
* @param apiResult
|
||||
*/
|
||||
public void setApiResult(String apiResult) {
|
||||
this.apiResult = apiResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 渠道
|
||||
* @return
|
||||
*/
|
||||
public String getChannel() {
|
||||
return channel;
|
||||
}
|
||||
/**
|
||||
* 渠道
|
||||
* @param channel
|
||||
*/
|
||||
public void setChannel(String channel) {
|
||||
this.channel = channel;
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用次数
|
||||
* @return
|
||||
*/
|
||||
public Long getUseCount() {
|
||||
return useCount;
|
||||
}
|
||||
/**
|
||||
* 使用次数
|
||||
* @param useCount
|
||||
*/
|
||||
public void setUseCount(Long useCount) {
|
||||
this.useCount = useCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 0 不可用,1 可用
|
||||
* @return
|
||||
*/
|
||||
public Integer getEnableStatus() {
|
||||
return enableStatus;
|
||||
}
|
||||
/**
|
||||
* 0 不可用,1 可用
|
||||
* @param enableStatus
|
||||
*/
|
||||
public void setEnableStatus(Integer enableStatus) {
|
||||
this.enableStatus = enableStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ApiMobileMetaEntity{" +
|
||||
",id=" + id +
|
||||
",isDelete=" + isDelete +
|
||||
",createTime=" + createTime +
|
||||
",modifyTime=" + modifyTime +
|
||||
",mobile=" + mobile +
|
||||
",realName=" + realName +
|
||||
",idCardNumber=" + idCardNumber +
|
||||
",apiResult=" + apiResult +
|
||||
",channel=" + channel +
|
||||
",useCount=" + useCount +
|
||||
",enableStatus=" + enableStatus +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package com.heyu.api.data.service.api;
|
||||
/**
|
||||
* <p>
|
||||
* 账户表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author quyixiao
|
||||
* @since 2025-04-19
|
||||
*/
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.heyu.api.data.entity.api.ApiMobileMetaEntity;
|
||||
public interface ApiMobileMetaService extends IService<ApiMobileMetaEntity> {
|
||||
|
||||
|
||||
|
||||
ApiMobileMetaEntity selectApiMobileMetaById(Long id);
|
||||
|
||||
|
||||
Long insertApiMobileMeta(ApiMobileMetaEntity apiMobileMeta);
|
||||
|
||||
|
||||
Long insertOrUpdateApiMobileMeta(ApiMobileMetaEntity apiMobileMeta);
|
||||
|
||||
|
||||
int updateApiMobileMetaById(ApiMobileMetaEntity apiMobileMeta);
|
||||
|
||||
|
||||
int updateCoverApiMobileMetaById(ApiMobileMetaEntity apiMobileMeta);
|
||||
|
||||
|
||||
int deleteApiMobileMetaById(Long id);
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
package com.heyu.api.data.service.impl.api;
|
||||
/**
|
||||
* <p>
|
||||
* 账户表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author quyixiao
|
||||
* @since 2025-04-19
|
||||
*/
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.heyu.api.data.dao.api.ApiMobileMetaDao;
|
||||
import com.heyu.api.data.entity.api.ApiMobileMetaEntity;
|
||||
import com.heyu.api.data.service.api.ApiMobileMetaService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class ApiMobileMetaServiceImpl extends ServiceImpl<ApiMobileMetaDao, ApiMobileMetaEntity> implements ApiMobileMetaService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private ApiMobileMetaDao apiMobileMetaDao;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public ApiMobileMetaEntity selectApiMobileMetaById(Long id){
|
||||
return apiMobileMetaDao.selectApiMobileMetaById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Long insertApiMobileMeta(ApiMobileMetaEntity apiMobileMeta){
|
||||
return apiMobileMetaDao.insertApiMobileMeta(apiMobileMeta);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Long insertOrUpdateApiMobileMeta(ApiMobileMetaEntity apiMobileMeta){
|
||||
return apiMobileMetaDao.insertOrUpdateApiMobileMeta(apiMobileMeta);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int updateApiMobileMetaById(ApiMobileMetaEntity apiMobileMeta){
|
||||
return apiMobileMetaDao.updateApiMobileMetaById(apiMobileMeta);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int updateCoverApiMobileMetaById(ApiMobileMetaEntity apiMobileMeta){
|
||||
return apiMobileMetaDao.updateCoverApiMobileMetaById(apiMobileMeta);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int deleteApiMobileMetaById(Long id){
|
||||
return apiMobileMetaDao.deleteApiMobileMetaById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -61,7 +61,7 @@ public class ApiRechargeMoneyServiceImpl extends ServiceImpl<ApiRechargeMoneyDao
|
||||
@Override
|
||||
public void addUseCountAndSendWarnMsg(String scene, int count) {
|
||||
ApiRechargeMoneyEntity apiRechargeMoney = apiRechargeMoneyDao.selectApiRechargeMoneyByScene(scene);
|
||||
if (apiRechargeMoney.getCurrentCount() <= apiRechargeMoney.getWarnCount()) {
|
||||
if (apiRechargeMoney !=null && apiRechargeMoney.getCurrentCount() <= apiRechargeMoney.getWarnCount()) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(apiRechargeMoney.getSceneName()).append("\n")
|
||||
.append("当前预警域值:").append(apiRechargeMoney.getWarnCount()).append("\n")
|
||||
|
||||
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.heyu.api.data.dao.api.ApiMobileMetaDao">
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -93,7 +93,7 @@ public class MysqlMain_insert {
|
||||
System.out.println(MysqlMain_insert.save_path);
|
||||
List<TablesBean> list = new ArrayList<TablesBean>();
|
||||
|
||||
list.add(new TablesBean("api_bank_card"));
|
||||
list.add(new TablesBean("api_mobile_meta"));
|
||||
|
||||
|
||||
List<TablesBean> list2 = new ArrayList<TablesBean>();
|
||||
|
||||
@ -122,7 +122,7 @@ public class ABank2MetaVerifyHandle extends AlibabaBaseHandle<ABank4MetaVerifyRe
|
||||
apiBankCardDao.insertApiBankCard(apiBankCard);
|
||||
|
||||
|
||||
apiRechargeMoneyService.addUseCountAndSendWarnMsg(ApiConstants.bankcard_verification_2, 1);
|
||||
apiRechargeMoneyService.addUseCountAndSendWarnMsg(ApiConstants.bankcard_verification_4, 1);
|
||||
|
||||
TBankMetaVerifyResponse bank2MetaVerifyResponse = JSONObject.parseObject(result, TBankMetaVerifyResponse.class);
|
||||
log.info("bankMetaVerifyRequest json : {}", result);
|
||||
|
||||
@ -137,7 +137,7 @@ public class ABank3MetaVerifyHandle extends AlibabaBaseHandle<ABank4MetaVerifyRe
|
||||
|
||||
apiBankCardDao.insertApiBankCard(apiBankCard);
|
||||
|
||||
apiRechargeMoneyService.addUseCountAndSendWarnMsg(ApiConstants.bankcard_verification_3, 1);
|
||||
apiRechargeMoneyService.addUseCountAndSendWarnMsg(ApiConstants.bankcard_verification_4, 1);
|
||||
|
||||
TBankMetaVerifyResponse bank2MetaVerifyResponse = JSONObject.parseObject(result, TBankMetaVerifyResponse.class);
|
||||
log.info("ABank3MetaVerifyHandle json : {}", result);
|
||||
|
||||
@ -4,6 +4,7 @@ package com.heyu.api.tencent;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.heyu.api.data.utils.ApiR;
|
||||
import com.heyu.api.data.utils.StringUtils;
|
||||
import com.heyu.api.tencent.resp.TMobile3MetaVerificationResp;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@ -51,4 +52,25 @@ public abstract class TencentBaseHandle<P, RR> {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public boolean checkMobileResp(TMobile3MetaVerificationResp bank2MetaVerifyResponse) {
|
||||
if (bank2MetaVerifyResponse != null) {
|
||||
if (bank2MetaVerifyResponse.getCode() == 400) {
|
||||
return true;
|
||||
|
||||
}
|
||||
if (bank2MetaVerifyResponse.getData() != null) {
|
||||
if ("1".equals(bank2MetaVerifyResponse.getData().getResult())
|
||||
|| "2".equals(bank2MetaVerifyResponse.getData().getResult())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,120 @@
|
||||
package com.heyu.api.tencent.handle;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.heyu.api.data.constants.ApiConstants;
|
||||
import com.heyu.api.data.dao.api.ApiMobileMetaDao;
|
||||
import com.heyu.api.data.entity.api.ApiMobileMetaEntity;
|
||||
import com.heyu.api.data.service.api.ApiRechargeMoneyService;
|
||||
import com.heyu.api.data.utils.StringUtils;
|
||||
import com.heyu.api.tencent.TencentBaseHandle;
|
||||
import com.heyu.api.tencent.request.TMobile3MetaVerificationRequest;
|
||||
import com.heyu.api.tencent.resp.TMobile3MetaVerificationResp;
|
||||
import com.heyu.api.utils.HttpUtils;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/***
|
||||
* https://market.aliyun.com/apimarket/detail/cmapi00066757#sku=yuncode6075700003
|
||||
*
|
||||
*身份信息认证(二要素核验)
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class TMobile2MetaHandle extends TencentBaseHandle<TMobile3MetaVerificationRequest, TMobile3MetaVerificationResp> {
|
||||
|
||||
|
||||
@Autowired
|
||||
private ApiMobileMetaDao apiMobileMetaDao;
|
||||
|
||||
@Autowired
|
||||
private ApiRechargeMoneyService apiRechargeMoneyService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String check(TMobile3MetaVerificationRequest tMobile3MetaVerificationRequest) {
|
||||
|
||||
if (StringUtils.isBlank(tMobile3MetaVerificationRequest.getMobile())
|
||||
|| StringUtils.isBlank(tMobile3MetaVerificationRequest.getRealName())) {
|
||||
|
||||
|
||||
return "手机号 + 真实姓名不能为空";
|
||||
}
|
||||
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public TMobile3MetaVerificationResp run(TMobile3MetaVerificationRequest ap) throws Exception {
|
||||
TMobile3MetaVerificationResp resp = null;
|
||||
|
||||
ApiMobileMetaEntity apiMobileMeta = apiMobileMetaDao.selectApiMobileMetaByMobileRealNameChannelEnableStatus(ap.getMobile(), ap.getRealName(), ApiConstants.third, 1);
|
||||
if (apiMobileMeta != null) {
|
||||
|
||||
resp = JSONObject.parseObject(apiMobileMeta.getApiResult(), TMobile3MetaVerificationResp.class);
|
||||
|
||||
|
||||
apiMobileMetaDao.updateApiMobileMetaUseCountById(1L, apiMobileMeta.getId());
|
||||
return resp;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
String host = "https://kzmobilev2.market.alicloudapi.com";
|
||||
String path = "/api-mall/mobile_two/check";
|
||||
String method = "POST";
|
||||
String appcode = ApiConstants.APP_CODE;
|
||||
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
//最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
|
||||
headers.put("Authorization", "APPCODE " + appcode);
|
||||
//根据API的要求,定义相对应的Content-Type
|
||||
headers.put("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
|
||||
Map<String, String> querys = new HashMap<String, String>();
|
||||
Map<String, String> bodys = new HashMap<String, String>();
|
||||
bodys.put("mobile", ap.getMobile());
|
||||
bodys.put("name", ap.getRealName());
|
||||
/**
|
||||
*
|
||||
*
|
||||
* 重要提示如下:
|
||||
* HttpUtils请从
|
||||
* https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/src/main/java/com/aliyun/api/gateway/demo/util/HttpUtils.java
|
||||
* 下载
|
||||
*
|
||||
* 相应的依赖请参照
|
||||
* https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/pom.xml
|
||||
*/
|
||||
HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys);
|
||||
|
||||
//获取response的body
|
||||
String result = EntityUtils.toString(response.getEntity());
|
||||
|
||||
apiMobileMeta = new ApiMobileMetaEntity();
|
||||
apiMobileMeta.setMobile(ap.getMobile());
|
||||
apiMobileMeta.setRealName(ap.getRealName());
|
||||
apiMobileMeta.setChannel(ApiConstants.third);
|
||||
apiMobileMeta.setEnableStatus(1);
|
||||
apiMobileMeta.setApiResult(result);
|
||||
apiMobileMetaDao.insertApiMobileMeta(apiMobileMeta);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
apiRechargeMoneyService.addUseCountAndSendWarnMsg(ApiConstants.mobile_verification_3, 1);
|
||||
|
||||
|
||||
resp = JSONObject.parseObject(result, TMobile3MetaVerificationResp.class);
|
||||
return resp;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,112 @@
|
||||
package com.heyu.api.tencent.handle;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.heyu.api.data.constants.ApiConstants;
|
||||
import com.heyu.api.data.dao.api.ApiMobileMetaDao;
|
||||
import com.heyu.api.data.entity.api.ApiMobileMetaEntity;
|
||||
import com.heyu.api.data.service.api.ApiRechargeMoneyService;
|
||||
import com.heyu.api.data.utils.StringUtils;
|
||||
import com.heyu.api.tencent.TencentBaseHandle;
|
||||
import com.heyu.api.tencent.request.TMobile3MetaVerificationRequest;
|
||||
import com.heyu.api.tencent.resp.TMobile3MetaVerificationResp;
|
||||
import com.heyu.api.utils.HttpUtils;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/***
|
||||
* https://market.aliyun.com/apimarket/detail/cmapi00066757#sku=yuncode6075700003
|
||||
*
|
||||
*身份信息认证(二要素核验)
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class TMobile3MetaHandle extends TencentBaseHandle<TMobile3MetaVerificationRequest, TMobile3MetaVerificationResp> {
|
||||
|
||||
|
||||
@Autowired
|
||||
private ApiMobileMetaDao apiMobileMetaDao;
|
||||
|
||||
@Autowired
|
||||
private ApiRechargeMoneyService apiRechargeMoneyService;
|
||||
|
||||
|
||||
@Override
|
||||
public String check(TMobile3MetaVerificationRequest tMobile3MetaVerificationRequest) {
|
||||
|
||||
|
||||
if (StringUtils.isBlank(tMobile3MetaVerificationRequest.getMobile())
|
||||
|| StringUtils.isBlank(tMobile3MetaVerificationRequest.getRealName())
|
||||
|| StringUtils.isBlank(tMobile3MetaVerificationRequest.getIdCardNumber())
|
||||
|
||||
) {
|
||||
|
||||
|
||||
return "手机号 + 真实姓名 + 身份证号 不能为空";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TMobile3MetaVerificationResp run(TMobile3MetaVerificationRequest ap) throws Exception {
|
||||
ApiMobileMetaEntity apiMobileMeta2 = apiMobileMetaDao.selectApiMobileMetaByMobileRealNameChannelEnableStatus(ap.getMobile(), ap.getRealName(), ApiConstants.third, 1);
|
||||
if (apiMobileMeta2 != null) {
|
||||
TMobile3MetaVerificationResp resp = JSONObject.parseObject(apiMobileMeta2.getApiResult(), TMobile3MetaVerificationResp.class);
|
||||
// 如果二要素都失败,那直接返回 ,这样增加撞库的次数,节约成本
|
||||
if (checkMobileResp(resp)) {
|
||||
apiMobileMetaDao.updateApiMobileMetaUseCountById(1L, apiMobileMeta2.getId());
|
||||
return resp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TMobile3MetaVerificationResp resp = null;
|
||||
ApiMobileMetaEntity apiMobileMeta = apiMobileMetaDao.selectApiMobileMetaByMobileRealNameIdCardNumberChannelEnableStatus(ap.getMobile(), ap.getRealName(), ap.getIdCardNumber(), ApiConstants.third, 1);
|
||||
if (apiMobileMeta != null) {
|
||||
resp = JSONObject.parseObject(apiMobileMeta.getApiResult(), TMobile3MetaVerificationResp.class);
|
||||
apiMobileMetaDao.updateApiMobileMetaUseCountById(1L, apiMobileMeta.getId());
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
||||
String host = "https://kzmobilev2.market.alicloudapi.com";
|
||||
String path = "/api/mobile_three/check";
|
||||
String method = "GET";
|
||||
String appcode = ApiConstants.APP_CODE;
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
//最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
|
||||
headers.put("Authorization", "APPCODE " + appcode);
|
||||
Map<String, String> querys = new HashMap<String, String>();
|
||||
querys.put("mobile", ap.getMobile());
|
||||
querys.put("name", ap.getRealName());
|
||||
querys.put("idcard", ap.getIdCardNumber());
|
||||
|
||||
|
||||
HttpResponse response = HttpUtils.doGet(host, path, method, headers, querys);
|
||||
|
||||
//获取response的body
|
||||
String result = EntityUtils.toString(response.getEntity());
|
||||
|
||||
|
||||
apiMobileMeta = new ApiMobileMetaEntity();
|
||||
apiMobileMeta.setMobile(ap.getMobile());
|
||||
apiMobileMeta.setRealName(ap.getRealName());
|
||||
apiMobileMeta.setIdCardNumber(ap.getIdCardNumber());
|
||||
|
||||
apiMobileMeta.setChannel(ApiConstants.third);
|
||||
apiMobileMeta.setEnableStatus(1);
|
||||
apiMobileMeta.setApiResult(result);
|
||||
apiMobileMetaDao.insertApiMobileMeta(apiMobileMeta);
|
||||
|
||||
|
||||
apiRechargeMoneyService.addUseCountAndSendWarnMsg(ApiConstants.mobile_verification_3, 1);
|
||||
|
||||
resp = JSONObject.parseObject(result, TMobile3MetaVerificationResp.class);
|
||||
return resp;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
package com.heyu.api.tencent.request;
|
||||
|
||||
import com.heyu.api.tencent.TencentBaseRequest;
|
||||
import lombok.Data;
|
||||
|
||||
/****
|
||||
* https://console.cloud.tencent.com/api/explorer?Product=faceid&Version=2018-03-01&Action=PhoneVerification
|
||||
*
|
||||
* 手机号三要素核验
|
||||
*/
|
||||
@Data
|
||||
public class TMobile3MetaVerificationRequest extends TencentBaseRequest {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/***
|
||||
* 是 String 手机号。
|
||||
* 示例值:16137688175
|
||||
*/
|
||||
private String mobile;
|
||||
|
||||
|
||||
/***
|
||||
* 姓名。
|
||||
* 示例值:韦小宝
|
||||
*/
|
||||
private String realName;
|
||||
|
||||
|
||||
/***
|
||||
*是 String 身份证号。
|
||||
* 示例值:11204416541220243X
|
||||
*/
|
||||
private String idCardNumber;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package com.heyu.api.tencent.resp;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/***
|
||||
* {
|
||||
* "msg": "成功",
|
||||
* "success": true,
|
||||
* "code": 200,
|
||||
* "data": {
|
||||
* "result": "0", //0一致 ,1不一致,2库无或销户
|
||||
* "orderNo": "202406282055560705659",
|
||||
* "desc": "一致"
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class TMobile3MetaVerificationResp {
|
||||
|
||||
|
||||
@JsonProperty("msg")
|
||||
private String msg;
|
||||
@JsonProperty("success")
|
||||
private Boolean success;
|
||||
@JsonProperty("code")
|
||||
private Integer code;
|
||||
@JsonProperty("data")
|
||||
private DataDTO data;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public static class DataDTO {
|
||||
@JsonProperty("result")
|
||||
private String result;
|
||||
@JsonProperty("orderNo")
|
||||
private String orderNo;
|
||||
@JsonProperty("desc")
|
||||
private String desc;
|
||||
}
|
||||
}
|
||||
@ -26,10 +26,12 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
*
|
||||
*
|
||||
*
|
||||
* https://marketnext.console.aliyun.com/bizlist
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/bank/card/4")
|
||||
@RequestMapping("/bank/card/234")
|
||||
@NotIntercept
|
||||
public class BankCard234MetaController extends BaseController {
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ public class BankCard4MetaController extends BaseController {
|
||||
public static final String SUCCESS_MSG = "银⾏卡号+姓名+身份证号+手机号信息匹配";
|
||||
public static final String FAILED_MSG = "银⾏卡号+姓名+身份证号码+手机号信息不匹配";
|
||||
|
||||
// http://localhost:8888/bank/card/4/verify?bankCard=6214855713516769&realName=%E7%9E%BF%E8%B4%BB%E6%99%93&idCardNumber=430529199209255030&mobile=18458195149
|
||||
// http://localhost:8888/bank/card/4/verify?bankCard=6214855713516769&realName=瞿贻晓&idCardNumber=430529199209255030&mobile=18458195149
|
||||
@RequestMapping("/verify")
|
||||
@EbAuthentication(tencent = ApiConstants.TENCENT_AUTH)
|
||||
public R verify(ABank4MetaVerifyRequest bankCard4MetaRequest) {
|
||||
|
||||
@ -0,0 +1,97 @@
|
||||
package com.heyu.api.controller.mobile;
|
||||
|
||||
import com.heyu.api.data.annotation.EbAuthentication;
|
||||
import com.heyu.api.data.annotation.NotIntercept;
|
||||
import com.heyu.api.data.constants.ApiConstants;
|
||||
import com.heyu.api.data.utils.ApiR;
|
||||
import com.heyu.api.data.utils.R;
|
||||
import com.heyu.api.data.utils.StringUtils;
|
||||
import com.heyu.api.resp.certificate.MobileMetaResp;
|
||||
import com.heyu.api.tencent.handle.TMobile2MetaHandle;
|
||||
import com.heyu.api.tencent.handle.TMobile3MetaHandle;
|
||||
import com.heyu.api.tencent.request.TMobile3MetaVerificationRequest;
|
||||
import com.heyu.api.tencent.resp.TMobile3MetaVerificationResp;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/***
|
||||
*手机号三要素核验
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/mobile/23/meta")
|
||||
|
||||
@NotIntercept
|
||||
public class Mobile23MetaVerificationController {
|
||||
|
||||
|
||||
public static final String SUCCESS_MSG = "信息匹配";
|
||||
public static final String FAILED_MSG = "信息不匹配";
|
||||
|
||||
|
||||
@Autowired
|
||||
private TMobile2MetaHandle tMobile2MetaHandle;
|
||||
|
||||
|
||||
@Autowired
|
||||
private TMobile3MetaHandle tMobile3MetaHandle;
|
||||
|
||||
|
||||
@RequestMapping("/verification")
|
||||
@EbAuthentication(tencent = ApiConstants.TENCENT_AUTH)
|
||||
public R verification(TMobile3MetaVerificationRequest request) {
|
||||
return doVerify(request);
|
||||
}
|
||||
|
||||
|
||||
public R doVerify(TMobile3MetaVerificationRequest request) {
|
||||
MobileMetaResp mobileMetaResp = new MobileMetaResp();
|
||||
ApiR<TMobile3MetaVerificationResp> tR = null;
|
||||
|
||||
|
||||
if (StringUtils.isNotBlank(request.getMobile())
|
||||
&& StringUtils.isNotBlank(request.getRealName())
|
||||
&& StringUtils.isNotBlank(request.getIdCardNumber())
|
||||
) {
|
||||
tR = tMobile3MetaHandle.handle(request);
|
||||
} else if (StringUtils.isNotBlank(request.getMobile())
|
||||
&& StringUtils.isNotBlank(request.getRealName())
|
||||
) {
|
||||
tR = tMobile2MetaHandle.handle(request);
|
||||
} else {
|
||||
return R.error("手机号 + 姓名 不能为空");
|
||||
}
|
||||
|
||||
|
||||
if (tR.isSuccess()) {
|
||||
TMobile3MetaVerificationResp bankMetaVerifyResponse = tR.getData();
|
||||
|
||||
if (bankMetaVerifyResponse != null) {
|
||||
if (bankMetaVerifyResponse.getCode() == 400) {
|
||||
mobileMetaResp.setCheckResult(ApiConstants.FAILED);
|
||||
mobileMetaResp.setDesc(bankMetaVerifyResponse.getMsg());
|
||||
return R.ok().setData(mobileMetaResp);
|
||||
}
|
||||
|
||||
if (bankMetaVerifyResponse.getCode() == 200 && bankMetaVerifyResponse.getData() != null) {
|
||||
String result = bankMetaVerifyResponse.getData().getResult();
|
||||
if ("0".equals(result)) {
|
||||
mobileMetaResp.setCheckResult(ApiConstants.SUCCESS);
|
||||
mobileMetaResp.setDesc(SUCCESS_MSG);
|
||||
} else if ("1".equals(result)) {
|
||||
mobileMetaResp.setCheckResult(ApiConstants.FAILED);
|
||||
mobileMetaResp.setDesc(FAILED_MSG);
|
||||
} else {
|
||||
mobileMetaResp.setCheckResult(result + "");
|
||||
mobileMetaResp.setDesc(bankMetaVerifyResponse.getData().getDesc());
|
||||
}
|
||||
}
|
||||
return R.ok().setData(mobileMetaResp);
|
||||
}
|
||||
}
|
||||
return R.error(tR.getErrorMsg());
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,21 +1,19 @@
|
||||
package com.heyu.api.controller.mobile;
|
||||
|
||||
import com.heyu.api.request.mobile.Mobile2MetaVerificationRequest;
|
||||
import com.heyu.api.resp.mobile.Mobile3MetaVerificationResp;
|
||||
import com.heyu.api.data.annotation.EbAuthentication;
|
||||
import com.heyu.api.data.annotation.NotIntercept;
|
||||
import com.heyu.api.data.constants.ApiConstants;
|
||||
import com.heyu.api.data.utils.ApiR;
|
||||
import com.heyu.api.data.utils.R;
|
||||
import com.heyu.api.tencent.handle.TCheckPhoneAndNameHandle;
|
||||
import com.heyu.api.tencent.request.TCheckPhoneAndNameRequest;
|
||||
import com.tencentcloudapi.faceid.v20180301.models.CheckPhoneAndNameResponse;
|
||||
import com.heyu.api.resp.certificate.MobileMetaResp;
|
||||
import com.heyu.api.tencent.handle.TMobile2MetaHandle;
|
||||
import com.heyu.api.tencent.request.TMobile3MetaVerificationRequest;
|
||||
import com.heyu.api.tencent.resp.TMobile3MetaVerificationResp;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/***
|
||||
* 手机号二要素核验
|
||||
*/
|
||||
@ -27,43 +25,54 @@ import java.util.Map;
|
||||
public class Mobile2MetaVerificationController {
|
||||
|
||||
|
||||
public final static Map<String, String> checkResult = new HashMap<>();
|
||||
public static final String SUCCESS_MSG = "银⾏卡号+姓名信息匹配";
|
||||
public static final String FAILED_MSG = "银⾏卡号+姓名信息不匹配";
|
||||
|
||||
|
||||
@Autowired
|
||||
private TCheckPhoneAndNameHandle tCheckPhoneAndNameHandle;
|
||||
private TMobile2MetaHandle tMobile2MetaHandle;
|
||||
|
||||
|
||||
@RequestMapping("/verification")
|
||||
public R verification(Mobile2MetaVerificationRequest request) {
|
||||
Mobile3MetaVerificationResp resp = new Mobile3MetaVerificationResp("1");
|
||||
TCheckPhoneAndNameRequest tPhone3MetaVerificationRequest = new TCheckPhoneAndNameRequest();
|
||||
tPhone3MetaVerificationRequest.setMobile(request.getMobile());
|
||||
@RequestMapping("/verify")
|
||||
@EbAuthentication(tencent = ApiConstants.TENCENT_AUTH)
|
||||
public R verify(TMobile3MetaVerificationRequest request) {
|
||||
|
||||
tPhone3MetaVerificationRequest.setName(request.getRealName());
|
||||
return doVerify(request);
|
||||
}
|
||||
|
||||
ApiR<CheckPhoneAndNameResponse> tR = tCheckPhoneAndNameHandle.handle(tPhone3MetaVerificationRequest);
|
||||
|
||||
|
||||
// http://localhost:8888/mobile/2/meta/verify?mobile=18458195149&realName=瞿贻晓
|
||||
public R doVerify(TMobile3MetaVerificationRequest request) {
|
||||
MobileMetaResp mobileMetaResp = new MobileMetaResp();
|
||||
ApiR<TMobile3MetaVerificationResp> tR = tMobile2MetaHandle.handle(request);
|
||||
if (tR.isSuccess()) {
|
||||
CheckPhoneAndNameResponse response = tR.getData();
|
||||
resp.setCheckResult(response.getResult());
|
||||
resp.setDesc(checkResult.get(response.getResult()));
|
||||
resp.setDescription(response.getDescription());
|
||||
return R.ok().setData(resp);
|
||||
TMobile3MetaVerificationResp bankMetaVerifyResponse = tR.getData();
|
||||
|
||||
if (bankMetaVerifyResponse != null) {
|
||||
if (bankMetaVerifyResponse.getCode() == 400) {
|
||||
mobileMetaResp.setCheckResult(ApiConstants.FAILED);
|
||||
mobileMetaResp.setDesc(bankMetaVerifyResponse.getMsg());
|
||||
return R.ok().setData(mobileMetaResp);
|
||||
}
|
||||
|
||||
if (bankMetaVerifyResponse.getCode() == 200 && bankMetaVerifyResponse.getData() != null) {
|
||||
String result = bankMetaVerifyResponse.getData().getResult();
|
||||
if ("0".equals(result)) {
|
||||
mobileMetaResp.setCheckResult(ApiConstants.SUCCESS);
|
||||
mobileMetaResp.setDesc(SUCCESS_MSG);
|
||||
} else if ("1".equals(result)) {
|
||||
mobileMetaResp.setCheckResult(ApiConstants.FAILED);
|
||||
mobileMetaResp.setDesc(FAILED_MSG);
|
||||
} else {
|
||||
mobileMetaResp.setCheckResult(result + "");
|
||||
mobileMetaResp.setDesc(bankMetaVerifyResponse.getData().getDesc());
|
||||
}
|
||||
}
|
||||
return R.ok().setData(mobileMetaResp);
|
||||
}
|
||||
}
|
||||
return R.error(tR.getErrorMsg());
|
||||
}
|
||||
|
||||
|
||||
static {
|
||||
checkResult.put("0", "验证结果一致");
|
||||
checkResult.put("1", "验证结果不一致");
|
||||
checkResult.put("-1", "查无记录");
|
||||
checkResult.put("-2", "引擎未知错误");
|
||||
checkResult.put("-3", "引擎服务异常");
|
||||
checkResult.put("-4", "姓名校验不通过");
|
||||
checkResult.put("-5", "手机号码不合法");
|
||||
checkResult.put("-6", " 认证次数超过当日限制,请次日重试");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,21 +1,19 @@
|
||||
package com.heyu.api.controller.mobile;
|
||||
|
||||
import com.heyu.api.request.mobile.Mobile3MetaVerificationRequest;
|
||||
import com.heyu.api.resp.mobile.Mobile3MetaVerificationResp;
|
||||
import com.heyu.api.data.annotation.EbAuthentication;
|
||||
import com.heyu.api.data.annotation.NotIntercept;
|
||||
import com.heyu.api.data.constants.ApiConstants;
|
||||
import com.heyu.api.data.utils.ApiR;
|
||||
import com.heyu.api.data.utils.R;
|
||||
import com.heyu.api.tencent.handle.TPhone3MetaVerificationHandle;
|
||||
import com.heyu.api.tencent.request.TPhone3MetaVerificationRequest;
|
||||
import com.tencentcloudapi.faceid.v20180301.models.PhoneVerificationResponse;
|
||||
import com.heyu.api.resp.certificate.MobileMetaResp;
|
||||
import com.heyu.api.tencent.handle.TMobile3MetaHandle;
|
||||
import com.heyu.api.tencent.request.TMobile3MetaVerificationRequest;
|
||||
import com.heyu.api.tencent.resp.TMobile3MetaVerificationResp;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/***
|
||||
*手机号三要素核验
|
||||
*/
|
||||
@ -27,56 +25,51 @@ import java.util.Map;
|
||||
public class Mobile3MetaVerificationController {
|
||||
|
||||
|
||||
public final static Map<String, String> checkResult = new HashMap<>();
|
||||
public final static Map<String, String> resultDetailMap = new HashMap<>();
|
||||
public static final String SUCCESS_MSG = "手机号+姓名+身份证信息匹配";
|
||||
public static final String FAILED_MSG = "手机号+姓名+身份证信息不匹配";
|
||||
|
||||
|
||||
@Autowired
|
||||
private TPhone3MetaVerificationHandle tPhone3MetaVerificationHandle;
|
||||
private TMobile3MetaHandle tMobile3MetaHandle;
|
||||
|
||||
// http://localhost:8888/mobile/3/meta/verify?mobile=18458195149&realName=瞿贻晓&idCardNumber=430529199209255030
|
||||
@RequestMapping("/verify")
|
||||
@EbAuthentication(tencent = ApiConstants.TENCENT_AUTH)
|
||||
public R verify(TMobile3MetaVerificationRequest request) {
|
||||
return doVerify(request);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/verification")
|
||||
public R verification(Mobile3MetaVerificationRequest request) {
|
||||
Mobile3MetaVerificationResp resp = new Mobile3MetaVerificationResp("-1");
|
||||
TPhone3MetaVerificationRequest tPhone3MetaVerificationRequest = new TPhone3MetaVerificationRequest();
|
||||
tPhone3MetaVerificationRequest.setPhone(request.getMobile());
|
||||
tPhone3MetaVerificationRequest.setIdCard(request.getIdCardNumber());
|
||||
tPhone3MetaVerificationRequest.setName(request.getRealName());
|
||||
ApiR<PhoneVerificationResponse> tR = tPhone3MetaVerificationHandle.handle(tPhone3MetaVerificationRequest);
|
||||
public R doVerify(TMobile3MetaVerificationRequest request) {
|
||||
MobileMetaResp mobileMetaResp = new MobileMetaResp();
|
||||
ApiR<TMobile3MetaVerificationResp> tR = tMobile3MetaHandle.handle(request);
|
||||
if (tR.isSuccess()) {
|
||||
PhoneVerificationResponse response = tR.getData();
|
||||
resp.setCheckResult(response.getResult());
|
||||
resp.setDesc(checkResult.get(response.getResult()));
|
||||
resp.setIsp(response.getIsp());
|
||||
resp.setDescription(response.getDescription());
|
||||
resp.setResultDetail(response.getResultDetail());
|
||||
TMobile3MetaVerificationResp bankMetaVerifyResponse = tR.getData();
|
||||
|
||||
if (bankMetaVerifyResponse != null) {
|
||||
if (bankMetaVerifyResponse.getCode() == 400) {
|
||||
mobileMetaResp.setCheckResult(ApiConstants.FAILED);
|
||||
mobileMetaResp.setDesc(bankMetaVerifyResponse.getMsg());
|
||||
return R.ok().setData(mobileMetaResp);
|
||||
}
|
||||
|
||||
resp.setResultDetailDesc(resultDetailMap.get(response.getResultDetail()));
|
||||
|
||||
return R.ok().setData(resp);
|
||||
|
||||
if (bankMetaVerifyResponse.getCode() == 200 && bankMetaVerifyResponse.getData() != null) {
|
||||
String result = bankMetaVerifyResponse.getData().getResult();
|
||||
if ("0".equals(result)) {
|
||||
mobileMetaResp.setCheckResult(ApiConstants.SUCCESS);
|
||||
mobileMetaResp.setDesc(SUCCESS_MSG);
|
||||
} else if ("1".equals(result)) {
|
||||
mobileMetaResp.setCheckResult(ApiConstants.FAILED);
|
||||
mobileMetaResp.setDesc(FAILED_MSG);
|
||||
} else {
|
||||
mobileMetaResp.setCheckResult(result + "");
|
||||
mobileMetaResp.setDesc(bankMetaVerifyResponse.getData().getDesc());
|
||||
}
|
||||
}
|
||||
return R.ok().setData(mobileMetaResp);
|
||||
}
|
||||
}
|
||||
return R.error(tR.getErrorMsg());
|
||||
}
|
||||
|
||||
|
||||
static {
|
||||
checkResult.put("0", "三要素信息一致");
|
||||
checkResult.put("-4", "三要素信息不一致");
|
||||
checkResult.put("-6", "手机号码不合法");
|
||||
checkResult.put("-7", "身份证号码有误");
|
||||
checkResult.put("-8", "姓名校验不通过");
|
||||
checkResult.put("-9", "没有记录");
|
||||
checkResult.put("-11", "验证中心服务繁忙");
|
||||
checkResult.put("-12", "认证次数超过当日限制,请次日重试");
|
||||
|
||||
|
||||
|
||||
resultDetailMap.put("PhoneIdCardMismatch","手机号码与姓名一致,与身份证号不一致");
|
||||
resultDetailMap.put("PhoneNameMismatch","手机号码身份证号一致,与姓名不一致");
|
||||
resultDetailMap.put("PhoneNameIdCardMismatch","手机号码与姓名和身份证号均不一致");
|
||||
resultDetailMap.put("NameIdCardMismatch","姓名和身份证号不一致");
|
||||
resultDetailMap.put("OtherMismatch","其他不一致");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,13 @@
|
||||
package com.heyu.api.resp.certificate;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MobileMetaResp extends BaseCheckResultResp {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user