1
0
mirror of synced 2025-12-22 00:48:00 +08:00

🎨 #2563 【企业微信】优化获取待分配离职成员列表的接口,增加分页查询游标参数

This commit is contained in:
Wong
2022-03-25 09:21:27 +00:00
committed by Binary Wang
parent 1893790aae
commit 62645a4311
4 changed files with 81 additions and 11 deletions

View File

@@ -361,14 +361,19 @@ public interface WxCpExternalContactService {
List<String> listFollowers() throws WxErrorException;
/**
* 企业和第三方可通过此接口,获取所有离职成员的客户列表,并可进一步调用离职成员的外部联系人再分配接口将这些客户重新分配给其他企业成员。
* 获取待分配的离职成员列表
* 企业和第三方可通过此接口,获取所有离职成员的客户列表,并可进一步调用分配离职成员的客户接口将这些客户重新分配给其他企业成员。
*
* @param page the page
* @param pageSize the page size
* @return wx cp user external unassign list
* @throws WxErrorException the wx error exception
* 请求方式POSTHTTPS
* 请求地址https://qyapi.weixin.qq.com/cgi-bin/externalcontact/get_unassigned_list?access_token=ACCESS_TOKEN
*
* @param pageId 分页查询要查询页号从0开始
* @param cursor 分页查询游标字符串类型适用于数据量较大的情况如果使用该参数则无需填写page_id该参数由上一次调用返回
* @param pageSize 每次返回的最大记录数默认为1000最大值为1000
* @return
* @throws WxErrorException
*/
WxCpUserExternalUnassignList listUnassignedList(Integer page, Integer pageSize) throws WxErrorException;
WxCpUserExternalUnassignList listUnassignedList(Integer pageId, String cursor, Integer pageSize) throws WxErrorException;
/**
* 企业可通过此接口,将已离职成员的外部联系人分配给另一个成员接替联系。

View File

@@ -32,7 +32,7 @@ import java.util.List;
import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.ExternalContact.*;
/**
* @author 曹祖鹏 & yuanqixun & Mr.Pan
* @author 曹祖鹏 & yuanqixun & Mr.Pan & Wang_Wong
*/
@RequiredArgsConstructor
public class WxCpExternalContactServiceImpl implements WxCpExternalContactService {
@@ -245,10 +245,13 @@ public class WxCpExternalContactServiceImpl implements WxCpExternalContactServic
}
@Override
public WxCpUserExternalUnassignList listUnassignedList(Integer pageIndex, Integer pageSize) throws WxErrorException {
public WxCpUserExternalUnassignList listUnassignedList(Integer pageIndex, String cursor, Integer pageSize) throws WxErrorException {
JsonObject json = new JsonObject();
json.addProperty("page_id", pageIndex == null ? 0 : pageIndex);
json.addProperty("page_size", pageSize == null ? 100 : pageSize);
if(pageIndex != null){
json.addProperty("page_id", pageIndex);
}
json.addProperty("cursor", StringUtils.isEmpty(cursor) ? "" : cursor);
json.addProperty("page_size", pageSize == null ? 1000 : pageSize);
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(LIST_UNASSIGNED_CONTACT);
final String result = this.mainService.post(url, json.toString());
return WxCpUserExternalUnassignList.fromJson(result);

View File

@@ -12,7 +12,7 @@ import java.util.List;
/**
* 离职员工外部联系人列表
*
* @author yqx
* @author yqx & Wang_Wong
* @date 2020/3/15
*/
@Getter
@@ -25,6 +25,9 @@ public class WxCpUserExternalUnassignList extends WxCpBaseResp {
@SerializedName("is_last")
private boolean isLast;
@SerializedName("next_cursor")
private String nextCursor;
@Getter
@Setter
public static class UnassignInfo implements Serializable {
@@ -52,4 +55,9 @@ public class WxCpUserExternalUnassignList extends WxCpBaseResp {
public static WxCpUserExternalUnassignList fromJson(String json) {
return WxCpGsonBuilder.create().fromJson(json, WxCpUserExternalUnassignList.class);
}
public String toJson() {
return WxCpGsonBuilder.create().toJson(this);
}
}