Skip to content

Commit 6de6a8f

Browse files
authored
Merge branch 'binarywang:develop' into develop
2 parents 0943a0e + 26f5887 commit 6de6a8f

File tree

85 files changed

+4504
-75
lines changed

Some content is hidden

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

85 files changed

+4504
-75
lines changed

MINIAPP_KEFU_SERVICE.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# WeChat Mini Program Customer Service Management
2+
3+
This document describes the new customer service management functionality added to the WxJava Mini Program SDK.
4+
5+
## Overview
6+
7+
Previously, the mini program module only had:
8+
- `WxMaCustomserviceWorkService` - For binding mini programs to enterprise WeChat customer service
9+
- `WxMaMsgService.sendKefuMsg()` - For sending customer service messages
10+
11+
The new `WxMaKefuService` adds comprehensive customer service management capabilities:
12+
13+
## Features
14+
15+
### Customer Service Account Management
16+
- `kfList()` - Get list of customer service accounts
17+
- `kfAccountAdd()` - Add new customer service account
18+
- `kfAccountUpdate()` - Update customer service account
19+
- `kfAccountDel()` - Delete customer service account
20+
21+
### Session Management
22+
- `kfSessionCreate()` - Create customer service session
23+
- `kfSessionClose()` - Close customer service session
24+
- `kfSessionGet()` - Get customer session status
25+
- `kfSessionList()` - Get customer service session list
26+
27+
## Usage Example
28+
29+
```java
30+
// Get the customer service management service
31+
WxMaKefuService kefuService = wxMaService.getKefuService();
32+
33+
// Add a new customer service account
34+
WxMaKfAccountRequest request = WxMaKfAccountRequest.builder()
35+
.kfAccount("service001@example")
36+
.kfNick("Customer Service 001")
37+
.kfPwd("password123")
38+
.build();
39+
boolean result = kefuService.kfAccountAdd(request);
40+
41+
// Create a session between user and customer service
42+
boolean sessionResult = kefuService.kfSessionCreate("user_openid", "service001@example");
43+
44+
// Get customer service list
45+
WxMaKfList kfList = kefuService.kfList();
46+
```
47+
48+
## Bean Classes
49+
50+
### Request Objects
51+
- `WxMaKfAccountRequest` - For customer service account operations
52+
- `WxMaKfSessionRequest` - For session operations
53+
54+
### Response Objects
55+
- `WxMaKfInfo` - Customer service account information
56+
- `WxMaKfList` - List of customer service accounts
57+
- `WxMaKfSession` - Session information
58+
- `WxMaKfSessionList` - List of sessions
59+
60+
## API Endpoints
61+
62+
The service uses the following WeChat Mini Program API endpoints:
63+
- `https://api.weixin.qq.com/cgi-bin/customservice/getkflist` - Get customer service list
64+
- `https://api.weixin.qq.com/customservice/kfaccount/add` - Add customer service account
65+
- `https://api.weixin.qq.com/customservice/kfaccount/update` - Update customer service account
66+
- `https://api.weixin.qq.com/customservice/kfaccount/del` - Delete customer service account
67+
- `https://api.weixin.qq.com/customservice/kfsession/create` - Create session
68+
- `https://api.weixin.qq.com/customservice/kfsession/close` - Close session
69+
- `https://api.weixin.qq.com/customservice/kfsession/getsession` - Get session
70+
- `https://api.weixin.qq.com/customservice/kfsession/getsessionlist` - Get session list
71+
72+
## Integration
73+
74+
The service is automatically available through the main `WxMaService` interface:
75+
76+
```java
77+
WxMaKefuService kefuService = wxMaService.getKefuService();
78+
```
79+
80+
This fills the gap mentioned in the original issue and provides full customer service management capabilities for WeChat Mini Programs.

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelAfterSaleService.java

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22

33

