8000 增加查询小程序可回退的版本 接口 by hywr · Pull Request #2163 · binarywang/WxJava · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
f14b88c
添加对话能力(原导购)相关结果 均通过单元测试
May 14, 2021
1c049e4
Merge remote-tracking branch 'origin/develop' into develop
hywr May 14, 2021
32695c7
Merge remote-tracking branch 'origin/develop' into develop
hywr May 17, 2021
aec9387
修改公众号、小程序、企业微信的access token自动刷新逻辑,用于避免当使用secrete误调用第三方平台专属接口的情况下出现循环递…
hywr May 17, 2021
edc935a
1.修复公众号在由第三方平台管理时OAuth2Service授权相关报错问题
hywr May 21, 2021
32028de
Merge remote-tracking branch 'origin/develop' into develop
hywr May 21, 2021
41791eb
1.增加查询小程序可回退的版本 接口
hywr Jun 23, 2021
1611b41
:memo: 更新版本信息
binarywang Jun 2, 2021
5d276b7
:memo: 更新部分信息
binarywang Jun 2, 2021
9279156
:art: 修复单元测试代码
binarywang Jun 3, 2021
933e058
:arrow_up: upgrade guava version
binarywang Jun 3, 2021
1905871
:new: #2142 【企业微信】被动回复消息内容新增任务卡片格式
arthur0201 Jun 4, 2021
d47d687
:arrow_up: Bump httpclient from 4.5 to 4.5.13 (#2143)
dependabot[bot] Jun 4, 2021
953b5f9
:art: 优化部分代码
binarywang Jun 4, 2021
a736621
:art: #2144【企业微信】更新任务卡片消息状态接口参数跟文档保持一致
arthur0201 Jun 7, 2021
d1e8fe3
:new: #2135 【小程序】实现获取 URL Link接口 以及微信电子发票报销方相关接口
mr-xiaoyu Jun 11, 2021
d6d3625
:art: #2155 【企业微信】发送新客户欢迎语接口增加对视频类型的支持,同时修复结构不正确的问题
chutian0124 Jun 21, 2021
4f5be60
:new: #2150 【企业微信】补充完善部分客户联系接口,以及服务商模式外部联系人openid转换接口
chutian0124 Jun 22, 2021
b6092db
:new: #2161 【公众号】微信推送消息类增加群发接口事件相关字段
arthur0201 Jun 23, 2021
e56eb91
1.增加查询小程序可回退的版本 接口
hywr Jun 23, 2021
a6cd1e3
Merge branch 'develop' into develop2
hywr Jun 23, 2021
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
Prev Previous commit
Next Next commit
🆕 #2150 【企业微信】补充完善部分客户联系接口,以及服务商模式外部联系人openid转换接口
  • Loading branch information
chutian0124 authored and hywr committed Jun 23, 2021
commit 4f5be601e05ceeb241916efa263abf9a55143134
10BC0
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
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.jetbrains.annotations.NotNull;

import java.util.Date;
import java.util.List;
Expand Down Expand Up @@ -134,6 +135,14 @@ public interface WxCpExternalContactService {
*/
WxCpExternalContactInfo getContactDetail(String userId) throws WxErrorException;

/**
* 企业和服务商可通过此接口,将微信外部联系人的userid转为微信openid,用于调用支付相关接口。暂不支持企业微信外部联系人(ExternalUserid为wo开头)的userid转openid。
* @param externalUserid 微信外部联系人的userid
* @return 该企业的外部联系人openid
* @throws WxErrorException .
*/
String convertToOpenid(String externalUserid) throws WxErrorException;

/**
* 批量获取客户详情.
* <pre>
Expand Down Expand Up @@ -225,9 +234,85 @@ WxCpExternalContactBatchInfo getContactDetailBatch(String userId, String cursor,
* @param takeOverUserid the take over userid
* @return wx cp base resp
* @throws WxErrorException the wx error exception
* @deprecated 此后续将不再更新维护,建议使用 {@link #transferCustomer(WxCpUserTransferCustomerReq)}
*/
@Deprecated
WxCpBaseResp transferExternalContact(String externalUserid, String handOverUserid, String takeOverUserid) throws WxErrorException;

/**
* 企业可通过此接口,转接在职成员的客户给其他成员。
* <per>
* external_userid必须是handover_userid的客户(即配置了客户联系功能的成员所添加的联系人)。
* 在职成员的每位客户最多被分配2次。客户被转接成功后,将有90个自然日的服务关系保护期,保护期内的客户无法再次被分配。
*
* 权限说明:
* * 企业需要使用“客户联系”secret或配置到“可调用应用”列表中的自建应用secret所获取的accesstoken来调用(accesstoken如何获取?)。
* 第三方应用需拥有“企业客户权限->客户联系->在职继承”权限
* 接替成员必须在此第三方应用或自建应用的可见范围内。
* 接替成员需要配置了客户联系功能。
* 接替成员需要在企业微信激活且已经过实名认证。
* </per>
* @param req 转接在职成员的客户给其他成员请求实体
* @return wx cp base resp
* @throws WxErrorException the wx error exception
*/
WxCpUserTransferCustomerResp transferCustomer(WxCpUserTransferCustomerReq req) throws WxErrorException;

/**
* 企业和第三方可通过此接口查询在职成员的客户转接情况。
* <per>
* 权限说明:
*
* 企业需要使用“客户联系”secret或配置到“可调用应用”列表中的自建应用secret所获取的accesstoken来调用(accesstoken如何获取?)。
* 第三方应用需拥有“企业客户权限->客户联系->在职继承”权限
* 接替成员必须在此第三方应用或自建应用的可见范围内。
* </per>
* @param handOverUserid 原添加成员的userid
* @param takeOverUserid 接替成员的userid
* @param cursor 分页查询的cursor,每个分页返回的数据不会超过1000条;不填或为空表示获取第一个分页;
* @return 客户转接接口实体
* @throws WxErrorException the wx error exception
*/
WxCpUserTransferResultResp transferResult(@NotNull String handOverUserid, @NotNull String takeOverUserid, String cursor) throws WxErrorException;

/**
* 企业可通过此接口,分配离职成员的客户给其他成员。
* <per>
* handover_userid必须是已离职用户。
* external_userid必须是handover_userid的客户(即配置了客户联系功能的成员所添加的联系人)。
* 在职成员的每位客户最多被分配2次。客户被转接成功后,将有90个自然日的服务关系保护期,保护期内的客户无法再次被分配。
*
* 权限说明:
*
* 企业需要使用“客户联系”secret或配置到“可调用应用”列表中的自建应用secret所获取的accesstoken来调用(accesstoken如何获取?)。
* 第三方应用需拥有“企业客户权限->客户联系->离职分配”权限
* 接替成员必须在此第三方应用或自建应用的可见范围内。
* 接替成员需要配置了客户联系功能。
* 接替成员需要在企业微信激活且已经过实名认证。
* </per>
* @param req 转接在职成员的客户给其他成员请求实体
* @return wx cp base resp
* @throws WxErrorException the wx error exception
*/
WxCpUserTransferCustomerResp resignedTransferCustomer(WxCpUserTransferCustomerReq req) throws WxErrorException;

/**
* 企业和第三方可通过此接口查询离职成员的客户分配情况。
* <per>
* 权限说明:
*
* 企业需要使用“客户联系”secret或配置到“可调用应用”列表中的自建应用secret所获取的accesstoken来调用(accesstoken如何获取?)。
* 第三方应用需拥有“企业客户权限->客户联系->在职继承”权限
* 接替成员必须在此第三方应用或自建应用的可见范围内。
* </per>
* @param handOverUserid 原添加成员的userid
* @param takeOverUserid 接替成员的userid
* @param cursor 分页查询的cursor,每个分页返回的数据不会超过1000条;不填或为空表示获取第一个分页;
* @return 客户转接接口实体
* @throws WxErrorException the wx error exception
*/
WxCpUserTransferResultResp resignedTransferResult(@NotNull String handOverUserid, @NotNull String takeOverUserid, String cursor) throws WxErrorException;

/**
* <pre>
* 该接口用于获取配置过客户群管理的客户群列表。
Expand Down Expand Up @@ -260,6 +345,32 @@ WxCpExternalContactBatchInfo getContactDetailBatch(String userId, String cursor,
*/
WxCpUserExternalGroupChatInfo getGroupChat(String chatId) throws WxErrorException;

/**
*
* 企业可通过此接口,将已离职成员为群主的群,分配给另一个客服成员。
*
* <per>
* 注意::
*
* 群主离职了的客户群,才可继承
* 继承给的新群主,必须是配置了客户联系功能的成员
* 继承给的新群主,必须有设置实名
* 继承给的新群主,必须有激活企业微信
* 同一个人的群,限制每天最多分配300个给新群主
*
* 权限说明:
*
* 企业需要使用“客户联系”secret或配置到“可调用应用”列表中的自建应用secret所获取的accesstoken来调用(accesstoken如何获取?)。
* 第三方应用需拥有“企业客户权限->客户联系->分配离职成员的客户群”权限
* 对于第三方/自建应用,群主必须在应用的可见范围。
* </per>
* @param chatIds 需要转群主的客户群ID列表。取值范围: 1 ~ 100
* @param newOwner 新群主ID
* @return 分配结果,主要是分配失败的群列表
* @throws WxErrorException the wx error exception
*/
WxCpUserExternalGroupChatTransferResp transferGroupChat(String[] chatIds, String newOwner) throws WxErrorException;

/**
* <pre>
* 企业可通过此接口获取成员联系客户的数据,包括发起申请数、新增客户数、聊天数、发送消息数和删除/拉黑成员的客户数等指标。
Expand Down Expand Up @@ -397,4 +508,6 @@ WxCpExternalContactBatchInfo getContactDetailBatch(String userId, String cursor,
* @throws WxErrorException the wx error exception
*/
WxCpBaseResp markTag(String userid, String externalUserid, String[] addTag, String[] removeTag) throws WxErrorException;


}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import me.chanjar.weixin.common.error.WxCpErrorMsgEnum;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.error.WxRuntimeException;
import me.chanjar.weixin.common.util.BeanUtils;
import me.chanjar.weixin.common.util.json.GsonParser;
import me.chanjar.weixin.cp.api.WxCpExternalContactService;
import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
Expand All @@ -15,6 +17,7 @@
import me.chanjar.weixin.cp.bean.external.contact.WxCpExternalContactInfo;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;

import java.util.Collections;
import java.util.Date;
Expand Down Expand Up @@ -106,6 +109,16 @@ public WxCpExternalContactInfo getContactDetail(String userId) throws WxErrorExc
return WxCpExternalContactInfo.fromJson(responseContent);
}

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

