Skip to content

Commit

Permalink
[企业微信]查询电子发票企业微信官方文档更新接口 binarywang#2178
Browse files Browse the repository at this point in the history
  • Loading branch information
pengg committed Jun 29, 2021
1 parent ee0e20a commit 92320d4
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ WxCpExternalContactBatchInfo getContactDetailBatch(String userId, String cursor,
* 微信文档:https://work.weixin.qq.com/api/doc/90000/90135/92119
* </pre>
*
* @deprecated 请使用 {@link WxCpExternalContactService#listGroupChat(Integer, String, int, String[])}
* @param pageIndex the page index
* @param pageSize the page size
* @param status the status
Expand All @@ -329,8 +330,26 @@ WxCpExternalContactBatchInfo getContactDetailBatch(String userId, String cursor,
* @return the wx cp user external group chat list
* @throws WxErrorException the wx error exception
*/
@Deprecated
WxCpUserExternalGroupChatList listGroupChat(Integer pageIndex, Integer pageSize, int status, String[] userIds, String[] partyIds) throws WxErrorException;

/**
* <pre>
* 该接口用于获取配置过客户群管理的客户群列表。
* 企业需要使用“客户联系”secret或配置到“可调用应用”列表中的自建应用secret所获取的accesstoken来调用(accesstoken如何获取?)。
* 暂不支持第三方调用。
* 微信文档:https://work.weixin.qq.com/api/doc/90000/90135/92119
* </pre>
*
* @param limit 分页,预期请求的数据量,取值范围 1 ~ 1000
* @param cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用不填
* @param status 客户群跟进状态过滤。0 - 所有列表(即不过滤) 1 - 离职待继承 2 - 离职继承中 3 - 离职继承完成 默认为0
* @param userIds 群主过滤。如果不填,表示获取应用可见范围内全部群主的数据(但是不建议这么用,如果可见范围人数超过1000人,为了防止数据包过大,会报错 81017);用户ID列表。最多100个
* @return the wx cp user external group chat list
* @throws WxErrorException the wx error exception
*/
WxCpUserExternalGroupChatList listGroupChat(Integer limit, String cursor, int status, String[] userIds) throws WxErrorException;

/**
* <pre>
* 通过客户群ID,获取详情。包括群名、群成员列表、群成员入群时间、入群方式。(客户群是由具有客户群使用权限的成员创建的外部群)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,24 @@ public WxCpUserExternalGroupChatList listGroupChat(Integer pageIndex, Integer pa
return WxCpUserExternalGroupChatList.fromJson(result);
}

@Override
public WxCpUserExternalGroupChatList listGroupChat(Integer limit, String cursor, int status, String[] userIds) throws WxErrorException {
JsonObject json = new JsonObject();
json.addProperty("cursor", cursor == null ? "" : cursor);
json.addProperty("limit", limit == null ? 100 : limit);
json.addProperty("status_filter", status);
if (ArrayUtils.isNotEmpty(userIds)) {
JsonObject ownerFilter = new JsonObject();
if (ArrayUtils.isNotEmpty(userIds)) {
ownerFilter.add("userid_list", new Gson().toJsonTree(userIds).getAsJsonArray());
}
json.add("owner_filter", ownerFilter);
}
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GROUP_CHAT_LIST);
final String result = this.mainService.post(url, json.toString());
return WxCpUserExternalGroupChatList.fromJson(result);
}

@Override
public WxCpUserExternalGroupChatInfo getGroupChat(String chatId) throws WxErrorException {
JsonObject json = new JsonObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@
@Getter
@Setter
public class WxCpUserExternalGroupChatList extends WxCpBaseResp {
private static final long serialVersionUID = 1907272035492110236L;

@SerializedName("group_chat_list")
private List<ChatStatus> groupChatList;

@SerializedName("next_cursor")
private String nextCursor;

@Getter
@Setter
public static class ChatStatus implements Serializable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,13 @@ public void testListGroupChat() throws WxErrorException {
assertNotNull(result);
}

@Test
public void testListGroupChatV3() throws WxErrorException {
WxCpUserExternalGroupChatList result = this.wxCpService.getExternalContactService().listGroupChat(100, "" ,0,new String[1]);
System.out.println(result);
assertNotNull(result);
}

@Test
public void testGetGroupChat() {
}
Expand Down

0 comments on commit 92320d4

Please sign in to comment.