Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(企业微信):新增通讯录管理-异步批量接口-增量更新成员接口 #2596

Merged
merged 4 commits into from
Apr 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
* 上传用户列表覆盖企业号上的用户信息
*
Expand All @@ -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请求对象
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,15 @@ public String replaceParty(String mediaId) throws WxErrorException {
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();
Expand All @@ -416,8 +425,8 @@ public String replaceUser(String mediaId) throws WxErrorException {
}

@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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down