fix:支付宝支付按租户查询支付配置
This commit is contained in:
+11
-1
@@ -17,7 +17,17 @@ public class PayTypeConstants {
|
|||||||
* 优惠券支付
|
* 优惠券支付
|
||||||
*/
|
*/
|
||||||
public static final Integer COUPON_PAY = 2;
|
public static final Integer COUPON_PAY = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 第三方聚到核销
|
||||||
|
*/
|
||||||
|
public static final Integer FEIPAI_VERIFY = 3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付宝支付
|
||||||
|
*/
|
||||||
|
public static final Integer ALIPAY_PAY = 4;
|
||||||
|
|
||||||
private PayTypeConstants() {
|
private PayTypeConstants() {
|
||||||
// 私有构造函数,防止实例化
|
// 私有构造函数,防止实例化
|
||||||
}
|
}
|
||||||
|
|||||||
+14
@@ -39,6 +39,20 @@ public class AlipayConfigServiceImpl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AlipayConfig getConfigByTypeAndTenantId(String type, String tenantId) {
|
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<>();
|
LambdaQueryWrapper<AlipayConfig> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(AlipayConfig::getType, type)
|
wrapper.eq(AlipayConfig::getType, type)
|
||||||
.eq(AlipayConfig::getTenantId, tenantId)
|
.eq(AlipayConfig::getTenantId, tenantId)
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ const PAY_TYPE = {
|
|||||||
WECHAT: 1, // 微信支付
|
WECHAT: 1, // 微信支付
|
||||||
COUPON: 2, // 优惠券支付
|
COUPON: 2, // 优惠券支付
|
||||||
THIRD_PARTY: 3, // 第三方支付
|
THIRD_PARTY: 3, // 第三方支付
|
||||||
|
ALIPAY: 4, // 支付宝支付
|
||||||
};
|
};
|
||||||
|
|
||||||
// 资源列表操作组件
|
// 资源列表操作组件
|
||||||
@@ -43,8 +44,10 @@ const ResourcesActionCell: React.FC<{ record: OrderItem; onReload?: () => void;
|
|||||||
const isThirdPartyPay = record.payType === PAY_TYPE.THIRD_PARTY;
|
const isThirdPartyPay = record.payType === PAY_TYPE.THIRD_PARTY;
|
||||||
// 判断是否为优惠券支付(携程不支持退款接口)
|
// 判断是否为优惠券支付(携程不支持退款接口)
|
||||||
const isCouponPay = record.payType === PAY_TYPE.COUPON;
|
const isCouponPay = record.payType === PAY_TYPE.COUPON;
|
||||||
// 是否可以创建退款(任务完成 且 非第三方支付 且 非优惠券支付)
|
// 判断是否为支付宝支付(暂不支持退款)
|
||||||
const canCreateRefund = isTaskComplete && !isThirdPartyPay && !isCouponPay;
|
const isAlipayPay = record.payType === PAY_TYPE.ALIPAY;
|
||||||
|
// 是否可以创建退款(任务完成 且 非第三方支付 且 非优惠券支付 且 非支付宝支付)
|
||||||
|
const canCreateRefund = isTaskComplete && !isThirdPartyPay && !isCouponPay && !isAlipayPay;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -60,6 +63,10 @@ const ResourcesActionCell: React.FC<{ record: OrderItem; onReload?: () => void;
|
|||||||
<Tooltip title="优惠券支付订单不支持退款">
|
<Tooltip title="优惠券支付订单不支持退款">
|
||||||
<span style={{ color: '#999', cursor: 'not-allowed' }}>创建退款</span>
|
<span style={{ color: '#999', cursor: 'not-allowed' }}>创建退款</span>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
) : isAlipayPay ? (
|
||||||
|
<Tooltip title="支付宝支付订单暂不支持退款">
|
||||||
|
<span style={{ color: '#999', cursor: 'not-allowed' }}>创建退款</span>
|
||||||
|
</Tooltip>
|
||||||
) : (
|
) : (
|
||||||
<Link onClick={() => setCreateRefundModalVisible(true)}>创建退款</Link>
|
<Link onClick={() => setCreateRefundModalVisible(true)}>创建退款</Link>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ export const PAY_TYPE_OPTIONS: { label: string; value: number; color?: string }[
|
|||||||
{ label: '微信支付', value: 1, color: 'green' },
|
{ label: '微信支付', value: 1, color: 'green' },
|
||||||
{ label: '优惠券支付', value: 2, color: 'blue' },
|
{ label: '优惠券支付', value: 2, color: 'blue' },
|
||||||
{ label: '第三方支付', value: 3, color: 'purple' },
|
{ label: '第三方支付', value: 3, color: 'purple' },
|
||||||
|
{ label: '支付宝支付', value: 4, color: 'geekblue' },
|
||||||
];
|
];
|
||||||
|
|
||||||
export const ORDER_STATUS_OPTIONS: { label: string; value: number; color?: string }[] = [
|
export const ORDER_STATUS_OPTIONS: { label: string; value: number; color?: string }[] = [
|
||||||
|
|||||||
Reference in New Issue
Block a user