feat:
1. 增加银行卡信息查询 2. 增加银行卡验证 3. 新增用户银行卡模块
This commit is contained in:
@@ -35,8 +35,6 @@ import org.springblade.core.tool.utils.StringUtil;
|
||||
*/
|
||||
public class CommonUtil {
|
||||
|
||||
private static final String CHINESE_NAME_REGEX = "^[\\u4e00-\\u9fa5]+(?:[·\\u00B7\\u2027][\\u4e00-\\u9fa5]+)*$";
|
||||
|
||||
public static boolean isValidChineseName(String name) {
|
||||
if (StringUtil.isBlank(name)) {
|
||||
return false;
|
||||
@@ -46,7 +44,7 @@ public class CommonUtil {
|
||||
if (trimmed.length() < 2 || trimmed.length() > 20) {
|
||||
return false;
|
||||
}
|
||||
return RegexUtil.match(CHINESE_NAME_REGEX, trimmed);
|
||||
return RegexUtil.match("^[\\u4e00-\\u9fa5]+(?:[·\\u00B7\\u2027][\\u4e00-\\u9fa5]+)*$", trimmed);
|
||||
}
|
||||
|
||||
public static boolean isValidIdCard(String idCard) {
|
||||
@@ -65,4 +63,25 @@ public class CommonUtil {
|
||||
return RegexUtil.match(RegexUtil.PHONE, trimmed);
|
||||
}
|
||||
|
||||
public static boolean isValidBankCard(String cardNo) {
|
||||
String clean = cardNo.replaceAll("[\\s-]", "");
|
||||
if (!clean.matches("^[1-9]\\d{12,18}$")) {
|
||||
return false;
|
||||
}
|
||||
return luhnCheck(clean);
|
||||
}
|
||||
|
||||
private static boolean luhnCheck(String cardNo) {
|
||||
int sum = 0, len = cardNo.length();
|
||||
for (int i = len - 1; i >= 0; i--) {
|
||||
int digit = Character.getNumericValue(cardNo.charAt(i));
|
||||
if ((len - i) % 2 == 0) { // 从右往左,偶数位(实际是奇数索引)乘2
|
||||
digit *= 2;
|
||||
digit = digit > 9 ? digit - 9 : digit;
|
||||
}
|
||||
sum += digit;
|
||||
}
|
||||
return sum % 10 == 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
package org.springblade.modules.api.client;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.TypeReference;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springblade.core.http.util.HttpUtil;
|
||||
import org.springblade.core.tool.sensitive.SensitiveUtil;
|
||||
import org.springblade.core.tool.utils.StringUtil;
|
||||
import org.springblade.modules.api.response.RemoteVerifyIDCardResponse;
|
||||
import org.springblade.modules.api.response.remote.VerifyBankCardData;
|
||||
import org.springblade.modules.api.response.remote.VerifyIDCardData;
|
||||
import org.springblade.modules.api.response.remote.BankCardInfoData;
|
||||
import org.springblade.modules.api.response.remote.RemoteResponse;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -17,11 +21,11 @@ public class RemoteVerifyClient {
|
||||
|
||||
private static final String BANKCARD_URL = "https://bankcard234.shumaidata.com/bankcard234";
|
||||
|
||||
private static final String BANKCARD_INFO_URL ="https://bankaddress.shumaidata.com/bankaddress";
|
||||
private static final String BANKCARD_INFO_URL = "https://bankaddress.shumaidata.com/bankaddress";
|
||||
|
||||
private static final String APP_CODE = "650c376cec984b06a1289d30531c05a6";
|
||||
|
||||
public static RemoteVerifyIDCardResponse verifyRealName(String realName, String idCard) {
|
||||
public static RemoteResponse<VerifyIDCardData> verifyRealName(String realName, String idCard) {
|
||||
try {
|
||||
if (StringUtil.isAnyBlank(realName, idCard)) {
|
||||
return buildErrorResponse("请求参数缺失");
|
||||
@@ -33,28 +37,86 @@ public class RemoteVerifyClient {
|
||||
if (StringUtil.isBlank(strJson)) {
|
||||
return buildErrorResponse("远程服务返回空响应");
|
||||
}
|
||||
RemoteVerifyIDCardResponse response = JSON.parseObject(strJson, RemoteVerifyIDCardResponse.class);
|
||||
RemoteResponse<VerifyIDCardData> response = JSON.parseObject(
|
||||
strJson,
|
||||
new TypeReference<>() {
|
||||
}
|
||||
);
|
||||
if (response == null) {
|
||||
return buildErrorResponse("远程服务返回无效数据格式");
|
||||
}
|
||||
return response;
|
||||
} catch (Exception e) {
|
||||
log.error("实名认证调用异常 [name={}, idCard={}]", SensitiveUtil.process(realName), SensitiveUtil.process(idCard), e);
|
||||
log.error("实名认证调用异常 [name={}, idCard={}]", SensitiveUtil.process(realName), SensitiveUtil.process(idCard), e);
|
||||
return buildErrorResponse("服务调用失败,请稍后重试");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static RemoteVerifyIDCardResponse buildErrorResponse(String msg) {
|
||||
RemoteVerifyIDCardResponse resp = new RemoteVerifyIDCardResponse();
|
||||
public static RemoteResponse<VerifyBankCardData> verifyBankCard(String realName, String idCard, String cardNumber) {
|
||||
try {
|
||||
if (StringUtil.isAnyBlank(cardNumber)) {
|
||||
return buildErrorResponse("请求参数缺失");
|
||||
}
|
||||
Map<String, Object> body = new HashMap<>();
|
||||
body.put("name", realName);
|
||||
body.put("idcard", idCard);
|
||||
body.put("bankcard", cardNumber);
|
||||
String strJson = HttpUtil.get(BANKCARD_URL, getHeaders(), body);
|
||||
if (StringUtil.isBlank(strJson)) {
|
||||
return buildErrorResponse("远程服务返回空响应");
|
||||
}
|
||||
RemoteResponse<VerifyBankCardData> response = JSON.parseObject(
|
||||
strJson,
|
||||
new TypeReference<>() {
|
||||
}
|
||||
);
|
||||
if (response == null) {
|
||||
return buildErrorResponse("远程服务返回无效数据格式");
|
||||
}
|
||||
return response;
|
||||
} catch (Exception e) {
|
||||
log.error("银行卡验证调用异常 [bankcard={}]", cardNumber, e);
|
||||
return buildErrorResponse("服务调用失败,请稍后重试");
|
||||
}
|
||||
}
|
||||
|
||||
public static RemoteResponse<BankCardInfoData> bankCardInfo(String cardNumber) {
|
||||
try {
|
||||
if (StringUtil.isAnyBlank(cardNumber)) {
|
||||
return buildErrorResponse("请求参数缺失");
|
||||
}
|
||||
Map<String, Object> body = new HashMap<>();
|
||||
body.put("bankcard", cardNumber);
|
||||
String strJson = HttpUtil.get(BANKCARD_INFO_URL, getHeaders(), body);
|
||||
if (StringUtil.isBlank(strJson)) {
|
||||
return buildErrorResponse("远程服务返回空响应");
|
||||
}
|
||||
RemoteResponse<BankCardInfoData> response = JSON.parseObject(
|
||||
strJson,
|
||||
new TypeReference<>() {
|
||||
}
|
||||
);
|
||||
if (response == null) {
|
||||
return buildErrorResponse("远程服务返回无效数据格式");
|
||||
}
|
||||
return response;
|
||||
} catch (Exception e) {
|
||||
log.error("银行卡信息调用异常 [bankcard={}]", cardNumber, e);
|
||||
return buildErrorResponse("服务调用失败,请稍后重试");
|
||||
}
|
||||
}
|
||||
|
||||
private static RemoteResponse buildErrorResponse(String msg) {
|
||||
RemoteResponse resp = new RemoteResponse();
|
||||
resp.setCode(500); // 与业务 SUCCESS code 区分
|
||||
resp.setMsg(msg);
|
||||
return resp;
|
||||
}
|
||||
|
||||
private static Map<String, String> getHeaders() {
|
||||
Map<String, String> headers = new HashMap<>();
|
||||
headers.put("Authorization", "APPCODE " + APP_CODE);
|
||||
headers.put("Content-Type", "application/json; charset=utf-8");
|
||||
return headers;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
package org.springblade.modules.api.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class RemoteVerifyIDCardResponse implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer code;
|
||||
|
||||
private String msg;
|
||||
|
||||
private Boolean success;
|
||||
|
||||
private VerifyIDCardInfo data;
|
||||
|
||||
@Data
|
||||
public static class VerifyIDCardInfo implements Serializable {
|
||||
|
||||
private Integer result;
|
||||
|
||||
private String desc;
|
||||
|
||||
private String sex;
|
||||
|
||||
private String birthday;
|
||||
|
||||
private String address;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package org.springblade.modules.api.response.remote;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class BankCardInfoData implements Serializable {
|
||||
|
||||
private String bank;
|
||||
|
||||
private String province;
|
||||
|
||||
private String city;
|
||||
|
||||
@JSONField(name = "card_name")
|
||||
private String cardName;
|
||||
|
||||
private String tel;
|
||||
|
||||
private String type;
|
||||
|
||||
private String logo;
|
||||
|
||||
private String abbreviation; //银行缩写
|
||||
|
||||
@JSONField(name = "card_bin")
|
||||
private String cardBin;
|
||||
|
||||
@JSONField(name = "bin_digits")
|
||||
private Integer binDigits;
|
||||
|
||||
@JSONField(name = "card_digits")
|
||||
private Integer cardDigits;
|
||||
|
||||
private Boolean isLuhn; // 或 isLuhn,但 Java Bean 规范建议避免 is 开头的 boolean 字段名
|
||||
|
||||
private String weburl;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package org.springblade.modules.api.response.remote;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class RemoteResponse<T> {
|
||||
|
||||
private String msg;
|
||||
private Boolean success;
|
||||
private Integer code;
|
||||
private T data;
|
||||
|
||||
public static <T> RemoteResponse<T> success(T data) {
|
||||
return new RemoteResponse<>("成功", true, 200, data);
|
||||
}
|
||||
|
||||
public static <T> RemoteResponse<T> error(String msg, Integer code) {
|
||||
return new RemoteResponse<>(msg, false, code, null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.springblade.modules.api.response.remote;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import com.alipay.api.domain.BankCardInfo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class VerifyBankCardData implements Serializable {
|
||||
|
||||
private Integer result; //验证结果 0-一致 1-不一致 2-未认证 3-已注销
|
||||
|
||||
private String desc;
|
||||
|
||||
private String msg;
|
||||
|
||||
@JSONField(name = "bank_info")
|
||||
private BankCardInfoData bankInfo;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.springblade.modules.api.response.remote;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class VerifyIDCardData implements Serializable {
|
||||
|
||||
private Integer result;
|
||||
|
||||
private String desc;
|
||||
|
||||
private String sex;
|
||||
|
||||
private String birthday;
|
||||
|
||||
private String address;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.springblade.modules.common.eums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum BankCardVerifyStatus {
|
||||
//0-一致 1-不一致 2-未认证 3-已注销
|
||||
CONSISTENT(0),
|
||||
INCONSISTENT(1),
|
||||
UNVERIFIED(2),
|
||||
DEACTIVATED(3);
|
||||
|
||||
private final Integer code;
|
||||
|
||||
BankCardVerifyStatus(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import lombok.AllArgsConstructor;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.modules.market.pojo.entity.MarketBankCardEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MarketBankCardVO;
|
||||
import org.springblade.modules.market.service.IMarketBankCardService;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 用户银行卡表 控制器
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-04-14
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/martket/bankCard")
|
||||
@Tag(name = "用户银行卡表", description = "用户银行卡表接口")
|
||||
public class MarketBankCardController extends BladeController {
|
||||
|
||||
private final IMarketBankCardService bankCardService;
|
||||
|
||||
/**
|
||||
* 用户银行卡表 详情
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "详情", description = "传入bankCard")
|
||||
public R<MarketBankCardEntity> detail(MarketBankCardEntity bankCard) {
|
||||
MarketBankCardEntity detail = bankCardService.getOne(Condition.getQueryWrapper(bankCard));
|
||||
return R.data(detail);
|
||||
}
|
||||
/**
|
||||
* 用户银行卡表 分页
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "分页", description = "传入bankCard")
|
||||
public R<IPage<MarketBankCardEntity>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> bankCard, Query query) {
|
||||
IPage<MarketBankCardEntity> pages = bankCardService.page(Condition.getPage(query), Condition.getQueryWrapper(bankCard, MarketBankCardEntity.class));
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户银行卡表 自定义分页
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "分页", description = "传入bankCard")
|
||||
public R<IPage<MarketBankCardVO>> page(MarketBankCardVO bankCard, Query query) {
|
||||
IPage<MarketBankCardVO> pages = bankCardService.selectBankCardPage(Condition.getPage(query), bankCard);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户银行卡表 新增
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "新增", description = "传入bankCard")
|
||||
public R save(@Valid @RequestBody MarketBankCardEntity bankCard) {
|
||||
return R.status(bankCardService.save(bankCard));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户银行卡表 修改
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "修改", description = "传入bankCard")
|
||||
public R update(@Valid @RequestBody MarketBankCardEntity bankCard) {
|
||||
return R.status(bankCardService.updateById(bankCard));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户银行卡表 新增或修改
|
||||
*/
|
||||
@PostMapping("/submit")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "新增或修改", description = "传入bankCard")
|
||||
public R submit(@Valid @RequestBody MarketBankCardEntity bankCard) {
|
||||
return R.status(bankCardService.saveOrUpdate(bankCard));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户银行卡表 删除
|
||||
*/
|
||||
@PostMapping("/remove")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@Operation(summary = "删除", description = "传入ids")
|
||||
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
|
||||
return R.status(bankCardService.removeByIds(Func.toLongList(ids)));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.mapper;
|
||||
|
||||
import org.springblade.modules.market.pojo.entity.MarketBankCardEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MarketBankCardVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户银行卡表 Mapper 接口
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-04-14
|
||||
*/
|
||||
public interface MarketBankCardMapper extends BaseMapper<MarketBankCardEntity> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param bankCard 查询参数
|
||||
* @return List<BankCardVO>
|
||||
*/
|
||||
List<MarketBankCardVO> selectBankCardPage(IPage page, MarketBankCardVO bankCard);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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="org.springblade.modules.market.mapper.MarketBankCardMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="bankCardResultMap" type="org.springblade.modules.market.pojo.entity.MarketBankCardEntity">
|
||||
<result column="id" property="id"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
<result column="card_number" property="cardNumber"/>
|
||||
<result column="bank" property="bank"/>
|
||||
<result column="province" property="province"/>
|
||||
<result column="city" property="city"/>
|
||||
<result column="card_name" property="cardName"/>
|
||||
<result column="tel" property="tel"/>
|
||||
<result column="type" property="type"/>
|
||||
<result column="logo" property="logo"/>
|
||||
<result column="abbreviation" property="abbreviation"/>
|
||||
<result column="card_bin" property="cardBin"/>
|
||||
<result column="bin_digits" property="binDigits"/>
|
||||
<result column="card_digits" property="cardDigits"/>
|
||||
<result column="is_luhn" property="isLuhn"/>
|
||||
<result column="weburl" property="weburl"/>
|
||||
<result column="is_default" property="isDefault"/>
|
||||
<result column="create_user" property="createUser"/>
|
||||
<result column="create_dept" property="createDept"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectBankCardPage" resultMap="bankCardResultMap">
|
||||
select * from user_bank_card where is_deleted = 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.pojo.dto;
|
||||
|
||||
import org.springblade.modules.market.pojo.entity.MarketBankCardEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 用户银行卡表 数据传输对象实体类
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-04-14
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MarketMarketBankCardDTO extends MarketBankCardEntity {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.pojo.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springblade.core.mp.base.BaseEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 用户银行卡表 实体类
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-04-14
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("user_bank_card")
|
||||
@Schema(description = "BankCard对象")
|
||||
public class MarketBankCardEntity extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* uid
|
||||
*/
|
||||
@Schema(description = "uid")
|
||||
private Long userId;
|
||||
/**
|
||||
* 银行卡号
|
||||
*/
|
||||
@Schema(description = "银行卡号")
|
||||
private String cardNumber;
|
||||
/**
|
||||
* 银行名称
|
||||
*/
|
||||
@Schema(description = "银行名称")
|
||||
private String bank;
|
||||
/**
|
||||
* 省份
|
||||
*/
|
||||
@Schema(description = "省份")
|
||||
private String province;
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
@Schema(description = "城市")
|
||||
private String city;
|
||||
/**
|
||||
* 卡类型名称
|
||||
*/
|
||||
@Schema(description = "卡类型名称")
|
||||
private String cardName;
|
||||
/**
|
||||
* 客服电话
|
||||
*/
|
||||
@Schema(description = "客服电话")
|
||||
private String tel;
|
||||
/**
|
||||
* 卡类型
|
||||
*/
|
||||
@Schema(description = "卡类型")
|
||||
private String type;
|
||||
/**
|
||||
* 银行 Logo URL
|
||||
*/
|
||||
@Schema(description = "银行 Logo URL")
|
||||
private String logo;
|
||||
/**
|
||||
* 银行缩写
|
||||
*/
|
||||
@Schema(description = "银行缩写")
|
||||
private String abbreviation;
|
||||
/**
|
||||
* 卡 BIN(前6位)
|
||||
*/
|
||||
@Schema(description = "卡 BIN(前6位)")
|
||||
private String cardBin;
|
||||
/**
|
||||
* BIN 位数(通常为6)
|
||||
*/
|
||||
@Schema(description = "BIN 位数(通常为6)")
|
||||
private Integer binDigits;
|
||||
/**
|
||||
* 卡号总位数(如16、19)
|
||||
*/
|
||||
@Schema(description = "卡号总位数(如16、19)")
|
||||
private Integer cardDigits;
|
||||
/**
|
||||
* 是否通过 Luhn 校验
|
||||
*/
|
||||
@Schema(description = "是否通过 Luhn 校验")
|
||||
private Integer isLuhn;
|
||||
/**
|
||||
* 银行官网 URL
|
||||
*/
|
||||
@Schema(description = "银行官网 URL")
|
||||
private String weburl;
|
||||
/**
|
||||
* 默认银行卡标识
|
||||
*/
|
||||
@Schema(description = "默认银行卡标识")
|
||||
private Integer isDefault;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.pojo.vo;
|
||||
|
||||
import org.springblade.modules.market.pojo.entity.MarketBankCardEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 用户银行卡表 视图实体类
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-04-14
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MarketBankCardVO extends MarketBankCardEntity {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.service;
|
||||
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
import org.springblade.modules.market.pojo.entity.MarketBankCardEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MarketBankCardVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
||||
/**
|
||||
* 用户银行卡表 服务类
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-04-14
|
||||
*/
|
||||
public interface IMarketBankCardService extends BaseService<MarketBankCardEntity> {
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param bankCard 查询参数
|
||||
* @return IPage<BankCardVO>
|
||||
*/
|
||||
IPage<MarketBankCardVO> selectBankCardPage(IPage<MarketBankCardVO> page, MarketBankCardVO bankCard);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.market.service.impl;
|
||||
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import org.springblade.modules.market.pojo.entity.MarketBankCardEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MarketBankCardVO;
|
||||
import org.springblade.modules.market.mapper.MarketBankCardMapper;
|
||||
import org.springblade.modules.market.service.IMarketBankCardService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
||||
/**
|
||||
* 用户银行卡表 服务实现类
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-04-14
|
||||
*/
|
||||
@Service
|
||||
public class MarketBankCardServiceImpl extends BaseServiceImpl<MarketBankCardMapper, MarketBankCardEntity> implements IMarketBankCardService {
|
||||
|
||||
@Override
|
||||
public IPage<MarketBankCardVO> selectBankCardPage(IPage<MarketBankCardVO> page, MarketBankCardVO bankCard) {
|
||||
return page.setRecords(baseMapper.selectBankCardPage(page, bankCard));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -38,7 +38,8 @@ import org.springblade.core.tool.utils.DateUtil;
|
||||
import org.springblade.core.tool.utils.DigestUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.modules.api.client.RemoteVerifyClient;
|
||||
import org.springblade.modules.api.response.RemoteVerifyIDCardResponse;
|
||||
import org.springblade.modules.api.response.remote.VerifyIDCardData;
|
||||
import org.springblade.modules.api.response.remote.RemoteResponse;
|
||||
import org.springblade.modules.auth.provider.UserType;
|
||||
import org.springblade.modules.common.eums.IDCardVerifyStatus;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserPointEntity;
|
||||
@@ -149,9 +150,9 @@ public class MarketInfoServiceImpl extends BaseServiceImpl<MarketInfoMapper, Mar
|
||||
if (!CommonUtil.isValidChineseName(name) || !CommonUtil.isValidIdCard(idCard)) {
|
||||
throw new ServiceException("无效姓名、身份证号、手机号");
|
||||
}
|
||||
RemoteVerifyIDCardResponse response = RemoteVerifyClient.verifyRealName(name, idCard);
|
||||
RemoteResponse<VerifyIDCardData> response = RemoteVerifyClient.verifyRealName(name, idCard);
|
||||
if (response.getSuccess() && 200 == response.getCode()) {
|
||||
RemoteVerifyIDCardResponse.VerifyIDCardInfo data = response.getData();
|
||||
VerifyIDCardData data = response.getData();
|
||||
if (!Objects.isNull(data) && data.getResult().equals(IDCardVerifyStatus.CONSISTENT.getCode())) {
|
||||
marketInfo.setRealName(name);
|
||||
marketInfo.setIdCard(idCard);
|
||||
|
||||
Reference in New Issue
Block a user