🆕 #2596 【企业微信】新增通讯录管理-异步批量增量更新成员的接口

This commit is contained in:
zhongjun 2022-04-19 17:31:31 +08:00 committed by GitHub
parent 062eb6c3b4
commit 050dafbd42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 4 deletions

View File

@ -263,6 +263,14 @@ public interface WxCpService extends WxService {
*/
String replaceParty(String mediaId) throws WxErrorException;
/**
* 上传用户列表增量更新成员
* @param mediaId 媒体id
* @return jobId 异步任务id
* @throws WxErrorException the wx error exception
*/
String syncUser(String mediaId) throws WxErrorException;
/**
* 上传用户列表覆盖企业号上的用户信息
*
@ -275,11 +283,11 @@ public interface WxCpService extends WxService {
/**
* 获取异步任务结果
*
* @param joinId the join id
* @param jobId 异步任务id
* @return the task result
* @throws WxErrorException the wx error exception
*/
String getTaskResult(String joinId) throws WxErrorException;
String getTaskResult(String jobId) throws WxErrorException;
/**
* 初始化http请求对象

View File

@ -408,6 +408,15 @@ public abstract class BaseWxCpServiceImpl<H, P> implements WxCpService, RequestH
return post(this.configStorage.getApiUrl(BATCH_REPLACE_PARTY), jsonObject.toString());
}
@Override
public String syncUser(String mediaId) throws WxErrorException {
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("media_id", mediaId);
String responseContent = post(this.configStorage.getApiUrl(BATCH_SYNC_USER), jsonObject.toString());
JsonObject tmpJson = GsonParser.parse(responseContent);
return tmpJson.get("jobid").getAsString();
}
@Override
public String replaceUser(String mediaId) throws WxErrorException {
JsonObject jsonObject = new JsonObject();
@ -416,8 +425,8 @@ public abstract class BaseWxCpServiceImpl<H, P> implements WxCpService, RequestH
}
@Override
public String getTaskResult(String joinId) throws WxErrorException {
String url = this.configStorage.getApiUrl(BATCH_GET_RESULT + joinId);
public String getTaskResult(String jobId) throws WxErrorException {
String url = this.configStorage.getApiUrl(BATCH_GET_RESULT + jobId);
return get(url, null);
}

View File

@ -16,6 +16,7 @@ public interface WxCpApiPathConsts {
String GET_AGENT_CONFIG_TICKET = "/cgi-bin/ticket/get?&type=agent_config";
String GET_CALLBACK_IP = "/cgi-bin/getcallbackip";
String BATCH_REPLACE_PARTY = "/cgi-bin/batch/replaceparty";
String BATCH_SYNC_USER = "/cgi-bin/batch/syncuser";
String BATCH_REPLACE_USER = "/cgi-bin/batch/replaceuser";
String BATCH_GET_RESULT = "/cgi-bin/batch/getresult?jobid=";
String JSCODE_TO_SESSION = "/cgi-bin/miniprogram/jscode2session";