1 package com.foxinmy.weixin4j.qy.model;
2
3 import java.io.Serializable;
4 import java.util.List;
5
6 import com.alibaba.fastjson.annotation.JSONField;
7 import com.foxinmy.weixin4j.model.Token;
8 import com.foxinmy.weixin4j.qy.type.AgentAuthType;
9 import com.foxinmy.weixin4j.qy.type.LoginUserType;
10
11
12
13
14
15
16
17
18
19
20 public class OUserInfo implements Serializable {
21
22 private static final long serialVersionUID = -567063562050171293L;
23
24
25
26 @JSONField(name = "usertype")
27 private int userType;
28
29
30
31 @JSONField(name = "is_sys")
32 private boolean isSysAdmin;
33
34
35
36 @JSONField(name = "is_inner")
37 private boolean isInnerAdmin;
38
39
40
41 @JSONField(name = "user_info")
42 private User adminInfo;
43
44
45
46 @JSONField(name = "corp_info")
47 private CorpInfo corpInfo;
48
49
50
51 @JSONField(name = "agent")
52 private List<AgentItem> agentInfo;
53
54
55
56 @JSONField(name = "auth_info")
57 private AuthInfo authInfo;
58
59
60
61 @JSONField(name = "redirect_login_info")
62 private Token redirectLoginInfo;
63
64 public boolean isSysAdmin() {
65 return isSysAdmin;
66 }
67
68 public boolean isInnerAdmin() {
69 return isInnerAdmin;
70 }
71
72 public User getAdminInfo() {
73 return adminInfo;
74 }
75
76 public CorpInfo getCorpInfo() {
77 return corpInfo;
78 }
79
80 public List<AgentItem> getAgentInfo() {
81 return agentInfo;
82 }
83
84 public AuthInfo getAuthInfo() {
85 return authInfo;
86 }
87
88 public Token getRedirectLoginInfo() {
89 return redirectLoginInfo;
90 }
91
92
93
94 public int getUserType() {
95 return userType;
96 }
97
98 @JSONField(serialize = false)
99 public LoginUserType getFormatUserType() {
100 return LoginUserType.values()[userType - 1];
101 }
102
103 public void setUserType(int userType) {
104 this.userType = userType;
105 }
106
107 public void setSysAdmin(boolean isSysAdmin) {
108 this.isSysAdmin = isSysAdmin;
109 }
110
111 public void setInnerAdmin(boolean isInnerAdmin) {
112 this.isInnerAdmin = isInnerAdmin;
113 }
114
115 public void setAdminInfo(User adminInfo) {
116 this.adminInfo = adminInfo;
117 }
118
119 public void setCorpInfo(CorpInfo corpInfo) {
120 this.corpInfo = corpInfo;
121 }
122
123 public void setAgentInfo(List<AgentItem> agentInfo) {
124 this.agentInfo = agentInfo;
125 }
126
127 public void setAuthInfo(AuthInfo authInfo) {
128 this.authInfo = authInfo;
129 }
130
131 public void setRedirectLoginInfo(Token redirectLoginInfo) {
132 this.redirectLoginInfo = redirectLoginInfo;
133 }
134
135 @Override
136 public String toString() {
137 return "OUserInfo [userType=" + userType + ", isSysAdmin=" + isSysAdmin
138 + ", isInnerAdmin=" + isInnerAdmin + ", adminInfo=" + adminInfo
139 + ", corpInfo=" + corpInfo + ", agentInfo=" + agentInfo
140 + ", authInfo=" + authInfo + ", redirectLoginInfo="
141 + redirectLoginInfo + "]";
142 }
143
144
145
146
147
148
149
150
151
152
153 public static class AuthInfo implements Serializable {
154
155 private static final long serialVersionUID = -4290240764958942370L;
156
157
158
159 @JSONField(name = "is_new_auth")
160 private boolean isNewAuth;
161
162
163
164 @JSONField(name = "agent")
165 private List<AgentItem> agentItems;
166
167
168
169 @JSONField(name = "department")
170 private List<DepartItem> departItems;
171
172 public List<AgentItem> getAgentItems() {
173 return agentItems;
174 }
175
176 public List<DepartItem> getDepartItems() {
177 return departItems;
178 }
179
180
181
182 public boolean isNewAuth() {
183 return isNewAuth;
184 }
185
186 public void setNewAuth(boolean isNewAuth) {
187 this.isNewAuth = isNewAuth;
188 }
189
190 public void setAgentItems(List<AgentItem> agentItems) {
191 this.agentItems = agentItems;
192 }
193
194 public void setDepartItems(List<DepartItem> departItems) {
195 this.departItems = departItems;
196 }
197
198 @Override
199 public String toString() {
200 return "AuthInfo [isNewAuth=" + isNewAuth + ", agentItems="
201 + agentItems + ", departItems=" + departItems + "]";
202 }
203 }
204
205
206
207
208
209
210
211
212
213
214 public static class AgentItem extends AgentOverview {
215
216 private static final long serialVersionUID = -1188968391623633559L;
217
218
219
220 @JSONField(name = "auth_type")
221 private int authType;
222
223
224
225 @JSONField(name = "appid")
226 private int appId;
227
228
229
230
231 @JSONField(name = "api_group")
232 private List<String> apiGroup;
233
234
235
236 @JSONField(name = "privilege")
237 private PrivilegeInfo privilege;
238
239 public int getAuthType() {
240 return authType;
241 }
242
243 @JSONField(serialize = false)
244 public AgentAuthType getFormatAuthType() {
245 if (authType == 0) {
246 return AgentAuthType.USE;
247 } else if (authType == 1) {
248 return AgentAuthType.MANAGE;
249 }
250 return null;
251 }
252
253 public int getAppId() {
254 return appId;
255 }
256
257 public List<String> getApiGroup() {
258 return apiGroup;
259 }
260
261
262
263 public PrivilegeInfo getPrivilege() {
264 return privilege;
265 }
266
267 public void setPrivilege(PrivilegeInfo privilege) {
268 this.privilege = privilege;
269 }
270
271 public void setAuthType(int authType) {
272 this.authType = authType;
273 }
274
275 public void setAppId(int appId) {
276 this.appId = appId;
277 }
278
279 public void setApiGroup(List<String> apiGroup) {
280 this.apiGroup = apiGroup;
281 }
282
283 @Override
284 public String toString() {
285 return "AgentItem [authType=" + authType + ", appId=" + appId
286 + ", apiGroup=" + apiGroup + ", privilege=" + privilege
287 + ", " + super.toString() + "]";
288 }
289 }
290
291
292
293
294
295
296
297
298
299
300 public static class DepartItem extends Party {
301
302 private static final long serialVersionUID = 556556672204642407L;
303
304
305
306
307 private boolean writable;
308
309 public boolean isWritable() {
310 return writable;
311 }
312
313
314 public void setWritable(boolean writable) {
315 this.writable = writable;
316 }
317
318 @Override
319 public String toString() {
320 return "DepartItem [writable=" + writable + ", " + super.toString()
321 + "]";
322 }
323 }
324 }