fix:支付宝支付按租户查询支付配置

This commit is contained in:
2026-06-24 20:25:06 +08:00
parent c7bf4639bb
commit 84146bee17
4 changed files with 35 additions and 3 deletions
@@ -17,7 +17,17 @@ public class PayTypeConstants {
* 优惠券支付
*/
public static final Integer COUPON_PAY = 2;
/**
* 第三方聚到核销
*/
public static final Integer FEIPAI_VERIFY = 3;
/**
* 支付宝支付
*/
public static final Integer ALIPAY_PAY = 4;
private PayTypeConstants() {
// 私有构造函数,防止实例化
}
@@ -39,6 +39,20 @@ public class AlipayConfigServiceImpl
@Override
public AlipayConfig getConfigByTypeAndTenantId(String type, String tenantId) {
// 1. 先按当前租户查询
AlipayConfig config = queryByTypeAndTenantId(type, tenantId);
if (config != null) {
return config;
}
// 2. 查不到时降级到 webApp 默认配置
if (!"webApp".equals(tenantId)) {
log.info("当前租户[{}]未配置支付宝[{}],降级使用 webApp 默认配置", tenantId, type);
config = queryByTypeAndTenantId(type, "webApp");
}
return config;
}
private AlipayConfig queryByTypeAndTenantId(String type, String tenantId) {
LambdaQueryWrapper<AlipayConfig> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(AlipayConfig::getType, type)
.eq(AlipayConfig::getTenantId, tenantId)