🆕 #2181【企业微信】增加支持传入groupId参数的获取企业标签库接口实现

This commit is contained in:
wrinkle
2021-07-02 09:52:38 +08:00
committed by GitHub
parent fedab8f28a
commit 568d02c25e
2 changed files with 28 additions and 0 deletions

View File

@ -455,6 +455,20 @@ public interface WxCpExternalContactService {
*/
WxCpUserExternalTagGroupList getCorpTagList(String[] tagId) throws WxErrorException;
/**
* <pre>
* 企业可通过此接口获取企业客户标签详情。
* 若tag_id和group_id均为空则返回所有标签。
* 同时传递tag_id和group_id时忽略tag_id仅以group_id作为过滤条件。
* </pre>
*
* @param tagId the tag id
* @param groupId the tagGroup id
* @return corp tag list
* @throws WxErrorException the wx error exception
*/
WxCpUserExternalTagGroupList getCorpTagList(String[] tagId, String[] groupId) throws WxErrorException;
/**
* <pre>
* 企业可通过此接口向客户标签库中添加新的标签组和标签每个企业最多可配置3000个企业标签。

View File

@ -334,6 +334,20 @@ public class WxCpExternalContactServiceImpl implements WxCpExternalContactServic
return WxCpUserExternalTagGroupList.fromJson(result);
}
@Override
public WxCpUserExternalTagGroupList getCorpTagList(String[] tagId, String[] groupId) throws WxErrorException {
JsonObject json = new JsonObject();
if (ArrayUtils.isNotEmpty(tagId)) {
json.add("tag_id", new Gson().toJsonTree(tagId).getAsJsonArray());
}
if (ArrayUtils.isNotEmpty(groupId)) {
json.add("group_id", new Gson().toJsonTree(groupId).getAsJsonArray());
}
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_CORP_TAG_LIST);
final String result = this.mainService.post(url, json.toString());
return WxCpUserExternalTagGroupList.fromJson(result);
}
@Override
public WxCpUserExternalTagGroupInfo addCorpTag(WxCpUserExternalTagGroupInfo tagGroup) throws WxErrorException {