| @@ -24,25 +24,54 @@ public interface WxCpExternalContactService { | |||||
| * </pre> | * </pre> | ||||
| * | * | ||||
| * @param userId 外部联系人的userid | * @param userId 外部联系人的userid | ||||
| * @return . | |||||
| * @deprecated 建议使用 {@link #getContactDetail(String)} | |||||
| */ | */ | ||||
| @Deprecated | |||||
| WxCpUserExternalContactInfo getExternalContact(String userId) throws WxErrorException; | WxCpUserExternalContactInfo getExternalContact(String userId) throws WxErrorException; | ||||
| /** | /** | ||||
| * 获取外部联系人列表. | |||||
| * 获取客户详情. | |||||
| * <pre> | * <pre> | ||||
| * 企业可通过此接口获取指定成员添加的客户列表。 | |||||
| * 客户是指配置了客户联系功能的成员所添加的外部联系人。 | |||||
| * 没有配置客户联系功能的成员,所添加的外部联系人将不会作为客户返回。 | |||||
| * | |||||
| * 企业可通过此接口,根据外部联系人的userid(如何获取?),拉取客户详情。 | |||||
| * | |||||
| * 请求方式:GET(HTTPS) | |||||
| * 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/get?access_token=ACCESS_TOKEN&external_userid=EXTERNAL_USERID | |||||
| * | |||||
| * 权限说明: | |||||
| * | |||||
| * 企业需要使用“客户联系”secret或配置到“可调用应用”列表中的自建应用secret所获取的accesstoken来调用(accesstoken如何获取?); | |||||
| * 第三方/自建应用调用时,返回的跟进人follow_user仅包含应用可见范围之内的成员。 | |||||
| * </pre> | |||||
| * | |||||
| * @param userId 外部联系人的userid,注意不是企业成员的帐号 | |||||
| * @return . | |||||
| * @throws WxErrorException . | |||||
| */ | |||||
| WxCpUserExternalContactInfo getContactDetail(String userId) throws WxErrorException; | |||||
| /** | |||||
| * 获取客户列表. | |||||
| * <pre> | |||||
| * 企业可通过此接口获取指定成员添加的客户列表。客户是指配置了客户联系功能的成员所添加的外部联系人。没有配置客户联系功能的成员,所添加的外部联系人将不会作为客户返回。 | |||||
| * | |||||
| * 请求方式:GET(HTTPS) | |||||
| * 请求地址:https://qyapi.weixin.qq.com/cgi-bin/externalcontact/list?access_token=ACCESS_TOKEN&userid=USERID | |||||
| * | |||||
| * 权限说明: | |||||
| * | |||||
| * 企业需要使用“客户联系”secret或配置到“可调用应用”列表中的自建应用secret所获取的accesstoken来调用(accesstoken如何获取?); | |||||
| * 第三方应用需拥有“企业客户”权限。 | * 第三方应用需拥有“企业客户”权限。 | ||||
| * 第三方应用调用时,返回的跟进人follow_user仅包含应用可见范围之内的成员。 | |||||
| * 第三方/自建应用只能获取到可见范围内的配置了客户联系功能的成员。 | |||||
| * </pre> | * </pre> | ||||
| * | * | ||||
| * @param userId 外部联系人的userid | |||||
| * @param userId 企业成员的userid | |||||
| * @return List of External wx id | * @return List of External wx id | ||||
| * @throws WxErrorException . | |||||
| */ | */ | ||||
| List<String> listExternalContacts(String userId) throws WxErrorException; | List<String> listExternalContacts(String userId) throws WxErrorException; | ||||
| /** | /** | ||||
| * 企业和第三方服务商可通过此接口获取配置了客户联系功能的成员(Customer Contact)列表。 | * 企业和第三方服务商可通过此接口获取配置了客户联系功能的成员(Customer Contact)列表。 | ||||
| * <pre> | * <pre> | ||||
| @@ -52,7 +81,9 @@ public interface WxCpExternalContactService { | |||||
| * </pre> | * </pre> | ||||
| * | * | ||||
| * @return List of CpUser id | * @return List of CpUser id | ||||
| * @throws WxErrorException . | |||||
| */ | */ | ||||
| @Deprecated | |||||
| List<String> listFollowUser() throws WxErrorException; | List<String> listFollowUser() throws WxErrorException; | ||||
| } | } | ||||
| @@ -25,6 +25,13 @@ public class WxCpExternalContactServiceImpl implements WxCpExternalContactServic | |||||
| return WxCpUserExternalContactInfo.fromJson(responseContent); | return WxCpUserExternalContactInfo.fromJson(responseContent); | ||||
| } | } | ||||
| @Override | |||||
| public WxCpUserExternalContactInfo getContactDetail(String userId) throws WxErrorException { | |||||
| final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_CONTACT_DETAIL + userId); | |||||
| String responseContent = this.mainService.get(url, null); | |||||
| return WxCpUserExternalContactInfo.fromJson(responseContent); | |||||
| } | |||||
| @Override | @Override | ||||
| public List<String> listExternalContacts(String userId) throws WxErrorException { | public List<String> listExternalContacts(String userId) throws WxErrorException { | ||||
| final String url = this.mainService.getWxCpConfigStorage().getApiUrl(LIST_EXTERNAL_CONTACT + userId); | final String url = this.mainService.getWxCpConfigStorage().getApiUrl(LIST_EXTERNAL_CONTACT + userId); | ||||
| @@ -110,8 +110,12 @@ public final class WxCpApiPathConsts { | |||||
| } | } | ||||
| public static class ExternalContact { | public static class ExternalContact { | ||||
| @Deprecated | |||||
| public static final String GET_EXTERNAL_CONTACT = "/cgi-bin/crm/get_external_contact?external_userid="; | public static final String GET_EXTERNAL_CONTACT = "/cgi-bin/crm/get_external_contact?external_userid="; | ||||
| public static final String LIST_EXTERNAL_CONTACT = "/cgi-bin/externalcontact/list?userid="; | |||||
| @Deprecated | |||||
| public static final String GET_FOLLOW_USER_LIST = "/cgi-bin/externalcontact/get_follow_user_list"; | public static final String GET_FOLLOW_USER_LIST = "/cgi-bin/externalcontact/get_follow_user_list"; | ||||
| public static final String GET_CONTACT_DETAIL = "/cgi-bin/externalcontact/get?external_userid="; | |||||
| public static final String LIST_EXTERNAL_CONTACT = "/cgi-bin/externalcontact/list?userid="; | |||||
| } | } | ||||
| } | } | ||||
| @@ -42,4 +42,13 @@ public class WxCpExternalContactServiceImplTest { | |||||
| System.out.println(ret); | System.out.println(ret); | ||||
| assertNotNull(ret); | assertNotNull(ret); | ||||
| } | } | ||||
| @Test | |||||
| public void testGetContactDetail() throws WxErrorException { | |||||
| String externalUserId = this.configStorage.getExternalUserId(); | |||||
| WxCpUserExternalContactInfo result = this.wxCpService.getExternalContactService().getContactDetail(externalUserId); | |||||
| System.out.println(result); | |||||
| assertNotNull(result); | |||||
| } | |||||
| } | } | ||||