Skip to content

Commit 5bde717

Browse files
authored
🎨 #3594【视频号】微信小店更新售后、订单详情等返回参数,并修改获取售后单列表和获取快递公司列表等接口的参数
1 parent 8bacc94 commit 5bde717

14 files changed

+223
-15
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import java.util.List;
55
import me.chanjar.weixin.channel.bean.after.AfterSaleInfoResponse;
6+
import me.chanjar.weixin.channel.bean.after.AfterSaleListParam;
67
import me.chanjar.weixin.channel.bean.after.AfterSaleListResponse;
78
import me.chanjar.weixin.channel.bean.after.AfterSaleReasonResponse;
89
import me.chanjar.weixin.channel.bean.after.AfterSaleRejectReasonResponse;
@@ -26,10 +27,22 @@ public interface WxChannelAfterSaleService {
2627
* @return 售后单列表
2728
*
2829
* @throws WxErrorException 异常
30+
* @deprecated 使用 {@link WxChannelAfterSaleService#listIds(AfterSaleListParam)}
2931
*/
32+
@Deprecated
3033
AfterSaleListResponse listIds(Long beginCreateTime, Long endCreateTime, String nextKey)
3134
throws WxErrorException;
3235

36+
/**
37+
* 获取售后单列表
38+
*
39+
* @param param 参数
40+
* @return 售后单列表
41+
*
42+
* @throws WxErrorException 异常
43+
*/
44+
AfterSaleListResponse listIds(AfterSaleListParam param) throws WxErrorException;
45+
3346
/**
3447
* 获取售后单详情
3548
*

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,24 @@ WxChannelBaseResponse updatePrice(String orderId, Integer expressFee, List<Chang
139139
WxChannelBaseResponse closeOrder(String orderId);
140140

141141
/**
142-
* 获取快递公司列表
142+
* 获取快递公司列表-旧
143143
*
144144
* @return 快递公司列表
145145
*
146146
* @throws WxErrorException 异常
147147
*/
148148
DeliveryCompanyResponse listDeliveryCompany() throws WxErrorException;
149149

150+
/**
151+
* 获取快递公司列表
152+
*
153+
* @param ewaybillOnly 是否仅返回支持电子面单功能的快递公司
154+
* @return 快递公司列表
155+
*
156+
* @throws WxErrorException 异常
157+
*/
158+
DeliveryCompanyResponse listDeliveryCompany(Boolean ewaybillOnly) throws WxErrorException;
159+
150160
/**
151161
* 订单发货
152162
*

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@ public WxChannelAfterSaleServiceImpl(BaseWxChannelServiceImpl<?, ?> shopService)
3232
@Override
3333
public AfterSaleListResponse listIds(Long beginCreateTime, Long endCreateTime, String nextKey)
3434
throws WxErrorException {
35-
AfterSaleListParam param = new AfterSaleListParam(beginCreateTime, endCreateTime, nextKey);
35+
AfterSaleListParam param = new AfterSaleListParam(beginCreateTime, endCreateTime, null, null, nextKey);
36+
String resJson = shopService.post(AFTER_SALE_LIST_URL, param);
37+
return ResponseUtils.decode(resJson, AfterSaleListResponse.class);
38+
}
39+
40+
@Override
41+
public AfterSaleListResponse listIds(AfterSaleListParam param) throws WxErrorException {
3642
String resJson = shopService.post(AFTER_SALE_LIST_URL, param);
3743
return ResponseUtils.decode(resJson, AfterSaleListResponse.class);
3844
}

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

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,44 @@
11
package me.chanjar.weixin.channel.api.impl;
22

33
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Delivery.DELIVERY_SEND_URL;
4+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Delivery.GET_DELIVERY_COMPANY_NEW_URL;
45
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Delivery.GET_DELIVERY_COMPANY_URL;
5-
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.*;
6+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.ACCEPT_ADDRESS_MODIFY_URL;
7+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.DECODE_SENSITIVE_INFO_URL;
8+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.ORDER_GET_URL;
9+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.ORDER_LIST_URL;
10+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.ORDER_SEARCH_URL;
11+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.REJECT_ADDRESS_MODIFY_URL;
12+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.UPDATE_ADDRESS_URL;
13+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.UPDATE_EXPRESS_URL;
14+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.UPDATE_PRICE_URL;
15+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.UPDATE_REMARK_URL;
16+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.UPLOAD_FRESH_INSPECT_URL;
17+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.VIRTUAL_TEL_NUMBER_URL;
618

719
import java.util.List;
820
import lombok.extern.slf4j.Slf4j;
921
import me.chanjar.weixin.channel.api.WxChannelOrderService;
1022
import me.chanjar.weixin.channel.bean.base.AddressInfo;
1123
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
12-
import me.chanjar.weixin.channel.bean.delivery.PackageAuditInfo;
1324
import me.chanjar.weixin.channel.bean.delivery.DeliveryCompanyResponse;
1425
import me.chanjar.weixin.channel.bean.delivery.DeliveryInfo;
1526
import me.chanjar.weixin.channel.bean.delivery.DeliverySendParam;
1627
import me.chanjar.weixin.channel.bean.delivery.FreshInspectParam;
17-
import me.chanjar.weixin.channel.bean.order.*;
28+
import me.chanjar.weixin.channel.bean.delivery.PackageAuditInfo;
29+
import me.chanjar.weixin.channel.bean.order.ChangeOrderInfo;
30+
import me.chanjar.weixin.channel.bean.order.DecodeSensitiveInfoResponse;
31+
import me.chanjar.weixin.channel.bean.order.DeliveryUpdateParam;
32+
import me.chanjar.weixin.channel.bean.order.OrderAddressParam;
33+
import me.chanjar.weixin.channel.bean.order.OrderIdParam;
34+
import me.chanjar.weixin.channel.bean.order.OrderInfoParam;
35+
import me.chanjar.weixin.channel.bean.order.OrderInfoResponse;
36+
import me.chanjar.weixin.channel.bean.order.OrderListParam;
37+
import me.chanjar.weixin.channel.bean.order.OrderListResponse;
38+
import me.chanjar.weixin.channel.bean.order.OrderPriceParam;
39+
import me.chanjar.weixin.channel.bean.order.OrderRemarkParam;
40+
import me.chanjar.weixin.channel.bean.order.OrderSearchParam;
41+
import me.chanjar.weixin.channel.bean.order.VirtualTelNumberResponse;
1842
import me.chanjar.weixin.channel.util.ResponseUtils;
1943
import me.chanjar.weixin.common.error.WxErrorException;
2044

@@ -115,6 +139,16 @@ public DeliveryCompanyResponse listDeliveryCompany() throws WxErrorException {
115139
return ResponseUtils.decode(resJson, DeliveryCompanyResponse.class);
116140
}
117141

142+
@Override
143+
public DeliveryCompanyResponse listDeliveryCompany(Boolean ewaybillOnly) throws WxErrorException {
144+
String reqJson = "{}";
145+
if (ewaybillOnly != null) {
146+
reqJson = "{\"ewaybill_only\":" + ewaybillOnly + "}";
147+
}
148+
String resJson = shopService.post(GET_DELIVERY_COMPANY_NEW_URL, reqJson);
149+
return ResponseUtils.decode(resJson, DeliveryCompanyResponse.class);
150+
}
151+
118152
@Override
119153
public WxChannelBaseResponse deliveryOrder(String orderId, List<DeliveryInfo> deliveryList)
120154
throws WxErrorException {

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ public class AfterSaleListParam implements Serializable {
2828
@JsonProperty("end_create_time")
2929
private Long endCreateTime;
3030

31+
/** 售后单更新起始时间 */
32+
@JsonProperty("begin_update_time")
33+
private Long beginUpdateTime;
34+
35+
/** 售后单更新结束时间,end_update_time减去begin_update_time不得大于24小时 */
36+
@JsonProperty("end_update_time")
37+
private Long endUpdateTime;
38+
3139
/** 翻页参数,从第二页开始传,来源于上一页的返回值 */
3240
@JsonProperty("next_key")
3341
private String nextKey;
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package me.chanjar.weixin.channel.bean.order;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import java.io.Serializable;
5+
import lombok.Data;
6+
import lombok.NoArgsConstructor;
7+
8+
/**
9+
* 商品定制信息
10+
*
11+
* @author <a href="https://github.com/lixize">Zeyes</a>
12+
*/
13+
@Data
14+
@NoArgsConstructor
15+
public class OrderCustomInfo implements Serializable {
16+
private static final long serialVersionUID = 6681266835402157651L;
17+
18+
/** 定制图片,custom_type=2时返回 */
19+
@JsonProperty("custom_img_url")
20+
private String customImgUrl;
21+
22+
/** 定制文字,custom_type=1时返回 */
23+
@JsonProperty("custom_word")
24+
private String customWord;
25+
26+
/** 定制类型,枚举值请参考CustomType枚举 */
27+
@JsonProperty("custom_type")
28+
private Integer customType;
29+
30+
/** 定制预览图片,开启了定制预览时返回 */
31+
@JsonProperty("custom_preview_img_url")
32+
private String customPreviewImgUrl;
33+
}

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,18 @@ public class OrderDetailInfo implements Serializable {
6161
private OrderAgentInfo agentInfo;
6262

6363
/** 订单来源信息 */
64-
@JsonProperty("source_info")
65-
private OrderSourceInfo sourceInfo;
64+
@JsonProperty("source_infos")
65+
private List<OrderSourceInfo> sourceInfos;
6666

67+
/** 订单退款信息 */
68+
@JsonProperty("refund_info")
69+
private OrderSourceInfo refundInfo;
70+
71+
/** 订单代写商品信息 */
72+
@JsonProperty("greeting_card_info")
73+
private OrderGreetingCardInfo greetingCardInfo;
74+
75+
/** 商品定制信息 */
76+
@JsonProperty("custom_info")
77+
private OrderCustomInfo customInfo;
6778
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package me.chanjar.weixin.channel.bean.order;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import java.io.Serializable;
5+
import lombok.Data;
6+
import lombok.NoArgsConstructor;
7+
8+
/**
9+
* 订单商品贺卡信息
10+
*
11+
* @author <a href="https://github.com/lixize">Zeyes</a>
12+
*/
13+
@Data
14+
@NoArgsConstructor
15+
public class OrderGreetingCardInfo implements Serializable {
16+
private static final long serialVersionUID = -6391443179945240242L;
17+
18+
/** 贺卡落款,用户选填 */
19+
@JsonProperty("giver_name")
20+
private String giverName;
21+
22+
/** 贺卡称谓,用户选填 */
23+
@JsonProperty("receiver_name")
24+
private String receiverName;
25+
26+
/** 贺卡内容,用户必填 */
27+
@JsonProperty("greeting_message")
28+
private String greetingMessage;
29+
}

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

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,31 @@ public class OrderInfo implements Serializable {
3939
@JsonProperty("aftersale_detail")
4040
protected AfterSaleDetail afterSaleDetail;
4141

42+
/** 是否为礼物订单 */
43+
@JsonProperty("is_present")
44+
private Boolean present;
45+
46+
/** 礼物订单ID */
47+
@JsonProperty("present_order_id_str")
48+
private String presentOrderId;
49+
50+
/** 礼物订单留言 */
51+
@JsonProperty("present_note")
52+
private String presentNote;
53+
54+
/** 礼物订单赠送者openid */
55+
@JsonProperty("present_giver_openid")
56+
private String presentGiverOpenid;
57+
58+
/** 礼物订单赠送者unionid */
59+
@JsonProperty("present_giver_unionid")
60+
private String presentGiverUnionid;
61+
4262
/** 创建时间 秒级时间戳 */
4363
@JsonProperty("create_time")
4464
protected Integer createTime;
4565

4666
/** 更新时间 秒级时间戳 */
4767
@JsonProperty("update_time")
4868
protected Integer updateTime;
49-
5069
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package me.chanjar.weixin.channel.bean.order;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import java.io.Serializable;
5+
import lombok.Data;
6+
import lombok.NoArgsConstructor;
7+
8+
/**
9+
* 订单退款信息
10+
*
11+
* @author <a href="https://github.com/lixize">Zeyes</a>
12+
*/
13+
@Data
14+
@NoArgsConstructor
15+
public class OrderRefundInfo implements Serializable {
16+
private static final long serialVersionUID = -7257910073388645919L;
17+
18+
/** 退还运费金额,礼物订单(is_present=true)可能存在 */
19+
@JsonProperty("refund_freight")
20+
private Integer refundFreight;
21+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ public class OrderSearchParam extends StreamPageParam {
2525
private Integer onAfterSaleOrderExist;
2626

2727
/** 订单状态 {@link me.chanjar.weixin.channel.enums.WxOrderStatus} */
28-
@JsonProperty("on_aftersale_order_exist")
28+
@JsonProperty("status")
2929
private Integer status;
3030
}

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

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,44 @@ public class OrderSourceInfo implements Serializable {
2323
private String skuId;
2424

2525
/**
26-
* 带货账户类型,1:视频号,2:公众号,3:小程序
26+
* 带货账号类型,1:视频号,2:公众号,3:小程序,4:企业微信,5:带货达人,6:服务号,1000:带货机构
2727
*/
2828
@JsonProperty("account_type")
2929
private Integer accountType;
3030

3131
/**
32-
* 带货账户id,如果带货账户类型是视频号,此id为视频号id; 如果带货类型为 公众号/小程序, 此id 为对应 公众号/小程序 的appid
32+
* 带货账号id,取决于带货账号类型(分别为视频号id、公众号appid、小程序appid、企业微信id、带货达人appid、服务号appid、带货机构id)
3333
*/
3434
@JsonProperty("account_id")
3535
private String accountId;
3636

3737
/**
38-
* 销售渠道, 0:关联账号,1:合作账号,100:联盟达人带货
38+
* 账号关联类型,0:关联账号,1:合作账号,2:授权号,100:达人带货,101:带货机构推广
3939
*/
4040
@JsonProperty("sale_channel")
4141
private Integer saleChannel;
4242

4343
/**
44-
* 带货账户昵称
44+
* 带货账号昵称
4545
*/
4646
@JsonProperty("account_nickname")
4747
private String accountNickname;
48+
49+
/**
50+
* 带货内容类型,1:企微成员转发
51+
*/
52+
@JsonProperty("content_type")
53+
private String contentType;
54+
55+
/**
56+
* 带货内容id,取决于带货内容类型(企微成员user_id)
57+
*/
58+
@JsonProperty("content_id")
59+
private String contentId;
60+
61+
/**
62+
* 自营推客推广的带货机构id
63+
*/
64+
@JsonProperty("promoter_head_supplier_id")
65+
private String promoterHeadSupplierId;
4866
}

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/constant/WxChannelApiUrlConstants.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,9 @@ public interface Complaint {
247247

248248
/** 物流相关接口 */
249249
public interface Delivery {
250-
251250
/** 获取快递公司列表 */
251+
String GET_DELIVERY_COMPANY_NEW_URL = "https://api.weixin.qq.com/channels/ec/order/deliverycompanylist/new/get";
252+
/** 获取快递公司列表(旧) */
252253
String GET_DELIVERY_COMPANY_URL = "https://api.weixin.qq.com/channels/ec/order/deliverycompanylist/get";
253254
/** 订单发货 */
254255
String DELIVERY_SEND_URL = "https://api.weixin.qq.com/channels/ec/order/delivery/send";

weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxChannelOrderServiceImplTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import me.chanjar.weixin.channel.bean.order.OrderInfoResponse;
2121
import me.chanjar.weixin.channel.bean.order.OrderListParam;
2222
import me.chanjar.weixin.channel.bean.order.OrderListResponse;
23+
import me.chanjar.weixin.channel.bean.order.OrderSearchCondition;
2324
import me.chanjar.weixin.channel.bean.order.OrderSearchParam;
2425
import me.chanjar.weixin.channel.bean.order.VirtualTelNumberResponse;
2526
import me.chanjar.weixin.channel.test.ApiTestModule;
@@ -68,6 +69,10 @@ public void testGetOrders() throws WxErrorException {
6869
public void testSearchOrder() throws WxErrorException {
6970
WxChannelOrderService orderService = channelService.getOrderService();
7071
OrderSearchParam param = new OrderSearchParam();
72+
param.setPageSize(100);
73+
OrderSearchCondition searchCondition = new OrderSearchCondition();
74+
searchCondition.setTitle("");
75+
param.setSearchCondition(searchCondition);
7176
OrderListResponse response = orderService.searchOrder(param);
7277
assertNotNull(response);
7378
assertTrue(response.isSuccess());
@@ -145,7 +150,7 @@ public void testCloseOrder() {
145150
@Test
146151
public void testListDeliveryCompany() throws WxErrorException {
147152
WxChannelOrderService orderService = channelService.getOrderService();
148-
DeliveryCompanyResponse response = orderService.listDeliveryCompany();
153+
DeliveryCompanyResponse response = orderService.listDeliveryCompany(false);
149154
assertNotNull(response);
150155
assertTrue(response.isSuccess());
151156
}

0 commit comments

Comments
 (0)