czt
2025-08-20 12c99c99ed89d1d11318d9b4c6c295d35e21b1e7
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
package com.fzzy.api.service;
 
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
 
import java.util.HashMap;
import java.util.Map;
 
/**
 * @Desc: 同步数据接口管理封装
 * @author: andy.jia
 * @update-time: 2022/10/6 14:09
 */
@Component
public class ApiSyncManager implements ApplicationContextAware {
 
    public static Map<String, SyncService11> map11 = new HashMap<>();
 
    public static Map<String, SyncService12> map12 = new HashMap<>();
 
    public static Map<String, SyncService13> map13 = new HashMap<>();
 
    public static Map<String, SyncService14> map14 = new HashMap<>();
 
    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        Map<String, SyncService11> service11Map = applicationContext.getBeansOfType(SyncService11.class);
 
        for (String key : service11Map.keySet()) {
            map11.put(service11Map.get(key).getProtocol(), service11Map.get(key));
        }
 
 
        Map<String, SyncService12> service12Map = applicationContext.getBeansOfType(SyncService12.class);
 
        for (String key : service12Map.keySet()) {
            map12.put(service12Map.get(key).getProtocol(), service12Map.get(key));
        }
 
 
        Map<String, SyncService13> service13Map = applicationContext.getBeansOfType(SyncService13.class);
 
        for (String key : service13Map.keySet()) {
            map13.put(service13Map.get(key).getProtocol(), service13Map.get(key));
        }
 
 
        Map<String, SyncService14> service14Map = applicationContext.getBeansOfType(SyncService14.class);
 
        for (String key : service14Map.keySet()) {
            map14.put(service14Map.get(key).getProtocol(), service14Map.get(key));
        }
 
    }
 
 
    /**
     * 根据实现协议获取当前实现方法
     *
     * @param protocol
     * @return
     */
    public SyncService11 getSyncService11(String protocol) {
        return map11.get(protocol);
    }
 
    /**
     * 根据实现协议获取当前实现方法
     *
     * @param protocol
     * @return
     */
    public SyncService12 getSyncService12(String protocol) {
        return map12.get(protocol);
    }
 
 
    /**
     * 根据实现协议获取当前实现方法
     *
     * @param protocol
     * @return
     */
    public SyncService13 getSyncService13(String protocol) {
        return map13.get(protocol);
    }
 
 
    /**
     * 根据实现协议获取当前实现方法
     *
     * @param protocol
     * @return
     */
    public SyncService14 getSyncService14(String protocol) {
        return map14.get(protocol);
    }
 
 
}