🆕 #3247 【小程序】即时配送服务增加获取运力id列表和更新物流信息的接口

This commit is contained in:
zhongjun
2024-03-14 12:24:00 +08:00
committed by GitHub
parent ccf23a8668
commit 5977567689
7 changed files with 194 additions and 19 deletions

View File

@@ -1,24 +1,7 @@
package cn.binarywang.wx.miniapp.api;
import cn.binarywang.wx.miniapp.bean.delivery.AbnormalConfirmRequest;
import cn.binarywang.wx.miniapp.bean.delivery.AbnormalConfirmResponse;
import cn.binarywang.wx.miniapp.bean.delivery.AddOrderRequest;
import cn.binarywang.wx.miniapp.bean.delivery.AddOrderResponse;
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;
import cn.binarywang.wx.miniapp.bean.delivery.TraceWaybillResponse;
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
import cn.binarywang.wx.miniapp.bean.delivery.*;
import me.chanjar.weixin.common.error.WxErrorException;
/**
@@ -162,5 +145,30 @@ public interface WxMaImmediateDeliveryService {
QueryFollowTraceResponse queryFollowTrace(QueryFollowTraceRequest request)
throws WxErrorException ;
/**
* 获取运力id列表get_delivery_list
*
* <pre>
* 商户使用此接口获取所有运力id的列表
* 文档地址https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/business/express_search.html
* </pre>
*
* @return 响应
* @throws WxErrorException 异常
*/
GetDeliveryListResponse getDeliveryList() throws WxErrorException;
/**
* 更新物流物品信息接口 update_waybill_goods
*
* <pre>
* 更新物品信息
* 文档地址https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/business/express_search.html
* </pre>
*
* @return 响应
* @throws WxErrorException 异常
*/
WxMaBaseResponse updateWaybillGoods(UpdateWaybillGoodsRequest request) throws WxErrorException;
}

View File

@@ -2,10 +2,12 @@ package cn.binarywang.wx.miniapp.api.impl;
import cn.binarywang.wx.miniapp.api.WxMaImmediateDeliveryService;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
import cn.binarywang.wx.miniapp.bean.delivery.*;
import cn.binarywang.wx.miniapp.bean.delivery.base.WxMaDeliveryBaseResponse;
import cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants;
import cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.InstantDelivery;
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import lombok.RequiredArgsConstructor;
@@ -193,6 +195,26 @@ public class WxMaImmediateDeliveryServiceImpl implements WxMaImmediateDeliverySe
return response;
}
@Override
public GetDeliveryListResponse getDeliveryList() throws WxErrorException {
String responseContent = this.wxMaService.post(InstantDelivery.GET_DELIVERY_LIST_URL,"");
GetDeliveryListResponse response = GetDeliveryListResponse.fromJson(responseContent);
if (response.getErrcode() == -1) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
}
return response;
}
@Override
public WxMaBaseResponse updateWaybillGoods(UpdateWaybillGoodsRequest request) throws WxErrorException {
String responseContent = this.wxMaService.post(InstantDelivery.GET_DELIVERY_LIST_URL,request);
WxMaBaseResponse response = WxMaGsonBuilder.create().fromJson(responseContent, WxMaBaseResponse.class);
if (response.getErrcode() == -1) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
}
return response;
}
/**
* 解析响应.
*