@Override
public WxCpExternalContactBatchInfo getContactDetailBatch(String userId,
String cursor,
Expand Down Expand Up @@ -176,6 +189,44 @@ public WxCpBaseResp transferExternalContact(String externalUserid, String handOv
return WxCpBaseResp.fromJson(result);
}

@Override
public WxCpUserTransferCustomerResp transferCustomer(WxCpUserTransferCustomerReq req) throws WxErrorException {
BeanUtils.checkRequiredFields(req);
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(TRANSFER_CUSTOMER);
final String result = this.mainService.post(url, req.toJson());
return WxCpUserTransferCustomerResp.fromJson(result);
}

@Override
public WxCpUserTransferResultResp transferResult(@NotNull String handOverUserid, @NotNull String takeOverUserid, String cursor) throws WxErrorException {
JsonObject json = new JsonObject();
json.addProperty("cursor", cursor);
json.addProperty("handover_userid", handOverUserid);
json.addProperty("takeover_userid", takeOverUserid);
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(TRANSFER_RESULT);
final String result = this.mainService.post(url, json.toString());
return WxCpUserTransferResultResp.fromJson(result);
}

@Override
public WxCpUserTransferCustomerResp resignedTransferCustomer(WxCpUserTransferCustomerReq req) throws WxErrorException {
BeanUtils.checkRequiredFields(req);
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(RESIGNED_TRANSFER_CUSTOMER);
final String result = this.mainService.post(url, req.toJson());
return WxCpUserTransferCustomerResp.fromJson(result);
}

@Override
public WxCpUserTransferResultResp resignedTransferResult(@NotNull String handOverUserid, @NotNull String takeOverUserid, String cursor) throws WxErrorException {
JsonObject json = new JsonObject();
json.addProperty("cursor", cursor);
json.addProperty("handover_userid", handOverUserid);
json.addProperty("takeover_userid", takeOverUserid);
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(RESIGNED_TRANSFER_RESULT);
final String result = this.mainService.post(url, json.toString());
return WxCpUserTransferResultResp.fromJson(result);
}

@Override
public WxCpUserExternalGroupChatList listGroupChat(Integer pageIndex, Integer pageSize, int status, String[] userIds, String[] partyIds) throws WxErrorException {
JsonObject json = new JsonObject();
Expand Down Expand Up @@ -206,6 +257,18 @@ public WxCpUserExternalGroupChatInfo getGroupChat(String chatId) throws WxErrorE
return WxCpUserExternalGroupChatInfo.fromJson(result);
}

@Override
public WxCpUserExternalGroupChatTransferResp transferGroupChat(String[] chatIds, String newOwner) throws WxErrorException {
JsonObject json = new JsonObject();
if (ArrayUtils.isNotEmpty(chatIds)) {
json.add("chat_id_list", new Gson().toJsonTree(chatIds).getAsJsonArray());
}
json.addProperty("new_owner", newOwner);
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GROUP_CHAT_TRANSFER);
final String result = this.mainService.post(url, json.toString());
return WxCpUserExternalGroupChatTransferResp.fromJson(result);
}

