Skip to content

Commit 4fd6693

Browse files
authored
🎨 #2715【企业微信&小程序】微信客服、小程序物流服务和交易组件 等相关接口优化更新
1 parent a807063 commit 4fd6693

File tree

51 files changed

+2141
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2141
-0
lines changed

Diff for: weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpKfService.java

+58
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@
22

33
import me.chanjar.weixin.common.error.WxErrorException;
44
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
5+
import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountAdd;
6+
import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountAddResp;
7+
import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountDel;
8+
import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountLink;
9+
import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountLinkResp;
10+
import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountListResp;
11+
import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountUpd;
12+
import me.chanjar.weixin.cp.bean.kf.WxCpKfCustomerBatchGetResp;
13+
import me.chanjar.weixin.cp.bean.kf.WxCpKfMsgListResp;
14+
import me.chanjar.weixin.cp.bean.kf.WxCpKfMsgSendRequest;
15+
import me.chanjar.weixin.cp.bean.kf.WxCpKfMsgSendResp;
16+
import me.chanjar.weixin.cp.bean.kf.WxCpKfServiceStateResp;
17+
import me.chanjar.weixin.cp.bean.kf.WxCpKfServiceStateTransResp;
18+
import me.chanjar.weixin.cp.bean.kf.WxCpKfServiceUpgradeConfigResp;
19+
import me.chanjar.weixin.cp.bean.kf.WxCpKfServicerListResp;
20+
import me.chanjar.weixin.cp.bean.kf.WxCpKfServicerOpResp;
521
import me.chanjar.weixin.cp.bean.kf.*;
622

723
import java.util.List;
@@ -189,4 +205,46 @@ WxCpKfCustomerBatchGetResp customerBatchGet(List<String> externalUserIdList)
189205
* @return 客户数据统计-企业汇总数据
190206
*/
191207
WxCpKfGetCorpStatisticResp getCorpStatistic(WxCpKfGetCorpStatisticRequest request) throws WxErrorException;
208+
209+
// 「升级服务」配置
210+
/**
211+
* 获取配置的专员与客户群
212+
* @return
213+
* @throws WxErrorException
214+
*/
215+
WxCpKfServiceUpgradeConfigResp getUpgradeServiceConfig() throws WxErrorException;
216+
217+
/**
218+
* 升级专员服务
219+
* @param openKfid 客服帐号ID
220+
* @param externalUserId 微信客户的external_userid
221+
* @param userid 服务专员的userid
222+
* @param wording 推荐语
223+
* @return
224+
* @throws WxErrorException
225+
*/
226+
WxCpBaseResp upgradeMemberService(String openKfid, String externalUserId,
227+
String userid, String wording) throws WxErrorException;
228+
229+
/**
230+
* 升级客户群服务
231+
* @param openKfid 客服帐号ID
232+
* @param externalUserId 微信客户的external_userid
233+
* @param chatId 客户群id
234+
* @param wording 推荐语
235+
* @return
236+
* @throws WxErrorException
237+
*/
238+
WxCpBaseResp upgradeGroupchatService(String openKfid, String externalUserId,
239+
String chatId, String wording) throws WxErrorException;
240+
241+
/**
242+
* 为客户取消推荐
243+
* @param openKfid 客服帐号ID
244+
* @param externalUserId 微信客户的external_userid
245+
* @return
246+
* @throws WxErrorException
247+
*/
248+
WxCpBaseResp cancelUpgradeService(String openKfid, String externalUserId)
249+
throws WxErrorException;
192250
}

Diff for: weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpKfServiceImpl.java

+73
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,22 @@
1010
import me.chanjar.weixin.cp.api.WxCpService;
1111
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
1212
import me.chanjar.weixin.cp.bean.kf.*;
13+
import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountAdd;
14+
import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountAddResp;
15+
import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountDel;
16+
import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountLink;
17+
import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountLinkResp;
18+
import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountListResp;
19+
import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountUpd;
20+
import me.chanjar.weixin.cp.bean.kf.WxCpKfCustomerBatchGetResp;
21+
import me.chanjar.weixin.cp.bean.kf.WxCpKfMsgListResp;
22+
import me.chanjar.weixin.cp.bean.kf.WxCpKfMsgSendRequest;
23+
import me.chanjar.weixin.cp.bean.kf.WxCpKfMsgSendResp;
24+
import me.chanjar.weixin.cp.bean.kf.WxCpKfServiceStateResp;
25+
import me.chanjar.weixin.cp.bean.kf.WxCpKfServiceStateTransResp;
26+
import me.chanjar.weixin.cp.bean.kf.WxCpKfServiceUpgradeConfigResp;
27+
import me.chanjar.weixin.cp.bean.kf.WxCpKfServicerListResp;
28+
import me.chanjar.weixin.cp.bean.kf.WxCpKfServicerOpResp;
1329
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
1430

