forked from binarywang/WxJava
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathWxCpSchoolUserService.java
More file actions
363 lines (330 loc) · 12.6 KB
/
WxCpSchoolUserService.java
File metadata and controls
363 lines (330 loc) · 12.6 KB
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
package me.chanjar.weixin.cp.api;
import lombok.NonNull;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
import me.chanjar.weixin.cp.bean.WxCpOauth2UserInfo;
import me.chanjar.weixin.cp.bean.school.user.*;
import java.util.List;
/**
* 企业微信家校沟通相关接口.
* https://developer.work.weixin.qq.com/document/path/91638
*
* @author <a href="https://github.com/0katekate0">Wang_Wong</a>
* @date: 2022/6/18 9:10
*/
public interface WxCpSchoolUserService {
/**
* 获取访问用户身份
* 该接口用于根据code获取成员信息
* <p>
* 请求方式:GET(HTTPS)
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo?access_token=ACCESS_TOKEN&code=CODE
*
* @param code
* @return
* @throws WxErrorException
*/
WxCpOauth2UserInfo getUserInfo(@NonNull String code) throws WxErrorException;
/**
* 获取家校访问用户身份
* 该接口用于根据code获取家长或者学生信息
* <p>
* 请求方式:GET(HTTPS)
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/school/getuserinfo?access_token=ACCESS_TOKEN&code=CODE
*
* @param code
* @return
* @throws WxErrorException
*/
WxCpOauth2UserInfo getSchoolUserInfo(@NonNull String code) throws WxErrorException;
/**
* 创建学生
* 请求方式:POST(HTTPS)
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/school/user/create_student?access_token=ACCESS_TOKEN
*
* @param studentUserId
* @param name
* @param departments
* @return
* @throws WxErrorException
*/
WxCpBaseResp createStudent(@NonNull String studentUserId, @NonNull String name, @NonNull List<Integer> departments) throws WxErrorException;
/**
* 批量创建学生
* 请求方式:POST(HTTPS)
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/school/user/batch_create_student?access_token=ACCESS_TOKEN
*
* @param request
* @return
* @throws WxErrorException
*/
WxCpBatchResultList batchCreateStudent(@NonNull WxCpBatchCreateStudentRequest request) throws WxErrorException;
/**
* 批量删除学生
* 请求方式:POST(HTTPS)
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/school/user/batch_delete_student?access_token=ACCESS_TOKEN
*
* @param request
* @return
* @throws WxErrorException
*/
WxCpBatchResultList batchDeleteStudent(@NonNull WxCpBatchDeleteStudentRequest request) throws WxErrorException;
/**
* 批量更新学生
* 请求方式:POST(HTTPS)
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/school/user/batch_update_student?access_token=ACCESS_TOKEN
*
* @param request
* @return
* @throws WxErrorException
*/
WxCpBatchResultList batchUpdateStudent(@NonNull WxCpBatchUpdateStudentRequest request) throws WxErrorException;
/**
* 删除学生
* 请求方式:GET(HTTPS)
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/school/user/delete_student?access_token=ACCESS_TOKEN&userid=USERID
*
* @param studentUserId
* @return
* @throws WxErrorException
*/
WxCpBaseResp deleteStudent(@NonNull String studentUserId) throws WxErrorException;
/**
* 更新学生
* 请求方式:POST(HTTPS)
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/school/user/update_student?access_token=ACCESS_TOKEN
*
* @param studentUserId
* @param newStudentUserId
* @param name
* @param departments
* @return
* @throws WxErrorException
*/
WxCpBaseResp updateStudent(@NonNull String studentUserId, String newStudentUserId, String name, List<Integer> departments) throws WxErrorException;
/**
* 创建家长
* 请求方式:POST(HTTPS)
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/school/user/create_parent?access_token=ACCESS_TOKEN
*
* @param request
* @return
* @throws WxErrorException
*/
WxCpBaseResp createParent(@NonNull WxCpCreateParentRequest request) throws WxErrorException;
/**
* 批量创建家长
* 请求方式:POST(HTTPS)
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/school/user/batch_create_parent?access_token=ACCESS_TOKEN
*
* @param request
* @return
* @throws WxErrorException
*/
WxCpBatchResultList batchCreateParent(@NonNull WxCpBatchCreateParentRequest request) throws WxErrorException;
/**
* 批量删除家长
* 请求方式:POST(HTTPS)
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/school/user/batch_delete_parent?access_token=ACCESS_TOKEN
*
* @param userIdList
* @return
* @throws WxErrorException
*/
WxCpBatchResultList batchDeleteParent(@NonNull String... userIdList) throws WxErrorException;
/**
* 批量更新家长
* 请求方式:POST(HTTPS)
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/school/user/batch_update_parent?access_token=ACCESS_TOKEN
*
* @param request
* @return
* @throws WxErrorException
*/
WxCpBatchResultList batchUpdateParent(@NonNull WxCpBatchUpdateParentRequest request) throws WxErrorException;
/**
* 读取学生或家长
* 请求方式:GET(HTTPS)
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/school/user/get?access_token=ACCESS_TOKEN&userid=USERID
*
* @param userId
* @return
* @throws WxErrorException
*/
WxCpUserResult getUser(@NonNull String userId) throws WxErrorException;
/**
* 获取部门成员详情
* 请求方式:GET(HTTPS)
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/school/user/list?access_token=ACCESS_TOKEN&department_id=DEPARTMENT_ID&fetch_child=FETCH_CHILD
*
* @param departmentId 获取的部门id
* @param fetchChild 1/0:是否递归获取子部门下面的成员
* @return
* @throws WxErrorException
*/
WxCpUserListResult getUserList(@NonNull Integer departmentId, Integer fetchChild) throws WxErrorException;
/**
* 获取部门家长详情
* 请求方式:GET(HTTPS)
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/school/user/list_parent?access_token=ACCESS_TOKEN&department_id=DEPARTMENT_ID
*
* @param departmentId 获取的部门id
* @return
* @throws WxErrorException
*/
WxCpListParentResult getUserListParent(@NonNull Integer departmentId) throws WxErrorException;
/**
* 更新家长
* 请求方式:POST(HTTPS)
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/school/user/update_parent?access_token=ACCESS_TOKEN
*
* @param request
* @return
* @throws WxErrorException
*/
WxCpBaseResp updateParent(@NonNull WxCpUpdateParentRequest request) throws WxErrorException;
/**
* 删除家长
* 请求方式:GET(HTTPS)
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/school/user/delete_parent?access_token=ACCESS_TOKEN&userid=USERID
*
* @param userId
* @return
* @throws WxErrorException
*/
WxCpBaseResp deleteParent(@NonNull String userId) throws WxErrorException;
/**
* 设置家校通讯录自动同步模式
* 企业和第三方可通过此接口修改家校通讯录与班级标签之间的自动同步模式,注意,一旦设置禁止自动同步,将无法再次开启。
* <p>
* 请求方式:POST(HTTPS)
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/school/set_arch_sync_mode?access_token=ACCESS_TOKEN
*
* @param archSyncMode 家校通讯录同步模式:1-禁止将标签同步至家校通讯录,2-禁止将家校通讯录同步至标签,3-禁止家校通讯录和标签相互同步
* @return
* @throws WxErrorException
*/
WxCpBaseResp setArchSyncMode(@NonNull Integer archSyncMode) throws WxErrorException;
/**
* 创建部门
* <p>
* 请求方式:POST(HTTPS)
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/school/department/create?access_token=ACCESS_TOKEN
*
* @param request 请求参数对象
* @return
* @throws WxErrorException
*/
WxCpCreateDepartment createDepartment(@NonNull WxCpCreateDepartmentRequest request) throws WxErrorException;
/**
* 更新部门
* <p>
* 请求方式:POST(HTTPS)
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/school/department/update?access_token=ACCESS_TOKEN
*
* @param request
* @return
* @throws WxErrorException
*/
WxCpBaseResp updateDepartment(@NonNull WxCpUpdateDepartmentRequest request) throws WxErrorException;
/**
* 删除部门
* 请求方式:GET(HTTPS)
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/school/department/delete?access_token=ACCESS_TOKEN&id=ID
*
* @param id
* @return
* @throws WxErrorException
*/
WxCpBaseResp deleteDepartment(Integer id) throws WxErrorException;
/**
* 设置关注「学校通知」的模式
* 可通过此接口修改家长关注「学校通知」的模式:“可扫码填写资料加入”或“禁止扫码填写资料加入”
* <p>
* 请求方式:POST(HTTPS)
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/set_subscribe_mode?access_token=ACCESS_TOKEN
*
* @param subscribeMode 关注模式, 1:可扫码填写资料加入, 2:禁止扫码填写资料加入
* @return
* @throws WxErrorException
*/
WxCpBaseResp setSubscribeMode(@NonNull Integer subscribeMode) throws WxErrorException;
/**
* 获取关注「学校通知」的模式
* 可通过此接口获取家长关注「学校通知」的模式:“可扫码填写资料加入”或“禁止扫码填写资料加入”
* <p>
* 请求方式:GET(HTTPS)
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/get_subscribe_mode?access_token=ACCESS_TOKEN
*
* @return
* @throws WxErrorException
*/
Integer getSubscribeMode() throws WxErrorException;
/**
* 获取外部联系人详情
* 学校可通过此接口,根据外部联系人的userid(如何获取?),拉取外部联系人详情。
* <p>
* 请求方式:GET(HTTPS)
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/get?access_token=ACCESS_TOKEN&external_userid=EXTERNAL_USERID
*
* @param externalUserId 外部联系人的userid,注意不是学校成员的帐号
* @return
* @throws WxErrorException
*/
WxCpExternalContact getExternalContact(@NonNull String externalUserId) throws WxErrorException;
/**
* 获取可使用的家长范围
* 获取可在微信「学校通知-学校应用」使用该应用的家长范围,以学生或部门列表的形式返回。应用只能给该列表下的家长发送「学校通知」。注意该范围只能由学校的系统管理员在「管理端-家校沟通-配置」配置。
* <p>
* 请求方式:GET(HTTPS)
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/school/agent/get_allow_scope?access_token=ACCESS_TOKEN&agentid=AGENTID
*
* @param agentId
* @return
* @throws WxErrorException
*/
WxCpAllowScope getAllowScope(@NonNull Integer agentId) throws WxErrorException;
/**
* 外部联系人openid转换
* 企业和服务商可通过此接口,将微信外部联系人的userid(如何获取?)转为微信openid,用于调用支付相关接口。暂不支持企业微信外部联系人(ExternalUserid为wo开头)的userid转openid。
* <p>
* 请求方式:POST(HTTPS)
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/convert_to_openid?access_token=ACCESS_TOKEN
*
* @param externalUserId
* @return
* @throws WxErrorException
*/
String convertToOpenId(@NonNull String externalUserId) throws WxErrorException;
/**
* 获取部门列表
* 请求方式:GET(HTTPS)
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/school/department/list?access_token=ACCESS_TOKEN&id=ID
*
* @param id
* @return
* @throws WxErrorException
*/
WxCpDepartmentList listDepartment(Integer id) throws WxErrorException;
/**
* 获取「学校通知」二维码
* 学校可通过此接口获取「学校通知」二维码,家长可通过扫描此二维码关注「学校通知」并接收学校推送的消息。
* 请求方式:GET(HTTPS)
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/get_subscribe_qr_code?access_token=ACCESS_TOKEN
*
* @return
* @throws WxErrorException
*/
WxCpSubscribeQrCode getSubscribeQrCode() throws WxErrorException;
/**
* 修改自动升年级的配置
* 请求方式: POST(HTTPS)
* 请求地址: https://qyapi.weixin.qq.com/cgi-bin/school/set_upgrade_info?access_token=ACCESS_TOKEN
*
* @param upgradeTime
* @param upgradeSwitch
* @return
* @throws WxErrorException
*/
WxCpSetUpgradeInfo setUpgradeInfo(Long upgradeTime, Integer upgradeSwitch) throws WxErrorException;
}