init
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package com.ruoyi.cai.pay;
|
||||
|
||||
import com.alipay.api.domain.AppItemDataDiffVO;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ijpay.alipay.AliPayApiConfig;
|
||||
import com.ijpay.alipay.AliPayApiConfigKit;
|
||||
@@ -12,14 +11,14 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class PayConfigManager {
|
||||
private static final Map<Long,PayConfig> PAY_CONFIGS_MAP = new HashMap<>();
|
||||
private static final Map<Long,PayConfig> PAY_CONFIGS_MAP = new ConcurrentHashMap<>();
|
||||
@Autowired
|
||||
private PayConfigService payConfigService;
|
||||
|
||||
@@ -31,6 +30,10 @@ public class PayConfigManager {
|
||||
}
|
||||
}
|
||||
|
||||
public Collection<PayConfig> getAllPayConfig(){
|
||||
return PAY_CONFIGS_MAP.values();
|
||||
}
|
||||
|
||||
// 1支付宝2微信
|
||||
public void addPayConfig(PayConfig payConfig) {
|
||||
PAY_CONFIGS_MAP.put(payConfig.getId(),payConfig);
|
||||
@@ -96,11 +99,22 @@ public class PayConfigManager {
|
||||
}
|
||||
|
||||
public PayConfig getAliConfigByAppId(String appId) {
|
||||
this.getWxConfigByMchId(appId);
|
||||
Collection<PayConfig> values = PAY_CONFIGS_MAP.values();
|
||||
for (PayConfig value : values) {
|
||||
if(value.getAppid() != null && value.getAppid().equals(appId)){
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public PayConfig getWxConfigByMchId(String mchId) {
|
||||
Collection<PayConfig> values = PAY_CONFIGS_MAP.values();
|
||||
for (PayConfig value : values) {
|
||||
if(value.getWxMcid() != null && value.getWxMcid().equals(mchId)){
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user