Skip to content

Commit f2c6731

Browse files
committed
feat: 新版
1 parent a2bf226 commit f2c6731

513 files changed

Lines changed: 2897 additions & 3763 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ddes-open-sdk/src/main/java/com/xiaoju/open/sdk/didies/ApiClient.java

Lines changed: 172 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.xiaoju.open.sdk.didies;
22

3+
34
import com.xiaoju.open.sdk.didies.core.Config;
45
import com.xiaoju.open.sdk.didies.core.ITokenHolder;
56
import com.xiaoju.open.sdk.didies.core.LocalTokenHolder;
@@ -22,103 +23,178 @@
2223
import com.xiaoju.open.sdk.didies.service.workspace.Workspace;
2324
import lombok.Getter;
2425

26+
/**
27+
* ApiClient
28+
*
29+
* @author didi
30+
*/
2531
public class ApiClient {
2632

27-
@Getter
28-
private final Config config;
29-
/**
30-
* 一个客户端持有一个TokenHolder
31-
*/
32-
private final ITokenHolder tokenHolder;
33-
34-
/**
35-
* 默认使用LocalTokenHolder
36-
*
37-
* @param config 配置信息
38-
*/
39-
public ApiClient(Config config) {
40-
this.config = config;
41-
this.tokenHolder = new LocalTokenHolder(this);
42-
}
43-
44-
/**
45-
* 用户可自定义TokenHolder
46-
*
47-
* @param config 配置信息
48-
* @param tokenHolder 自定义token缓存逻辑
49-
*/
50-
public ApiClient(Config config, ITokenHolder tokenHolder) {
51-
this.config = config;
52-
this.tokenHolder = tokenHolder;
53-
}
54-
55-
public AfterApproval afterapproval() {
56-
return new AfterApproval(tokenHolder, config);
57-
}
58-
59-
public Approval approval() {
60-
return new Approval(tokenHolder, config);
61-
}
62-
63-
public Auth auth() {
64-
return new Auth(tokenHolder, config);
65-
}
66-
67-
public Bill bill() {
68-
return new Bill(tokenHolder, config);
69-
}
70-
71-
public BudgetCenter budgetcenter() {
72-
return new BudgetCenter(tokenHolder, config);
73-
}
74-
75-
public City city() {
76-
return new City(tokenHolder, config);
77-
}
78-
79-
public Extend extend() {
80-
return new Extend(tokenHolder, config);
81-
}
82-
83-
public LegalEntity legalentity() {
84-
return new LegalEntity(tokenHolder, config);
85-
}
86-
87-
public Login login() {
88-
return new Login(tokenHolder, config);
89-
}
90-
91-
public Member member() {
92-
return new Member(tokenHolder, config);
93-
}
94-
95-
public Order order() {
96-
return new Order(tokenHolder, config);
97-
}
98-
99-
public OutApproval outapproval() {
100-
return new OutApproval(tokenHolder, config);
101-
}
102-
103-
public Rank rank() {
104-
return new Rank(tokenHolder, config);
105-
}
106-
107-
public Regulation regulation() {
108-
return new Regulation(tokenHolder, config);
109-
}
110-
111-
public Role role() {
112-
return new Role(tokenHolder, config);
113-
}
114-
115-
public Traveler traveler() {
116-
return new Traveler(tokenHolder, config);
117-
}
118-
119-
public Workspace workspace() {
120-
return new Workspace(tokenHolder, config);
121-
}
33+
/**
34+
* 配置信息
35+
*/
36+
@Getter
37+
private final Config config;
38+
/**
39+
* 一个客户端持有一个TokenHolder
40+
*/
41+
private final ITokenHolder tokenHolder;
42+
/**
43+
* 默认使用LocalTokenHolder
44+
*
45+
* @param config 配置信息
46+
*/
47+
public ApiClient(Config config) {
48+
this.config = config;
49+
this.tokenHolder = new LocalTokenHolder(this);
50+
}
51+
52+
/**
53+
* 用户可自定义TokenHolder
54+
*
55+
* @param config 配置信息
56+
* @param tokenHolder 自定义token缓存逻辑
57+
*/
58+
public ApiClient(Config config, ITokenHolder tokenHolder) {
59+
this.config = config;
60+
this.tokenHolder = tokenHolder;
61+
}
62+
63+
/**
64+
* 获取AfterApproval
65+
*
66+
* @return AfterApproval
67+
*/
68+
public AfterApproval afterapproval() {
69+
return new AfterApproval(tokenHolder, config);
70+
}
71+
/**
72+
* 获取Approval
73+
*
74+
* @return Approval
75+
*/
76+
public Approval approval() {
77+
return new Approval(tokenHolder, config);
78+
}
79+
/**
80+
* 获取Auth
81+
*
82+
* @return Auth
83+
*/
84+
public Auth auth() {
85+
return new Auth(tokenHolder, config);
86+
}
87+
/**
88+
* 获取Bill
89+
*
90+
* @return Bill
91+
*/
92+
public Bill bill() {
93+
return new Bill(tokenHolder, config);
94+
}
95+
/**
96+
* 获取BudgetCenter
97+
*
98+
* @return BudgetCenter
99+
*/
100+
public BudgetCenter budgetcenter() {
101+
return new BudgetCenter(tokenHolder, config);
102+
}
103+
/**
104+
* 获取City
105+
*
106+
* @return City
107+
*/
108+
public City city() {
109+
return new City(tokenHolder, config);
110+
}
111+
/**
112+
* 获取Extend
113+
*
114+
* @return Extend
115+
*/
116+
public Extend extend() {
117+
return new Extend(tokenHolder, config);
118+
}
119+
/**
120+
* 获取LegalEntity
121+
*
122+
* @return LegalEntity
123+
*/
124+
public LegalEntity legalentity() {
125+
return new LegalEntity(tokenHolder, config);
126+
}
127+
/**
128+
* 获取Login
129+
*
130+
* @return Login
131+
*/
132+
public Login login() {
133+
return new Login(tokenHolder, config);
134+
}
135+
/**
136+
* 获取Member
137+
*
138+
* @return Member
139+
*/
140+
public Member member() {
141+
return new Member(tokenHolder, config);
142+
}
143+
/**
144+
* 获取Order
145+
*
146+
* @return Order
147+
*/
148+
public Order order() {
149+
return new Order(tokenHolder, config);
150+
}
151+
/**
152+
* 获取OutApproval
153+
*
154+
* @return OutApproval
155+
*/
156+
public OutApproval outapproval() {
157+
return new OutApproval(tokenHolder, config);
158+
}
159+
/**
160+
* 获取Rank
161+
*
162+
* @return Rank
163+
*/
164+
public Rank rank() {
165+
return new Rank(tokenHolder, config);
166+
}
167+
/**
168+
* 获取Regulation
169+
*
170+
* @return Regulation
171+
*/
172+
public Regulation regulation() {
173+
return new Regulation(tokenHolder, config);
174+
}
175+
/**
176+
* 获取Role
177+
*
178+
* @return Role
179+
*/
180+
public Role role() {
181+
return new Role(tokenHolder, config);
182+
}
183+
/**
184+
* 获取Traveler
185+
*
186+
* @return Traveler
187+
*/
188+
public Traveler traveler() {
189+
return new Traveler(tokenHolder, config);
190+
}
191+
/**
192+
* 获取Workspace
193+
*
194+
* @return Workspace
195+
*/
196+
public Workspace workspace() {
197+
return new Workspace(tokenHolder, config);
198+
}
122199

123200
}
124-

