mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
🆕 #2258 【小程序】增加自定义组件之物流和售后相关接口
This commit is contained in:
@@ -377,18 +377,20 @@ public interface WxMaService extends WxService {
|
||||
*/
|
||||
WxImgProcService getImgProcService();
|
||||
|
||||
// /**
|
||||
// * 返回小程序交易组件-售后服务接口
|
||||
// * @return
|
||||
// */
|
||||
// WxMaShopAfterSaleService getShopAfterSaleService();
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 返回小程序交易组件-物流服务接口
|
||||
// * @return
|
||||
// */
|
||||
// WxMaShopDeliveryService getShopDeliveryService();
|
||||
/**
|
||||
* 返回小程序交易组件-售后服务接口
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
WxMaShopAfterSaleService getShopAfterSaleService();
|
||||
|
||||
|
||||
/**
|
||||
* 返回小程序交易组件-物流服务接口
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
WxMaShopDeliveryService getShopDeliveryService();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,10 +1,44 @@
|
||||
package cn.binarywang.wx.miniapp.api;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAfterSaleAddRequest;
|
||||
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAfterSaleGetRequest;
|
||||
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAfterSaleUpdateRequest;
|
||||
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAfterSaleGetResponse;
|
||||
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
|
||||
/**
|
||||
* 小程序交易组件-售后服务
|
||||
*
|
||||
* @author boris
|
||||
* @author liming1019
|
||||
*/
|
||||
public interface WxMaShopAfterSaleService {
|
||||
/**
|
||||
* 创建售后
|
||||
*
|
||||
* @param request
|
||||
* @return WxMaShopBaseResponse
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxMaShopBaseResponse add(WxMaShopAfterSaleAddRequest request) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 获取订单下售后单
|
||||
*
|
||||
* @param request
|
||||
* @return WxMaShopAfterSaleGetResponse
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxMaShopAfterSaleGetResponse get(WxMaShopAfterSaleGetRequest request) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 更新售后
|
||||
*
|
||||
* @param request
|
||||
* @return WxMaShopBaseResponse
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxMaShopBaseResponse update(WxMaShopAfterSaleUpdateRequest request) throws WxErrorException;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,42 @@
|
||||
package cn.binarywang.wx.miniapp.api;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopDeliveryRecieveRequest;
|
||||
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopDeliverySendRequest;
|
||||
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse;
|
||||
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopDeliveryGetCompanyListResponse;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
|
||||
/**
|
||||
* 小程序交易组件-物流发货服务
|
||||
*
|
||||
* @author boris
|
||||
* @author liming1019
|
||||
*/
|
||||
public interface WxMaShopDeliveryService {
|
||||
/**
|
||||
* 获取快递公司列表
|
||||
*
|
||||
* @return WxMaShopDeliveryGetCompanyListResponse
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxMaShopDeliveryGetCompanyListResponse getCompanyList() throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 订单发货
|
||||
*
|
||||
* @param request
|
||||
* @return WxMaShopBaseResponse
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxMaShopBaseResponse send(WxMaShopDeliverySendRequest request) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 订单确认收货
|
||||
*
|
||||
* @param request
|
||||
* @return WxMaShopBaseResponse
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
WxMaShopBaseResponse receive(WxMaShopDeliveryRecieveRequest request) throws WxErrorException;
|
||||
|
||||
}
|
||||
|
||||
@@ -70,6 +70,8 @@ public abstract class BaseWxMaServiceImpl<H, P> implements WxMaService, RequestH
|
||||
private final WxMaShopCatService shopCatService = new WxMaShopCatServiceImpl(this);
|
||||
private final WxMaShopImgService shopImgService = new WxMaShopImgServiceImpl(this);
|
||||
private final WxMaShopAuditService shopAuditService = new WxMaShopAuditServiceImpl(this);
|
||||
private final WxMaShopAfterSaleService shopAfterSaleService = new WxMaShopAfterSaleServiceImpl(this);
|
||||
private final WxMaShopDeliveryService shopDeliveryService = new WxMaShopDeliveryServiceImpl(this);
|
||||
private final WxMaLinkService linkService = new WxMaLinkServiceImpl(this);
|
||||
private final WxMaReimburseInvoiceService reimburseInvoiceService = new WxMaReimburseInvoiceServiceImpl(this);
|
||||
private Map<String, WxMaConfig> configMap;
|
||||
@@ -546,6 +548,16 @@ public abstract class BaseWxMaServiceImpl<H, P> implements WxMaService, RequestH
|
||||
return this.shopAuditService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaShopAfterSaleService getShopAfterSaleService() {
|
||||
return this.shopAfterSaleService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaShopDeliveryService getShopDeliveryService() {
|
||||
return this.shopDeliveryService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaLinkService getLinkService() {
|
||||
return this.linkService;
|
||||
|
||||
@@ -2,18 +2,81 @@ package cn.binarywang.wx.miniapp.api.impl;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.api.WxMaShopAfterSaleService;
|
||||
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAfterSaleAddRequest;
|
||||
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAfterSaleGetRequest;
|
||||
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAfterSaleUpdateRequest;
|
||||
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAfterSaleGetResponse;
|
||||
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse;
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.common.enums.WxType;
|
||||
import me.chanjar.weixin.common.error.WxError;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.json.GsonParser;
|
||||
|
||||
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Aftersale.*;
|
||||
import static cn.binarywang.wx.miniapp.constant.WxMaConstants.ERRCODE;
|
||||
|
||||
/**
|
||||
* @author boris
|
||||
* @author liming1019
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class WxMaShopAfterSaleServiceImpl implements WxMaShopAfterSaleService {
|
||||
private final WxMaService service;
|
||||
private final WxMaService wxMaService;
|
||||
|
||||
|
||||
/**
|
||||
* 创建售后
|
||||
*
|
||||
* @param request
|
||||
* @return WxMaShopBaseResponse
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
@Override
|
||||
public WxMaShopBaseResponse add(WxMaShopAfterSaleAddRequest request) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(AFTERSALE_ADD, request);
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopBaseResponse.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单下售后单
|
||||
*
|
||||
* @param request
|
||||
* @return WxMaShopAfterSaleGetResponse
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
@Override
|
||||
public WxMaShopAfterSaleGetResponse get(WxMaShopAfterSaleGetRequest request) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(AFTERSALE_GET, request);
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopAfterSaleGetResponse.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新售后
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
@Override
|
||||
public WxMaShopBaseResponse update(WxMaShopAfterSaleUpdateRequest request) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(AFTERSALE_UPDATE, request);
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopBaseResponse.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,15 +2,78 @@ package cn.binarywang.wx.miniapp.api.impl;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.api.WxMaShopDeliveryService;
|
||||
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopDeliveryRecieveRequest;
|
||||
import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopDeliverySendRequest;
|
||||
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse;
|
||||
import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopDeliveryGetCompanyListResponse;
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.common.enums.WxType;
|
||||
import me.chanjar.weixin.common.error.WxError;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.json.GsonParser;
|
||||
|
||||
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Delivery.*;
|
||||
import static cn.binarywang.wx.miniapp.constant.WxMaConstants.ERRCODE;
|
||||
|
||||
/**
|
||||
* @author boris
|
||||
* @author liming1019
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class WxMaShopDeliveryServiceImpl implements WxMaShopDeliveryService {
|
||||
private final WxMaService service;
|
||||
private final WxMaService wxMaService;
|
||||
|
||||
/**
|
||||
* 获取快递公司列表
|
||||
*
|
||||
* @return WxMaShopDeliveryGetCompanyListResponse
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
@Override
|
||||
public WxMaShopDeliveryGetCompanyListResponse getCompanyList() throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(GET_COMPANY_LIST, new JsonObject());
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopDeliveryGetCompanyListResponse.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单发货
|
||||
*
|
||||
* @param request
|
||||
* @return WxMaShopBaseResponse
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
@Override
|
||||
public WxMaShopBaseResponse send(WxMaShopDeliverySendRequest request) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(DELIVERY_SEND, request);
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopBaseResponse.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单确认收货
|
||||
*
|
||||
* @param request
|
||||
* @return WxMaShopBaseResponse
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
@Override
|
||||
public WxMaShopBaseResponse receive(WxMaShopDeliveryRecieveRequest request) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(DELIVERY_RECEIVE, request);
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(ERRCODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopBaseResponse.class);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user