1531
import java.util.List;
@@ -182,6 +198,63 @@ public WxCpKfCustomerBatchGetResp customerBatchGet(List<String> externalUserIdLi
182198
return WxCpKfCustomerBatchGetResp.fromJson(responseContent);
183199
}
184200

201+
@Override
202+
public WxCpKfServiceUpgradeConfigResp getUpgradeServiceConfig() throws WxErrorException {
203+
String url = cpService.getWxCpConfigStorage().getApiUrl(CUSTOMER_GET_UPGRADE_SERVICE_CONFIG);
204+
205+
String response = cpService.get(url, null);
206+
return WxCpKfServiceUpgradeConfigResp.fromJson(response);
207+
}
208+
209+
@Override
210+
public WxCpBaseResp upgradeMemberService(String openKfid, String externalUserId,
211+
String userid, String wording) throws WxErrorException {
212+
String url = cpService.getWxCpConfigStorage().getApiUrl(CUSTOMER_UPGRADE_SERVICE);
213+
214+
JsonObject json = new JsonObject();
215+
json.addProperty("open_kfid", openKfid);
216+
json.addProperty("external_userid", externalUserId);
217+
json.addProperty("type", 1);
218+
219+
JsonObject memberJson = new JsonObject();
220+
memberJson.addProperty("userid", userid);
221+
memberJson.addProperty("wording", wording);
222+
json.add("member", memberJson);
223+
224+
String response = cpService.post(url, json);
225+
return WxCpBaseResp.fromJson(response);
226+
}
227+
228+
@Override
229+
public WxCpBaseResp upgradeGroupchatService(String openKfid, String externalUserId,
230+
String chatId, String wording) throws WxErrorException {
231+
String url = cpService.getWxCpConfigStorage().getApiUrl(CUSTOMER_UPGRADE_SERVICE);
232+
233+
JsonObject json = new JsonObject();
234+
json.addProperty("open_kfid", openKfid);
235+
json.addProperty("external_userid", externalUserId);
236+
json.addProperty("type", 2);
237+
238+
JsonObject groupchatJson = new JsonObject();
239+
groupchatJson.addProperty("chat_id", chatId);
240+
groupchatJson.addProperty("wording", wording);
241+
json.add("groupchat", groupchatJson);
242+
243+
String response = cpService.post(url, json);
244+
return WxCpBaseResp.fromJson(response);
245+
}
246+
247+
@Override
248+
public WxCpBaseResp cancelUpgradeService(String openKfid, String externalUserId)
249+
throws WxErrorException {
250+
String url = cpService.getWxCpConfigStorage().getApiUrl(CUSTOMER_CANCEL_UPGRADE_SERVICE);
251+
252+
JsonObject json = new JsonObject();
253+
json.addProperty("open_kfid", openKfid);
254+
json.addProperty("external_userid", externalUserId);
255+
String response = cpService.post(url, json);
256+
return WxCpBaseResp.fromJson(response);
257+
}
185258
@Override
186259
public WxCpKfGetCorpStatisticResp getCorpStatistic(WxCpKfGetCorpStatisticRequest request) throws WxErrorException {
187260
String url = cpService.getWxCpConfigStorage().getApiUrl(GET_CORP_STATISTIC);

Diff for: weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpUserExternalGroupChatTransferResp.java

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public static class GroupChatFailedTransfer extends WxCpBaseResp {
3939
/**
4040
* 没能成功继承的群ID
4141
*/
42+
@SerializedName("chat_id")
4243
private String chatId;
4344

4445
public static WxCpUserExternalGroupChatTransferResp.GroupChatFailedTransfer fromJson(String json) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package me.chanjar.weixin.cp.bean.kf;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
import java.util.List;
5+
import lombok.Data;
6+
import lombok.EqualsAndHashCode;
7+
import lombok.NoArgsConstructor;
8+
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
9+
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
10+
11+
/**
12+
* @author leiin
13+
* @date 2022/4/26 5:21 下午
14+
*/
15+
@EqualsAndHashCode(callSuper = true)
16+
@NoArgsConstructor
17+
@Data
18+
public class WxCpKfServiceUpgradeConfigResp extends WxCpBaseResp {
19+
20+
private static final long serialVersionUID = -3212550906238196617L;
21+
22+
@SerializedName("member_range")
23+
private MemberRange memberRange;
24+
25+
@SerializedName("groupchat_range")
26+
private GroupchatRange groupchatRange;
27+
28+
public static WxCpKfServiceUpgradeConfigResp fromJson(String json) {
29+
return WxCpGsonBuilder.create().fromJson(json, WxCpKfServiceUpgradeConfigResp.class);
30+
}
31+
32+
@Data
33+
@NoArgsConstructor
34+
public static class MemberRange {
35+
@SerializedName("userid_list")
36+
private List<String> useridList;
37+
38+
@SerializedName("department_id_list")
39+
private List<Integer> departmentIdList;
40+
}
41+
42+
@Data
43+
@NoArgsConstructor
44+
public static class GroupchatRange {
45+
@SerializedName("chat_id_list")
46+
private List<String> chatIdList;
47+
}
48+
}

Diff for: weixin-java-cp/src/main/java/me/chanjar/weixin/cp/constant/WxCpApiPathConsts.java

+3
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,9 @@ interface Kf {
390390
String SEND_MSG_ON_EVENT = "/cgi-bin/kf/send_msg_on_event";
391391
String CUSTOMER_BATCH_GET = "/cgi-bin/kf/customer/batchget";
392392
String GET_CORP_STATISTIC = "/cgi-bin/kf/get_corp_statistic";
393+
String CUSTOMER_GET_UPGRADE_SERVICE_CONFIG = "/cgi-bin/kf/customer/get_upgrade_service_config";
394+
String CUSTOMER_UPGRADE_SERVICE = "/cgi-bin/kf/customer/upgrade_service";
395+
String CUSTOMER_CANCEL_UPGRADE_SERVICE = "/cgi-bin/kf/customer/cancel_upgrade_service";
393396

394397
}
395398

Diff for: weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaImmediateDeliveryService.java

+34
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@
77
import cn.binarywang.wx.miniapp.bean.delivery.BindAccountResponse;
88
import cn.binarywang.wx.miniapp.bean.delivery.CancelOrderRequest;
99
import cn.binarywang.wx.miniapp.bean.delivery.CancelOrderResponse;
10+
import cn.binarywang.wx.miniapp.bean.delivery.FollowWaybillRequest;
11+
import cn.binarywang.wx.miniapp.bean.delivery.FollowWaybillResponse;
1012
import cn.binarywang.wx.miniapp.bean.delivery.GetOrderRequest;
1113
import cn.binarywang.wx.miniapp.bean.delivery.GetOrderResponse;
1214
import cn.binarywang.wx.miniapp.bean.delivery.MockUpdateOrderRequest;
1315
import cn.binarywang.wx.miniapp.bean.delivery.MockUpdateOrderResponse;
16+
import cn.binarywang.wx.miniapp.bean.delivery.QueryFollowTraceRequest;
17+
import cn.binarywang.wx.miniapp.bean.delivery.QueryFollowTraceResponse;
1418
import cn.binarywang.wx.miniapp.bean.delivery.QueryWaybillTraceRequest;
1519
import cn.binarywang.wx.miniapp.bean.delivery.QueryWaybillTraceResponse;
1620
import cn.binarywang.wx.miniapp.bean.delivery.TraceWaybillRequest;
@@ -129,4 +133,34 @@ QueryWaybillTraceResponse queryWaybillTrace(QueryWaybillTraceRequest request)
129133
throws WxErrorException;
130134

131135

136+
/**
137+
* 传运单接口 follow_waybill 订阅微信后台会跟踪运单的状态变化
138+
* <pre>
139+
* 文档地址:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/express_open_msg.html
140+
* </pre>
141+
*
142+
* @param request request
143+
* @return 响应
144+
* @throws WxErrorException 异常
145+
*/
146+
FollowWaybillResponse followWaybill(FollowWaybillRequest request)
147+
throws WxErrorException;
148+
149+
150+
/**
151+
* 查运单接口 query_follow_trace
152+
*
153+
* <pre>
154+
* 商户在调用完trace_waybill接口后,可以使用本接口查询到对应运单的详情信息
155+
* 文档地址:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/express_open_msg.html
156+
* </pre>
157+
*
158+
* @param request request
159+
* @return 响应
160+
* @throws WxErrorException 异常
161+
*/
162+
QueryFollowTraceResponse queryFollowTrace(QueryFollowTraceRequest request)
163+
throws WxErrorException ;
164+
165+
132166
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
package cn.binarywang.wx.miniapp.api;
2+
3+
import cn.binarywang.wx.miniapp.bean.product.WxMinishopAddGoodsSkuData;
4+
import cn.binarywang.wx.miniapp.bean.product.WxMinishopAddGoodsSpuData;
5+
import cn.binarywang.wx.miniapp.bean.product.WxMinishopOrderListResponse;
6+
import cn.binarywang.wx.miniapp.bean.product.WxMinishopResult;
7+
import cn.binarywang.wx.miniapp.bean.product.WxMinishopSku;
8+
import cn.binarywang.wx.miniapp.bean.product.WxMinishopSpu;
9+
import cn.binarywang.wx.miniapp.bean.product.WxMinishopSpuGet;
10+
import cn.binarywang.wx.miniapp.bean.product.WxMinishopSpuGetResponse;
11+
import cn.binarywang.wx.miniapp.bean.product.WxMinishopSpuListResponse;
12+
import cn.binarywang.wx.miniapp.bean.product.WxMinishopUpdateGoodsSkuData;
13+
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopSpuPageRequest;
14+
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse;
15+
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopGetSpuListResponse;
16+
import java.util.List;
17+
import me.chanjar.weixin.common.error.WxErrorException;
18+
19+
/**
20+
* 小程序交易组件-商品服务
21+
*
22+
* @author boris
23+
*/
24+
public interface WxMaProductService {
25+
WxMinishopResult addSpu(WxMinishopSpu spuInfo) throws WxErrorException;
26+
27+
WxMaShopBaseResponse deleteSpu(Integer productId, String outProductId) throws WxErrorException;
28+
29+
WxMinishopSpuGetResponse getSpu(Integer productId, String outProductId, Integer needEditSpu)
30+
throws WxErrorException;
31+
32+
WxMinishopSpuListResponse getSpuList(WxMaShopSpuPageRequest request)
33+
throws WxErrorException;
34+
35+
WxMinishopResult<WxMinishopAddGoodsSpuData> updateSpu(WxMinishopSpu spuInfo) throws WxErrorException;
36+
37+
WxMaShopBaseResponse listingSpu(Integer productId, String outProductId)
38+
throws WxErrorException;
39+
40+
WxMaShopBaseResponse delistingSpu(Integer productId, String outProductId)
41+
throws WxErrorException;
42+
43+
/**
44+
* 小商店新增sku信息
45+
*
46+
* @param sku
47+
* @return
48+
* @throws WxErrorException
49+
*/
50+
WxMinishopResult<WxMinishopAddGoodsSkuData> minishiopGoodsAddSku(WxMinishopSku sku) throws WxErrorException;
51+
52+
53+
/**
54+
* 小商店批量新增sku信息
55+
*
56+
* @param skuList
57+
* @return
58+
* @throws WxErrorException
59+
*/
60+
WxMinishopResult<List<WxMinishopAddGoodsSkuData>> minishopGoodsBatchAddSku(List<WxMinishopSku> skuList) throws WxErrorException;
61+
62+
63+
/**
64+
* 小商店删除sku消息
65+
*
66+
* @param productId
67+
* @param outProductId
68+
* @param outSkuId
69+
* @param skuId
70+
* @return
71+
* @throws WxErrorException
72+
*/
73+
WxMaShopBaseResponse minishopGoodsDelSku(Long productId, Long outProductId, String outSkuId, Long skuId) throws WxErrorException;
74+
75+
76+
/**
77+
* 小商店更新sku
78+
*
79+
* @param sku
80+
* @return
81+
* @throws WxErrorException
82+
*/
83+
WxMinishopResult<WxMinishopUpdateGoodsSkuData> minishopGoodsUpdateSku(WxMinishopSku sku) throws WxErrorException;
84+
85+
86+
/**
87+
* 小商店更新sku价格
88+
*
89+
* @param productId
90+
* @param outProductId
91+
* @param outSkuId
92+
* @param skuId
93+
* @param salePrice
94+
* @param marketPrice
95+
* @return
96+
* @throws WxErrorException
97+
*/
98+
WxMinishopResult<WxMinishopUpdateGoodsSkuData> minishopGoodsUpdateSkuPrice(Long productId,
99+
Long outProductId, String outSkuId, Long skuId, Long salePrice, Long marketPrice) throws WxErrorException;
100+
101+
102+
/**
103+
* 小商店更新sku库存
104+
*
105+
* @param productId
106+
* @param outProductId
107+
* @param outSkuId
108+
* @param skuId
109+
* @param type
110+
* @param stockNum
111+
* @return
112+
* @throws WxErrorException
113+
*/
114+
WxMinishopResult<WxMinishopUpdateGoodsSkuData> minishopGoodsUpdateSkuStock(Long productId,
115+
Long outProductId, String outSkuId, Long skuId, Integer type, Integer stockNum) throws WxErrorException;
116+
117+
WxMinishopOrderListResponse minishopOrderGetList(String startCreateTime, String endCreateTime,
118+
Integer status, Integer page, Integer pageSize, Integer source) throws WxErrorException;
119+
}

0 commit comments

Comments
 (0)