🎨 #3458 【企业微信】家校沟通获取部门列表接口优化,如果部门id为空则获取全量组织架构
This commit is contained in:
@@ -334,7 +334,7 @@ public interface WxCpSchoolUserService {
|
||||
* 请求方式:GET(HTTPS)
|
||||
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/school/department/list?access_token=ACCESS_TOKEN&id=ID
|
||||
*
|
||||
* @param id the id
|
||||
* @param id 部门id。获取指定部门及其下的子部门。 如果不填,默认获取全量组织架构
|
||||
* @return wx cp department list
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
|
||||
@@ -16,6 +16,7 @@ import me.chanjar.weixin.cp.bean.school.user.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.ExternalContact.*;
|
||||
import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.School.*;
|
||||
@@ -246,7 +247,7 @@ public class WxCpSchoolUserServiceImpl implements WxCpSchoolUserService {
|
||||
|
||||
@Override
|
||||
public WxCpDepartmentList listDepartment(Integer id) throws WxErrorException {
|
||||
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(DEPARTMENT_LIST) + id;
|
||||
String apiUrl = Objects.isNull(id) ? this.cpService.getWxCpConfigStorage().getApiUrl(DEPARTMENT_LIST) : String.format("%s?id=%s", this.cpService.getWxCpConfigStorage().getApiUrl(DEPARTMENT_LIST), id);
|
||||
String responseContent = this.cpService.get(apiUrl, null);
|
||||
return WxCpDepartmentList.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@@ -691,7 +691,7 @@ public interface WxCpApiPathConsts {
|
||||
/**
|
||||
* The constant DEPARTMENT_LIST.
|
||||
*/
|
||||
String DEPARTMENT_LIST = "/cgi-bin/school/department/list?id=";
|
||||
String DEPARTMENT_LIST = "/cgi-bin/school/department/list";
|
||||
|
||||
/**
|
||||
* The constant GET_PAYMENT_RESULT.
|
||||
|
||||
Reference in New Issue
Block a user