1
0
mirror of synced 2026-04-10 18:48:41 +08:00

Update weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/impl/WxCpTpUserServiceImpl.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Binary Wang
2026-03-12 14:34:02 +08:00
committed by GitHub
parent 7b25283d8b
commit 64e021017f

View File

@@ -99,19 +99,29 @@ public class WxCpTpUserServiceImpl implements WxCpTpUserService {
@Override
public List<WxCpUser> listSimpleByDepartment(Long departId, Boolean fetchChild, Integer status, String corpId)
throws WxErrorException {
String params = "";
StringBuilder params = new StringBuilder();
if (fetchChild != null) {
params += "&fetch_child=" + (fetchChild ? "1" : "0");
params.append("fetch_child=").append(fetchChild ? "1" : "0");
}
if (status != null) {
params += "&status=" + status;
if (params.length() > 0) {
params.append('&');
}
params.append("status=").append(status);
} else {
params += "&status=0";
if (params.length() > 0) {
params.append('&');
}
params.append("status=0");
}
params += "&access_token=" + mainService.getWxCpTpConfigStorage().getAccessToken(corpId);
if (params.length() > 0) {
params.append('&');
}
params.append("access_token=")
.append(mainService.getWxCpTpConfigStorage().getAccessToken(corpId));
String url = mainService.getWxCpTpConfigStorage().getApiUrl(USER_SIMPLE_LIST + departId);
String responseContent = this.mainService.get(url, params, true);
String responseContent = this.mainService.get(url, params.toString(), true);
JsonObject tmpJsonElement = GsonParser.parse(responseContent);
return WxCpGsonBuilder.create()
.fromJson(