Skip to content

Commit 2ef299b

Browse files
authored
补充订单管理缺失的13个接口实现
1 parent 65e8b7b commit 2ef299b

14 files changed

Lines changed: 682 additions & 0 deletions

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

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,15 @@
99
import me.chanjar.weixin.channel.bean.order.ChangeOrderInfo;
1010
import me.chanjar.weixin.channel.bean.order.DecodeSensitiveInfoResponse;
1111
import me.chanjar.weixin.channel.bean.order.DeliveryUpdateParam;
12+
import me.chanjar.weixin.channel.bean.order.OrderCompensationDeliveryParam;
1213
import me.chanjar.weixin.channel.bean.order.OrderInfoResponse;
1314
import me.chanjar.weixin.channel.bean.order.OrderListParam;
1415
import me.chanjar.weixin.channel.bean.order.OrderListResponse;
1516
import me.chanjar.weixin.channel.bean.order.OrderSearchParam;
17+
import me.chanjar.weixin.channel.bean.order.PreShipmentChangeSkuResponse;
18+
import me.chanjar.weixin.channel.bean.order.PresentSubOrderResponse;
19+
import me.chanjar.weixin.channel.bean.order.PrivateNumberGetPhoneResponse;
20+
import me.chanjar.weixin.channel.bean.order.RealNumberViewAuditResponse;
1621
import me.chanjar.weixin.channel.bean.order.VirtualTelNumberResponse;
1722
import me.chanjar.weixin.common.error.WxErrorException;
1823

