10000 企业微信帐号ID安全性全面升级 && 相关接口新增 by wslongchen · Pull Request #2397 · binarywang/WxJava · GitHub
[go: up one dir, main page]

Skip to content

企业微信帐号ID安全性全面升级 && 相关接口新增 #2397

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

Merged
merged 2 commits into from
Nov 18, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
新增企业微信接口 - 代开发应用external_userid转换
  • Loading branch information
mrpan committed Nov 18, 2021
commit 7c680a3603d4fa13fd4f66a0a9bbdd8b54daabd2
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,28 @@ public interface WxCpExternalContactService {
*/
String unionidToExternalUserid(@NotNull String unionid,String openid) throws WxErrorException;

/**
* 代开发应用external_userid转换
* <pre>
*
* 文档地址:https://work.weixin.qq.com/api/doc/90001/90143/95195
*
* 企业同时安装服务商第三方应用以及授权代开发自建应用的时,服务商可使用该接口将代开发应用获取到的外部联系人id跟第三方应用的id进行关联,
* 该接口可将代开发自建应用获取到的external_userid转换为服务商第三方应用的external_userid。
*
* 权限说明:
*
* 该企业授权了该服务商第三方应用,且授权的第三方应用具备“企业客户权限->客户基础信息”权限
* 该客户的跟进人必须在应用的可见范围之内
* 应用需具备“企业客户权限->客户基础信息”权限
* </pre>
*
* @param externalUserid 代开发自建应用获取到的外部联系人ID
* @return 该服务商第三方应用下的企业的外部联系人ID
* @throws WxErrorException .
*/
String toServiceExternalUserid(@NotNull String externalUserid) throws WxErrorException;

/**
* 客户群opengid转换
* <pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.ExternalContact.*;

/**
* @author 曹祖鹏 & yuanqixun
* @author 曹祖鹏 & yuanqixun & Mr.Pan
*/
@RequiredArgsConstructor
public class WxCpExternalContactServiceImpl implements WxCpExternalContactService {
Expand Down Expand Up @@ -135,6 +135,16 @@ public String unionidToExternalUserid(@NotNull String unionid,String openid) thr
return tmpJson.get("external_userid").getAsString();
}

@Override
public String toServiceExternalUserid(@NotNull String externalUserid) throws WxErrorException {
JsonObject json = new JsonObject();
json.addProperty("external_userid", externalUserid);
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(TO_SERVICE_EXTERNAL_USERID);
String responseContent = this.mainService.post(url, json.toString());
JsonObject tmpJson = GsonParser.parse(responseContent);
return tmpJson.get("external_userid").getAsString();
}

@Override
public String opengidToChatid(@NotNull String opengid) throws WxErrorException {
JsonObject json = new JsonObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ interface ExternalContact {
String GET_CONTACT_DETAIL = "/cgi-bin/externalcontact/get?external_userid=";
String CONVERT_TO_OPENID = "/cgi-bin/externalcontact/convert_to_openid";
String UNIONID_TO_EXTERNAL_USERID = "/cgi-bin/externalcontact/unionid_to_external_userid";
String TO_SERVICE_EXTERNAL_USERID = "/cgi-bin/externalcontact/to_service_external_userid";
String GET_CONTACT_DETAIL_BATCH = "/cgi-bin/externalcontact/batch/get_by_user?";
String UPDATE_REMARK = "/cgi-bin/externalcontact/remark";
String LIST_EXTERNAL_CONTACT = "/cgi-bin/externalcontact/list?userid=";
Expand Down
0