ddes-open-sdk/src/main/java/com/xiaoju/open/sdk/didies/core/Config.java

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,36 @@
99
import lombok.Builder;
1010
import lombok.Data;
1111
import lombok.EqualsAndHashCode;
12-
import lombok.experimental.Accessors;
1312

1413
import java.util.concurrent.TimeUnit;
1514

15+
/**
16+
* 应用配置信息
17+
*/
1618
@Data
1719
@Builder
1820
@EqualsAndHashCode(exclude = {"httpTransport"})
1921
public class Config {
2022

23+
/**
24+
* 应用ID
25+
*/
2126
private String clientId;
27+
/**
28+
* 应用密钥
29+
*/
2230
private String clientSecret;
31+
/**
32+
* 签名key
33+
*/
2334
private String signKey;
35+
/**
36+
* 基础URL
37+
*/
2438
private String baseUrl = "https://api.es.xiaojukeji.com";
39+
/**
40+
* grantType
41+
*/
2542
private String grantType = "client_credentials";
2643
/**
2744
* 因token失效接口请求重试次数
@@ -42,7 +59,7 @@ public class Config {
4259
/**
4360
* 调用超时时间
4461
*/
45-
private Long callTimeOut = 15000L;
62+
private Long callTimeOut = 3000L;
4663
/**
4764
* 超时时间单位,默认毫秒
4865
*/
@@ -76,6 +93,11 @@ public class Config {
7693
*/
7794
private EncryptTypeEnum encryptType = EncryptTypeEnum.NORMAL;
7895

96+
/**
97+
* 获取httpTransport
98+
*
99+
* @return httpTransport
100+
*/
79101
public IHttpTransport getHttpTransport() {
80102
if (httpTransport == null) {
81103
httpTransport = new RestHttpTransport(RestTemplates.noneUrlEncodeRestTemplate(this));

0 commit comments

Comments
 (0)