@@ -200,4 +205,122 @@ WxChannelBaseResponse updatePrice(String orderId, Integer expressFee, List<Chang
200205
* @throws WxErrorException 异常
201206
*/
202207
DecodeSensitiveInfoResponse decodeSensitiveInfo(String orderId) throws WxErrorException;
208+
209+
/**
210+
* 礼物订单新增备注信息
211+
*
212+
* @param orderId 礼物订单ID
213+
* @param note 备注内容
214+
* @return BaseResponse
215+
* @throws WxErrorException 异常
216+
*/
217+
WxChannelBaseResponse addPresentNote(String orderId, String note) throws WxErrorException;
218+
219+
/**
220+
* 获取礼物单的子单列表
221+
*
222+
* @param orderId 礼物订单ID
223+
* @return 子单列表
224+
* @throws WxErrorException 异常
225+
*/
226+
PresentSubOrderResponse getPresentSubOrders(String orderId) throws WxErrorException;
227+
228+
/**
229+
* 获取待发货前更换SKU待处理请求
230+
*
231+
* @param orderId 订单ID
232+
* @return 换SKU信息
233+
* @throws WxErrorException 异常
234+
*/
235+
PreShipmentChangeSkuResponse getPreShipmentChangeSku(String orderId) throws WxErrorException;
236+
237+
/**
238+
* 同意待发货前更换SKU请求
239+
*
240+
* @param orderId 订单ID
241+
* @return BaseResponse
242+
* @throws WxErrorException 异常
243+
*/
244+
WxChannelBaseResponse approvePreShipmentChangeSku(String orderId) throws WxErrorException;
245+
246+
/**
247+
* 拒绝待发货前更换SKU请求
248+
*
249+
* @param orderId 订单ID
250+
* @param rejectReason 拒绝原因
251+
* @return BaseResponse
252+
* @throws WxErrorException 异常
253+
*/
254+
WxChannelBaseResponse rejectPreShipmentChangeSku(String orderId, String rejectReason) throws WxErrorException;
255+
256+
/**
257+
* 申请查看订单真实号码
258+
*
259+
* @param orderId 订单ID
260+
* @return BaseResponse
261+
* @throws WxErrorException 异常
262+
*/
263+
WxChannelBaseResponse applyRealNumber(String orderId) throws WxErrorException;
264+
265+
/**
266+
* 查看订单真实号审核状态
267+
*
268+
* @param orderId 订单ID
269+
* @return 审核状态
270+
* @throws WxErrorException 异常
271+
*/
272+
RealNumberViewAuditResponse getRealNumberViewAudit(String orderId) throws WxErrorException;
273+
274+
/**
275+
* 订单再次申请虚拟号
276+
*
277+
* @param orderId 订单ID
278+
* @return BaseResponse
279+
* @throws WxErrorException 异常
280+
*/
281+
WxChannelBaseResponse applyVirtualNumberAgain(String orderId) throws WxErrorException;
282+
283+
/**
284+
* 订单虚拟号延期
285+
*
286+
* @param orderId 订单ID
287+
* @return BaseResponse
288+
* @throws WxErrorException 异常
289+
*/
290+
WxChannelBaseResponse delayVirtualNumber(String orderId) throws WxErrorException;
291+
292+
/**
293+
* 添加待认证的手机号
294+
*
295+
* @param phone 手机号
296+
* @return BaseResponse
297+
* @throws WxErrorException 异常
298+
*/
299+
WxChannelBaseResponse addPrivatePhone(String phone) throws WxErrorException;
300+
301+
/**
302+
* 获取短信验证码
303+
*
304+
* @param phone 手机号
305+
* @return BaseResponse
306+
* @throws WxErrorException 异常
307+
*/
308+
WxChannelBaseResponse sendPrivatePhoneVerifyCode(String phone) throws WxErrorException;
309+
310+
/**
311+
* 获取小店手机号认证状态
312+
*
313+
* @return 手机号认证状态
314+
* @throws WxErrorException 异常
315+
*/
316+
PrivateNumberGetPhoneResponse getPrivatePhone() throws WxErrorException;
317+
318+
/**
319+
* 订单补发货
320+
*
321+
* @param param 补发货参数
322+
* @return BaseResponse
323+
* @throws WxErrorException 异常
324+
*/
325+
WxChannelBaseResponse compensationDelivery(OrderCompensationDeliveryParam param) throws WxErrorException;
203326
}

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

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,29 @@
55
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Delivery.GET_DELIVERY_COMPANY_URL;
66
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.ACCEPT_ADDRESS_MODIFY_URL;
77
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.DECODE_SENSITIVE_INFO_URL;
8+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.DELIVERY_COMPENSATION_URL;
89
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.ORDER_GET_URL;
910
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.ORDER_LIST_URL;
1011
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.ORDER_SEARCH_URL;
12+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.PRE_SHIPMENT_CHANGE_SKU_APPROVE_URL;
13+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.PRE_SHIPMENT_CHANGE_SKU_GET_URL;
14+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.PRE_SHIPMENT_CHANGE_SKU_REJECT_URL;
15+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.PRESENT_NOTE_ADD_URL;
16+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.PRESENT_SUB_ORDER_GET_URL;
17+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.REAL_NUMBER_APPLY_URL;
18+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.REAL_NUMBER_VIEW_AUDIT_GET_URL;
1119
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.REJECT_ADDRESS_MODIFY_URL;
1220
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.UPDATE_ADDRESS_URL;
1321
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.UPDATE_EXPRESS_URL;
1422
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.UPDATE_PRICE_URL;
1523
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.UPDATE_REMARK_URL;
1624
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.UPLOAD_FRESH_INSPECT_URL;
25+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.VIRTUAL_NUMBER_APPLY_AGAIN_URL;
26+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.VIRTUAL_NUMBER_DELAY_URL;
1727
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Order.VIRTUAL_TEL_NUMBER_URL;
28+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.PrivateNumber.ADD_PHONE_URL;
29+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.PrivateNumber.GET_PHONE_URL;
30+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.PrivateNumber.SEND_VERIFY_CODE_URL;
1831