@Override
public WxCpUserExternalUserBehaviorStatistic getUserBehaviorStatistic(Date startTime, Date endTime, String[] userIds, String[] partyIds) throws WxErrorException {
JsonObject json = new JsonObject();
Expand Down
63A7
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package me.chanjar.weixin.cp.bean.external;

import com.google.gson.annotations.SerializedName;
import lombok.Getter;
import lombok.Setter;
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;

import java.util.List;

/**
* 分配离职成员的客户群结果
* @author pg
* @date 2021年6月21日
*/
@Getter
@Setter
public class WxCpUserExternalGroupChatTransferResp extends WxCpBaseResp {
private static final long serialVersionUID = -943124579487821819L;
/**
* 没有成功继承的群列表
*/
@SerializedName("failed_chat_list")
private List<GroupChatFailedTransfer> failedChatList;

public static WxCpUserExternalGroupChatTransferResp fromJson(String json) {
return WxCpGsonBuilder.create().fromJson(json, WxCpUserExternalGroupChatTransferResp.class);
}

public String toJson() {
return WxCpGsonBuilder.create().toJson(this);
}

@Getter
@Setter
public static class GroupChatFailedTransfer extends WxCpBaseResp {
private static final long serialVersionUID = -5836775099634587239L;
/**
* 没能成功继承的群ID
*/
private String chatId;

public static WxCpUserExternalGroupChatTransferResp.GroupChatFailedTransfer fromJson(String json) {
return WxCpGsonBuilder.create().fromJson(json, WxCpUserExternalGroupChatTransferResp.GroupChatFailedTransfer.class);
}

public String toJson() {
return WxCpGsonBuilder.create().toJson(this);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package me.chanjar.weixin.cp.bean.external;

import com.google.gson.annotations.SerializedName;
import lombok.Getter;
import lombok.Setter;
import me.chanjar.weixin.common.annotation.Required;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;

import java.io.Serializable;
import java.util.List;

/**
* 转接在职成员的客户给其他成员,请求对象
*
* @author pg
* @date 2021年6月21日
*/
@Getter
@Setter
public class WxCpUserTransferCustomerReq implements Serializable {
private static final long serialVersionUID = -309819538677411801L;
/**
* 原跟进成员的userid
*/
@SerializedName("handover_userid")
@Required
private String handOverUserid;
/**
* 接替成员的userid
*/
@SerializedName("takeover_userid")
@Required
private String takeOverUserid;
/**
* 客户的external_userid列表,每次最多分配100个客户
*/
@SerializedName("external_userid")
@Required
private List<String> externalUserid;
/**
* 转移成功后发给客户的消息,最多200个字符,不填则使用默认文案
*/
@SerializedName("transfer_success_msg")
private String transferMsg;

public String toJson() {
return WxCpGsonBuilder.create().toJson(this);
}
}
Loading
0