mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
🆕 #2746 【企业微信】 增加读取学生或家长所有接口支持
This commit is contained in:
@@ -158,6 +158,40 @@ public interface WxCpSchoolUserService {
|
||||
*/
|
||||
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)
|
||||
|
||||
@@ -142,6 +142,27 @@ public class WxCpSchoolUserServiceImpl implements WxCpSchoolUserService {
|
||||
return WxCpBatchResultList.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpUserResult getUser(@NonNull String userId) throws WxErrorException {
|
||||
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(GET_USER) + userId;
|
||||
String responseContent = this.cpService.get(apiUrl, null);
|
||||
return WxCpUserResult.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpUserListResult getUserList(@NonNull Integer departmentId, Integer fetchChild) throws WxErrorException {
|
||||
String apiUrl = String.format(this.cpService.getWxCpConfigStorage().getApiUrl(GET_USER_LIST), departmentId, fetchChild);
|
||||
String responseContent = this.cpService.get(apiUrl, null);
|
||||
return WxCpUserListResult.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpListParentResult getUserListParent(@NonNull Integer departmentId) throws WxErrorException {
|
||||
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(GET_USER_LIST_PARENT) + departmentId;
|
||||
String responseContent = this.cpService.get(apiUrl, null);
|
||||
return WxCpListParentResult.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpBaseResp updateParent(@NonNull WxCpUpdateParentRequest request) throws WxErrorException {
|
||||
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(UPDATE_PARENT);
|
||||
|
||||
Reference in New Issue
Block a user