mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
🎨 #1849 企业微信外部联系人相关接口重构,优化重复代码,同时获取客户详情接口返回增加标签id字段
This commit is contained in:
@@ -4,6 +4,8 @@ import lombok.NonNull;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
|
||||
import me.chanjar.weixin.cp.bean.external.*;
|
||||
import me.chanjar.weixin.cp.bean.external.contact.WxCpExternalContactBatchInfo;
|
||||
import me.chanjar.weixin.cp.bean.external.contact.WxCpExternalContactInfo;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -109,7 +111,7 @@ public interface WxCpExternalContactService {
|
||||
* @deprecated 建议使用 {@link #getContactDetail(String)}
|
||||
*/
|
||||
@Deprecated
|
||||
WxCpUserExternalContactInfo getExternalContact(String userId) throws WxErrorException;
|
||||
WxCpExternalContactInfo getExternalContact(String userId) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 获取客户详情.
|
||||
@@ -130,7 +132,7 @@ public interface WxCpExternalContactService {
|
||||
* @return . contact detail
|
||||
* @throws WxErrorException .
|
||||
*/
|
||||
WxCpUserExternalContactInfo getContactDetail(String userId) throws WxErrorException;
|
||||
WxCpExternalContactInfo getContactDetail(String userId) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 批量获取客户详情.
|
||||
@@ -153,8 +155,8 @@ public interface WxCpExternalContactService {
|
||||
* @return wx cp user external contact batch info
|
||||
* @throws WxErrorException .
|
||||
*/
|
||||
WxCpUserExternalContactBatchInfo getContactDetailBatch(String userId, String cursor,
|
||||
Integer limit)
|
||||
WxCpExternalContactBatchInfo getContactDetailBatch(String userId, String cursor,
|
||||
Integer limit)
|
||||
throws WxErrorException;
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@ package me.chanjar.weixin.cp.api;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.cp.bean.WxCpInviteResult;
|
||||
import me.chanjar.weixin.cp.bean.WxCpUser;
|
||||
import me.chanjar.weixin.cp.bean.external.WxCpUserExternalContactInfo;
|
||||
import me.chanjar.weixin.cp.bean.external.contact.WxCpExternalContactInfo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -167,7 +167,7 @@ public interface WxCpUserService {
|
||||
* @return 联系人详情
|
||||
* @throws WxErrorException .
|
||||
*/
|
||||
WxCpUserExternalContactInfo getExternalContact(String userId) throws WxErrorException;
|
||||
WxCpExternalContactInfo getExternalContact(String userId) throws WxErrorException;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ import me.chanjar.weixin.cp.api.WxCpExternalContactService;
|
||||
import me.chanjar.weixin.cp.api.WxCpService;
|
||||
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
|
||||
import me.chanjar.weixin.cp.bean.external.*;
|
||||
import me.chanjar.weixin.cp.bean.external.contact.WxCpExternalContactBatchInfo;
|
||||
import me.chanjar.weixin.cp.bean.external.contact.WxCpExternalContactInfo;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@@ -91,23 +93,23 @@ public class WxCpExternalContactServiceImpl implements WxCpExternalContactServic
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpUserExternalContactInfo getExternalContact(String userId) throws WxErrorException {
|
||||
public WxCpExternalContactInfo getExternalContact(String userId) throws WxErrorException {
|
||||
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_EXTERNAL_CONTACT + userId);
|
||||
String responseContent = this.mainService.get(url, null);
|
||||
return WxCpUserExternalContactInfo.fromJson(responseContent);
|
||||
return WxCpExternalContactInfo.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpUserExternalContactInfo getContactDetail(String userId) throws WxErrorException {
|
||||
public WxCpExternalContactInfo 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);
|
||||
return WxCpExternalContactInfo.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpUserExternalContactBatchInfo getContactDetailBatch(String userId,
|
||||
String cursor,
|
||||
Integer limit)
|
||||
public WxCpExternalContactBatchInfo getContactDetailBatch(String userId,
|
||||
String cursor,
|
||||
Integer limit)
|
||||
throws WxErrorException {
|
||||
final String url =
|
||||
this.mainService
|
||||
@@ -122,7 +124,7 @@ public class WxCpExternalContactServiceImpl implements WxCpExternalContactServic
|
||||
json.addProperty("limit", limit);
|
||||
}
|
||||
String responseContent = this.mainService.post(url, json.toString());
|
||||
return WxCpUserExternalContactBatchInfo.fromJson(responseContent);
|
||||
return WxCpExternalContactBatchInfo.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,7 +10,7 @@ import me.chanjar.weixin.cp.api.WxCpService;
|
||||
import me.chanjar.weixin.cp.api.WxCpUserService;
|
||||
import me.chanjar.weixin.cp.bean.WxCpInviteResult;
|
||||
import me.chanjar.weixin.cp.bean.WxCpUser;
|
||||
import me.chanjar.weixin.cp.bean.external.WxCpUserExternalContactInfo;
|
||||
import me.chanjar.weixin.cp.bean.external.contact.WxCpExternalContactInfo;
|
||||
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
|
||||
|
||||
import java.util.List;
|
||||
@@ -193,9 +193,9 @@ public class WxCpUserServiceImpl implements WxCpUserService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpUserExternalContactInfo getExternalContact(String userId) throws WxErrorException {
|
||||
public WxCpExternalContactInfo getExternalContact(String userId) throws WxErrorException {
|
||||
String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_EXTERNAL_CONTACT + userId);
|
||||
String responseContent = this.mainService.get(url, null);
|
||||
return WxCpUserExternalContactInfo.fromJson(responseContent);
|
||||
return WxCpExternalContactInfo.fromJson(responseContent);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user