Skip to content

Commit

Permalink
🎨 #2715【企业微信&小程序】微信客服、小程序物流服务和交易组件 等相关接口优化更新
Browse files Browse the repository at this point in the history
  • Loading branch information
borisbao authored Jun 27, 2022
1 parent a807063 commit 4fd6693
Show file tree
Hide file tree
Showing 51 changed files with 2,141 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

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;
Expand Down Expand Up @@ -189,4 +205,46 @@ WxCpKfCustomerBatchGetResp customerBatchGet(List<String> externalUserIdList)
* @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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@
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;
Expand Down Expand Up @@ -182,6 +198,63 @@ public WxCpKfCustomerBatchGetResp customerBatchGet(List<String> externalUserIdLi
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public static class GroupChatFailedTransfer extends WxCpBaseResp {
/**
* 没能成功继承的群ID
*/
@SerializedName("chat_id")
private String chatId;

public static WxCpUserExternalGroupChatTransferResp.GroupChatFailedTransfer fromJson(String json) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,9 @@ interface Kf {
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";

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
import cn.binarywang.wx.miniapp.bean.delivery.BindAccountResponse;
import cn.binarywang.wx.miniapp.bean.delivery.CancelOrderRequest;
import cn.binarywang.wx.miniapp.bean.delivery.CancelOrderResponse;
import cn.binarywang.wx.miniapp.bean.delivery.FollowWaybillRequest;
import cn.binarywang.wx.miniapp.bean.delivery.FollowWaybillResponse;
import cn.binarywang.wx.miniapp.bean.delivery.GetOrderRequest;
import cn.binarywang.wx.miniapp.bean.delivery.GetOrderResponse;
import cn.binarywang.wx.miniapp.bean.delivery.MockUpdateOrderRequest;
import cn.binarywang.wx.miniapp.bean.delivery.MockUpdateOrderResponse;
import cn.binarywang.wx.miniapp.bean.delivery.QueryFollowTraceRequest;
import cn.binarywang.wx.miniapp.bean.delivery.QueryFollowTraceResponse;
import cn.binarywang.wx.miniapp.bean.delivery.QueryWaybillTraceRequest;
import cn.binarywang.wx.miniapp.bean.delivery.QueryWaybillTraceResponse;
import cn.binarywang.wx.miniapp.bean.delivery.TraceWaybillRequest;
Expand Down Expand Up @@ -129,4 +133,34 @@ QueryWaybillTraceResponse queryWaybillTrace(QueryWaybillTraceRequest request)
throws WxErrorException;


/**
* 传运单接口 follow_waybill 订阅微信后台会跟踪运单的状态变化
* <pre>
* 文档地址:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/express_open_msg.html
* </pre>
*
* @param request request
* @return 响应
* @throws WxErrorException 异常
*/
FollowWaybillResponse followWaybill(FollowWaybillRequest request)
throws WxErrorException;


/**
* 查运单接口 query_follow_trace
*
* <pre>
* 商户在调用完trace_waybill接口后,可以使用本接口查询到对应运单的详情信息
* 文档地址:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/express_open_msg.html
* </pre>
*
* @param request request
* @return 响应
* @throws WxErrorException 异常
*/
QueryFollowTraceResponse queryFollowTrace(QueryFollowTraceRequest request)
throws WxErrorException ;


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
package cn.binarywang.wx.miniapp.api;

import cn.binarywang.wx.miniapp.bean.product.WxMinishopAddGoodsSkuData;
import cn.binarywang.wx.miniapp.bean.product.WxMinishopAddGoodsSpuData;
import cn.binarywang.wx.miniapp.bean.product.WxMinishopOrderListResponse;
import cn.binarywang.wx.miniapp.bean.product.WxMinishopResult;
import cn.binarywang.wx.miniapp.bean.product.WxMinishopSku;
import cn.binarywang.wx.miniapp.bean.product.WxMinishopSpu;
import cn.binarywang.wx.miniapp.bean.product.WxMinishopSpuGet;
import cn.binarywang.wx.miniapp.bean.product.WxMinishopSpuGetResponse;
import cn.binarywang.wx.miniapp.bean.product.WxMinishopSpuListResponse;
import cn.binarywang.wx.miniapp.bean.product.WxMinishopUpdateGoodsSkuData;
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopSpuPageRequest;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse;
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopGetSpuListResponse;
import java.util.List;
import me.chanjar.weixin.common.error.WxErrorException;

/**
* 小程序交易组件-商品服务
*
* @author boris
*/
public interface WxMaProductService {
WxMinishopResult addSpu(WxMinishopSpu spuInfo) throws WxErrorException;

WxMaShopBaseResponse deleteSpu(Integer productId, String outProductId) throws WxErrorException;

WxMinishopSpuGetResponse getSpu(Integer productId, String outProductId, Integer needEditSpu)
throws WxErrorException;

WxMinishopSpuListResponse getSpuList(WxMaShopSpuPageRequest request)
throws WxErrorException;

WxMinishopResult<WxMinishopAddGoodsSpuData> updateSpu(WxMinishopSpu spuInfo) throws WxErrorException;

WxMaShopBaseResponse listingSpu(Integer productId, String outProductId)
throws WxErrorException;

WxMaShopBaseResponse delistingSpu(Integer productId, String outProductId)
throws WxErrorException;

/**
* 小商店新增sku信息
*
* @param sku
* @return
* @throws WxErrorException
*/
WxMinishopResult<WxMinishopAddGoodsSkuData> minishiopGoodsAddSku(WxMinishopSku sku) throws WxErrorException;


/**
* 小商店批量新增sku信息
*
* @param skuList
* @return
* @throws WxErrorException
*/
WxMinishopResult<List<WxMinishopAddGoodsSkuData>> minishopGoodsBatchAddSku(List<WxMinishopSku> skuList) throws WxErrorException;


/**
* 小商店删除sku消息
*
* @param productId
* @param outProductId
* @param outSkuId
* @param skuId
* @return
* @throws WxErrorException
*/
WxMaShopBaseResponse minishopGoodsDelSku(Long productId, Long outProductId, String outSkuId, Long skuId) throws WxErrorException;


/**
* 小商店更新sku
*
* @param sku
* @return
* @throws WxErrorException
*/
WxMinishopResult<WxMinishopUpdateGoodsSkuData> minishopGoodsUpdateSku(WxMinishopSku sku) throws WxErrorException;


/**
* 小商店更新sku价格
*
* @param productId
* @param outProductId
* @param outSkuId
* @param skuId
* @param salePrice
* @param marketPrice
* @return
* @throws WxErrorException
*/
WxMinishopResult<WxMinishopUpdateGoodsSkuData> minishopGoodsUpdateSkuPrice(Long productId,
Long outProductId, String outSkuId, Long skuId, Long salePrice, Long marketPrice) throws WxErrorException;


/**
* 小商店更新sku库存
*
* @param productId
* @param outProductId
* @param outSkuId
* @param skuId
* @param type
* @param stockNum
* @return
* @throws WxErrorException
*/
WxMinishopResult<WxMinishopUpdateGoodsSkuData> minishopGoodsUpdateSkuStock(Long productId,
Long outProductId, String outSkuId, Long skuId, Integer type, Integer stockNum) throws WxErrorException;

WxMinishopOrderListResponse minishopOrderGetList(String startCreateTime, String endCreateTime,
Integer status, Integer page, Integer pageSize, Integer source) throws WxErrorException;
}
Loading

0 comments on commit 4fd6693

Please sign in to comment.