:new :#2382 【企业微信】增加获取商品图册的接口

This commit is contained in:
Lo_ading
2021-11-14 21:31:29 +08:00
committed by GitHub
parent ef99e3d24f
commit 93779d227a
11 changed files with 298 additions and 6 deletions

View File

@@ -109,7 +109,7 @@ public interface WxCpExternalContactService {
* @param userId 外部联系人的userid
* @return . external contact
* @throws WxErrorException the wx error exception
* @deprecated 建议使用 {@link #getContactDetail(String)}
* @deprecated 建议使用 {@link #getContactDetail(String, String)}
*/
@Deprecated
WxCpExternalContactInfo getExternalContact(String userId) throws WxErrorException;
@@ -130,10 +130,11 @@ public interface WxCpExternalContactService {
* </pre>
*
* @param userId 外部联系人的userid注意不是企业成员的帐号
* @param cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用可不填
* @return . contact detail
* @throws WxErrorException .
*/
WxCpExternalContactInfo getContactDetail(String userId) throws WxErrorException;
WxCpExternalContactInfo getContactDetail(String userId, String cursor) throws WxErrorException;
/**
* 企业和服务商可通过此接口将微信外部联系人的userid转为微信openid用于调用支付相关接口。暂不支持企业微信外部联系人ExternalUserid为wo开头的userid转openid。
@@ -190,7 +191,7 @@ public interface WxCpExternalContactService {
* @throws WxErrorException .
*/
String opengidToChatid(@NotNull String opengid) throws WxErrorException;
/**
* 批量获取客户详情.
* <pre>
@@ -789,4 +790,31 @@ public interface WxCpExternalContactService {
* @throws WxErrorException the wx error exception
*/
WxCpBaseResp delGroupWelcomeTemplate(@NotNull String templateId, String agentId) throws WxErrorException;
/**
* <pre>
* 获取商品图册
* https://work.weixin.qq.com/api/doc/90000/90135/95096#获取商品图册列表
* </pre>
*
* @param limit 返回的最大记录数整型最大值100默认值50超过最大值时取默认值
* @param cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用可不填
* @return wx cp base resp
* @throws WxErrorException the wx error exception
*/
WxCpProductAlbumListResult getProductAlbumList(Integer limit, String cursor) throws WxErrorException;
/**
* <pre>
* 获取商品图册
* https://work.weixin.qq.com/api/doc/90000/90135/95096#获取商品图册
* </pre>
*
* @param productId 商品id
* @return wx cp base resp
* @throws WxErrorException the wx error exception
*/
WxCpProductAlbumResult getProductAlbum(String productId) throws WxErrorException;
}

View File

@@ -102,8 +102,12 @@ public class WxCpExternalContactServiceImpl implements WxCpExternalContactServic
}
@Override
public WxCpExternalContactInfo getContactDetail(String userId) throws WxErrorException {
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_CONTACT_DETAIL + userId);
public WxCpExternalContactInfo getContactDetail(String userId, String cursor) throws WxErrorException {
String params = userId;
if(StringUtils.isNotEmpty(cursor)){
params = params + "&cursor=" + cursor;
}
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_CONTACT_DETAIL + params);
String responseContent = this.mainService.get(url, null);
return WxCpExternalContactInfo.fromJson(responseContent);
}
@@ -702,4 +706,45 @@ public class WxCpExternalContactServiceImpl implements WxCpExternalContactServic
final String result = this.mainService.post(url, json.toString());
return WxCpBaseResp.fromJson(result);
}
/**
* <pre>
* 获取商品图册
* https://work.weixin.qq.com/api/doc/90000/90135/95096#获取商品图册列表
* </pre>
*
* @param limit 返回的最大记录数整型最大值100默认值50超过最大值时取默认值
* @param cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用可不填
* @return wx cp base resp
* @throws WxErrorException the wx error exception
*/
@Override
public WxCpProductAlbumListResult getProductAlbumList(Integer limit, String cursor) throws WxErrorException {
JsonObject json = new JsonObject();
json.addProperty("limit", limit);
json.addProperty("cursor", cursor);
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_PRODUCT_ALBUM_LIST);
final String result = this.mainService.post(url, json.toString());
return WxCpProductAlbumListResult.fromJson(result);
}
/**
* <pre>
* 获取商品图册
* https://work.weixin.qq.com/api/doc/90000/90135/95096#获取商品图册
* </pre>
*
* @param productId 商品id
* @return wx cp base resp
* @throws WxErrorException the wx error exception
*/
@Override
public WxCpProductAlbumResult getProductAlbum(String productId) throws WxErrorException {
JsonObject json = new JsonObject();
json.addProperty("product_id", productId);
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_PRODUCT_ALBUM);
final String result = this.mainService.post(url, json.toString());
return WxCpProductAlbumResult.fromJson(result);
}
}