1
0
mirror of synced 2026-04-12 20:18:56 +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 @Override
public List<WxCpUser> listSimpleByDepartment(Long departId, Boolean fetchChild, Integer status, String corpId) public List<WxCpUser> listSimpleByDepartment(Long departId, Boolean fetchChild, Integer status, String corpId)
throws WxErrorException { throws WxErrorException {
String params = ""; StringBuilder params = new StringBuilder();
if (fetchChild != null) { if (fetchChild != null) {
params += "&fetch_child=" + (fetchChild ? "1" : "0"); params.append("fetch_child=").append(fetchChild ? "1" : "0");
} }
if (status != null) { if (status != null) {
params += "&status=" + status; if (params.length() > 0) {
} else { params.append('&');
params += "&status=0";
} }
params += "&access_token=" + mainService.getWxCpTpConfigStorage().getAccessToken(corpId); params.append("status=").append(status);
} else {
if (params.length() > 0) {
params.append('&');
}
params.append("status=0");
}
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 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); JsonObject tmpJsonElement = GsonParser.parse(responseContent);
return WxCpGsonBuilder.create() return WxCpGsonBuilder.create()
.fromJson( .fromJson(