mirror of
https://github.com/dromara/payment-spring-boot.git
synced 2026-03-14 05:43:46 +08:00
factor:租户信息服务类优化
This commit is contained in:
@@ -29,6 +29,8 @@ import java.util.Set;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 从配置文件中加载租户信息,默认实现,可被覆盖
|
||||||
|
*
|
||||||
* @author xiafang
|
* @author xiafang
|
||||||
* @since 2023/2/3 11:40
|
* @since 2023/2/3 11:40
|
||||||
*/
|
*/
|
||||||
@@ -37,7 +39,7 @@ public class InMemoryWechatTenantService implements WechatTenantService {
|
|||||||
private final WechatPayProperties wechatPayProperties;
|
private final WechatPayProperties wechatPayProperties;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<WechatMetaBean> getAllTenants() {
|
public Set<WechatMetaBean> loadTenants() {
|
||||||
Map<String, WechatPayProperties.V3> v3Map = wechatPayProperties.getV3();
|
Map<String, WechatPayProperties.V3> v3Map = wechatPayProperties.getV3();
|
||||||
KeyPairFactory keyPairFactory = new KeyPairFactory();
|
KeyPairFactory keyPairFactory = new KeyPairFactory();
|
||||||
return v3Map.entrySet()
|
return v3Map.entrySet()
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class WechatPayConfiguration {
|
|||||||
@ConditionalOnMissingBean
|
@ConditionalOnMissingBean
|
||||||
WechatMetaContainer wechatMetaContainer(WechatTenantService wechatTenantService) {
|
WechatMetaContainer wechatMetaContainer(WechatTenantService wechatTenantService) {
|
||||||
WechatMetaContainer container = new WechatMetaContainer();
|
WechatMetaContainer container = new WechatMetaContainer();
|
||||||
container.addWechatMetas(wechatTenantService.getAllTenants());
|
container.addWechatMetas(wechatTenantService.loadTenants());
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,9 +22,12 @@ import cn.felord.payment.wechat.v3.WechatMetaBean;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xiafang
|
* 加载租户信息服务
|
||||||
* @since 2023/2/3 11:37
|
*
|
||||||
|
* @author felord.cn
|
||||||
|
* @since 1.0.16.RELEASE
|
||||||
*/
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
public interface WechatTenantService {
|
public interface WechatTenantService {
|
||||||
Set<WechatMetaBean> getAllTenants();
|
Set<WechatMetaBean> loadTenants();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
/**
|
/**
|
||||||
* The type Wechat tenant service configuration.
|
* The type Wechat tenant service configuration.
|
||||||
*
|
*
|
||||||
* @author xiafang
|
* @author felord.cn
|
||||||
* @since 2023 /2/3 12:32
|
* @since 1.0.16.RELEASE
|
||||||
*/
|
*/
|
||||||
@Configuration(proxyBeanMethods = false)
|
@Configuration(proxyBeanMethods = false)
|
||||||
@Conditional(WechatPayConfiguredCondition.class)
|
@Conditional(WechatPayConfiguredCondition.class)
|
||||||
|
|||||||
Reference in New Issue
Block a user