cgf
2025-09-11 03dcc05067d46487eac0c65b9fdeb6436c6e7311
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
package com.java110.dto.system;
 
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
 
/**
 *
 * 路由处理
 * AppId 和 服务之间的关系
 * Created by wuxw on 2018/4/14.
 */
public class AppRoute implements Serializable{
 
    private String appId;
 
    // 应用名称
    private String name;
 
    private String orderTypeCd;
 
    //一分钟,调用限制次数
    private int limitTimes;
 
    private String invokeModel;
 
 
 
    //掩码
    private String securityCode;
    //白名单
    private List<String> whileListIp = new ArrayList<String>();
 
    //黑名单
    private List<String> backListIp = new ArrayList<String>();
 
    //服务
    //private List<AppServiceStatus> appServices = new ArrayList<AppServiceStatus>();
    private AppService appService;
 
    private String remark;
 
    //0在用,1失效,2 表示下线(当组件调用服务超过限制时自动下线)
    private String statusCd;
 
 
    public String getAppId() {
        return appId;
    }
 
    public void setAppId(String appId) {
        this.appId = appId;
    }
 
    public String getName() {
        return name;
    }
 
    public void setName(String name) {
        this.name = name;
    }
 
    public String getOrderTypeCd() {
        return orderTypeCd;
    }
 
    public void setOrderTypeCd(String orderTypeCd) {
        this.orderTypeCd = orderTypeCd;
    }
 
    public int getLimitTimes() {
        return limitTimes;
    }
 
    public void setLimitTimes(int limitTimes) {
        this.limitTimes = limitTimes;
    }
 
    public String getSecurityCode() {
        return securityCode;
    }
 
    public void setSecurityCode(String securityCode) {
        this.securityCode = securityCode;
    }
 
    public List<String> getWhileListIp() {
        return whileListIp;
    }
 
    public void addWhileListIp(String whileIp) {
        this.whileListIp.add(whileIp);
    }
 
    public List<String> getBackListIp() {
        return backListIp;
    }
 
    public void addBackListIp(String backIp) {
        this.backListIp.add(backIp);
    }
 
    public String getInvokeModel() {
        return invokeModel;
    }
 
    public void setInvokeModel(String invokeModel) {
        this.invokeModel = invokeModel;
    }
 
    /*public List<AppServiceStatus> getAppServices() {
        return appServices;
    }
 
    public void addAppServices(AppServiceStatus appServiceStatus) {
        this.appServices.add(appServiceStatus);
    }*/
 
    public AppService getAppService() {
        return appService;
    }
 
    public void setAppService(AppService appService) {
        this.appService = appService;
    }
 
    public String getRemark() {
        return remark;
    }
 
    public void setRemark(String remark) {
        this.remark = remark;
    }
 
    public String getStatusCd() {
        return statusCd;
    }
 
    public void setStatusCd(String statusCd) {
        this.statusCd = statusCd;
    }
 
    /**
     * 构建数据
     * @return
     */
    public AppRoute builder(Map appInfo){
        String []listIps = null;
        this.setAppId(appInfo.get("app_id").toString());
        this.setLimitTimes(appInfo.get("invoke_limit_times") == null ? -1 : Integer.parseInt(appInfo.get("invoke_limit_times").toString()));
        this.setName(appInfo.get("name").toString());
        this.setOrderTypeCd(appInfo.get("order_type_cd").toString());
        this.setSecurityCode(appInfo.get("security_code").toString());
        this.setInvokeModel(appInfo.get("invoke_model").toString());
        if(appInfo.get("while_list_ip") != null && !"".equals(appInfo.get("while_list_ip"))){
            listIps = appInfo.get("while_list_ip").toString().split(";");
            for(String whileIp : listIps )
                this.addWhileListIp(whileIp);
        }
        if(appInfo.get("black_list_ip") != null && !"".equals(appInfo.get("black_list_ip"))){
            listIps = appInfo.get("black_list_ip").toString().split(";");
            for(String backIp : listIps )
                this.addBackListIp(backIp);
        }
        this.setStatusCd("0");
        this.setAppService(AppService.newInstance().builder(appInfo));
        return this;
    }
 
 
 
    public static AppRoute newInstance(){
        return new AppRoute();
    }
 
 
}