1932
import java.util.List;
2033
import lombok.extern.slf4j.Slf4j;
@@ -30,6 +43,7 @@
3043
import me.chanjar.weixin.channel.bean.order.DecodeSensitiveInfoResponse;
3144
import me.chanjar.weixin.channel.bean.order.DeliveryUpdateParam;
3245
import me.chanjar.weixin.channel.bean.order.OrderAddressParam;
46+
import me.chanjar.weixin.channel.bean.order.OrderCompensationDeliveryParam;
3347
import me.chanjar.weixin.channel.bean.order.OrderIdParam;
3448
import me.chanjar.weixin.channel.bean.order.OrderInfoParam;
3549
import me.chanjar.weixin.channel.bean.order.OrderInfoResponse;
@@ -38,6 +52,14 @@
3852
import me.chanjar.weixin.channel.bean.order.OrderPriceParam;
3953
import me.chanjar.weixin.channel.bean.order.OrderRemarkParam;
4054
import me.chanjar.weixin.channel.bean.order.OrderSearchParam;
55+
import me.chanjar.weixin.channel.bean.order.PreShipmentChangeSkuRejectParam;
56+
import me.chanjar.weixin.channel.bean.order.PreShipmentChangeSkuResponse;
57+
import me.chanjar.weixin.channel.bean.order.PresentNoteAddParam;
58+
import me.chanjar.weixin.channel.bean.order.PresentSubOrderResponse;
59+
import me.chanjar.weixin.channel.bean.order.PrivateNumberAddPhoneParam;
60+
import me.chanjar.weixin.channel.bean.order.PrivateNumberGetPhoneResponse;
61+
import me.chanjar.weixin.channel.bean.order.PrivateNumberSendVerifyCodeParam;
62+
import me.chanjar.weixin.channel.bean.order.RealNumberViewAuditResponse;
4163
import me.chanjar.weixin.channel.bean.order.VirtualTelNumberResponse;
4264
import me.chanjar.weixin.channel.util.ResponseUtils;
4365
import me.chanjar.weixin.common.error.WxErrorException;
@@ -178,4 +200,95 @@ public DecodeSensitiveInfoResponse decodeSensitiveInfo(String orderId) throws Wx
178200
String resJson = shopService.post(DECODE_SENSITIVE_INFO_URL, reqJson);
179201
return ResponseUtils.decode(resJson, DecodeSensitiveInfoResponse.class);
180202
}
203+
204+
@Override
205+
public WxChannelBaseResponse addPresentNote(String orderId, String note) throws WxErrorException {
206+
PresentNoteAddParam param = new PresentNoteAddParam(orderId, note);
207+
String resJson = shopService.post(PRESENT_NOTE_ADD_URL, param);
208+
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
209+
}
210+
211+
@Override
212+
public PresentSubOrderResponse getPresentSubOrders(String orderId) throws WxErrorException {
213+
OrderIdParam param = new OrderIdParam(orderId);
214+
String resJson = shopService.post(PRESENT_SUB_ORDER_GET_URL, param);
215+
return ResponseUtils.decode(resJson, PresentSubOrderResponse.class);
216+
}
217+
218+
@Override
219+
public PreShipmentChangeSkuResponse getPreShipmentChangeSku(String orderId) throws WxErrorException {
220+
OrderIdParam param = new OrderIdParam(orderId);
221+
String resJson = shopService.post(PRE_SHIPMENT_CHANGE_SKU_GET_URL, param);
222+
return ResponseUtils.decode(resJson, PreShipmentChangeSkuResponse.class);
223+
}
224+
225+
@Override
226+
public WxChannelBaseResponse approvePreShipmentChangeSku(String orderId) throws WxErrorException {
227+
OrderIdParam param = new OrderIdParam(orderId);
228+
String resJson = shopService.post(PRE_SHIPMENT_CHANGE_SKU_APPROVE_URL, param);
229+
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
230+
}
231+
232+
@Override
233+
public WxChannelBaseResponse rejectPreShipmentChangeSku(String orderId, String rejectReason)
234+
throws WxErrorException {
235+
PreShipmentChangeSkuRejectParam param = new PreShipmentChangeSkuRejectParam(orderId, rejectReason);
236+
String resJson = shopService.post(PRE_SHIPMENT_CHANGE_SKU_REJECT_URL, param);
237+
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
238+
}
239+
240+
@Override
241+
public WxChannelBaseResponse applyRealNumber(String orderId) throws WxErrorException {
242+
OrderIdParam param = new OrderIdParam(orderId);
243+
String resJson = shopService.post(REAL_NUMBER_APPLY_URL, param);
244+
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
245+
}
246+
247+
@Override
248+
public RealNumberViewAuditResponse getRealNumberViewAudit(String orderId) throws WxErrorException {
249+
OrderIdParam param = new OrderIdParam(orderId);
250+
String resJson = shopService.post(REAL_NUMBER_VIEW_AUDIT_GET_URL, param);
251+
return ResponseUtils.decode(resJson, RealNumberViewAuditResponse.class);
252+
}
253+
254+
@Override
255+
public WxChannelBaseResponse applyVirtualNumberAgain(String orderId) throws WxErrorException {
256+
OrderIdParam param = new OrderIdParam(orderId);
257+
String resJson = shopService.post(VIRTUAL_NUMBER_APPLY_AGAIN_URL, param);
258+
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
259+
}
260+
261+
@Override
262+
public WxChannelBaseResponse delayVirtualNumber(String orderId) throws WxErrorException {
263+
OrderIdParam param = new OrderIdParam(orderId);
264+
String resJson = shopService.post(VIRTUAL_NUMBER_DELAY_URL, param);
265+
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
266+
}
267+
268+
@Override
269+
public WxChannelBaseResponse addPrivatePhone(String phone) throws WxErrorException {
270+
PrivateNumberAddPhoneParam param = new PrivateNumberAddPhoneParam(phone);
271+
String resJson = shopService.post(ADD_PHONE_URL, param);
272+
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
273+
}
274+
275+
@Override
276+
public WxChannelBaseResponse sendPrivatePhoneVerifyCode(String phone) throws WxErrorException {
277+
PrivateNumberSendVerifyCodeParam param = new PrivateNumberSendVerifyCodeParam(phone);
278+
String resJson = shopService.post(SEND_VERIFY_CODE_URL, param);
279+
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
280+
}
281+
282+
@Override
283+
public PrivateNumberGetPhoneResponse getPrivatePhone() throws WxErrorException {
284+
String resJson = shopService.post(GET_PHONE_URL, "{}");
285+
return ResponseUtils.decode(resJson, PrivateNumberGetPhoneResponse.class);
286+
}
287+
288+
@Override
289+
public WxChannelBaseResponse compensationDelivery(OrderCompensationDeliveryParam param)
290+
throws WxErrorException {
291+
String resJson = shopService.post(DELIVERY_COMPENSATION_URL, param);
292+
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
293+
}
181294
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package me.chanjar.weixin.channel.bean.order;
2+
3+
import com.fasterxml.jackson.annotation.JsonInclude;
4+
import com.fasterxml.jackson.annotation.JsonInclude.Include;
5+
import com.fasterxml.jackson.annotation.JsonProperty;
6+
import java.io.Serializable;
7+
import java.util.List;
8+
import lombok.AllArgsConstructor;
9+
import lombok.Data;
10+
import lombok.NoArgsConstructor;
11+
import me.chanjar.weixin.channel.bean.delivery.DeliveryInfo;
12+
13+
/**
14+
* 订单补发货 请求参数
15+
*
16+
* @author GitHub Copilot
17+
*/
18+
@Data
19+
@NoArgsConstructor
20+
@AllArgsConstructor
21+
@JsonInclude(Include.NON_NULL)
22+
public class OrderCompensationDeliveryParam implements Serializable {
23+
24+
private static final long serialVersionUID = 1L;
25+
26+
/** 订单ID */
27+
@JsonProperty("order_id")
28+
private String orderId;
29+
30+
/** 物流信息列表 */
31+
@JsonProperty("delivery_list")
32+
private List<DeliveryInfo> deliveryList;
33+
34+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package me.chanjar.weixin.channel.bean.order;
2+
3+
import com.fasterxml.jackson.annotation.JsonInclude;
4+
import com.fasterxml.jackson.annotation.JsonInclude.Include;
5+
import com.fasterxml.jackson.annotation.JsonProperty;
6+
import java.io.Serializable;
7+
import lombok.AllArgsConstructor;
8+
import lombok.Data;
9+
import lombok.NoArgsConstructor;
10+
11+
/**
12+
* 拒绝待发货前更换SKU请求 请求参数
13+
*
14+
* @author GitHub Copilot
15+
*/
16+
@Data
17+
@NoArgsConstructor
18+
@AllArgsConstructor
19+
@JsonInclude(Include.NON_NULL)
20+
public class PreShipmentChangeSkuRejectParam implements Serializable {
21+
22+
private static final long serialVersionUID = 1L;
23+
24+
/** 订单ID */
25+
@JsonProperty("order_id")
26+
private String orderId;
27+
28+
/** 拒绝原因 */
29+
@JsonProperty("reject_reason")
30+
private String rejectReason;
31+
32+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package me.chanjar.weixin.channel.bean.order;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import lombok.Data;
5+
import lombok.EqualsAndHashCode;
6+
import lombok.NoArgsConstructor;
7+
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
8+
9+
/**
10+
* 获取待发货前更换SKU待处理请求 响应
11+
*
12+
* @author GitHub Copilot
13+
*/
14+
@Data
15+
@NoArgsConstructor
16+
@EqualsAndHashCode(callSuper = true)
17+
public class PreShipmentChangeSkuResponse extends WxChannelBaseResponse {
18+
19+
private static final long serialVersionUID = 1L;
20+
21+
/** 更换SKU信息 */
22+
@JsonProperty("change_sku_info")
23+
private ChangeSkuInfo changeSkuInfo;
24+
25+
}

0 commit comments

Comments
 (0)