Skip to content

Commit

Permalink
🎨 #2178 【企业微信】更新获取客户群列表的接口
Browse files Browse the repository at this point in the history
  • Loading branch information
chutian0124 authored Jul 3, 2021
1 parent 568d02c commit 65921f5
Show file tree
Hide file tree
Showing 7 changed files with 246 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ WxCpExternalContactBatchInfo getContactDetailBatch(String userId, String cursor,
* 微信文档:https://work.weixin.qq.com/api/doc/90000/90135/92119
* </pre>
*
* @deprecated 请使用 {@link WxCpExternalContactService#listGroupChat(Integer, String, int, String[])}
* @param pageIndex the page index
* @param pageSize the page size
* @param status the status
Expand All @@ -329,8 +330,26 @@ WxCpExternalContactBatchInfo getContactDetailBatch(String userId, String cursor,
* @return the wx cp user external group chat list
* @throws WxErrorException the wx error exception
*/
@Deprecated
WxCpUserExternalGroupChatList listGroupChat(Integer pageIndex, Integer pageSize, int status, String[] userIds, String[] partyIds) throws WxErrorException;

/**
* <pre>
* 该接口用于获取配置过客户群管理的客户群列表。
* 企业需要使用“客户联系”secret或配置到“可调用应用”列表中的自建应用secret所获取的accesstoken来调用(accesstoken如何获取?)。
* 暂不支持第三方调用。
* 微信文档:https://work.weixin.qq.com/api/doc/90000/90135/92119
* </pre>
*
* @param limit 分页,预期请求的数据量,取值范围 1 ~ 1000
* @param cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用不填
* @param status 客户群跟进状态过滤。0 - 所有列表(即不过滤) 1 - 离职待继承 2 - 离职继承中 3 - 离职继承完成 默认为0
* @param userIds 群主过滤。如果不填,表示获取应用可见范围内全部群主的数据(但是不建议这么用,如果可见范围人数超过1000人,为了防止数据包过大,会报错 81017);用户ID列表。最多100个
* @return the wx cp user external group chat list
* @throws WxErrorException the wx error exception
*/
WxCpUserExternalGroupChatList listGroupChat(Integer limit, String cursor, int status, String[] userIds) throws WxErrorException;

/**
* <pre>
* 通过客户群ID,获取详情。包括群名、群成员列表、群成员入群时间、入群方式。(客户群是由具有客户群使用权限的成员创建的外部群)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,24 @@ public WxCpUserExternalGroupChatList listGroupChat(Integer pageIndex, Integer pa
return WxCpUserExternalGroupChatList.fromJson(result);
}

@Override
public WxCpUserExternalGroupChatList listGroupChat(Integer limit, String cursor, int status, String[] userIds) throws WxErrorException {
JsonObject json = new JsonObject();
json.addProperty("cursor", cursor == null ? "" : cursor);
json.addProperty("limit", limit == null ? 100 : limit);
json.addProperty("status_filter", status);
if (ArrayUtils.isNotEmpty(userIds)) {
JsonObject ownerFilter = new JsonObject();
if (ArrayUtils.isNotEmpty(userIds)) {
ownerFilter.add("userid_list", new Gson().toJsonTree(userIds).getAsJsonArray());
}
json.add("owner_filter", ownerFilter);
}
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GROUP_CHAT_LIST);
final String result = this.mainService.post(url, json.toString());
return WxCpUserExternalGroupChatList.fromJson(result);
}

@Override
public WxCpUserExternalGroupChatInfo getGroupChat(String chatId) throws WxErrorException {
JsonObject json = new JsonObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@
@Getter
@Setter
public class WxCpUserExternalGroupChatList extends WxCpBaseResp {
private static final long serialVersionUID = 1907272035492110236L;

@SerializedName("group_chat_list")
private List<ChatStatus> groupChatList;

@SerializedName("next_cursor")
private String nextCursor;

@Getter
@Setter
public static class ChatStatus implements Serializable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,13 @@ public void testListGroupChat() throws WxErrorException {
assertNotNull(result);
}

@Test
public void testListGroupChatV3() throws WxErrorException {
WxCpUserExternalGroupChatList result = this.wxCpService.getExternalContactService().listGroupChat(100, "" ,0,new String[1]);
System.out.println(result);
assertNotNull(result);
}

@Test
public void testGetGroupChat() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ public static class SubjectInfo implements Serializable {
@SpecEncrypt
private UboInfo uboInfo;

/**
* 小微辅助证明材料(subjectType为小微商户时必填)
*/
@SerializedName("micro_biz_info")
private MicroBizInfo microBizInfo;

@Data
@Builder
Expand Down Expand Up @@ -468,6 +473,175 @@ public static class UboInfo implements Serializable {
private String idPeriodEnd;
}

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public static class MicroBizInfo implements Serializable{
private static final long serialVersionUID = -5679477993681265764L;
/**
* 小微经营类型
*/
@SerializedName("micro_biz_type")
private MicroBizTypeEnum microBizType;

/**
* 门店场所---经营类型为“门店场所”时填写
*/
@SerializedName("micro_store_info")
private MicroStoreInfo microStoreInfo;

/**
* 经营类型为“流动经营/便民服务”时填写
*/
@SerializedName("micro_mobile_info")
private MicroMobileInfo microMobileInfo;

/**
* 经营类型为“线上商品/服务交易”时填写
*/
@SerializedName("micro_online_info")
private MicroOnlineInfo microOnlineInfo;

/**
* 门店场所
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public static class MicroStoreInfo implements Serializable{
private static final long serialVersionUID = 5277440587305558389L;
/**
* 门店名称
*/
@SerializedName("micro_name")
private String microName;
/**
* 门店省市编码 填写门店省市编码,只能由数字组成,详细参见《微信支付提供的省市对照表》
* @see <a href='https://pay.weixin.qq.com/wiki/doc/apiv3/download/%E7%9C%81%E5%B8%82%E5%8C%BA%E7%BC%96%E5%8F%B7%E5%AF%B9%E7%85%A7%E8%A1%A8.xlsx'>下载微信支付提供的省市对照表</a>
*/
@SerializedName("micro_address_code")
private String microAddressCode;
/**
* 门店地址(填写店铺详细地址,具体区/县及街道门牌号或大厦楼层)
*/
@SerializedName("micro_address")
private String microAddress;
/**
* 门店门头照片
* <per>
* 1、提交门店门口照片,要求招牌清晰可见
* 2、可上传1张图片,请填写通过《图片上传API》预先上传图片生成好的MediaID
* </per>
*
* @see <a href='https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/tool/chapter3_1.shtml'>图片上传API</a>
*/
@SerializedName("store_entrance_pic")
private String storeEntrancePic;
/**
* 店内环境照片
* <per>
* 1、提交店内环境照片
* 2、可上传1张图片,请填写通过《图片上传API》预先上传图片生成好的MediaID
* </per>
*
* @see <a href='https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/tool/chapter3_1.shtml'>图片上传API</a>
*/
@SerializedName("micro_indoor_copy")
private String microIndoorCopy;
/**
* 门店经度
*/
@SerializedName("store_longitude")
private String storeLongitude;
/**
* 门店纬度
*/
@SerializedName("store_latitude")
private String storeLatitude;
}

/**
* 流动经营/便民服务
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public static class MicroMobileInfo implements Serializable{
private static final long serialVersionUID = -1308090894511066935L;
/**
* 经营/服务名称
*/
@SerializedName("micro_mobile_name")
private String microMobileName;
/**
* 经营/服务所在地省市
*/
@SerializedName("micro_mobile_city")
private String microMobileCity;
/**
* 经营/服务所在地(不含省市) 填写“无"
*/
@SerializedName("micro_mobile_address")
private String microMobileAddress;
/**
* 经营/服务现场照片
* <per>
* 1、提交经营/服务现场照片
* 2、可上传多张图片,请填写通过《图片上传API》预先上传图片生成好的MediaID
* </per>
* @see <a href='https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/tool/chapter3_1.shtml'>图片上传API</a>
*/
@SerializedName("micro_mobile_pics")
private String micro_mobile_pics;
}

/**
* 线上商品/服务交易
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public static class MicroOnlineInfo implements Serializable{
private static final long serialVersionUID = 9029168841403055743L;
/**
* 线上店铺名称
*/
@SerializedName("micro_online_store")
private String microOnlineStore;
/**
* 电商平台名称
*/
@SerializedName("micro_ec_name")
private String microEcName;
/**
* 店铺二维码
* <per>
* 1、店铺二维码或店铺链接二选一必填
* 2、可上传多张图片,请填写通过《图片上传API》预先上传图片生成好的MediaID
* </per>
* @see <a href='https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/tool/chapter3_1.shtml'>图片上传API</a>
*/
@SerializedName("micro_qrcode")
private String microQrcode;
/**
* 店铺二维码
* <per>
* 1、店铺二维码或店铺链接二选一必填
* 2、请填写店铺主页链接,需符合网站规范
* </per>
*/
@SerializedName("micro_link")
private String microLink;
}
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.github.binarywang.wxpay.bean.applyment.enums;

/**
* 小微经营类型
*/
public enum MicroBizTypeEnum {
/**
* 门店场所
*/
MICRO_TYPE_STORE,
/**
* 流动经营/便民服务
*/
MICRO_TYPE_MOBILE,
/**
* 线上商品/服务交易
*/
MICRO_TYPE_ONLINE,
;
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ public enum SubjectTypeEnum {
* (其他组织):不属于企业、政府/事业单位的组织机构(如社会团体、民办非企业、基金会),要求机构已办理组织机构代码证。
*/
SUBJECT_TYPE_OTHERS,
/**
* (小微):无营业执照、免办理工商注册登记的实体商户
*/
SUBJECT_TYPE_MICRO,
;

}

0 comments on commit 65921f5

Please sign in to comment.