44
import java.util.List;
5-
import me.chanjar.weixin.channel.bean.after.AfterSaleInfoResponse;
6-
import me.chanjar.weixin.channel.bean.after.AfterSaleListParam;
7-
import me.chanjar.weixin.channel.bean.after.AfterSaleListResponse;
8-
import me.chanjar.weixin.channel.bean.after.AfterSaleReasonResponse;
9-
import me.chanjar.weixin.channel.bean.after.AfterSaleRejectReasonResponse;
5+
6+
import me.chanjar.weixin.channel.bean.after.*;
107
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
118
import me.chanjar.weixin.channel.bean.complaint.ComplaintOrderResponse;
129
import me.chanjar.weixin.common.error.WxErrorException;
@@ -149,4 +146,41 @@ WxChannelBaseResponse addComplaintEvidence(String complaintId, String content, L
149146
* @throws WxErrorException 异常
150147
*/
151148
AfterSaleRejectReasonResponse getRejectReason() throws WxErrorException;
149+
150+
/**
151+
* 换货发货
152+
* 文档地址:https://developers.weixin.qq.com/doc/store/shop/API/channels-shop-aftersale/api_acceptexchangereship.html
153+
*
154+
* @param afterSaleOrderId 售后单号
155+
* @param waybillId 快递单号
156+
* @param deliveryId 快递公司id
157+
* @return BaseResponse
158+
*
159+
* @throws WxErrorException 异常
160+
*/
161+
WxChannelBaseResponse acceptExchangeReship(String afterSaleOrderId, String waybillId, String deliveryId) throws WxErrorException;
162+
163+
/**
164+
* 换货拒绝发货
165+
* 文档地址:https://developers.weixin.qq.com/doc/store/shop/API/channels-shop-aftersale/api_rejectexchangereship.html
166+
*
167+
* @param afterSaleOrderId 售后单号
168+
* @param rejectReason 拒绝原因具体描述 ,可使用默认描述,也可以自定义描述
169+
* @param rejectReasonType 拒绝原因枚举值
170+
* @param rejectCertificates 退款凭证,可使用图片上传接口获取media_id(数据类型填0)
171+
* @return BaseResponse
172+
*
173+
* @throws WxErrorException 异常
174+
*/
175+
WxChannelBaseResponse rejectExchangeReship(String afterSaleOrderId, String rejectReason, Integer rejectReasonType, List<String> rejectCertificates) throws WxErrorException;
176+
177+
/**
178+
* 商家协商
179+
* 文档地址:https://developers.weixin.qq.com/doc/store/shop/API/channels-shop-aftersale/api_merchantupdateaftersale.html
180+
* @param param 参数
181+
* @return BaseResponse
182+
*
183+
* @throws WxErrorException 异常
184+
*/
185+
WxChannelBaseResponse merchantUpdateAfterSale(AfterSaleMerchantUpdateParam param) throws WxErrorException;
152186
}

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelAfterSaleServiceImpl.java

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
@Slf4j
2323
public class WxChannelAfterSaleServiceImpl implements WxChannelAfterSaleService {
2424

25-
/** 微信商店服务 */
25+
/**
26+
* 微信商店服务
27+
*/
2628
private final BaseWxChannelServiceImpl<?, ?> shopService;
2729

2830
public WxChannelAfterSaleServiceImpl(BaseWxChannelServiceImpl<?, ?> shopService) {
@@ -107,4 +109,25 @@ public AfterSaleRejectReasonResponse getRejectReason() throws WxErrorException {
107109
String resJson = shopService.post(AFTER_SALE_REJECT_REASON_GET_URL, "{}");
108110
return ResponseUtils.decode(resJson, AfterSaleRejectReasonResponse.class);
109111
}
112+
113+
@Override
114+
public WxChannelBaseResponse acceptExchangeReship(String afterSaleOrderId, String waybillId, String deliveryId) throws WxErrorException {
115+
AfterSaleAcceptExchangeReshipParam param = new AfterSaleAcceptExchangeReshipParam(afterSaleOrderId, waybillId, deliveryId);
116+
String resJson = shopService.post(AFTER_SALE_ACCEPT_EXCHANGE_RESHIP_URL, param);
117+
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
118+
}
119+
120+
@Override
121+
public WxChannelBaseResponse rejectExchangeReship(String afterSaleOrderId, String rejectReason, Integer rejectReasonType, List<String> rejectCertificates) throws WxErrorException {
122+
AfterSaleRejectExchangeReshipParam param = new AfterSaleRejectExchangeReshipParam(afterSaleOrderId, rejectReason, rejectReasonType, rejectCertificates);
123+
String resJson = shopService.post(AFTER_SALE_REJECT_EXCHANGE_RESHIP_URL, param);
124+
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
125+
}
126+
127+
@Override
128+
public WxChannelBaseResponse merchantUpdateAfterSale(AfterSaleMerchantUpdateParam param) throws WxErrorException {
129+
String resJson = shopService.post(AFTER_SALE_MERCHANT_UPDATE_URL, param);
130+
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
131+
}
132+
110133
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package me.chanjar.weixin.channel.bean.after;
2+
3+
import com.fasterxml.jackson.annotation.JsonInclude;
4+
import com.fasterxml.jackson.annotation.JsonProperty;
5+
import lombok.Data;
6+
7+
/**
8+
* 售后单换货发货信息
9+
*
10+
* @author <a href="https://gitee.com/cchengg">Chu</a>
11+
*/
12+
@Data
13+
@JsonInclude(JsonInclude.Include.NON_NULL)
14+
public class AfterSaleAcceptExchangeReshipParam extends AfterSaleIdParam {
15+
private static final long serialVersionUID = -7946679037747710613L;
16+
17+
/** 快递单号*/
18+
@JsonProperty("waybill_id")
19+
private String waybillId;
20+
21+
/** 快递公司id,通过获取快递公司列表接口获得,非主流快递公司可以填OTHER*/
22+
@JsonProperty("delivery_id")
23+
private String deliveryId;
24+
25+
public AfterSaleAcceptExchangeReshipParam() {
26+
27+
}
28+
29+
public AfterSaleAcceptExchangeReshipParam(String afterSaleOrderId, String waybillId, String deliveryId) {
30+
super(afterSaleOrderId);
31+
this.waybillId = waybillId;
32+
this.deliveryId = deliveryId;
33+
}
34+
35+
}

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/after/AfterSaleExchangeProductInfo.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,12 @@ public class AfterSaleExchangeProductInfo implements Serializable {
3131
/** 数量 */
3232
@JsonProperty("product_cnt")
3333
private String productCnt;
34+
35+
/** 旧商品价格 */
36+
@JsonProperty("old_sku_price")
37+
private Integer oldSkuPrice;
38+
39+
/** 新商品价格 */
40+
@JsonProperty("new_sku_price")
41+
private Integer newSkuPrice;
3442
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
package me.chanjar.weixin.channel.bean.after;
2+
3+
import com.fasterxml.jackson.annotation.JsonInclude;
4+
import com.fasterxml.jackson.annotation.JsonProperty;
5+
import lombok.Data;
6+
7+
import java.util.List;
8+
9+
/**
10+
* 售后单商家协商信息
11+
*
12+
* @author <a href="https://gitee.com/cchengg">Chu</a>
13+
*/
14+
@Data
15+
@JsonInclude(JsonInclude.Include.NON_NULL)
16+
public class AfterSaleMerchantUpdateParam extends AfterSaleIdParam {
17+
private static final long serialVersionUID = -3672834150982780L;
18+
19+
/** 协商修改把售后单修改成该售后类型。1:退款;2:退货退款*/
20+
@JsonProperty("type")
21+
private Integer type;
22+
23+
/** 金额(单位:分)*/
24+
@JsonProperty("amount")
25+
private Integer amount;
26+
27+
/** 协商描述*/
28+
@JsonProperty("merchant_update_desc")
29+
private String merchantUpdateDesc;
30+
31+
/** 协商原因*/
32+
@JsonProperty("update_reason_type")
33+
private Integer updateReasonType;
34+
35+
/** 1:已协商一致,邀请买家取消售后; 2:邀请买家核实与补充凭证; 3:修改买家售后申请*/
36+
@JsonProperty("merchant_update_type")
37+
private Integer merchantUpdateType;
38+
39+
/** 协商凭证id列表,可使用图片上传接口获取media_id(数据类型填0),当update_reason_type对应的need_image为1时必填*/
40+
@JsonProperty("media_ids")
41+
private List<String> mediaIds;
42+
43+
public AfterSaleMerchantUpdateParam() {
44+
}
45+
46+
public AfterSaleMerchantUpdateParam(String afterSaleOrderId, Integer type, Integer updateReasonType, Integer merchantUpdateType
47+
, Integer amount, String merchantUpdateDesc, List<String> mediaIds) {
48+
super(afterSaleOrderId);
49+
this.type = type;
50+
this.updateReasonType = updateReasonType;
51+
this.merchantUpdateType = merchantUpdateType;
52+
this.amount = amount;
53+
this.merchantUpdateDesc = merchantUpdateDesc;
54+
this.mediaIds = mediaIds;
55+
}
56+
57+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package me.chanjar.weixin.channel.bean.after;
2+
3+
import com.fasterxml.jackson.annotation.JsonInclude;
4+
import com.fasterxml.jackson.annotation.JsonProperty;
5+
import lombok.Data;
6+
7+
import java.util.List;
8+
9+
/**
10+
* 售后单换货拒绝发货信息
11+
*
12+
* @author <a href="https://gitee.com/cchengg">Chu</a>
13+
*/
14+
@Data
15+
@JsonInclude(JsonInclude.Include.NON_NULL)
16+
public class AfterSaleRejectExchangeReshipParam extends AfterSaleIdParam {
17+
private static final long serialVersionUID = -7946679037747710613L;
18+
19+
/** 拒绝原因具体描述 ,可使用默认描述,也可以自定义描述*/
20+
@JsonProperty("reject_reason")
21+
private String rejectReason;
22+
23+
/** 拒绝原因枚举 */
24+
@JsonProperty("reject_reason_type")
25+
private Integer rejectReasonType;
26+
27+
/** 退款凭证,可使用图片上传接口获取media_id(数据类型填0)*/
28+
@JsonProperty("reject_certificates")
29+
private List<String> rejectCertificates;
30+
31+
public AfterSaleRejectExchangeReshipParam() {
32+
}
33+
34+
public AfterSaleRejectExchangeReshipParam(String afterSaleOrderId, String rejectReason, Integer rejectReasonType, List<String> rejectCertificates) {
35+
super(afterSaleOrderId);
36+
this.rejectReason = rejectReason;
37+
this.rejectReasonType = rejectReasonType;
38+
this.rejectCertificates = rejectCertificates;
39+
}
40+
41+
}

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/after/AfterSaleRejectReason.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,9 @@ public class AfterSaleRejectReason implements Serializable {
3636
@JsonProperty("reject_reason")
3737
private String rejectReason;
3838

39+
/**
40+
* 售后拒绝原因适用场景
41+
*/
42+
@JsonProperty("reject_scene")
43+
private Integer rejectScene;
3944
}

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/complaint/ComplaintHistory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class ComplaintHistory implements Serializable {
2626

2727
/** 用户联系电话 */
2828
@JsonProperty("phone_number")
29-
private Integer phoneNumber;
29+
private String phoneNumber;
3030

3131
/** 相关文本内容 */
3232
@JsonProperty("content")

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/OrderPayInfo.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,8 @@ public class OrderPayInfo implements Serializable {
1616

1717
private static final long serialVersionUID = -5085386252699113948L;
1818
/** 预支付id */
19-
@JsonProperty("prepayId")
20-
private String prepayId;
21-
22-
/** 预支付时间,秒级时间戳 */
23-
@JsonProperty("prepay_time")
24-
private Long prepayTime;
19+
@JsonProperty("payment_method")
20+
private Integer paymentMethod;
2521

2622
/** 支付时间,秒级时间戳 */
2723
@JsonProperty("pay_time")

0 commit comments

Comments
 (0)