Skip to content

Commit 568d02c

Browse files
authored
🆕 #2181【企业微信】增加支持传入groupId参数的获取企业标签库接口实现
1 parent fedab8f commit 568d02c

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpExternalContactService.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,20 @@ WxCpExternalContactBatchInfo getContactDetailBatch(String userId, String cursor,
455455
*/
456456
WxCpUserExternalTagGroupList getCorpTagList(String[] tagId) throws WxErrorException;
457457

458+
/**
459+
* <pre>
460+
* 企业可通过此接口获取企业客户标签详情。
461+
* 若tag_id和group_id均为空,则返回所有标签。
462+
* 同时传递tag_id和group_id时,忽略tag_id,仅以group_id作为过滤条件。
463+
* </pre>
464+
*
465+
* @param tagId the tag id
466+
* @param groupId the tagGroup id
467+
* @return corp tag list
468+
* @throws WxErrorException the wx error exception
469+
*/
470+
WxCpUserExternalTagGroupList getCorpTagList(String[] tagId, String[] groupId) throws WxErrorException;
471+
458472
/**
459473
* <pre>
460474
* 企业可通过此接口向客户标签库中添加新的标签组和标签,每个企业最多可配置3000个企业标签。

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpExternalContactServiceImpl.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,20 @@ public WxCpUserExternalTagGroupList getCorpTagList(String[] tagId) throws WxErro
334334
return WxCpUserExternalTagGroupList.fromJson(result);
335335
}
336336

337+
@Override
338+
public WxCpUserExternalTagGroupList getCorpTagList(String[] tagId, String[] groupId) throws WxErrorException {
339+
JsonObject json = new JsonObject();
340+
if (ArrayUtils.isNotEmpty(tagId)) {
341+
json.add("tag_id", new Gson().toJsonTree(tagId).getAsJsonArray());
342+
}
343+
if (ArrayUtils.isNotEmpty(groupId)) {
344+
json.add("group_id", new Gson().toJsonTree(groupId).getAsJsonArray());
345+
}
346+
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_CORP_TAG_LIST);
347+
final String result = this.mainService.post(url, json.toString());
348+
return WxCpUserExternalTagGroupList.fromJson(result);
349+
}
350+
337351
@Override
338352
public WxCpUserExternalTagGroupInfo addCorpTag(WxCpUserExternalTagGroupInfo tagGroup) throws WxErrorException {
339353

0 commit comments

Comments
 (0)