diff --git a/weixin-java-common/src/main/java/me/chanjar/weixin/common/bean/result/WxMinishopImageUploadResult.java b/weixin-java-common/src/main/java/me/chanjar/weixin/common/bean/result/WxMinishopImageUploadResult.java index 9aa7a81e2f..e476de7881 100644 --- a/weixin-java-common/src/main/java/me/chanjar/weixin/common/bean/result/WxMinishopImageUploadResult.java +++ b/weixin-java-common/src/main/java/me/chanjar/weixin/common/bean/result/WxMinishopImageUploadResult.java @@ -1,5 +1,6 @@ package me.chanjar.weixin.common.bean.result; +import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import lombok.Data; @@ -25,8 +26,12 @@ public static WxMinishopImageUploadResult fromJson(String json) { if (result.getErrcode().equals("0")) { WxMinishopPicFileResult picFileResult = new WxMinishopPicFileResult(); JsonObject picObject = jsonObject.get("pic_file").getAsJsonObject(); - picFileResult.setMediaId(picObject.get("media_id").getAsString()); - picFileResult.setPayMediaId(picObject.get("pay_media_id").getAsString()); + JsonElement mediaId = picObject.get("media_id"); + picFileResult.setMediaId(mediaId==null ? "" : mediaId.getAsString()); + JsonElement payMediaId = picObject.get("pay_media_id"); + picFileResult.setPayMediaId(payMediaId==null ? "" : payMediaId.getAsString()); + JsonElement tempImgUrl = picObject.get("temp_img_url"); + picFileResult.setTempImgUrl(tempImgUrl==null ? "" : tempImgUrl.getAsString()); result.setPicFile(picFileResult); } diff --git a/weixin-java-common/src/main/java/me/chanjar/weixin/common/bean/result/WxMinishopPicFileResult.java b/weixin-java-common/src/main/java/me/chanjar/weixin/common/bean/result/WxMinishopPicFileResult.java index 1f77a1e6ab..2ae2e2320b 100644 --- a/weixin-java-common/src/main/java/me/chanjar/weixin/common/bean/result/WxMinishopPicFileResult.java +++ b/weixin-java-common/src/main/java/me/chanjar/weixin/common/bean/result/WxMinishopPicFileResult.java @@ -8,4 +8,5 @@ public class WxMinishopPicFileResult implements Serializable { private String mediaId; private String payMediaId; + private String tempImgUrl; } diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaProductOrderService.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaProductOrderService.java new file mode 100644 index 0000000000..793df60a27 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaProductOrderService.java @@ -0,0 +1,76 @@ +package cn.binarywang.wx.miniapp.api; + +import cn.binarywang.wx.miniapp.bean.product.WxMiniBatchGetAfterSaleOrderResponse; +import cn.binarywang.wx.miniapp.bean.product.WxMiniGetAfterSaleOrderResponse; +import cn.binarywang.wx.miniapp.bean.product.WxMiniOrderDeliveryRequest; +import cn.binarywang.wx.miniapp.bean.product.WxMinishopOrderDetailResponse; +import cn.binarywang.wx.miniapp.bean.product.WxMinishopOrderListResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse; +import java.util.List; +import me.chanjar.weixin.common.error.WxErrorException; + +/** + * 小程序交易组件-标准版-商品服务 + * + * @author boris + */ +public interface WxMaProductOrderService { + + + /** + * 获取订单列表 + * + * @param startCreateTime 否(未填更新时间范围时必填) + * @param endCreateTime 否(未填更新时间范围时必填) + * @param startUpdateTime 否(未填创建时间范围时必填) + * @param endUpdateTime 否(未填创建时间范围时必填) + * @param status 订单状态,枚举值见RequestOrderStatus + * @param page 第几页(最小填1) + * @param pageSize 每页数量(不超过10,000) + * @param source 1:小商店,2:CPS带货 + * @return + * @throws WxErrorException + */ + WxMinishopOrderListResponse getOrderList( + String startCreateTime, + String endCreateTime, + String startUpdateTime, + String endUpdateTime, + Integer status, + Integer page, + Integer pageSize, + Integer source + ) throws WxErrorException; + + + /** + * 获取订单详情 + * + * @param orderId 订单ID,可从获取订单列表中获得 + * @return + */ + WxMinishopOrderDetailResponse getOrderDetail(Long orderId) throws WxErrorException; + + + /** + * 修改订单备注 + * @param orderId 订单id + * @param merchantNotes 备注内容 + */ + void changeMerchantNotes(Long orderId,String merchantNotes) throws WxErrorException; + + WxMaShopBaseResponse deliverySend(WxMiniOrderDeliveryRequest request) + throws WxErrorException; + + WxMiniGetAfterSaleOrderResponse getAfterSaleOrder(Long afterSaleOrderId) + throws WxErrorException; + + WxMiniBatchGetAfterSaleOrderResponse batchGetAfterSaleOrder(List afterSaleOrderIdList) + throws WxErrorException; + + WxMaShopBaseResponse afterSaleAccept(Long orderId, Long addressId) + throws WxErrorException; + + WxMaShopBaseResponse afterSaleReject(Long afterSaleOrderId, String rejectReason) + throws WxErrorException; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaProductService.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaProductService.java index b496470749..b629772a27 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaProductService.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaProductService.java @@ -2,9 +2,13 @@ import cn.binarywang.wx.miniapp.bean.product.WxMinishopAddGoodsSkuData; import cn.binarywang.wx.miniapp.bean.product.WxMinishopAddGoodsSpuData; +import cn.binarywang.wx.miniapp.bean.product.WxMinishopGetBrandResponse; +import cn.binarywang.wx.miniapp.bean.product.WxMinishopGetCategoryResponse; +import cn.binarywang.wx.miniapp.bean.product.WxMinishopGetFrightTemplateResponse; import cn.binarywang.wx.miniapp.bean.product.WxMinishopOrderListResponse; import cn.binarywang.wx.miniapp.bean.product.WxMinishopResult; import cn.binarywang.wx.miniapp.bean.product.WxMinishopSku; +import cn.binarywang.wx.miniapp.bean.product.WxMinishopSkuListResponse; import cn.binarywang.wx.miniapp.bean.product.WxMinishopSpu; import cn.binarywang.wx.miniapp.bean.product.WxMinishopSpuGet; import cn.binarywang.wx.miniapp.bean.product.WxMinishopSpuGetResponse; @@ -13,7 +17,9 @@ import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopSpuPageRequest; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopGetSpuListResponse; +import java.io.File; import java.util.List; +import me.chanjar.weixin.common.bean.result.WxMinishopImageUploadResult; import me.chanjar.weixin.common.error.WxErrorException; /** @@ -22,7 +28,18 @@ * @author boris */ public interface WxMaProductService { - WxMinishopResult addSpu(WxMinishopSpu spuInfo) throws WxErrorException; + + WxMinishopImageUploadResult uploadImg(File file, Integer respType, Integer width, Integer height) throws WxErrorException; + + WxMinishopImageUploadResult uploadImg(String imgUrl, Integer respType) throws WxErrorException; + + WxMinishopGetCategoryResponse getCategory(Integer fCatId) throws WxErrorException; + + WxMinishopGetBrandResponse getBrand() throws WxErrorException; + + WxMinishopGetFrightTemplateResponse getFreightTemplate() throws WxErrorException; + + WxMinishopResult addSpu(WxMinishopSpu spuInfo) throws WxErrorException; WxMaShopBaseResponse deleteSpu(Integer productId, String outProductId) throws WxErrorException; @@ -40,6 +57,9 @@ WxMaShopBaseResponse listingSpu(Integer productId, String outProductId) WxMaShopBaseResponse delistingSpu(Integer productId, String outProductId) throws WxErrorException; + WxMinishopSkuListResponse getSkuList(Long productId, Integer needRealStock, Integer needEditSku) + throws WxErrorException; + /** * 小商店新增sku信息 * @@ -96,7 +116,7 @@ WxMaShopBaseResponse delistingSpu(Integer productId, String outProductId) * @throws WxErrorException */ WxMinishopResult minishopGoodsUpdateSkuPrice(Long productId, - Long outProductId, String outSkuId, Long skuId, Long salePrice, Long marketPrice) throws WxErrorException; + String outProductId, String outSkuId, Long skuId, Long salePrice, Long marketPrice) throws WxErrorException; /** @@ -112,8 +132,6 @@ WxMinishopResult minishopGoodsUpdateSkuPrice(Long * @throws WxErrorException */ WxMinishopResult minishopGoodsUpdateSkuStock(Long productId, - Long outProductId, String outSkuId, Long skuId, Integer type, Integer stockNum) throws WxErrorException; + String outProductId, String outSkuId, Long skuId, Integer type, Integer stockNum) throws WxErrorException; - WxMinishopOrderListResponse minishopOrderGetList(String startCreateTime, String endCreateTime, - Integer status, Integer page, Integer pageSize, Integer source) throws WxErrorException; } diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaService.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaService.java index f424ed4552..72e8aad1e6 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaService.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaService.java @@ -494,13 +494,25 @@ public interface WxMaService extends WxService { /** * 分享人接口 - * @return + * @return WxMaShopSharerService */ WxMaShopSharerService getShopSharerService(); /** * 标准交易组件接口 - * @return + * @return WxMaProductService */ WxMaProductService getProductService(); + + /** + * 小商店-标准交易组件-订单服务 + * @return getProductOrderService + */ + WxMaProductOrderService getProductOrderService(); + + /** + * 小商店-标准交易组件-优惠券 + * @return getWxMaShopCouponService + */ + WxMaShopCouponService getWxMaShopCouponService(); } diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopAfterSaleService.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopAfterSaleService.java index 97b8aa56d7..4f5a3f18d2 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopAfterSaleService.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopAfterSaleService.java @@ -1,9 +1,15 @@ package cn.binarywang.wx.miniapp.api; +import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAcceptReturnRequest; 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.WxMaShopAfterSaleListRequest; import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAfterSaleUpdateRequest; +import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAfterSaleUploadReturnInfoRequest; +import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopUploadCerficatesRequest; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAfterSaleAddResponse; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAfterSaleGetResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAfterSaleListResponse; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse; import me.chanjar.weixin.common.error.WxErrorException; @@ -21,7 +27,7 @@ public interface WxMaShopAfterSaleService { * @return WxMaShopBaseResponse * @throws WxErrorException */ - WxMaShopBaseResponse add(WxMaShopAfterSaleAddRequest request) throws WxErrorException; + WxMaShopAfterSaleAddResponse add(WxMaShopAfterSaleAddRequest request) throws WxErrorException; /** * 获取订单下售后单 @@ -41,4 +47,81 @@ public interface WxMaShopAfterSaleService { */ WxMaShopBaseResponse update(WxMaShopAfterSaleUpdateRequest request) throws WxErrorException; + /** + * 用户取消售后申请 + * @param outAfterSaleId 商家自定义订单ID + * @param afterSaleId 与out_aftersale_id二选一 + * @param openId 用户openid + * @return + * @throws WxErrorException + */ + WxMaShopBaseResponse cancel(String outAfterSaleId, Long afterSaleId, String openId) + throws WxErrorException; + + /** + * 用户上传退货物流 + * @param request + * @return + * @throws WxErrorException + */ + WxMaShopBaseResponse uploadReturnInfo(WxMaShopAfterSaleUploadReturnInfoRequest request) + throws WxErrorException; + + /** + * 商家同意退款 + * @param outAfterSaleId + * @param afterSaleId + * @return + * @throws WxErrorException + */ + WxMaShopBaseResponse acceptRefund(String outAfterSaleId, Long afterSaleId) + throws WxErrorException; + + /** + * 商家同意退货 + * @param request + * @return + * @throws WxErrorException + */ + WxMaShopBaseResponse acceptReturn(WxMaShopAcceptReturnRequest request) + throws WxErrorException; + + /** + * 商家拒绝售后 + * @param outAfterSaleId + * @param afterSaleId + * @return + * @throws WxErrorException + */ + WxMaShopBaseResponse reject(String outAfterSaleId, Long afterSaleId) + throws WxErrorException; + + /** + * 商家上传退款凭证 + * @param request + * @return + * @throws WxErrorException + */ + WxMaShopBaseResponse uploadCertificates(WxMaShopUploadCerficatesRequest request) + throws WxErrorException; + + /** + * 商家更新订单售后期 + * @param outOrderId + * @param orderId + * @param openid + * @param afterSaleDeadline + * @return + * @throws WxErrorException + */ + WxMaShopBaseResponse updateDeadline(String outOrderId, Long orderId, String openid, + Long afterSaleDeadline) throws WxErrorException; + + /** + * 获取售后单详情 + * @param request + * @return + * @throws WxErrorException + */ + WxMaShopAfterSaleListResponse list(WxMaShopAfterSaleListRequest request) throws WxErrorException; } diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopCouponService.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopCouponService.java new file mode 100644 index 0000000000..bee5a0ec52 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopCouponService.java @@ -0,0 +1,40 @@ +package cn.binarywang.wx.miniapp.api; + +import cn.binarywang.wx.miniapp.bean.shop.WxMaShopCouponInfo; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopCouponListResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopCouponResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopUserCouponListResponse; +import me.chanjar.weixin.common.error.WxErrorException; + +/** + * @author leiin + * @date 2022/7/1 2:49 下午 + */ +public interface WxMaShopCouponService { + + WxMaShopBaseResponse addCoupon(WxMaShopCouponInfo couponInfo) throws WxErrorException; + + WxMaShopCouponResponse getCoupon(String outCouponId) throws WxErrorException; + + WxMaShopCouponListResponse getCouponList(Integer pageSize, + Integer offset) throws WxErrorException; + + WxMaShopBaseResponse updateCoupon(WxMaShopCouponInfo couponInfo) throws WxErrorException; + + WxMaShopBaseResponse updateCouponStatus(String outCouponId, + Integer status) throws WxErrorException; + + WxMaShopBaseResponse updateCouponStock(String outCouponId, Integer isUsedNum, Integer receiveNum) throws WxErrorException; + + WxMaShopBaseResponse addUserCoupon(String openid, String outUserCouponId, + String outCouponId, Integer status, Long recvTime) throws WxErrorException; + + WxMaShopUserCouponListResponse getUserCouponList(Integer pageSize, Integer offset, String openid) throws WxErrorException; + + WxMaShopBaseResponse updateUserCoupon(String openid, String outUserCouponId, + String outCouponId, Long useTime, Long recvTime) throws WxErrorException; + + WxMaShopBaseResponse updateUserCouponStatus(String openid, String outUserCouponId, + String outCouponId, Integer status) throws WxErrorException; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/BaseWxMaServiceImpl.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/BaseWxMaServiceImpl.java index 314f20de7c..b1d3db0d7b 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/BaseWxMaServiceImpl.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/BaseWxMaServiceImpl.java @@ -81,6 +81,8 @@ public abstract class BaseWxMaServiceImpl implements WxMaService, RequestH private final WxMaSafetyRiskControlService safetyRiskControlService = new WxMaSafetyRiskControlServiceImpl(this); private final WxMaShopSharerService shopSharerService = new WxMaShopSharerServiceImpl(this); private final WxMaProductService productService = new WxMaProductServiceImpl(this); + private final WxMaProductOrderService productOrderService = new WxMaProductOrderServiceImpl(this); + private final WxMaShopCouponService wxMaShopCouponService = new WxMaShopCouponServiceImpl(this); private Map configMap; private int retrySleepMillis = 1000; private int maxRetryTimes = 5; @@ -600,4 +602,14 @@ public WxMaImmediateDeliveryService getWxMaImmediateDeliveryService() { @Override public WxMaProductService getProductService() { return this.productService; } + @Override + public WxMaProductOrderService getProductOrderService() { + return this.productOrderService; + } + + @Override + public WxMaShopCouponService getWxMaShopCouponService() { + return this.wxMaShopCouponService; + } + } diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaProductOrderServiceImpl.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaProductOrderServiceImpl.java new file mode 100644 index 0000000000..15ed07a945 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaProductOrderServiceImpl.java @@ -0,0 +1,167 @@ +package cn.binarywang.wx.miniapp.api.impl; + +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Order.AFTER_SALE_ACCEPT_APPLY; +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Order.AFTER_SALE_REJECT_APPLY; +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Order.BATCH_GET_AFTER_SALE_ORDER; +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Order.GET_AFTER_SALE_ORDER; +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Order.PRODUCT_DELIVERY_SEND; +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Order.PRODUCT_ORDER_CHANGE_MERCHANT_NOTES_URL; +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Order.PRODUCT_ORDER_DETAIL_URL; +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Order.PRODUCT_ORDER_GET_LIST; + +import cn.binarywang.wx.miniapp.api.WxMaProductOrderService; +import cn.binarywang.wx.miniapp.api.WxMaService; +import cn.binarywang.wx.miniapp.bean.product.WxMiniBatchGetAfterSaleOrderResponse; +import cn.binarywang.wx.miniapp.bean.product.WxMiniGetAfterSaleOrderResponse; +import cn.binarywang.wx.miniapp.bean.product.WxMiniOrderDeliveryRequest; +import cn.binarywang.wx.miniapp.bean.product.WxMinishopOrderDetailResponse; +import cn.binarywang.wx.miniapp.bean.product.WxMinishopOrderListResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse; +import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import me.chanjar.weixin.common.error.WxError; +import me.chanjar.weixin.common.error.WxErrorException; +import me.chanjar.weixin.common.util.json.GsonHelper; +import me.chanjar.weixin.common.util.json.WxGsonBuilder; + +/** + * 小程序交易组件-标准版-订单服务 + * + * @author boris 详情请见 : https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent/API/order/get_order_list.html + */ +@RequiredArgsConstructor +@Slf4j +public class WxMaProductOrderServiceImpl implements WxMaProductOrderService { + + private final WxMaService wxMaService; + + + @Override + public WxMinishopOrderListResponse getOrderList( + String startCreateTime, String endCreateTime, String startUpdateTime, + String endUpdateTime, Integer status, Integer page, Integer pageSize, Integer source) + throws WxErrorException { + String responseContent = this.wxMaService + .post(PRODUCT_ORDER_GET_LIST, GsonHelper.buildJsonObject( + "start_create_time", startCreateTime, "end_create_time", endCreateTime, + "start_update_time", startUpdateTime, "end_update_time", endUpdateTime, + "status", status, "page", page, "page_size", pageSize, "source", source)); + + WxMinishopOrderListResponse response = WxMaGsonBuilder.create() + .fromJson(responseContent, WxMinishopOrderListResponse.class); + + if (response.getErrCode() != 0) { + throw new WxErrorException(new WxError(response.getErrCode(), response.getErrMsg())); + } + + return response; + + } + + @Override + public WxMinishopOrderDetailResponse getOrderDetail( + Long orderId) throws WxErrorException { + String responseContent = this.wxMaService + .post(PRODUCT_ORDER_DETAIL_URL, GsonHelper.buildJsonObject( + "order_id", orderId)); + + WxMinishopOrderDetailResponse getDetailResponse = WxMaGsonBuilder.create() + .fromJson(responseContent, WxMinishopOrderDetailResponse.class); + + if (getDetailResponse.getErrCode() != 0) { + throw new WxErrorException( + new WxError(getDetailResponse.getErrCode(), getDetailResponse.getErrMsg())); + } + + return getDetailResponse; + } + + @Override + public void changeMerchantNotes(Long orderId, String merchantNotes) throws WxErrorException { + String responseContent = this.wxMaService + .post(PRODUCT_ORDER_CHANGE_MERCHANT_NOTES_URL, GsonHelper.buildJsonObject( + "order_id", orderId,"merchant_notes",merchantNotes)); + + WxMaShopBaseResponse changeResult = WxMaGsonBuilder.create() + .fromJson(responseContent, WxMaShopBaseResponse.class); + + if (changeResult.getErrCode() != 0) { + throw new WxErrorException( + new WxError(changeResult.getErrCode(), changeResult.getErrMsg())); + } + } + + @Override + public WxMaShopBaseResponse deliverySend(WxMiniOrderDeliveryRequest request) + throws WxErrorException { + String response = this.wxMaService.post(PRODUCT_DELIVERY_SEND, request); + WxMaShopBaseResponse baseResponse = WxMaGsonBuilder.create() + .fromJson(response, WxMaShopBaseResponse.class); + if (baseResponse.getErrCode() != 0) { + throw new WxErrorException( + new WxError(baseResponse.getErrCode(), baseResponse.getErrMsg())); + } + return baseResponse; + } + + @Override + public WxMiniGetAfterSaleOrderResponse getAfterSaleOrder(Long afterSaleOrderId) + throws WxErrorException { + String response = this.wxMaService.post(GET_AFTER_SALE_ORDER, + GsonHelper.buildJsonObject("after_sale_order_id", afterSaleOrderId)); + + WxMiniGetAfterSaleOrderResponse orderResponse = WxMaGsonBuilder.create() + .fromJson(response, WxMiniGetAfterSaleOrderResponse.class); + if (orderResponse.getErrCode() != 0) { + throw new WxErrorException( + new WxError(orderResponse.getErrCode(), orderResponse.getErrMsg())); + } + return orderResponse; + } + + @Override + public WxMiniBatchGetAfterSaleOrderResponse batchGetAfterSaleOrder( + List afterSaleOrderIdList) + throws WxErrorException { + String response = this.wxMaService.post(BATCH_GET_AFTER_SALE_ORDER, + GsonHelper.buildJsonObject("after_sale_order_id_list", afterSaleOrderIdList)); + + WxMiniBatchGetAfterSaleOrderResponse orderResponse = WxMaGsonBuilder.create() + .fromJson(response, WxMiniBatchGetAfterSaleOrderResponse.class); + if (orderResponse.getAfterSaleOrderList() == null) { + throw new WxErrorException( + new WxError(orderResponse.getErrCode(), "售后查询不存在")); + } + return orderResponse; + } + + @Override + public WxMaShopBaseResponse afterSaleAccept(Long orderId, Long addressId) + throws WxErrorException { + String response = this.wxMaService.post(AFTER_SALE_ACCEPT_APPLY, + GsonHelper.buildJsonObject("order_id", orderId, "address_id", addressId)); + WxMaShopBaseResponse baseResponse = WxGsonBuilder.create() + .fromJson(response, WxMaShopBaseResponse.class); + if (baseResponse.getErrCode() != 0) { + throw new WxErrorException( + new WxError(baseResponse.getErrCode(), baseResponse.getErrMsg())); + } + return baseResponse; + } + + @Override + public WxMaShopBaseResponse afterSaleReject(Long afterSaleOrderId, String rejectReason) + throws WxErrorException { + String response = this.wxMaService.post(AFTER_SALE_REJECT_APPLY, + GsonHelper.buildJsonObject("order_id", afterSaleOrderId, "reject_reason", rejectReason)); + WxMaShopBaseResponse baseResponse = WxGsonBuilder.create() + .fromJson(response, WxMaShopBaseResponse.class); + if (baseResponse.getErrCode() != 0) { + throw new WxErrorException( + new WxError(baseResponse.getErrCode(), baseResponse.getErrMsg())); + } + return baseResponse; + } +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaProductServiceImpl.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaProductServiceImpl.java index 6652cd3b0d..9825cfa5d5 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaProductServiceImpl.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaProductServiceImpl.java @@ -1,5 +1,13 @@ package cn.binarywang.wx.miniapp.api.impl; +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.OTHER.GET_BRAND; +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.OTHER.GET_CATEGORY; +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.OTHER.GET_FREIGHT_TEMPLATE; +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.OTHER.IMG_UPLOAD; +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Sku.PRODUCT_ADD_SKU_URL; +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Sku.PRODUCT_BATCH_ADD_SKU_URL; +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Sku.PRODUCT_DEL_SKU_URL; +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Sku.PRODUCT_SKU_LIST; import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Order.PRODUCT_ORDER_GET_LIST; import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Sku.PRODUCT_ADD_SKU_URL; import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Sku.PRODUCT_BATCH_ADD_SKU_URL; @@ -22,6 +30,12 @@ import cn.binarywang.wx.miniapp.bean.product.WxMinishopOrderListResponse; import cn.binarywang.wx.miniapp.bean.product.WxMinishopResult; import cn.binarywang.wx.miniapp.bean.product.WxMinishopSku; +import cn.binarywang.wx.miniapp.bean.product.WxMinishopGetBrandResponse; +import cn.binarywang.wx.miniapp.bean.product.WxMinishopGetCategoryResponse; +import cn.binarywang.wx.miniapp.bean.product.WxMinishopGetFrightTemplateResponse; +import cn.binarywang.wx.miniapp.bean.product.WxMinishopResult; +import cn.binarywang.wx.miniapp.bean.product.WxMinishopSku; +import cn.binarywang.wx.miniapp.bean.product.WxMinishopSkuListResponse; import cn.binarywang.wx.miniapp.bean.product.WxMinishopSpu; import cn.binarywang.wx.miniapp.bean.product.WxMinishopSpuGetResponse; import cn.binarywang.wx.miniapp.bean.product.WxMinishopSpuListResponse; @@ -32,10 +46,16 @@ import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import java.io.File; import java.util.ArrayList; import java.util.List; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import me.chanjar.weixin.common.bean.result.WxMinishopImageUploadResult; +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.http.MinishopUploadRequestExecutor; import me.chanjar.weixin.common.enums.WxType; import me.chanjar.weixin.common.error.WxError; import me.chanjar.weixin.common.error.WxErrorException; @@ -52,6 +72,66 @@ public class WxMaProductServiceImpl implements WxMaProductService { private static final String ERR_CODE = "errcode"; private final WxMaService wxMaService; + @Override + public WxMinishopImageUploadResult uploadImg(File file, Integer respType, Integer width, + Integer height) throws WxErrorException { + String url = IMG_UPLOAD + "?upload_type=0" + "&height=" + height + "&width=" + width + "&resp_type=" + respType; + WxMinishopImageUploadResult result = this.wxMaService.execute( + MinishopUploadRequestExecutor.create(this.wxMaService.getRequestHttp()), url, file); + return result; + } + + @Override + public WxMinishopImageUploadResult uploadImg(String imgUrl, Integer respType) throws WxErrorException { + JsonObject jsonObject = GsonHelper.buildJsonObject("img_url", imgUrl); + String url = IMG_UPLOAD + "?upload_type=1" + "&resp_type=" + respType; + String response = this.wxMaService.post(url, jsonObject); + JsonObject respObj = GsonParser.parse(response); + + if (respObj.get(ERR_CODE).getAsInt() != 0) { + throw new WxErrorException(WxError.fromJson(response, WxType.MiniApp)); + } + + return WxMinishopImageUploadResult.fromJson(response); + } + + @Override + public WxMinishopGetCategoryResponse getCategory(Integer fCatId) throws WxErrorException { + JsonObject jsonObject = GsonHelper.buildJsonObject("f_cat_id", fCatId); + String response = this.wxMaService.post(GET_CATEGORY, jsonObject); + JsonObject respObj = GsonParser.parse(response); + + if (respObj.get(ERR_CODE).getAsInt() != 0) { + throw new WxErrorException(WxError.fromJson(response, WxType.MiniApp)); + } + + return WxMaGsonBuilder.create().fromJson(response, WxMinishopGetCategoryResponse.class); + } + + @Override + public WxMinishopGetBrandResponse getBrand() throws WxErrorException { + String response = this.wxMaService.post(GET_BRAND, new Object()); + JsonObject respObj = GsonParser.parse(response); + + if (respObj.get(ERR_CODE).getAsInt() != 0) { + throw new WxErrorException(WxError.fromJson(response, WxType.MiniApp)); + } + + return WxMaGsonBuilder.create().fromJson(response, WxMinishopGetBrandResponse.class); + } + + @Override + public WxMinishopGetFrightTemplateResponse getFreightTemplate() throws WxErrorException { + String response = this.wxMaService.post(GET_FREIGHT_TEMPLATE, new Object()); + JsonObject respObj = GsonParser.parse(response); + + if (respObj.get(ERR_CODE).getAsInt() != 0) { + throw new WxErrorException(WxError.fromJson(response, WxType.MiniApp)); + } + + return WxMaGsonBuilder.create().fromJson(response, WxMinishopGetFrightTemplateResponse.class); + } + @Override public WxMinishopResult addSpu(WxMinishopSpu spu) throws WxErrorException { @@ -157,6 +237,19 @@ public WxMaShopBaseResponse delistingSpu(Integer productId, String outProductId) return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopBaseResponse.class); } + @Override + public WxMinishopSkuListResponse getSkuList(Long productId, Integer needRealStock, Integer needEditSku) + throws WxErrorException { + String responseContent = this.wxMaService + .post(PRODUCT_SKU_LIST, GsonHelper.buildJsonObject("product_id", productId, + "need_edit_sku", needEditSku, "need_real_stock", needRealStock)); + JsonObject jsonObject = GsonParser.parse(responseContent); + if (jsonObject.get(ERR_CODE).getAsInt() != 0) { + throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp)); + } + return WxMaGsonBuilder.create().fromJson(responseContent, WxMinishopSkuListResponse.class); + } + @Override public WxMinishopResult minishiopGoodsAddSku( WxMinishopSku sku) throws WxErrorException { @@ -228,7 +321,6 @@ public WxMinishopResult minishopGoodsUpdateSku( result.setErrcode(jsonObject.get("errcode").getAsInt()); JsonObject dataObj = jsonObject.get("data").getAsJsonObject(); WxMinishopUpdateGoodsSkuData resultData = new WxMinishopUpdateGoodsSkuData(); - resultData.setSkuId(dataObj.get("sku_id").getAsLong()); resultData.setUpdateTime(dataObj.get("update_time").getAsString()); result.setData(resultData); return result; @@ -236,7 +328,7 @@ public WxMinishopResult minishopGoodsUpdateSku( @Override public WxMinishopResult minishopGoodsUpdateSkuPrice( - Long productId, Long outProductId, String outSkuId, Long skuId, Long salePrice, + Long productId, String outProductId, String outSkuId, Long skuId, Long salePrice, Long marketPrice) throws WxErrorException { String response = this.wxMaService .post(PRODUCT_UPDATE_SKU_PRICE_URL, GsonHelper.buildJsonObject( @@ -251,7 +343,6 @@ public WxMinishopResult minishopGoodsUpdateSkuPric result.setErrcode(jsonObject.get("errcode").getAsInt()); JsonObject dataObj = jsonObject.get("data").getAsJsonObject(); WxMinishopUpdateGoodsSkuData resultData = new WxMinishopUpdateGoodsSkuData(); - resultData.setSkuId(dataObj.get("sku_id").getAsLong()); resultData.setUpdateTime(dataObj.get("update_time").getAsString()); result.setData(resultData); return result; @@ -259,7 +350,7 @@ public WxMinishopResult minishopGoodsUpdateSkuPric @Override public WxMinishopResult minishopGoodsUpdateSkuStock( - Long productId, Long outProductId, String outSkuId, Long skuId, Integer type, + Long productId, String outProductId, String outSkuId, Long skuId, Integer type, Integer stockNum) throws WxErrorException { String response = this.wxMaService .post(PRODUCT_UPDATE_SKU_STOCK_URL, GsonHelper.buildJsonObject( @@ -279,20 +370,6 @@ public WxMinishopResult minishopGoodsUpdateSkuStoc return result; } - @Override - public WxMinishopOrderListResponse minishopOrderGetList(String startCreateTime, String endCreateTime, - Integer status, Integer page, Integer pageSize, Integer source) throws WxErrorException { - String response = this.wxMaService - .post(PRODUCT_ORDER_GET_LIST, GsonHelper.buildJsonObject( - "start_create_time", startCreateTime, "end_create_time", endCreateTime, - "status", status, "page", page, "page_size", pageSize, "source", source)); - - JsonObject jsonObject = GsonParser.parse(response); - if (jsonObject.get(ERR_CODE).getAsInt() != 0) { - throw new WxErrorException(WxError.fromJson(response, WxType.MiniApp)); - } - return WxMaGsonBuilder.create().fromJson(response, WxMinishopOrderListResponse.class); - } } diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopAfterSaleServiceImpl.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopAfterSaleServiceImpl.java index 9fd24350a5..5641489b4c 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopAfterSaleServiceImpl.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopAfterSaleServiceImpl.java @@ -2,10 +2,16 @@ import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.api.WxMaShopAfterSaleService; +import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAcceptReturnRequest; 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.WxMaShopAfterSaleListRequest; import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAfterSaleUpdateRequest; +import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAfterSaleUploadReturnInfoRequest; +import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopUploadCerficatesRequest; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAfterSaleAddResponse; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAfterSaleGetResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAfterSaleListResponse; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse; import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder; import com.google.gson.JsonObject; @@ -14,6 +20,7 @@ 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.GsonHelper; import me.chanjar.weixin.common.util.json.GsonParser; import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Aftersale.*; @@ -37,13 +44,13 @@ public class WxMaShopAfterSaleServiceImpl implements WxMaShopAfterSaleService { * @throws WxErrorException */ @Override - public WxMaShopBaseResponse add(WxMaShopAfterSaleAddRequest request) throws WxErrorException { + public WxMaShopAfterSaleAddResponse 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); + return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopAfterSaleAddResponse.class); } /** @@ -79,4 +86,154 @@ public WxMaShopBaseResponse update(WxMaShopAfterSaleUpdateRequest request) throw } return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopBaseResponse.class); } + + /** + * 用户取消售后申请 + * @param outAfterSaleId 商家自定义订单ID + * @param afterSaleId 与out_aftersale_id二选一 + * @param openId 用户openid + * @return + * @throws WxErrorException + */ + @Override + public WxMaShopBaseResponse cancel(String outAfterSaleId, Long afterSaleId, String openId) + throws WxErrorException { + JsonObject request = GsonHelper.buildJsonObject("out_aftersale_id", outAfterSaleId, + "aftersale_id", afterSaleId, "openid", openId); + String resp = this.wxMaService.post(AFTERSALE_CANCEL, request); + JsonObject jsonObject = GsonParser.parse(resp); + if (jsonObject.get(ERRCODE).getAsInt() != 0) { + throw new WxErrorException(WxError.fromJson(resp, WxType.MiniApp)); + } + return WxMaGsonBuilder.create().fromJson(resp, WxMaShopBaseResponse.class); + } + + /** + * 用户上传退货物流 + * @param request + * @return + * @throws WxErrorException + */ + @Override + public WxMaShopBaseResponse uploadReturnInfo(WxMaShopAfterSaleUploadReturnInfoRequest request) + throws WxErrorException { + String resp = this.wxMaService.post(AFTERSALE_UPLOAD_RETURN_INFO, request); + JsonObject jsonObject = GsonParser.parse(resp); + if (jsonObject.get(ERRCODE).getAsInt() != 0) { + throw new WxErrorException(WxError.fromJson(resp, WxType.MiniApp)); + } + return WxMaGsonBuilder.create().fromJson(resp, WxMaShopBaseResponse.class); + } + + /** + * 商家同意退款 + * @param outAfterSaleId + * @param afterSaleId + * @return + * @throws WxErrorException + */ + @Override + public WxMaShopBaseResponse acceptRefund(String outAfterSaleId, Long afterSaleId) + throws WxErrorException { + JsonObject request = GsonHelper.buildJsonObject("out_aftersale_id", outAfterSaleId, + "aftersale_id", afterSaleId); + String resp = this.wxMaService.post(AFTERSALE_ACCEPT_REFUND, request); + JsonObject jsonObject = GsonParser.parse(resp); + if (jsonObject.get(ERRCODE).getAsInt() != 0) { + throw new WxErrorException(WxError.fromJson(resp, WxType.MiniApp)); + } + return WxMaGsonBuilder.create().fromJson(resp, WxMaShopBaseResponse.class); + } + + /** + * 商家同意退货 + * @param request + * @return + * @throws WxErrorException + */ + @Override + public WxMaShopBaseResponse acceptReturn(WxMaShopAcceptReturnRequest request) + throws WxErrorException { + String resp = this.wxMaService.post(AFTERSALE_ACCEPT_RETURN, request); + JsonObject jsonObject = GsonParser.parse(resp); + if (jsonObject.get(ERRCODE).getAsInt() != 0) { + throw new WxErrorException(WxError.fromJson(resp, WxType.MiniApp)); + } + return WxMaGsonBuilder.create().fromJson(resp, WxMaShopBaseResponse.class); + } + + /** + * 商家拒绝售后 + * @param outAfterSaleId + * @param afterSaleId + * @return + * @throws WxErrorException + */ + @Override + public WxMaShopBaseResponse reject(String outAfterSaleId, Long afterSaleId) + throws WxErrorException { + JsonObject request = GsonHelper.buildJsonObject("out_aftersale_id", outAfterSaleId, + "aftersale_id", afterSaleId); + String resp = this.wxMaService.post(AFTERSALE_REJECT, request); + JsonObject jsonObject = GsonParser.parse(resp); + if (jsonObject.get(ERRCODE).getAsInt() != 0) { + throw new WxErrorException(WxError.fromJson(resp, WxType.MiniApp)); + } + return WxMaGsonBuilder.create().fromJson(resp, WxMaShopBaseResponse.class); + } + + /** + * 商家上传退款凭证 + * @param request + * @return + * @throws WxErrorException + */ + @Override + public WxMaShopBaseResponse uploadCertificates(WxMaShopUploadCerficatesRequest request) + throws WxErrorException { + String resp = this.wxMaService.post(AFTERSALE_UPLOAD_CERTIFICATES, request); + JsonObject jsonObject = GsonParser.parse(resp); + if (jsonObject.get(ERRCODE).getAsInt() != 0) { + throw new WxErrorException(WxError.fromJson(resp, WxType.MiniApp)); + } + return WxMaGsonBuilder.create().fromJson(resp, WxMaShopBaseResponse.class); + } + + /** + * 商家更新订单售后期 + * @param outOrderId + * @param orderId + * @param openid + * @param afterSaleDeadline + * @return + * @throws WxErrorException + */ + @Override + public WxMaShopBaseResponse updateDeadline(String outOrderId, Long orderId, String openid, + Long afterSaleDeadline) throws WxErrorException { + JsonObject request = GsonHelper.buildJsonObject("out_order_id", outOrderId, + "order_id", orderId, "openid", openid, "after_sale_deadline", afterSaleDeadline); + String resp = this.wxMaService.post(AFTERSALE_UPLOAD_DEADLINE, request); + JsonObject jsonObject = GsonParser.parse(resp); + if (jsonObject.get(ERRCODE).getAsInt() != 0) { + throw new WxErrorException(WxError.fromJson(resp, WxType.MiniApp)); + } + return WxMaGsonBuilder.create().fromJson(resp, WxMaShopBaseResponse.class); + } + + /** + * 获取售后单详情 + * @param request + * @return + * @throws WxErrorException + */ + @Override + public WxMaShopAfterSaleListResponse list(WxMaShopAfterSaleListRequest request) throws WxErrorException { + String resp = this.wxMaService.post(AFTERSALE_GET_LIST, request); + JsonObject jsonObject = GsonParser.parse(resp); + if (jsonObject.get(ERRCODE).getAsInt() != 0) { + throw new WxErrorException(WxError.fromJson(resp, WxType.MiniApp)); + } + return WxMaGsonBuilder.create().fromJson(resp, WxMaShopAfterSaleListResponse.class); + } } diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopCouponServiceImpl.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopCouponServiceImpl.java new file mode 100644 index 0000000000..fecca734bd --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopCouponServiceImpl.java @@ -0,0 +1,165 @@ +package cn.binarywang.wx.miniapp.api.impl; + +import static cn.binarywang.wx.miniapp.api.impl.WxMaImmediateDeliveryServiceImpl.ERR_CODE; + +import cn.binarywang.wx.miniapp.api.WxMaService; +import cn.binarywang.wx.miniapp.api.WxMaShopCouponService; +import cn.binarywang.wx.miniapp.bean.shop.WxMaShopCouponInfo; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopCouponListResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopCouponResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopUserCouponListResponse; +import cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Coupon; +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.GsonHelper; +import me.chanjar.weixin.common.util.json.GsonParser; + +/** + * @author leiin + * @date 2022/7/1 2:49 下午 + */ +@RequiredArgsConstructor +@Slf4j +public class WxMaShopCouponServiceImpl implements WxMaShopCouponService { + private final WxMaService wxMaService; + + @Override + public WxMaShopBaseResponse addCoupon(WxMaShopCouponInfo couponInfo) throws WxErrorException { + JsonObject json = GsonHelper.buildJsonObject("coupon", couponInfo); + String responseContent = this.wxMaService.post(Coupon.ADD_COUPON, json); + JsonObject jsonObject = GsonParser.parse(responseContent); + if (jsonObject.get(ERR_CODE).getAsInt() != 0) { + throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp)); + } + return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopBaseResponse.class); + } + + @Override + public WxMaShopCouponResponse getCoupon(String outCouponId) throws WxErrorException { + JsonObject json = GsonHelper.buildJsonObject("out_coupon_id", outCouponId); + String responseContent = this.wxMaService.post(Coupon.GET_COUPON, json); + JsonObject jsonObject = GsonParser.parse(responseContent); + if (jsonObject.get(ERR_CODE).getAsInt() != 0) { + throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp)); + } + return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopCouponResponse.class); + } + + @Override + public WxMaShopCouponListResponse getCouponList(Integer pageSize, Integer offset) throws WxErrorException { + JsonObject json = GsonHelper.buildJsonObject("page_size", pageSize, "offset", offset); + String responseContent = this.wxMaService.post(Coupon.GET_COUPON_LIST, json); + JsonObject jsonObject = GsonParser.parse(responseContent); + if (jsonObject.get(ERR_CODE).getAsInt() != 0) { + throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp)); + } + return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopCouponListResponse.class); + } + + @Override + public WxMaShopBaseResponse updateCoupon(WxMaShopCouponInfo couponInfo) throws WxErrorException { + JsonObject json = GsonHelper.buildJsonObject("coupon", couponInfo); + String responseContent = this.wxMaService.post(Coupon.UPDATE_COUPON, json); + JsonObject jsonObject = GsonParser.parse(responseContent); + if (jsonObject.get(ERR_CODE).getAsInt() != 0) { + throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp)); + } + return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopBaseResponse.class); + } + + @Override + public WxMaShopBaseResponse updateCouponStatus(String outCouponId, Integer status) throws WxErrorException { + JsonObject json = GsonHelper.buildJsonObject("out_coupon_id", outCouponId, "status", status); + String responseContent = this.wxMaService.post(Coupon.UPDATE_COUPON_STATUS, json); + JsonObject jsonObject = GsonParser.parse(responseContent); + if (jsonObject.get(ERR_CODE).getAsInt() != 0) { + throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp)); + } + return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopBaseResponse.class); + } + + @Override + public WxMaShopBaseResponse updateCouponStock(String outCouponId, Integer isUsedNum, Integer receiveNum) throws WxErrorException { + JsonObject stockInfo = GsonHelper.buildJsonObject("issued_num", isUsedNum, "receive_num", receiveNum); + JsonObject stock = GsonHelper.buildJsonObject("out_coupon_id", outCouponId, "stock_info", stockInfo); + JsonObject json = GsonHelper.buildJsonObject("coupon_stock", stock); + + String responseContent = this.wxMaService.post(Coupon.UPDATE_COUPON_STOCK, json); + JsonObject jsonObject = GsonParser.parse(responseContent); + if (jsonObject.get(ERR_CODE).getAsInt() != 0) { + throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp)); + } + return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopBaseResponse.class); + } + + @Override + public WxMaShopBaseResponse addUserCoupon(String openid, String outUserCouponId, + String outCouponId, Integer status, Long recvTime) throws WxErrorException { + JsonObject userCoupon = GsonHelper.buildJsonObject("out_user_coupon_id", outUserCouponId, + "out_coupon_id", outCouponId, + "status", status); + JsonObject json = GsonHelper.buildJsonObject("openid", openid, "user_coupon", userCoupon, + "recv_time", recvTime); + + String responseContent = this.wxMaService.post(Coupon.ADD_USER_COUPON, json); + JsonObject jsonObject = GsonParser.parse(responseContent); + if (jsonObject.get(ERR_CODE).getAsInt() != 0) { + throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp)); + } + return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopBaseResponse.class); + } + + @Override + public WxMaShopUserCouponListResponse getUserCouponList(Integer pageSize, Integer offset, String openid) throws WxErrorException { + JsonObject json = GsonHelper.buildJsonObject("page_size", pageSize, "offset", offset, + "openid", openid); + String responseContent = this.wxMaService.post(Coupon.GET_USER_COUPON_LIST, json); + JsonObject jsonObject = GsonParser.parse(responseContent); + if (jsonObject.get(ERR_CODE).getAsInt() != 0) { + throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp)); + } + return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopUserCouponListResponse.class); + } + + @Override + public WxMaShopBaseResponse updateUserCoupon(String openid, String outUserCouponId, + String outCouponId, Long useTime, Long recvTime) throws WxErrorException { + JsonObject extInfo = GsonHelper.buildJsonObject("use_time", useTime); + + JsonObject userCoupon = GsonHelper.buildJsonObject("out_user_coupon_id", outUserCouponId, + "out_coupon_id", outCouponId, "ext_info", extInfo); + + JsonObject json = GsonHelper.buildJsonObject("openid", openid, "user_coupon", userCoupon, + "recv_time", recvTime); + + String responseContent = this.wxMaService.post(Coupon.UPDATE_USER_COUPON, json); + JsonObject jsonObject = GsonParser.parse(responseContent); + if (jsonObject.get(ERR_CODE).getAsInt() != 0) { + throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp)); + } + return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopBaseResponse.class); + } + + @Override + public WxMaShopBaseResponse updateUserCouponStatus(String openid, String outUserCouponId, + String outCouponId, Integer status) throws WxErrorException { + + JsonObject json = GsonHelper.buildJsonObject("openid", openid, + "out_user_coupon_id", outUserCouponId, + "out_coupon_id", outCouponId, + "status", status); + + String responseContent = this.wxMaService.post(Coupon.UPDATE_USER_COUPON_STATUS, json); + JsonObject jsonObject = GsonParser.parse(responseContent); + if (jsonObject.get(ERR_CODE).getAsInt() != 0) { + throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp)); + } + return WxMaGsonBuilder.create().fromJson(responseContent, WxMaShopBaseResponse.class); + } +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMiniAfterSaleOrder.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMiniAfterSaleOrder.java new file mode 100644 index 0000000000..c58e41bae4 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMiniAfterSaleOrder.java @@ -0,0 +1,95 @@ +package cn.binarywang.wx.miniapp.bean.product; + +import com.google.gson.annotations.SerializedName; +import java.util.List; +import lombok.Data; + +/** + * @author leiin + * @date 2022/7/11 20:33 + */ +@Data +public class WxMiniAfterSaleOrder { + @SerializedName("order_id") + private Long orderId; + @SerializedName("status") + private String status; + @SerializedName("openid") + private String openid; + @SerializedName("original_order_id") + private Long originalOrderId; + @SerializedName("product_info") + private AfterSaleProductInfo productInfo; + + private AfterSaleDetails details; + @SerializedName("refund_info") + private RefundInfo refundInfo; + @SerializedName("return_info") + private ReturnInfo returnInfo; + @SerializedName("merchant_upload_info") + private MerchantUploadInfo merchantUploadInfo; + @SerializedName("create_time") + private Long createTime; + @SerializedName("update_time") + private Long updateTime; + @SerializedName("reason") + private String reason; + @SerializedName("refund_resp") + private RefundResp refundResp; + private String type; + + @Data + public static class AfterSaleProductInfo { + @SerializedName("product_id") + private Long productId; + @SerializedName("sku_id") + private Long skuId; + @SerializedName("count") + private Integer count; + } + + @Data + public static class AfterSaleDetails { + + @SerializedName("num") + private Integer num; + @SerializedName("desc") + private String desc; + @SerializedName("cancel_time") + private Long cancelTime; + @SerializedName("prove_imgs") + private List proveImgs; + @SerializedName("tel_number") + private String telNumber; + } + + @Data + public static class RefundInfo { + private Long amount; + } + + @Data + public static class ReturnInfo { + @SerializedName("delivery_id") + private String deliveryId; + @SerializedName("waybill_id") + private String waybillId; + @SerializedName("delivery_name") + private String deliveryName; + } + + @Data + public static class MerchantUploadInfo { + @SerializedName("reject_reason") + private String rejectReason; + @SerializedName("refund_certificates") + private List refundCertificates; + } + + @Data + public static class RefundResp { + private String code; + private Integer ret; + private String message; + } +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMiniBatchGetAfterSaleOrderResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMiniBatchGetAfterSaleOrderResponse.java new file mode 100644 index 0000000000..5043366784 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMiniBatchGetAfterSaleOrderResponse.java @@ -0,0 +1,16 @@ +package cn.binarywang.wx.miniapp.bean.product; + +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse; +import com.google.gson.annotations.SerializedName; +import java.util.List; +import lombok.Data; + +/** + * @author leiin + * @date 2022/7/11 20:59 + */ +@Data +public class WxMiniBatchGetAfterSaleOrderResponse extends WxMaShopBaseResponse { + @SerializedName("after_sale_order_list") + private List afterSaleOrderList; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMiniGetAfterSaleOrderResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMiniGetAfterSaleOrderResponse.java new file mode 100644 index 0000000000..06586176e6 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMiniGetAfterSaleOrderResponse.java @@ -0,0 +1,15 @@ +package cn.binarywang.wx.miniapp.bean.product; + +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse; +import com.google.gson.annotations.SerializedName; +import lombok.Data; + +/** + * @author leiin + * @date 2022/7/11 20:58 + */ +@Data +public class WxMiniGetAfterSaleOrderResponse extends WxMaShopBaseResponse { + @SerializedName("after_sale_order") + private WxMiniAfterSaleOrder afterSaleOrder; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMiniOrderAfterSaleDetail.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMiniOrderAfterSaleDetail.java new file mode 100644 index 0000000000..b5bfbe7950 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMiniOrderAfterSaleDetail.java @@ -0,0 +1,24 @@ +package cn.binarywang.wx.miniapp.bean.product; + +import com.google.gson.annotations.SerializedName; +import java.util.List; +import lombok.Data; + +/** + * @author leiin + * @date 2022/6/20 7:16 下午 + */ +@Data +public class WxMiniOrderAfterSaleDetail { + @SerializedName("aftersale_order_list") + private List aftersaleOrderList; + @SerializedName("on_aftersale_order_cnt") + private Integer onAftersaleOrderCnt; + + @Data + public static class AfterSaleOrder { + @SerializedName("aftersale_order_id") + private Long aftersaleOrderId; + private Integer status; + } +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMiniOrderDeliveryRequest.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMiniOrderDeliveryRequest.java new file mode 100644 index 0000000000..3307a11611 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMiniOrderDeliveryRequest.java @@ -0,0 +1,41 @@ +package cn.binarywang.wx.miniapp.bean.product; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import java.util.List; +import lombok.Data; + +/** + * @author leiin + * @date 2022/7/14 19:05 + */ +@Data +public class WxMiniOrderDeliveryRequest { + @SerializedName("order_id") + private Long orderId; + @SerializedName("delivery_list") + private List deliveryList; + + @Data + public static class DeliveryListBean implements Serializable { + @SerializedName("delivery_id") + private String deliveryId; + @SerializedName("is_all_product") + private Boolean isAllProduct; + @SerializedName("waybill_id") + private String waybillId; + @SerializedName("product_infos") + private List productInfoList; + } + + @Data + public static class ProductInfosBean implements Serializable { + + @SerializedName("product_id") + private String productId; + @SerializedName("sku_id") + private String skuId; + @SerializedName("product_cnt") + private Integer productCnt; + } +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopAddressInfo.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopAddressInfo.java index 0e140883eb..b5dd9e872a 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopAddressInfo.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopAddressInfo.java @@ -16,7 +16,7 @@ public class WxMinishopAddressInfo { @SerializedName("province_name") private String provinceName; @SerializedName("city_name") - private String cityame; + private String cityName; @SerializedName("county_name") private String countyName; @SerializedName("detail_info") diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopDeliveryInfo.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopDeliveryInfo.java index b8098edb30..1a9f844c12 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopDeliveryInfo.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopDeliveryInfo.java @@ -17,7 +17,7 @@ public class WxMinishopDeliveryInfo { @SerializedName("delivery_product_info") private List deliveryProductInfo; @SerializedName("ship_done_time") - private Long ship_done_time; + private Long shipDoneTime; @SerializedName("insurance_info") private InsuranceInfo insuranceInfo; @SerializedName("deliver_type") @@ -53,10 +53,10 @@ public static class InsuranceInfo { @Data public static class ProductInfo { @SerializedName("product_id") - private Long product_id; + private Long productId; @SerializedName("sku_id") - private Long sku_id; + private Long skuId; @SerializedName("product_cnt") - private Long product_cnt; + private Long productCnt; } } diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopGetBrandResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopGetBrandResponse.java new file mode 100644 index 0000000000..1e9e4862e2 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopGetBrandResponse.java @@ -0,0 +1,35 @@ +package cn.binarywang.wx.miniapp.bean.product; + +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse; +import com.google.gson.annotations.SerializedName; +import java.util.List; +import lombok.Data; + +/** + * @author leiin + * @date 2022/7/8 3:46 下午 + */ +@Data +public class WxMinishopGetBrandResponse extends WxMaShopBaseResponse { + private List brands; + + @Data + public static class MinishopBrandItem { + @SerializedName("first_cat_id") + private Integer firstCatId; + @SerializedName("second_cat_id") + private Integer secondCatId; + @SerializedName("third_cat_id") + private Integer thirdCatId; + @SerializedName("brand_info") + private MinishopBrandInfo brandInfo; + } + + @Data + public static class MinishopBrandInfo { + @SerializedName("brand_id") + private Long brandId; + @SerializedName("brand_name") + private String brandName; + } +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopGetCategoryResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopGetCategoryResponse.java new file mode 100644 index 0000000000..55954d8b32 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopGetCategoryResponse.java @@ -0,0 +1,30 @@ +package cn.binarywang.wx.miniapp.bean.product; + +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse; +import com.google.gson.annotations.SerializedName; +import java.util.List; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author leiin + * @date 2022/7/8 3:39 下午 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class WxMinishopGetCategoryResponse extends WxMaShopBaseResponse { + @SerializedName("cat_list") + private List catList; + + @Data + public static class MinishopCatItem { + + @SerializedName("cat_id") + private Integer catId; + + @SerializedName("f_cat_id") + private Integer fCatId; + + private String name; + } +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopGetFrightTemplateResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopGetFrightTemplateResponse.java new file mode 100644 index 0000000000..9b79c1e3f1 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopGetFrightTemplateResponse.java @@ -0,0 +1,26 @@ +package cn.binarywang.wx.miniapp.bean.product; + +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse; +import com.google.gson.annotations.SerializedName; +import java.util.List; +import lombok.Data; + +/** + * @author leiin + * @date 2022/7/8 3:46 下午 + */ +@Data +public class WxMinishopGetFrightTemplateResponse extends WxMaShopBaseResponse { + @SerializedName("template_list") + private List templateList; + + @Data + public static class MinishopFeightTemplateItem { + @SerializedName("template_id") + private Long templateId; + private String name; + @SerializedName("valuation_type") + private Integer valuationType; + + } +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopOrderDetailResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopOrderDetailResponse.java new file mode 100644 index 0000000000..aa2996ca64 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopOrderDetailResponse.java @@ -0,0 +1,19 @@ +package cn.binarywang.wx.miniapp.bean.product; + +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse; +import lombok.Data; + +/** + * 获取订单详情 回包结构 + * + * @author leiin + * @date 2022/6/20 7:09 下午 + */ +@Data +public class WxMinishopOrderDetailResponse extends WxMaShopBaseResponse { + + /** + * 订单结构 + */ + private WxMinishopOrderResult order; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopOrderResult.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopOrderResult.java index ed3d02cd92..9fb817a6eb 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopOrderResult.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopOrderResult.java @@ -1,6 +1,5 @@ package cn.binarywang.wx.miniapp.bean.product; -import cn.binarywang.wx.miniapp.bean.shop.WxMaShopOrderDetail; import com.google.gson.annotations.SerializedName; import java.io.Serializable; import lombok.Data; @@ -37,7 +36,7 @@ public class WxMinishopOrderResult implements Serializable { private WxMinishopOrderDetail orderDetail; @SerializedName("aftersale_detail") - private WxMiniAfterSaleDetail afterSaleDetail; + private WxMiniOrderAfterSaleDetail afterSaleDetail; /** * 商家小程序该订单的用户id diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopProductInfo.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopProductInfo.java index 5e709120e8..7342a2c29e 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopProductInfo.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopProductInfo.java @@ -18,11 +18,17 @@ public class WxMinishopProductInfo implements Serializable { @SerializedName("product_id") private Integer productId; + @SerializedName("out_product_id") + private String outProductId; + /** * 交易组件平台内部skuID,可填0(如果这个product_id下没有sku) */ @SerializedName("sku_id") private Integer skuId; + + @SerializedName("out_sku_id") + private String outSkuId; /** * 购买的数量 *
diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopSku.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopSku.java
index 8fa8712e25..9ac5636156 100644
--- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopSku.java
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopSku.java
@@ -18,6 +18,9 @@ public class WxMinishopSku implements Serializable {
   @SerializedName("out_sku_id")
   private String outSkuId;
 
+  @SerializedName("sku_id")
+  private Long skuId;
+
   @SerializedName("thumb_img")
   private String thumbImg;
 
diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopSkuListResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopSkuListResponse.java
new file mode 100644
index 0000000000..a1713709e9
--- /dev/null
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopSkuListResponse.java
@@ -0,0 +1,14 @@
+package cn.binarywang.wx.miniapp.bean.product;
+
+import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse;
+import java.util.List;
+import lombok.Data;
+
+/**
+ * @author leiin
+ * @date 2022/7/13 20:00
+ */
+@Data
+public class WxMinishopSkuListResponse extends WxMaShopBaseResponse {
+  private List skus;
+}
diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopCouponInfo.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopCouponInfo.java
new file mode 100644
index 0000000000..e04c362f39
--- /dev/null
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopCouponInfo.java
@@ -0,0 +1,319 @@
+package cn.binarywang.wx.miniapp.bean.shop;
+
+import com.google.gson.annotations.SerializedName;
+import java.io.Serializable;
+import java.util.List;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @author leiin
+ * @date 2022/7/1 2:57 下午
+ */
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class WxMaShopCouponInfo implements Serializable {
+
+  private static final long serialVersionUID = 5807154725645642700L;
+
+  /**
+   * 是否必填:是
+   * 说明:商家侧优惠券ID
+   */
+  @SerializedName("out_coupon_id")
+  private String outCouponId;
+  /**
+   * 是否必填:是
+   * 说明:优惠券类型
+   */
+  @SerializedName("type")
+  private Integer type;
+  /**
+   * 是否必填:是
+   * 说明:优惠券推广类型
+   */
+  @SerializedName("promote_type")
+  private Integer promoteType;
+
+  @SerializedName("coupon_info")
+  private CouponInfo couponInfo;
+
+  // 返回参数
+  /**
+   * 优惠券状态
+   */
+  @SerializedName("status")
+  private Integer status;
+  /**
+   * 创建时间
+   */
+  @SerializedName("create_time")
+  private Long createTime;
+  /**
+   * 更新时间
+   */
+  @SerializedName("update_time")
+  private Long updateTime;
+
+  @SerializedName("coupon_stock")
+  private CouponStock couponStock;
+
+  @Data
+  @Builder
+  @NoArgsConstructor
+  @AllArgsConstructor
+  public static class CouponInfo implements Serializable {
+
+    private static final long serialVersionUID = -7913225774910831745L;
+
+    /**
+     * 是否必填:是
+     * 说明:优惠券名
+     */
+    private String name;
+
+    @SerializedName("promote_info")
+    private PromoteInfo promoteInfo;
+
+    @SerializedName("discount_info")
+    private DiscountInfo discountInfo;
+
+    @SerializedName("receive_info")
+    private ReceiveInfo receiveInfo;
+
+    @SerializedName("valid_info")
+    private ValidInfo validInfo;
+  }
+
+  @Data
+  @Builder
+  @NoArgsConstructor
+  @AllArgsConstructor
+  public static class PromoteInfo {
+    @SerializedName("promote_type")
+    private Integer promoteType;
+    private PromoteFinder finder;
+
+    @Data
+    public static class PromoteFinder {
+      private String nickname;
+    }
+  }
+
+  @Data
+  @Builder
+  @NoArgsConstructor
+  @AllArgsConstructor
+  public static class DiscountInfo {
+
+    /**
+     * 是否必填:	否
+     * 说明:折扣数,比如5.1折,则填5100,折扣券必需
+     */
+    @SerializedName("discount_num")
+    private Integer discountNum;
+    /**
+     * 是否必填:	否
+     * 说明:减金额,单位为分,直减券、满减券必需
+     */
+    @SerializedName("discount_fee")
+    private Long discountFee;
+
+    @SerializedName("discount_condition")
+    private DiscountCondition discountCondition;
+
+    @Data
+    @Builder
+    @NoArgsConstructor
+    @AllArgsConstructor
+    public static class DiscountCondition {
+
+      /**
+       * 是否必填:	否
+       * 说明:优惠条件所需的商品数
+       */
+      @SerializedName("product_cnt")
+      private Integer productCnt;
+      /**
+       * 是否必填:	否
+       * 说明:优惠条件所需满足的金额
+       */
+      @SerializedName("product_price")
+      private Long productPrice;
+      /**
+       * 是否必填: 否
+       * 说明:指定商品商家侧ID,商品券必需,最多128个
+       */
+      @SerializedName("out_product_ids")
+      private List outProductIds;
+
+      @SerializedName("tradein_info")
+      private TradeinInfo tradeinInfo;
+
+      @SerializedName("buyget_info")
+      private BuygetInfo buyget_info;
+
+      @Data
+      @Builder
+      @NoArgsConstructor
+      @AllArgsConstructor
+      public static class TradeinInfo {
+
+        /**
+         * 是否必填:否
+         * 说明:换购商品商家侧ID,换购券必需
+         */
+        @SerializedName("out_product_id")
+        private String outProductId;
+        /**
+         * 是否必填:否
+         * 说明:需要支付的金额,单位分,换购券必需
+         */
+        @SerializedName("price")
+        private Long price;
+      }
+
+      @Data
+      @Builder
+      @NoArgsConstructor
+      @AllArgsConstructor
+      public static class BuygetInfo {
+        /**
+         * 是否必填:否
+         * 说明:购买商品商家侧ID,买赠券必需
+         */
+        @SerializedName("buy_out_product_id")
+        private String buyOutProductId;
+        /**
+         * 是否必填:否
+         * 说明:购买商品数,买赠券必需
+         */
+        @SerializedName("buy_product_cnt")
+        private Integer buyProductCnt;
+        /**
+         * 是否必填:否
+         * 说明:赠送商品商家侧ID,买赠券必需
+         */
+        @SerializedName("get_out_product_id")
+        private String getOutProductId;
+        /**
+         * 是否必填:否
+         * 说明:赠送商品数,买赠券必需
+         */
+        @SerializedName("get_product_cnt")
+        private Integer getProductCnt;
+      }
+    }
+  }
+
+  @Data
+  @Builder
+  @NoArgsConstructor
+  @AllArgsConstructor
+  public static class ReceiveInfo {
+
+    /**
+     * 是否必填:是
+     * 说明:领取开始时间 (秒级时间戳)
+     */
+    @SerializedName("start_time")
+    private Long startTime;
+    /**
+     * 是否必填:是
+     * 说明:领取结束时间 (秒级时间戳)
+     */
+    @SerializedName("end_time")
+    private Long endTime;
+    /**
+     * 是否必填:是
+     * 说明:个人限领张数,只做展示,领券回调时接入方判断有无超领。
+     */
+    @SerializedName("limit_num_one_person")
+    private Integer limitNumOnePerson;
+    /**
+     * 是否必填:是
+     * 说明:总发放量,即初始库存数,只做展示,领券回调时接入方判断有无超领。
+     */
+    @SerializedName("total_num")
+    private Integer totalNum;
+  }
+
+  @Data
+  @Builder
+  @NoArgsConstructor
+  @AllArgsConstructor
+  public static class ValidInfo {
+
+    /**
+     * 是否必填:是
+     * 说明:有效期类型,1:商品指定时间区间,2:生效天数,3:生效秒数
+     */
+    @SerializedName("valid_type")
+    private Integer validType;
+    /**
+     * 是否必填:否
+     * 说明:生效天数,有效期类型为2时必需
+     */
+    @SerializedName("valid_day_num")
+    private Integer validDayNum;
+    /**
+     * 是否必填:否
+     * 说明:生效秒数,有效期类型为3时必需
+     */
+    @SerializedName("valid_second")
+    private Long validSecond;
+    /**
+     * 是否必填:否
+     * 说明:生效开始时间,有效期类型为1时必需
+     */
+    @SerializedName("start_time")
+    private Long startTime;
+    /**
+     * 是否必填:否
+     * 说明:生效结束时间,有效期类型为1时必需
+     */
+    @SerializedName("end_time")
+    private Long endTime;
+  }
+
+  @Data
+  public static class CouponStock {
+
+    /**
+     * 商家侧优惠券ID
+     */
+    @SerializedName("out_coupon_id")
+    private String outCouponId;
+    /**
+     * 创建时间
+     */
+    @SerializedName("create_time")
+    private Long createTime;
+    /**
+     * 更新时间
+     */
+    @SerializedName("update_time")
+    private Long updateTime;
+
+    @SerializedName("stock_info")
+    private StockInfo stockInfo;
+
+    @Data
+    public static class StockInfo {
+      /**
+       * 优惠券库存剩余量
+       */
+      @SerializedName("issued_num")
+      private Integer issuedNum;
+      /**
+       * 优惠卷发放量
+       */
+      @SerializedName("receive_num")
+      private Integer receiveNum;
+    }
+  }
+}
diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopOrderInfo.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopOrderInfo.java
index b942bb6b55..006f41266c 100644
--- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopOrderInfo.java
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopOrderInfo.java
@@ -84,4 +84,53 @@ public class WxMaShopOrderInfo implements Serializable {
   @SerializedName("address_info")
   private WxMaShopAddressInfo addressInfo;
 
+  /**
+   * 订单类型:0,普通单,1,二级商户单
+   * 
+   * 是否必填:是
+   * 
+ */ + @SerializedName("fund_type") + private Integer fundType; // 订单类型:0,普通单,1,二级商户单 + /** + * unix秒级时间戳,订单超时时间,取值:[15min, 1d] + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("expire_time") + private Long expireTime; // unix秒级时间戳,订单超时时间,取值:[15min, 1d] + /** + * 取值范围,[7,3 * 365],单位:天 + *
+   * 是否必填:选填
+   * 
+ */ + @SerializedName("aftersale_duration") + private Integer aftersaleDuration; // 取值范围,[7,3 * 365],单位:天 + /** + * 会影响主播归因、分享员归因等,从下单前置检查获取 + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("trace_id") + private String traceId; // 会影响主播归因、分享员归因等,从下单前置检查获取 + /** + * 默认退货地址,退货售后超时时,会让用户将货物寄往此地址 + *
+   * 是否必填:选填
+   * 
œ + */ + @SerializedName("default_receiving_address") + private WxMaShopAddressInfo defaultReceivingAddress; // 默认退货地址,退货售后超时时,会让用户将货物寄往此地址 + /** + * 生成的order_id以字符串形式返回 + *
+   * 是否必填:选填
+   * 
+ */ + @SerializedName("stringify_64bits_number") + private Boolean stringify64bitsNumber; // 生成的order_id以字符串形式返回 + } diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopAcceptReturnRequest.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopAcceptReturnRequest.java new file mode 100644 index 0000000000..58d08b4b41 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopAcceptReturnRequest.java @@ -0,0 +1,43 @@ +package cn.binarywang.wx.miniapp.bean.shop.request; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author leiin + * @date 2022/6/28 11:39 上午 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class WxMaShopAcceptReturnRequest implements Serializable { + @SerializedName("out_aftersale_id") + private String outAftersaleId; + @SerializedName("aftersale_id") + private Long aftersaleId; + @SerializedName("address_info") + private RefundAddressInfo addressInfo; + + @Data + public static class RefundAddressInfo { + @SerializedName("receiver_name") + private String receiverName; + @SerializedName("detailed_address") + private String detailedAddress; + @SerializedName("tel_number") + private String telNumber; + @SerializedName("country") + private String country; + @SerializedName("province") + private String province; + @SerializedName("city") + private String city; + @SerializedName("town") + private String town; + } +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopAfterSaleAddRequest.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopAfterSaleAddRequest.java index 47c33f1ae7..f5a00aeb58 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopAfterSaleAddRequest.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopAfterSaleAddRequest.java @@ -33,6 +33,8 @@ public class WxMaShopAfterSaleAddRequest implements Serializable { * product_infos : [{"out_product_id":"234245","out_sku_id":"23424","product_cnt":5}] */ + @SerializedName("order_id") + private Long orderId; @SerializedName("out_order_id") private String outOrderId; @SerializedName("out_aftersale_id") @@ -41,8 +43,14 @@ public class WxMaShopAfterSaleAddRequest implements Serializable { private String openid; @SerializedName("type") private Integer type; - @SerializedName("create_time") - private String createTime; + @SerializedName("product_info") + private ProductInfosBean productInfo; + @SerializedName("orderamt") + private Long orderamt; + @SerializedName("refund_reason") + private String refundReason; + @SerializedName("refund_reason_type") + private Integer refundReasonType; @SerializedName("status") private Integer status; @SerializedName("finish_all_aftersale") @@ -51,8 +59,8 @@ public class WxMaShopAfterSaleAddRequest implements Serializable { private String path; @SerializedName("refund") private Long refund; - @SerializedName("product_infos") - private List productInfos; + @SerializedName("media_list") + private UploadMediaList mediaList; @Data @Builder @@ -72,4 +80,12 @@ public static class ProductInfosBean implements Serializable { @SerializedName("product_cnt") private Integer productCnt; } + + @Data + public static class UploadMediaList { + private Integer type; + private String url; + @SerializedName("thumb_url") + private String thumbUrl; + } } diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopAfterSaleListRequest.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopAfterSaleListRequest.java new file mode 100644 index 0000000000..a0c01e8c81 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopAfterSaleListRequest.java @@ -0,0 +1,36 @@ +package cn.binarywang.wx.miniapp.bean.shop.request; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import java.util.List; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author leiin + * @date 2022/6/28 11:39 上午 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class WxMaShopAfterSaleListRequest implements Serializable { + @SerializedName("status") + private Integer status; //售后单状态,见 AfterSalesState + @SerializedName("out_order_id") + private String outOrderId; //售后单关联的外部订单号 + @SerializedName("order_id") + private Long orderId; //售后单关联的微信侧订单号 + @SerializedName("openid") + private String openid; //买家openid + @SerializedName("begin_create_time") + private Long beginCreateTime; //申请时间(单位毫秒)起始 + @SerializedName("end_create_time") + private Long endCreateTime; //申请时间(单位毫秒)结束 + @SerializedName("offset") + private Long offset; //本次拉取的起始位置(从0开始) + @SerializedName("limit") + private Integer limit; //本次拉取的大小(最大50) +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopAfterSaleUpdateRequest.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopAfterSaleUpdateRequest.java index d208b239e2..f5679aeb3e 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopAfterSaleUpdateRequest.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopAfterSaleUpdateRequest.java @@ -1,5 +1,6 @@ package cn.binarywang.wx.miniapp.bean.shop.request; +import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAfterSaleAddRequest.UploadMediaList; import com.google.gson.annotations.SerializedName; import lombok.AllArgsConstructor; import lombok.Builder; @@ -33,6 +34,16 @@ public class WxMaShopAfterSaleUpdateRequest implements Serializable { private String openid; @SerializedName("out_aftersale_id") private String outAftersaleId; + @SerializedName("type") + private Integer type; + @SerializedName("orderamt") + private Long orderamt; + @SerializedName("refund_reason") + private String refundReason; + @SerializedName("refund_reason_type") + private Integer refundReasonType; + @SerializedName("media_list") + private UploadMediaList mediaList; @SerializedName("status") private Integer status; @SerializedName("finish_all_aftersale") diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopAfterSaleUploadReturnInfoRequest.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopAfterSaleUploadReturnInfoRequest.java new file mode 100644 index 0000000000..aa7f713922 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopAfterSaleUploadReturnInfoRequest.java @@ -0,0 +1,31 @@ +package cn.binarywang.wx.miniapp.bean.shop.request; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author leiin + * @date 2022/6/28 11:39 上午 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class WxMaShopAfterSaleUploadReturnInfoRequest implements Serializable { + @SerializedName("out_aftersale_id") + private String outAftersaleId; + @SerializedName("aftersale_id") + private Long aftersaleId; + @SerializedName("openid") + private String openid; + @SerializedName("delivery_id") + private String deliveryId; + @SerializedName("waybill_id") + private String waybillId; + @SerializedName("delivery_name") + private String deliveryName; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopUploadCerficatesRequest.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopUploadCerficatesRequest.java new file mode 100644 index 0000000000..4e4aae4dbe --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopUploadCerficatesRequest.java @@ -0,0 +1,28 @@ +package cn.binarywang.wx.miniapp.bean.shop.request; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import java.util.List; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author leiin + * @date 2022/6/28 11:39 上午 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class WxMaShopUploadCerficatesRequest implements Serializable { + @SerializedName("out_aftersale_id") + private String outAftersaleId; + @SerializedName("aftersale_id") + private Long aftersaleId; + @SerializedName("refund_desc") + private String refundDesc; + @SerializedName("certificates") + private List certificates; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopAfterSaleAddResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopAfterSaleAddResponse.java new file mode 100644 index 0000000000..c376d3bcbd --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopAfterSaleAddResponse.java @@ -0,0 +1,15 @@ +package cn.binarywang.wx.miniapp.bean.shop.response; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; + +/** + * @author leiin + * @date 2022/6/28 11:29 上午 + */ +@Data +public class WxMaShopAfterSaleAddResponse extends WxMaShopBaseResponse implements Serializable { + @SerializedName("aftersale_id") + private String aftersaleId; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopAfterSaleGetResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopAfterSaleGetResponse.java index ac8f68db66..2261ad3dda 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopAfterSaleGetResponse.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopAfterSaleGetResponse.java @@ -1,5 +1,6 @@ package cn.binarywang.wx.miniapp.bean.shop.response; +import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAfterSaleAddRequest.UploadMediaList; import com.google.gson.annotations.SerializedName; import lombok.Data; import lombok.EqualsAndHashCode; @@ -29,24 +30,43 @@ public static class AftersaleInfosBean implements Serializable { * product_infos : [{"out_product_id":"234245","out_sku_id":"23424","product_cnt":5}] */ - @SerializedName("out_order_id") - private String outOrderId; + @SerializedName("aftersale_id") + private Long aftersaleId; @SerializedName("out_aftersale_id") private String outAftersaleId; - @SerializedName("openid") - private String openid; + @SerializedName("out_order_id") + private String outOrderId; + @SerializedName("order_id") + private Long orderId; + @SerializedName("product_info") + private List productInfo; @SerializedName("type") private Integer type; - @SerializedName("create_time") - private String createTime; - @SerializedName("path") - private String path; + @SerializedName("return_info") + private ReturnInfo returnInfo; + @SerializedName("orderamt") + private Long orderamt; + @SerializedName("refund_reason") + private String refundReason; + @SerializedName("refund_reason_type") + private Integer refundReasonType; + @SerializedName("media_list") + private UploadMediaList mediaList; @SerializedName("status") private Integer status; - @SerializedName("refund") - private Long refund; - @SerializedName("product_infos") - private List productInfos; + @SerializedName("create_time") + private String createTime; + @SerializedName("update_time") + private String updateTime; + @SerializedName("openid") + private String openid; + @SerializedName("refund_pay_detail") + private RefundPayDetail refund_pay_detail; + @SerializedName("return_id") + private String returnId; + @SerializedName("complaint_order_id_list") + private List complaintOrderIdList; + @Data public static class ProductInfosBean implements Serializable { @@ -58,10 +78,32 @@ public static class ProductInfosBean implements Serializable { @SerializedName("out_product_id") private String outProductId; + @SerializedName("product_id") + private Long productId; @SerializedName("out_sku_id") private String outSkuId; + @SerializedName("sku_id") + private Long skuId; @SerializedName("product_cnt") private Integer productCnt; } + + @Data + public static class ReturnInfo { + @SerializedName("order_return_time") + private Long orderReturnTime; + @SerializedName("delivery_id") + private String deliveryId; + @SerializedName("waybill_id") + private String waybillId; + @SerializedName("delivery_name") + private String deliveryName; + } + + @Data + public static class RefundPayDetail { + @SerializedName("refund_id") + private String refundId; + } } } diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopAfterSaleListResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopAfterSaleListResponse.java new file mode 100644 index 0000000000..1e4fb93ad1 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopAfterSaleListResponse.java @@ -0,0 +1,25 @@ +package cn.binarywang.wx.miniapp.bean.shop.response; + +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAfterSaleGetResponse.AftersaleInfosBean; +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import java.util.List; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author leiin + * @date 2022/6/28 11:39 上午 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class WxMaShopAfterSaleListResponse extends WxMaShopBaseResponse implements Serializable { + @SerializedName("has_more") + private Boolean hasMore; + @SerializedName("after_sales_orders") + private List afterSalesOrders; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopBaseResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopBaseResponse.java index 4332c130c4..2156be2297 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopBaseResponse.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopBaseResponse.java @@ -21,7 +21,7 @@ public class WxMaShopBaseResponse implements Serializable { *
*/ @SerializedName("errcode") - private Integer errcode; + private Integer errCode; /** * 错误信息 @@ -30,5 +30,5 @@ public class WxMaShopBaseResponse implements Serializable { * */ @SerializedName("errmsg") - private String errmsg; + private String errMsg; } diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopCouponListResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopCouponListResponse.java new file mode 100644 index 0000000000..5d77c360fd --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopCouponListResponse.java @@ -0,0 +1,23 @@ +package cn.binarywang.wx.miniapp.bean.shop.response; + +import cn.binarywang.wx.miniapp.bean.shop.WxMaShopCouponInfo; +import com.google.gson.annotations.SerializedName; +import java.util.List; +import lombok.Data; + +/** + * @author leiin + * @date 2022/7/1 3:34 下午 + */ +@Data +public class WxMaShopCouponListResponse extends WxMaShopBaseResponse { + @SerializedName("total_num") + private Long totalNum; + @SerializedName("result_list") + private List resultList; + + @Data + public static class ResponseCouponResult { + private WxMaShopCouponInfo coupon; + } +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopCouponResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopCouponResponse.java new file mode 100644 index 0000000000..f83c159d1b --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopCouponResponse.java @@ -0,0 +1,18 @@ +package cn.binarywang.wx.miniapp.bean.shop.response; + +import cn.binarywang.wx.miniapp.bean.shop.WxMaShopCouponInfo; +import lombok.Data; + +/** + * @author leiin + * @date 2022/7/1 3:34 下午 + */ +@Data +public class WxMaShopCouponResponse extends WxMaShopBaseResponse { + private ResponseCouponResult result; + + @Data + public static class ResponseCouponResult { + private WxMaShopCouponInfo coupon; + } +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopUserCouponListResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopUserCouponListResponse.java new file mode 100644 index 0000000000..6f615554bc --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopUserCouponListResponse.java @@ -0,0 +1,76 @@ +package cn.binarywang.wx.miniapp.bean.shop.response; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import java.util.List; +import lombok.Data; + +/** + * @author leiin + * @date 2022/7/1 3:59 下午 + */ +@Data +public class WxMaShopUserCouponListResponse extends WxMaShopBaseResponse implements Serializable { + + private static final long serialVersionUID = 3264119403757388410L; + + @SerializedName("total_num") + private Long totalNum; + @SerializedName("result_list") + private List resultList; + + @Data + public static class UserCouponResultItem { + + /** + * 商家侧用户优惠券ID + */ + @SerializedName("out_user_coupon_id") + private String outUserCouponId; + /** + * openid + */ + @SerializedName("openid") + private String openid; + /** + * 商家侧优惠券ID + */ + @SerializedName("out_coupon_id") + private String outCouponId; + /** + * 用户优惠券状态 + */ + @SerializedName("status") + private Integer status; + /** + * 用户优惠券创建时间 + */ + @SerializedName("create_time") + private Long createTime; + /** + * 用户优惠券更新时间 + */ + @SerializedName("update_time") + private Long updateTime; + /** + * 用户优惠券有效开始时间 + */ + @SerializedName("start_time") + private Long startTime; + /** + * 用户优惠券有效结束时间 + */ + @SerializedName("end_time") + private Long endTime; + + @SerializedName("ext_info") + private UserCouponExtInfo extInfo; + + @Data + public static class UserCouponExtInfo { + @SerializedName("use_time") + private Long useTime; + } + } + +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/WxMaApiUrlConstants.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/WxMaApiUrlConstants.java index fbe7c36cb0..97f53a3c62 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/WxMaApiUrlConstants.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/WxMaApiUrlConstants.java @@ -418,10 +418,27 @@ interface Sku { String PRODUCT_UPDATE_SKU_URL = "https://api.weixin.qq.com/product/sku/update"; String PRODUCT_UPDATE_SKU_PRICE_URL = "https://api.weixin.qq.com/product/sku/update_price"; String PRODUCT_UPDATE_SKU_STOCK_URL = "https://api.weixin.qq.com/product/stock/update"; + String PRODUCT_SKU_LIST = "https://api.weixin.qq.com/product/sku/get_list"; } interface Order { String PRODUCT_ORDER_GET_LIST = "https://api.weixin.qq.com/product/order/get_list"; + String PRODUCT_ORDER_DETAIL_URL = "https://api.weixin.qq.com/product/order/get"; + String PRODUCT_ORDER_CHANGE_MERCHANT_NOTES_URL = "https://api.weixin.qq.com/product/order/change_merchant_notes"; + + String PRODUCT_DELIVERY_SEND = "https://api.weixin.qq.com/product/delivery/send"; + + String GET_AFTER_SALE_ORDER = "https://api.weixin.qq.com/product/order/getaftersaleorder"; + String BATCH_GET_AFTER_SALE_ORDER = "https://api.weixin.qq.com/product/order/batchgetaftersaleorder"; + String AFTER_SALE_ACCEPT_APPLY = "https://api.weixin.qq.com/product/order/acceptapply"; + String AFTER_SALE_REJECT_APPLY = "https://api.weixin.qq.com/product/order/rejectrefund"; + } + + interface OTHER { + String GET_CATEGORY = "https://api.weixin.qq.com/product/category/get"; + String GET_BRAND = "https://api.weixin.qq.com/product/brand/get"; + String GET_FREIGHT_TEMPLATE = "https://api.weixin.qq.com/product/delivery/get_freight_template"; + String IMG_UPLOAD = "https://api.weixin.qq.com/product/img/upload"; } } @@ -483,9 +500,17 @@ interface Delivery { } interface Aftersale { - String AFTERSALE_ADD = "https://api.weixin.qq.com/shop/aftersale/add"; - String AFTERSALE_GET = "https://api.weixin.qq.com/shop/aftersale/get"; - String AFTERSALE_UPDATE = "https://api.weixin.qq.com/shop/aftersale/update"; + String AFTERSALE_ADD = "https://api.weixin.qq.com/shop/ecaftersale/add"; + String AFTERSALE_CANCEL = "https://api.weixin.qq.com/shop/ecaftersale/cancel"; + String AFTERSALE_UPDATE = "https://api.weixin.qq.com/shop/ecaftersale/update"; + String AFTERSALE_UPLOAD_RETURN_INFO = "https://api.weixin.qq.com/shop/ecaftersale/uploadreturninfo"; + String AFTERSALE_ACCEPT_REFUND = "https://api.weixin.qq.com/shop/ecaftersale/acceptrefund"; + String AFTERSALE_ACCEPT_RETURN = "https://api.weixin.qq.com/shop/ecaftersale/acceptreturn"; + String AFTERSALE_REJECT = "https://api.weixin.qq.com/shop/ecaftersale/reject"; + String AFTERSALE_UPLOAD_CERTIFICATES = "https://api.weixin.qq.com/shop/ecaftersale/upload_certificates"; + String AFTERSALE_UPLOAD_DEADLINE = "https://api.weixin.qq.com/shop/aftersale/update_deadline"; + String AFTERSALE_GET_LIST = "https://api.weixin.qq.com/shop/ecaftersale/get_list"; + String AFTERSALE_GET = "https://api.weixin.qq.com/shop/ecaftersale/get"; } interface Sharer { @@ -497,6 +522,19 @@ interface Sharer { String SEARCH_SHARER = "https://api.weixin.qq.com/shop/sharer/search_sharer"; String UNBIND = "https://api.weixin.qq.com/shop/sharer/unbind"; } + + interface Coupon { + String ADD_COUPON = "https://api.weixin.qq.com/shop/coupon/add"; + String GET_COUPON = "https://api.weixin.qq.com/shop/coupon/get"; + String GET_COUPON_LIST = "https://api.weixin.qq.com/shop/coupon/get_list"; + String UPDATE_COUPON = "https://api.weixin.qq.com/shop/coupon/update"; + String UPDATE_COUPON_STATUS = "https://api.weixin.qq.com/shop/coupon/update_status"; + String UPDATE_COUPON_STOCK = "https://api.weixin.qq.com/shop/coupon/update_coupon_stock"; + String ADD_USER_COUPON = "https://api.weixin.qq.com/shop/coupon/add_user_coupon"; + String GET_USER_COUPON_LIST = "https://api.weixin.qq.com/shop/coupon/get_usercoupon_list"; + String UPDATE_USER_COUPON = "https://api.weixin.qq.com/shop/coupon/update_user_coupon"; + String UPDATE_USER_COUPON_STATUS = "https://api.weixin.qq.com/shop/coupon/update_usercoupon_status"; + } } /** diff --git a/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopAfterSaleServiceImplTest.java b/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopAfterSaleServiceImplTest.java index 75538a1510..9839cbf4c1 100644 --- a/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopAfterSaleServiceImplTest.java +++ b/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopAfterSaleServiceImplTest.java @@ -38,12 +38,11 @@ public void testAdd() throws WxErrorException { .outAftersaleId("318092069606883328X") .openid("odIi15CuQ0IQviqsnUMy6CKNetrMX") .type(1) - .createTime("2021-08-20 00:00:00") .status(1) .finishAllAftersale(0) .path("/pages/aftersale.html?out_aftersale_id=318092069606883328X") .refund(100L) - .productInfos(new ArrayList<>(Arrays.asList(productInfosBean))) + .productInfo(productInfosBean) .build(); WxMaShopBaseResponse response = wxService.getShopAfterSaleService().add(request); assertThat(response).isNotNull();