mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-11-03 05:41:46 +08:00
🎨 #2715【企业微信&小程序】微信客服、小程序物流服务和交易组件 等相关接口优化更新
This commit is contained in:
@ -2,6 +2,22 @@ package me.chanjar.weixin.cp.api;
|
||||
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountAdd;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountAddResp;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountDel;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountLink;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountLinkResp;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountListResp;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountUpd;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfCustomerBatchGetResp;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfMsgListResp;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfMsgSendRequest;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfMsgSendResp;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfServiceStateResp;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfServiceStateTransResp;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfServiceUpgradeConfigResp;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfServicerListResp;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfServicerOpResp;
|
||||
import me.chanjar.weixin.cp.bean.kf.*;
|
||||
|
||||
import java.util.List;
|
||||
@ -189,4 +205,46 @@ public interface WxCpKfService {
|
||||
* @return 客户数据统计-企业汇总数据
|
||||
*/
|
||||
WxCpKfGetCorpStatisticResp getCorpStatistic(WxCpKfGetCorpStatisticRequest request) throws WxErrorException;
|
||||
|
||||
// 「升级服务」配置
|
||||
/**
|
||||
* 获取配置的专员与客户群
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxCpKfServiceUpgradeConfigResp getUpgradeServiceConfig() throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 升级专员服务
|
||||
* @param openKfid 客服帐号ID
|
||||
* @param externalUserId 微信客户的external_userid
|
||||
* @param userid 服务专员的userid
|
||||
* @param wording 推荐语
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxCpBaseResp upgradeMemberService(String openKfid, String externalUserId,
|
||||
String userid, String wording) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 升级客户群服务
|
||||
* @param openKfid 客服帐号ID
|
||||
* @param externalUserId 微信客户的external_userid
|
||||
* @param chatId 客户群id
|
||||
* @param wording 推荐语
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxCpBaseResp upgradeGroupchatService(String openKfid, String externalUserId,
|
||||
String chatId, String wording) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 为客户取消推荐
|
||||
* @param openKfid 客服帐号ID
|
||||
* @param externalUserId 微信客户的external_userid
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxCpBaseResp cancelUpgradeService(String openKfid, String externalUserId)
|
||||
throws WxErrorException;
|
||||
}
|
||||
|
||||
@ -10,6 +10,22 @@ import me.chanjar.weixin.cp.api.WxCpKfService;
|
||||
import me.chanjar.weixin.cp.api.WxCpService;
|
||||
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
|
||||
import me.chanjar.weixin.cp.bean.kf.*;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountAdd;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountAddResp;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountDel;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountLink;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountLinkResp;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountListResp;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountUpd;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfCustomerBatchGetResp;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfMsgListResp;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfMsgSendRequest;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfMsgSendResp;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfServiceStateResp;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfServiceStateTransResp;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfServiceUpgradeConfigResp;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfServicerListResp;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfServicerOpResp;
|
||||
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
|
||||
|
||||
import java.util.List;
|
||||
@ -182,6 +198,63 @@ public class WxCpKfServiceImpl implements WxCpKfService {
|
||||
return WxCpKfCustomerBatchGetResp.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpKfServiceUpgradeConfigResp getUpgradeServiceConfig() throws WxErrorException {
|
||||
String url = cpService.getWxCpConfigStorage().getApiUrl(CUSTOMER_GET_UPGRADE_SERVICE_CONFIG);
|
||||
|
||||
String response = cpService.get(url, null);
|
||||
return WxCpKfServiceUpgradeConfigResp.fromJson(response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpBaseResp upgradeMemberService(String openKfid, String externalUserId,
|
||||
String userid, String wording) throws WxErrorException {
|
||||
String url = cpService.getWxCpConfigStorage().getApiUrl(CUSTOMER_UPGRADE_SERVICE);
|
||||
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("open_kfid", openKfid);
|
||||
json.addProperty("external_userid", externalUserId);
|
||||
json.addProperty("type", 1);
|
||||
|
||||
JsonObject memberJson = new JsonObject();
|
||||
memberJson.addProperty("userid", userid);
|
||||
memberJson.addProperty("wording", wording);
|
||||
json.add("member", memberJson);
|
||||
|
||||
String response = cpService.post(url, json);
|
||||
return WxCpBaseResp.fromJson(response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpBaseResp upgradeGroupchatService(String openKfid, String externalUserId,
|
||||
String chatId, String wording) throws WxErrorException {
|
||||
String url = cpService.getWxCpConfigStorage().getApiUrl(CUSTOMER_UPGRADE_SERVICE);
|
||||
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("open_kfid", openKfid);
|
||||
json.addProperty("external_userid", externalUserId);
|
||||
json.addProperty("type", 2);
|
||||
|
||||
JsonObject groupchatJson = new JsonObject();
|
||||
groupchatJson.addProperty("chat_id", chatId);
|
||||
groupchatJson.addProperty("wording", wording);
|
||||
json.add("groupchat", groupchatJson);
|
||||
|
||||
String response = cpService.post(url, json);
|
||||
return WxCpBaseResp.fromJson(response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpBaseResp cancelUpgradeService(String openKfid, String externalUserId)
|
||||
throws WxErrorException {
|
||||
String url = cpService.getWxCpConfigStorage().getApiUrl(CUSTOMER_CANCEL_UPGRADE_SERVICE);
|
||||
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("open_kfid", openKfid);
|
||||
json.addProperty("external_userid", externalUserId);
|
||||
String response = cpService.post(url, json);
|
||||
return WxCpBaseResp.fromJson(response);
|
||||
}
|
||||
@Override
|
||||
public WxCpKfGetCorpStatisticResp getCorpStatistic(WxCpKfGetCorpStatisticRequest request) throws WxErrorException {
|
||||
String url = cpService.getWxCpConfigStorage().getApiUrl(GET_CORP_STATISTIC);
|
||||
|
||||
@ -39,6 +39,7 @@ public class WxCpUserExternalGroupChatTransferResp extends WxCpBaseResp {
|
||||
/**
|
||||
* 没能成功继承的群ID
|
||||
*/
|
||||
@SerializedName("chat_id")
|
||||
private String chatId;
|
||||
|
||||
public static WxCpUserExternalGroupChatTransferResp.GroupChatFailedTransfer fromJson(String json) {
|
||||
|
||||
@ -0,0 +1,48 @@
|
||||
package me.chanjar.weixin.cp.bean.kf;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
|
||||
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
|
||||
|
||||
/**
|
||||
* @author leiin
|
||||
* @date 2022/4/26 5:21 下午
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class WxCpKfServiceUpgradeConfigResp extends WxCpBaseResp {
|
||||
|
||||
private static final long serialVersionUID = -3212550906238196617L;
|
||||
|
||||
@SerializedName("member_range")
|
||||
private MemberRange memberRange;
|
||||
|
||||
@SerializedName("groupchat_range")
|
||||
private GroupchatRange groupchatRange;
|
||||
|
||||
public static WxCpKfServiceUpgradeConfigResp fromJson(String json) {
|
||||
return WxCpGsonBuilder.create().fromJson(json, WxCpKfServiceUpgradeConfigResp.class);
|
||||
}
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public static class MemberRange {
|
||||
@SerializedName("userid_list")
|
||||
private List<String> useridList;
|
||||
|
||||
@SerializedName("department_id_list")
|
||||
private List<Integer> departmentIdList;
|
||||
}
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public static class GroupchatRange {
|
||||
@SerializedName("chat_id_list")
|
||||
private List<String> chatIdList;
|
||||
}
|
||||
}
|
||||
@ -390,6 +390,9 @@ public interface WxCpApiPathConsts {
|
||||
String SEND_MSG_ON_EVENT = "/cgi-bin/kf/send_msg_on_event";
|
||||
String CUSTOMER_BATCH_GET = "/cgi-bin/kf/customer/batchget";
|
||||
String GET_CORP_STATISTIC = "/cgi-bin/kf/get_corp_statistic";
|
||||
String CUSTOMER_GET_UPGRADE_SERVICE_CONFIG = "/cgi-bin/kf/customer/get_upgrade_service_config";
|
||||
String CUSTOMER_UPGRADE_SERVICE = "/cgi-bin/kf/customer/upgrade_service";
|
||||
String CUSTOMER_CANCEL_UPGRADE_SERVICE = "/cgi-bin/kf/customer/cancel_upgrade_service";
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user