完成 yudao-spring-boot-starter-file 组件,支持 S3 对接云存储、local、ftp、sftp、db 等协议

This commit is contained in:
YunaiV
2022-03-14 23:07:37 +08:00
parent 3d40fc81dd
commit 05d4aae65d
26 changed files with 271 additions and 33 deletions

View File

@ -11,6 +11,7 @@ import org.springframework.context.annotation.Configuration;
*
* @author 芋道源码
*/
@Configuration
@EnableConfigurationProperties(PayProperties.class)
public class YudaoPayAutoConfiguration {

View File

@ -27,11 +27,11 @@ public class PayClientFactoryImpl implements PayClientFactory {
* 支付客户端 Map
* key渠道编号
*/
private final ConcurrentMap<Long, AbstractPayClient<?>> channelIdClients = new ConcurrentHashMap<>();
private final ConcurrentMap<Long, AbstractPayClient<?>> clients = new ConcurrentHashMap<>();
@Override
public PayClient getPayClient(Long channelId) {
AbstractPayClient<?> client = channelIdClients.get(channelId);
AbstractPayClient<?> client = clients.get(channelId);
if (client == null) {
log.error("[getPayClient][渠道编号({}) 找不到客户端]", channelId);
}
@ -42,11 +42,11 @@ public class PayClientFactoryImpl implements PayClientFactory {
@SuppressWarnings("unchecked")
public <Config extends PayClientConfig> void createOrUpdatePayClient(Long channelId, String channelCode,
Config config) {
AbstractPayClient<Config> client = (AbstractPayClient<Config>) channelIdClients.get(channelId);
AbstractPayClient<Config> client = (AbstractPayClient<Config>) clients.get(channelId);
if (client == null) {
client = this.createPayClient(channelId, channelCode, config);
client.init();
channelIdClients.put(client.getId(), client);
clients.put(client.getId(), client);
} else {
client.refresh(config);
}
@ -69,7 +69,7 @@ public class PayClientFactoryImpl implements PayClientFactory {
case ALIPAY_PC: return (AbstractPayClient<Config>) new AlipayQrPayClient(channelId, (AlipayPayClientConfig) config);
}
// 创建失败,错误日志 + 抛出异常
log.error("[createSmsClient][配置({}) 找不到合适的客户端实现]", config);
log.error("[createPayClient][配置({}) 找不到合适的客户端实现]", config);
throw new IllegalArgumentException(String.format("配置(%s) 找不到合适的客户端实现", config));
}

View File

@ -56,5 +56,4 @@ public enum PayChannelEnum {
return ArrayUtil.firstMatch(o -> o.getCode().equals(code), values());
}
}