Administrator
2025-12-13 a7d61fcdf24ab8e459f53761b632072df00251b6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package com.xcong.excoin.modules.okxNewPrice.okxpi.verify;
 
import lombok.Data;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
 
import java.util.HashMap;
import java.util.Map;
 
/**
 * 账号验证工厂类
 * 该类用于管理不同交易所的账号验证服务通过传入的键获取相应的验证服务
 */
@Component
@Data
public class VerifyAccountFactory {
 
    /**
     * OKX交易所的账号验证服务
     */
    @Qualifier("oKXVerifyAccount")
    private final IVerifyAccountService oKXVerifyAccount;
 
    /**
     * 存储不同交易所的账号验证服务的映射
     */
    private Map<String, IVerifyAccountService> accountMap = new HashMap<>();
 
    /**
     * 构造方法,初始化账号验证工厂
     * @param oKXVerifyAccount OKX交易所的账号验证服务
     */
    public VerifyAccountFactory(IVerifyAccountService oKXVerifyAccount) {
        this.oKXVerifyAccount = oKXVerifyAccount;
        accountMap.put("OKX", oKXVerifyAccount);
    }
 
    /**
     * 根据传入的键获取相应的账号验证服务
     * @param key 交易所的键,如"OKX"或"BINANCE"
     * @return 对应的账号验证服务
     */
    public IVerifyAccountService get(String key) {
        return accountMap.get(key);
    }
}