🆕 #2746 【企业微信】 增加读取学生或家长所有接口支持

This commit is contained in:
0katekate0
2022-07-14 09:15:54 +08:00
committed by GitHub
parent e0f3c76cea
commit bac18534dc
8 changed files with 536 additions and 0 deletions

View File

@@ -158,6 +158,40 @@ public interface WxCpSchoolUserService {
*/
WxCpBatchResultList batchUpdateParent(@NonNull WxCpBatchUpdateParentRequest request) throws WxErrorException;
/**
* 读取学生或家长
* 请求方式GETHTTPS
* 请求地址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;
/**
* 获取部门成员详情
* 请求方式GETHTTPS
* 请求地址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;
/**
* 获取部门家长详情
* 请求方式GETHTTPS
* 请求地址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;
/**
* 更新家长
* 请求方式POSTHTTPS

View File

@@ -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);