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 bdbb47268..55af89289 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 @@ -377,4 +377,29 @@ public interface WxMaService extends WxService { */ WxImgProcService getImgProcService(); +// /** +// * 返回小程序交易组件-售后服务接口 +// * @return +// */ +// WxMaShopAfterSaleService getShopAfterSaleService(); +// +// +// /** +// * 返回小程序交易组件-物流服务接口 +// * @return +// */ +// WxMaShopDeliveryService getShopDeliveryService(); + + + /** + * 返回小程序交易组件-订单服务接口 + * @return + */ + WxMaShopOrderService getShopOrderService(); + + /** + * 返回小程序交易组件-spu商品服务接口 + * @return + */ + WxMaShopSpuService getShopSpuService(); } 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 new file mode 100644 index 000000000..6e9878c9f --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopAfterSaleService.java @@ -0,0 +1,10 @@ +package cn.binarywang.wx.miniapp.api; + +/** + * 小程序交易组件-售后服务 + * + * @author boris + */ +public interface WxMaShopAfterSaleService { + +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopDeliveryService.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopDeliveryService.java new file mode 100644 index 000000000..2a3a11986 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopDeliveryService.java @@ -0,0 +1,10 @@ +package cn.binarywang.wx.miniapp.api; + +/** + * 小程序交易组件-物流发货服务 + * + * @author boris + */ +public interface WxMaShopDeliveryService { + +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopOrderService.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopOrderService.java new file mode 100644 index 000000000..50b39fb6e --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopOrderService.java @@ -0,0 +1,24 @@ +package cn.binarywang.wx.miniapp.api; + +import cn.binarywang.wx.miniapp.bean.shop.WxMaShopOrderInfo; +import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopOrderPayRequest; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAddOrderResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopGetOrderResponse; +import me.chanjar.weixin.common.error.WxErrorException; + +/** + * 小程序交易组件-订单服务 + * + * @author boris + */ +public interface WxMaShopOrderService { + Boolean checkScene(Integer scene) throws WxErrorException; + + WxMaShopAddOrderResponse addOrder(WxMaShopOrderInfo orderInfo) throws WxErrorException; + + WxMaShopBaseResponse orderPay(WxMaShopOrderPayRequest request) throws WxErrorException; + + WxMaShopGetOrderResponse getOrder(Integer orderId, String outOrderId, String openid) + throws WxErrorException; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopSpuService.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopSpuService.java new file mode 100644 index 000000000..183d23967 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopSpuService.java @@ -0,0 +1,38 @@ +package cn.binarywang.wx.miniapp.api; + +import cn.binarywang.wx.miniapp.bean.shop.WxMaShopSpuInfo; +import cn.binarywang.wx.miniapp.bean.shop.WxMaShopSpuWithoutAuditInfo; +import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopSpuPageRequest; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAddSpuResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopGetSpuListResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopGetSpuResponse; +import me.chanjar.weixin.common.error.WxErrorException; + +/** + * 小程序交易组件-商品服务 + * + * @author boris + */ +public interface WxMaShopSpuService { + WxMaShopAddSpuResponse addSpu(WxMaShopSpuInfo spuInfo) throws WxErrorException; + + WxMaShopBaseResponse deleteSpu(Integer productId, String outProductId) throws WxErrorException; + + WxMaShopGetSpuResponse getSpu(Integer productId, String outProductId, Integer needEditSpu) + throws WxErrorException; + + WxMaShopGetSpuListResponse getSpuList(WxMaShopSpuPageRequest request) + throws WxErrorException; + + WxMaShopAddSpuResponse updateSpu(WxMaShopSpuInfo spuInfo) throws WxErrorException; + + WxMaShopAddSpuResponse updateSpuWithoutAudit(WxMaShopSpuWithoutAuditInfo spuInfo) + throws WxErrorException; + + WxMaShopBaseResponse listingSpu(Integer productId, String outProductId) + throws WxErrorException; + + WxMaShopBaseResponse delistingSpu(Integer productId, String outProductId) + 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 ebbcbfc69..7d0d96da9 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 @@ -63,6 +63,8 @@ public abstract class BaseWxMaServiceImpl implements WxMaService, RequestH private final WxMaLiveMemberService liveMemberService = new WxMaLiveMemberServiceImpl(this); private final WxOcrService ocrService = new WxMaOcrServiceImpl(this); private final WxImgProcService imgProcService = new WxMaImgProcServiceImpl(this); + private final WxMaShopSpuService shopSpuService = new WxMaShopSpuServiceImpl(this); + private final WxMaShopOrderService shopOrderService = new WxMaShopOrderServiceImpl(this); private Map configMap; private int retrySleepMillis = 1000; private int maxRetryTimes = 5; @@ -499,4 +501,13 @@ public WxImgProcService getImgProcService() { return this.imgProcService; } + @Override + public WxMaShopSpuService getShopSpuService() { + return this.shopSpuService; + } + + @Override + public WxMaShopOrderService getShopOrderService() { + return this.shopOrderService; + } } 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 new file mode 100644 index 000000000..85fdb90b6 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopAfterSaleServiceImpl.java @@ -0,0 +1,19 @@ +package cn.binarywang.wx.miniapp.api.impl; + +import cn.binarywang.wx.miniapp.api.WxMaService; +import cn.binarywang.wx.miniapp.api.WxMaShopAfterSaleService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author boris + */ +@RequiredArgsConstructor +@Slf4j +public class WxMaShopAfterSaleServiceImpl implements WxMaShopAfterSaleService { + private final WxMaService service; + + + + +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopDeliveryServiceImpl.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopDeliveryServiceImpl.java new file mode 100644 index 000000000..9b6a093eb --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopDeliveryServiceImpl.java @@ -0,0 +1,16 @@ +package cn.binarywang.wx.miniapp.api.impl; + +import cn.binarywang.wx.miniapp.api.WxMaService; +import cn.binarywang.wx.miniapp.api.WxMaShopDeliveryService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author boris + */ +@RequiredArgsConstructor +@Slf4j +public class WxMaShopDeliveryServiceImpl implements WxMaShopDeliveryService { + private final WxMaService service; + +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopOrderServiceImpl.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopOrderServiceImpl.java new file mode 100644 index 000000000..ff466ded6 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopOrderServiceImpl.java @@ -0,0 +1,78 @@ +package cn.binarywang.wx.miniapp.api.impl; + +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Order.ORDER_ADD; +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Order.ORDER_CHECK_SCENE; +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Order.ORDER_GET; +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Order.ORDER_PAY; + +import cn.binarywang.wx.miniapp.api.WxMaService; +import cn.binarywang.wx.miniapp.api.WxMaShopOrderService; +import cn.binarywang.wx.miniapp.bean.shop.WxMaShopOrderInfo; +import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopOrderPayRequest; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAddOrderResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopGetOrderResponse; +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 boris + */ +@RequiredArgsConstructor +@Slf4j +public class WxMaShopOrderServiceImpl implements WxMaShopOrderService { + private static final String ERR_CODE = "errcode"; + private static final String MATCH_KEY = "is_matched"; + private final WxMaService wxMaService; + + @Override + public Boolean checkScene(Integer scene) throws WxErrorException { + String responseContent = this.wxMaService + .post(ORDER_CHECK_SCENE, GsonHelper.buildJsonObject("scene", scene)); + JsonObject jsonObject = GsonParser.parse(responseContent); + if (jsonObject.get(ERR_CODE).getAsInt() != 0) { + throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp)); + } + return jsonObject.get(MATCH_KEY).getAsBoolean(); + } + + @Override + public WxMaShopAddOrderResponse addOrder(WxMaShopOrderInfo orderInfo) throws WxErrorException { + String responseContent = this.wxMaService.post(ORDER_ADD, orderInfo); + 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, WxMaShopAddOrderResponse.class); + } + + @Override + public WxMaShopBaseResponse orderPay(WxMaShopOrderPayRequest request) throws WxErrorException { + String responseContent = this.wxMaService.post(ORDER_PAY, request); + 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 WxMaShopGetOrderResponse getOrder(Integer orderId, String outOrderId, String openid) + throws WxErrorException { + String responseContent = this.wxMaService.post(ORDER_GET, + GsonHelper.buildJsonObject("order_id", orderId, "out_order_id", outOrderId, + "openid", openid)); + 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, WxMaShopGetOrderResponse.class); + } +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopSpuServiceImpl.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopSpuServiceImpl.java new file mode 100644 index 000000000..4be695a07 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopSpuServiceImpl.java @@ -0,0 +1,134 @@ +package cn.binarywang.wx.miniapp.api.impl; + +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Spu.SPU_ADD_URL; +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Spu.SPU_DELISTING_URL; +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Spu.SPU_DEL_URL; +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Spu.SPU_GET_LIST_URL; +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Spu.SPU_GET_URL; +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Spu.SPU_LISTING_URL; +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Spu.SPU_UPDATE_URL; +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Spu.SPU_UPDATE_WITHOUT_URL; + +import cn.binarywang.wx.miniapp.api.WxMaService; +import cn.binarywang.wx.miniapp.api.WxMaShopSpuService; +import cn.binarywang.wx.miniapp.bean.shop.WxMaShopSpuInfo; +import cn.binarywang.wx.miniapp.bean.shop.WxMaShopSpuWithoutAuditInfo; +import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopSpuPageRequest; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAddSpuResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopGetSpuListResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopGetSpuResponse; +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 boris + */ +@RequiredArgsConstructor +@Slf4j +public class WxMaShopSpuServiceImpl implements WxMaShopSpuService { + + private static final String ERR_CODE = "errcode"; + private final WxMaService wxMaService; + + @Override + public WxMaShopAddSpuResponse addSpu(WxMaShopSpuInfo spuInfo) throws WxErrorException { + String responseContent = this.wxMaService.post(SPU_ADD_URL, spuInfo); + 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, WxMaShopAddSpuResponse.class); + } + + @Override + public WxMaShopBaseResponse deleteSpu(Integer productId, String outProductId) + throws WxErrorException { + String responseContent = this.wxMaService + .post(SPU_DEL_URL, GsonHelper.buildJsonObject("product_id", productId, + "out_product_id", outProductId)); + 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 WxMaShopGetSpuResponse getSpu(Integer productId, String outProductId, Integer needEditSpu) + throws WxErrorException { + String responseContent = this.wxMaService + .post(SPU_GET_URL, GsonHelper.buildJsonObject("product_id", productId, + "out_product_id", outProductId, "need_edit_spu", needEditSpu)); + 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, WxMaShopGetSpuResponse.class); + } + + @Override + public WxMaShopGetSpuListResponse getSpuList(WxMaShopSpuPageRequest request) + throws WxErrorException { + String responseContent = this.wxMaService.post(SPU_GET_LIST_URL, request); + 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, WxMaShopGetSpuListResponse.class); + } + + @Override + public WxMaShopAddSpuResponse updateSpu(WxMaShopSpuInfo spuInfo) throws WxErrorException { + String responseContent = this.wxMaService.post(SPU_UPDATE_URL, spuInfo); + 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, WxMaShopAddSpuResponse.class); + } + + @Override + public WxMaShopAddSpuResponse updateSpuWithoutAudit(WxMaShopSpuWithoutAuditInfo spuInfo) + throws WxErrorException { + String responseContent = this.wxMaService.post(SPU_UPDATE_WITHOUT_URL, spuInfo); + 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, WxMaShopAddSpuResponse.class); + } + + @Override + public WxMaShopBaseResponse listingSpu(Integer productId, String outProductId) + throws WxErrorException { + String responseContent = this.wxMaService + .post(SPU_LISTING_URL, GsonHelper.buildJsonObject("product_id", productId, + "out_product_id", outProductId)); + 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 delistingSpu(Integer productId, String outProductId) + throws WxErrorException { + String responseContent = this.wxMaService + .post(SPU_DELISTING_URL, GsonHelper.buildJsonObject("product_id", productId, + "out_product_id", outProductId)); + 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/shop/WxMaShopAddOrderResult.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopAddOrderResult.java new file mode 100644 index 000000000..310a07a39 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopAddOrderResult.java @@ -0,0 +1,41 @@ +package cn.binarywang.wx.miniapp.bean.shop; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; + +/** + * @author leiin + * @date 2021/3/23 + * @description: + */ +@Data +public class WxMaShopAddOrderResult implements Serializable { + /** + * 交易组件平台订单ID + */ + @SerializedName("order_id") + private Long orderId; + /** + * 交易组件平台订单ID + */ + @SerializedName("out_order_id") + private String outOrderId; + /** + * 拉起收银台的ticket + */ + @SerializedName("ticket") + private String ticket; + /** + * ticket有效截止时间 + */ + @SerializedName("ticket_expire_time") + private String ticketExpireTime; + /** + * 订单最终价格(单位:分) + */ + @SerializedName("final_price") + private Integer finalPrice; + +} + diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopAddSpuResult.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopAddSpuResult.java new file mode 100644 index 000000000..561bb114e --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopAddSpuResult.java @@ -0,0 +1,60 @@ +package cn.binarywang.wx.miniapp.bean.shop; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import java.util.List; +import lombok.Data; + +/** + * @author leiin + * @date 2021/3/23 + * @description: 添加商品参数返回 + */ +@Data +public class WxMaShopAddSpuResult implements Serializable { + + private static final long serialVersionUID = 2520459849240776617L; + /** + * 交易组件平台内部商品ID + *
+   * 是否必填:
+   * 
+ */ + @SerializedName("product_id") + private String productId; + + /** + * 商家自定义商品ID + *
+   * 是否必填:
+   * 
+ */ + @SerializedName("out_product_id") + private String outProductId; + + /** + * 创建时间,新建时返回 + *
+   * 是否必填:
+   * 
+ */ + @SerializedName("create_time") + private String createTime; + + /** + * 更新时间,修改时返回 + *
+   * 是否必填:
+   * 
+ */ + @SerializedName("update_time") + private String updateTime; + /** + * sku数组 + *
+   * 是否必填:
+   * 
+ */ + @SerializedName("skus") + private List skus; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopAddressInfo.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopAddressInfo.java new file mode 100644 index 000000000..4440205c5 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopAddressInfo.java @@ -0,0 +1,70 @@ +package cn.binarywang.wx.miniapp.bean.shop; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; + +/** + * @author leiin + * @date 2021/3/23 + * @description: + */ +@Data +public class WxMaShopAddressInfo implements Serializable { + /** + * 收件人姓名 + *
+   * 是否必填:是
+   * 
+ */ + @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/WxMaShopDeliveryDetail.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopDeliveryDetail.java new file mode 100644 index 000000000..38d578a95 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopDeliveryDetail.java @@ -0,0 +1,41 @@ +package cn.binarywang.wx.miniapp.bean.shop; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import java.util.List; +import lombok.Data; + +/** + * @author leiin + * @date 2021/3/23 + * @description: + */ +@Data +public class WxMaShopDeliveryDetail implements Serializable { + + private static final long serialVersionUID = 9074573142867543744L; + + /** + * + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("delivery_type") + private Integer deliveryType; + + // 以下字段仅作为返回数据展示填充 + + /** + * 是否发货完成 + */ + @SerializedName("finish_all_delivery") + private Integer finishAllDelivery; + + /** + * 快递信息 + */ + @SerializedName("delivery_list") + private List deliveryList; +} + diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopDeliveryItem.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopDeliveryItem.java new file mode 100644 index 000000000..47289acd6 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopDeliveryItem.java @@ -0,0 +1,28 @@ +package cn.binarywang.wx.miniapp.bean.shop; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; + +/** + * @author leiin + * @date 2021/3/23 + * @description: + */ +@Data +public class WxMaShopDeliveryItem implements Serializable { + + private static final long serialVersionUID = -161617470937369136L; + + /** + * 快递公司ID,通过获取快递公司列表获取 + */ + @SerializedName("delivery_id") + private String deliveryId; + + /** + * 快递单号 + */ + @SerializedName("waybill_id") + private String waybillId; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopGetSpuResult.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopGetSpuResult.java new file mode 100644 index 000000000..c2d9356db --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopGetSpuResult.java @@ -0,0 +1,59 @@ +package cn.binarywang.wx.miniapp.bean.shop; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; + +/** + * @author leiin + * @date 2021/3/23 + * @description: + */ +@Data +public class WxMaShopGetSpuResult extends WxMaShopSpuInfo implements Serializable { + + private static final long serialVersionUID = -3859372286926181933L; + /** + * 商品审核信息 + *
+   * 是否必填:
+   * 
+ */ + @SerializedName("audit_info") + private WxMaShopSpuAudit auditInfo; + + /** + * 商品线上状态 + *
+   * 是否必填:
+   * 
+ */ + @SerializedName("status") + private Integer status; + + /** + * 商品草稿状态 + *
+   * 是否必填:
+   * 
+ */ + @SerializedName("edit_status") + private Integer editStatus; + /** + * 创建时间 + *
+   * 是否必填:
+   * 
+ */ + @SerializedName("create_time") + private String createTime; + + /** + * 更新时间 + *
+   * 是否必填:
+   * 
+ */ + @SerializedName("update_time") + private String updateTime; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopOrderDetail.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopOrderDetail.java new file mode 100644 index 000000000..afaac18ea --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopOrderDetail.java @@ -0,0 +1,55 @@ +package cn.binarywang.wx.miniapp.bean.shop; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import java.util.List; +import lombok.Data; + +/** + * @author leiin + * @date 2021/3/23 + * @description: + */ +@Data +public class WxMaShopOrderDetail implements Serializable { + + /** + * 下单商品信息 + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("product_infos") + private List productInfos; + + /** + * 支付信息 (当作为返回结果,payorder时action_type!=6时存在) + *
+   * 是否必填:
+   * 
+ */ + @SerializedName("pay_info") + private WxMaShopPayInfo payInfo; + + /** + * 价格信息 + *
+   * 是否必填:
+   * 
+ */ + @SerializedName("price_info") + private WxMaShopPriceInfo priceInfo; + + // 以下字段仅作为结果返回展示字段 + /** + * payorder时action_type=6时存在 + */ + @SerializedName("multi_pay_info") + private List multiPayInfo; + + /** + * 必须调过发货接口才会存在这个字段 + */ + @SerializedName("delivery_detail") + private WxMaShopDeliveryDetail deliveryDetail; +} 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 new file mode 100644 index 000000000..73499a182 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopOrderInfo.java @@ -0,0 +1,84 @@ +package cn.binarywang.wx.miniapp.bean.shop; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; + +@Data +public class WxMaShopOrderInfo implements Serializable { + + private static final long serialVersionUID = -159624260640727372L; + + /** + * 创建时间 + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("create_time") + private String createTime; + + /** + * 商家自定义订单ID + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("out_order_id") + private String outOrderId; + + /** + * 用户的openid + *
+   * 是否必填:
+   * 
+ */ + @SerializedName("openid") + private String openid; + + /** + * 商家小程序该订单的页面path,用于微信侧订单中心跳转 + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("path") + private String path; + + /** + * 商家小程序该订单的用户id + *
+   * 是否必填:否
+   * 
+ */ + @SerializedName("out_user_id") + private String outUserId; + + /** + * 订单详情 + *
+   * 是否必填:
+   * 
+ */ + @SerializedName("order_detail") + private WxMaShopOrderDetail orderDetail; + + /** + * 快递信息 + *
+   * 是否必填:
+   * 
+ */ + @SerializedName("delivery_detail") + private WxMaShopDeliveryDetail deliveryDetail; + + /** + * 地址信息 + *
+   * 是否必填:
+   * 
+ */ + @SerializedName("address_info") + private WxMaShopAddressInfo addressInfo; + +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopOrderResult.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopOrderResult.java new file mode 100644 index 000000000..272e0b3fe --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopOrderResult.java @@ -0,0 +1,52 @@ +package cn.binarywang.wx.miniapp.bean.shop; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; + +/** + * @author leiin + * @date 2021/3/23 + * @description: + */ +@Data +public class WxMaShopOrderResult implements Serializable { + + private static final long serialVersionUID = -2665426592693969921L; + + /** + * 交易组件平台订单ID + */ + @SerializedName("order_id") + private Long orderId; + + /** + * 商家自定义订单ID + */ + @SerializedName("out_order_id") + private String outOrderId; + + /** + * 订单状态 + */ + @SerializedName("status") + private Integer status; + + /** + * 商家小程序该订单的页面path,用于微信侧订单中心跳转 + */ + @SerializedName("path") + private String path; + + /** + * 商家小程序该订单的用户id + */ + @SerializedName("out_user_id") + private String outUserId; + + /** + * 订单详情 + */ + @SerializedName("order_detail") + private WxMaShopOrderDetail orderDetail; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopPayInfo.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopPayInfo.java new file mode 100644 index 000000000..5a03b369e --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopPayInfo.java @@ -0,0 +1,62 @@ +package cn.binarywang.wx.miniapp.bean.shop; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; + +/** + * @author leiin + * @date 2021/3/23 + * @description: + */ +@Data +public class WxMaShopPayInfo implements Serializable { + + private static final long serialVersionUID = 687488209024968647L; + + /** + * 支付方式(目前只有"微信支付") + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("pay_method") + private String payMethod; + + /** + * 预支付ID + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("prepay_id") + private String prepayId; + + /** + * 预付款时间(拿到prepay_id的时间) + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("prepay_time") + private String prepayTime; + + // 以下字段仅作为返回数据 + /** + * 支付ID,调过同步订单支付结果且action_type=1时才存在 + *
+   * 是否必填:
+   * 
+ */ + @SerializedName("transaction_id") + private String transactionId; + + /** + * 付款时间(拿到transaction_id的时间) + *
+   * 是否必填:
+   * 
+ */ + @SerializedName("pay_time") + private String payTime; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopPriceInfo.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopPriceInfo.java new file mode 100644 index 000000000..33df70f46 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopPriceInfo.java @@ -0,0 +1,56 @@ +package cn.binarywang.wx.miniapp.bean.shop; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; + +/** + * @author leiin + * @date 2021/3/23 + * @description: + */ +@Data +public class WxMaShopPriceInfo implements Serializable { + + private static final long serialVersionUID = 1588840927992523263L; + /** + * 该订单最终的金额(单位:分) + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("order_price") + private Integer orderPrice; + /** + * 运费(单位:分) + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("freight") + private Integer freight; + /** + * 优惠金额(单位:分) + *
+   * 是否必填:否
+   * 
+ */ + @SerializedName("discounted_price") + private Integer discountedPrice; + /** + * 附加金额(单位:分) + *
+   * 是否必填:否
+   * 
+ */ + @SerializedName("additional_price") + private Integer additionalPrice; + /** + * 附加金额备注 + *
+   * 是否必填:否
+   * 
+ */ + @SerializedName("additional_remarks") + private String additionalRemarks; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopProductInfo.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopProductInfo.java new file mode 100644 index 000000000..7023f6a23 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopProductInfo.java @@ -0,0 +1,83 @@ +package cn.binarywang.wx.miniapp.bean.shop; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; + +/** + * @author leiin + * @date 2021/3/23 + * @description: + */ +@Data +public class WxMaShopProductInfo { + /** + * 商家自定义商品ID + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("out_product_id") + private String outProductId; + /** + * 商家自定义商品skuID,可填空字符串(如果这个product_id下没有sku) + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("out_sku_id") + private String outSkuId; + /** + * 购买的数量 + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("product_cnt") + private Integer productCnt; + /** + * 生成订单时商品的售卖价(单位:分),可以跟上传商品接口的价格不一致 + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("sale_price") + private Integer salePrice; + /** + * 生成订单时商品的头图 + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("head_img") + private String headImg; + /** + * 生成订单时商品的标题 + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("title") + private String title; + /** + * 绑定的小程序商品路径 + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("path") + private String path; + + // 以下字段仅作为订单信息返回字段 + /** + * 交易组件平台内部商品ID + */ + @SerializedName("product_id") + private Integer productId; + + /** + * 交易组件平台内部skuID,可填0(如果这个product_id下没有sku) + */ + @SerializedName("sku_id") + private Integer skuId; +} + diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopSkuAttribute.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopSkuAttribute.java new file mode 100644 index 000000000..3cdfc389e --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopSkuAttribute.java @@ -0,0 +1,39 @@ +package cn.binarywang.wx.miniapp.bean.shop; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *
+ * sku对象
+ * 
+ * + * @author boris + * @since 2021-03-22 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class WxMaShopSkuAttribute implements Serializable { + + + private static final long serialVersionUID = -3617077838017818865L; + + + /** + * 销售属性key(自定义) + *
+   * 是否必填: 否
+   * 
+ */ + @SerializedName("attr_key") + private String attrKey; + + @SerializedName("attr_value") + private String attrValue; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopSkuInfo.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopSkuInfo.java new file mode 100644 index 000000000..bfbee0269 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopSkuInfo.java @@ -0,0 +1,111 @@ +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; + +/** + *
+ * sku对象
+ * 
+ * + * @author boris + * @since 2021-03-22 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class WxMaShopSkuInfo implements Serializable { + + + private static final long serialVersionUID = -3617077838017818865L; + + /** + * 商家自定义商品ID + *
+   * 是否必填: 是
+   * 
+ */ + @SerializedName("out_product_id") + private String outProductId; + + /** + * 商家自定义商品ID + *
+   * 是否必填: 是
+   * 
+ */ + @SerializedName("out_sku_id") + private String outSkuId; + + + /** + * sku小图 + *
+   * 是否必填: 是
+   * 
+ */ + @SerializedName("thumb_img") + private String thumbImg; + + /** + * 售卖价格,以分为单位 + *
+   * 是否必填: 是
+   * 
+ */ + @SerializedName("sale_price") + private Integer salePrice; + + /** + * 售卖价格,以分为单位 + *
+   * 是否必填: 是
+   * 
+ */ + @SerializedName("market_price") + private Integer marketPrice; + + /** + * 库存 + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("stock_num") + private Integer stockNum; + + + /** + * 条形码 + *
+   * 是否必填: 否
+   * 
+ */ + @SerializedName("barcode") + private String barcode; + + + /** + * 商品编码 + *
+   * 是否必填: 否
+   * 
+ */ + @SerializedName("sku_code") + private String skuCode; + + /** + * 销售属性 + *
+   * 是否必填: 是
+   * 
+ */ + @SerializedName("sku_attrs") + private List skuAttributeList; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopSkuResult.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopSkuResult.java new file mode 100644 index 000000000..a6ba18b74 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopSkuResult.java @@ -0,0 +1,33 @@ +package cn.binarywang.wx.miniapp.bean.shop; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; + +/** + * @author leiin + * @date 2021/3/23 + * @description: + */ +@Data +public class WxMaShopSkuResult implements Serializable { + + private static final long serialVersionUID = 7127892618805299305L; + /** + * 交易组件平台自定义skuID + *
+   * 是否必填:
+   * 
+ */ + @SerializedName("sku_id") + private String skuId; + + /** + * 商家自定义skuID + *
+   * 是否必填:
+   * 
+ */ + @SerializedName("out_sku_id") + private String outSkuId; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopSkuWithoutAuditInfo.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopSkuWithoutAuditInfo.java new file mode 100644 index 000000000..61b9fec59 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopSkuWithoutAuditInfo.java @@ -0,0 +1,72 @@ +package cn.binarywang.wx.miniapp.bean.shop; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; + +/** + * @author leiin + * @date 2021/3/23 + * @description: + */ +@Data +public class WxMaShopSkuWithoutAuditInfo implements Serializable { + + private static final long serialVersionUID = 3354108922805323888L; + + /** + * 商家自定义skuID + *
+   * 是否必填: 是
+   * 
+ */ + @SerializedName("out_sku_id") + private String outSkuId; + + /** + * 售卖价格,以分为单位 + *
+   * 是否必填: 是
+   * 
+ */ + @SerializedName("sale_price") + private Integer salePrice; + + /** + * 售卖价格,以分为单位 + *
+   * 是否必填: 是
+   * 
+ */ + @SerializedName("market_price") + private Integer marketPrice; + + /** + * 库存 + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("stock_num") + private Integer stockNum; + + + /** + * 条形码 + *
+   * 是否必填: 否
+   * 
+ */ + @SerializedName("barcode") + private String barcode; + + + /** + * 商品编码 + *
+   * 是否必填: 否
+   * 
+ */ + @SerializedName("sku_code") + private String skuCode; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopSpuAudit.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopSpuAudit.java new file mode 100644 index 000000000..2e56c433c --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopSpuAudit.java @@ -0,0 +1,33 @@ +package cn.binarywang.wx.miniapp.bean.shop; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; + +/** + * @author leiin + * @date 2021/3/23 + * @description: + */ +@Data +public class WxMaShopSpuAudit implements Serializable { + + private static final long serialVersionUID = -3793445161382782265L; + /** + * 上一次审核时间, yyyy-MM-dd HH:mm:ss + *
+   * 是否必填:
+   * 
+ */ + @SerializedName("audit_time") + private String auditTime; + + /** + * 拒绝理由 + *
+   * 是否必填:
+   * 
+ */ + @SerializedName("reject_reason") + private String rejectReason; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopSpuDescInfo.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopSpuDescInfo.java new file mode 100644 index 000000000..cfa03824f --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopSpuDescInfo.java @@ -0,0 +1,41 @@ +package cn.binarywang.wx.miniapp.bean.shop; + +import com.google.gson.annotations.SerializedName; +import java.util.List; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *
+ * 交易组件-spu商品详情图文
+ * 
+ * @author boris + * @since 2021-03-22 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class WxMaShopSpuDescInfo { + + /** + * 商品详情图文-描述 + *
+   * 是否必填: 否
+   * 
+ */ + @SerializedName("desc") + private String desc; + + /** + * 商品详情图片 + *
+   * 是否必填: 否
+   * 
+ */ + @SerializedName("imgs") + private List imgList; + +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopSpuInfo.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopSpuInfo.java new file mode 100644 index 000000000..38f66017e --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopSpuInfo.java @@ -0,0 +1,102 @@ +package cn.binarywang.wx.miniapp.bean.shop; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import java.util.List; +import lombok.Data; + +@Data +public class WxMaShopSpuInfo implements Serializable { + + private static final long serialVersionUID = 7237829277693177420L; + + /** + * 交易组件平台内部商品ID,修改时与out_product_id二选一 + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("product_id") + private String productId; + + /** + * 商家自定义商品ID,新建必填,修改时与product_id二选一 + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("out_product_id") + private String outProductId; + + /** + * 标题 + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("title") + private String title; + + /** + * 绑定的小程序商品路径 + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("path") + private String path; + + /** + * 主图,多张,列表 + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("head_img") + private List headImg; + + /** + * 商品资质图片 + *
+   * 是否必填:否
+   * 
+ */ + @SerializedName("qualification_pics") + private List qualificationPics; + + /** + * 商品详情 + *
+   * 是否必填:否
+   * 
+ */ + @SerializedName("desc_info") + private WxMaShopSpuDescInfo descInfo; + + /** + * 第三级类目ID + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("third_cat_id") + private Integer thirdCatId; + + /** + * 品牌id + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("brand_id") + private Integer brandId; + + /** + * sku数组 + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("skus") + private List skus; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopSpuWithoutAuditInfo.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopSpuWithoutAuditInfo.java new file mode 100644 index 000000000..d4cd76b8c --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopSpuWithoutAuditInfo.java @@ -0,0 +1,50 @@ +package cn.binarywang.wx.miniapp.bean.shop; + +import com.google.gson.annotations.SerializedName; +import java.util.List; +import lombok.Data; + +/** + * @author leiin + * @date 2021/3/23 + * @description: + */ +@Data +public class WxMaShopSpuWithoutAuditInfo { + + /** + * 交易组件平台内部商品ID,修改时与out_product_id二选一 + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("product_id") + private String productId; + + /** + * 商家自定义商品ID,新建必填,修改时与product_id二选一 + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("out_product_id") + private String outProductId; + + /** + * 绑定的小程序商品路径 + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("path") + private String path; + + /** + * sku数组 + *
+   * 是否必填:否
+   * 
+ */ + @SerializedName("skus") + private List skus; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopOrderPayRequest.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopOrderPayRequest.java new file mode 100644 index 000000000..c91a7895b --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopOrderPayRequest.java @@ -0,0 +1,74 @@ +package cn.binarywang.wx.miniapp.bean.shop.request; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; + +/** + * @author leiin + * @date 2021/3/23 + * @description: + */ +@Data +public class WxMaShopOrderPayRequest implements Serializable { + + private static final long serialVersionUID = -954667936670521398L; + + /** + * 订单ID + *
+   * 是否必填:否
+   * 
+ */ + @SerializedName("order_id") + private Long orderId; + /** + * 商家自定义订单ID,与 order_id 二选一 + *
+   * 是否必填:否
+   * 
+ */ + @SerializedName("out_order_id") + private String outOrderId; + /** + * 用户的openid + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("openid") + private String openid; + /** + * 类型,默认1:支付成功,2:支付失败,3:用户取消,4:超时未支付;5:商家取消 + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("action_type") + private Integer actionType; + /** + * 其他具体原因 + *
+   * 是否必填:否
+   * 
+ */ + @SerializedName("action_remark") + private String actionRemark; + /** + * 支付订单号,action_type=1时必填 + *
+   * 是否必填:否
+   * 
+ */ + @SerializedName("transaction_id") + private String transactionId; + /** + * 支付完成时间,action_type=1时必填 + *
+   * 是否必填:否
+   * 
+ */ + @SerializedName("pay_time") + private String payTime; +} + diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopSpuPageRequest.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopSpuPageRequest.java new file mode 100644 index 000000000..fbe89d9b0 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopSpuPageRequest.java @@ -0,0 +1,89 @@ +package cn.binarywang.wx.miniapp.bean.shop.request; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; + +/** + * @author leiin + * @date 2021/3/23 + * @description: spu分页参数 + */ +@Data +public class WxMaShopSpuPageRequest implements Serializable { + + private static final long serialVersionUID = -4927300283039328661L; + + /** + * 商品状态 + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("status") + private Integer status; + + /** + * 开始创建时间 + *
+   * 是否必填:否
+   * 
+ */ + @SerializedName("start_create_time") + private String startCreateTime; + + /** + * 结束创建时间 + *
+   * 是否必填:否
+   * 
+ */ + @SerializedName("end_create_time") + private String endCreateTime; + + /** + * 开始更新时间 + *
+   * 是否必填:否
+   * 
+ */ + @SerializedName("start_update_time") + private String startUpdateTime; + + /** + * 结束更新时间 + *
+   * 是否必填:否
+   * 
+ */ + @SerializedName("end_update_time") + private String endUpdateTime; + + /** + * 默认0:获取线上数据, 1:获取草稿数据 + *
+   * 是否必填:否
+   * 
+ */ + @SerializedName("need_edit_spu") + private Integer needEditSpu; + + /** + * 页号 + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("page") + private Integer page; + + /** + * 页面大小 + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("page_size") + private Integer pageSize; + +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopAddOrderResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopAddOrderResponse.java new file mode 100644 index 000000000..509b954dd --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopAddOrderResponse.java @@ -0,0 +1,20 @@ +package cn.binarywang.wx.miniapp.bean.shop.response; + +import cn.binarywang.wx.miniapp.bean.shop.WxMaShopAddOrderResult; +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; + +/** + * @author leiin + * @date 2021/3/23 + * @description: + */ +@Data +public class WxMaShopAddOrderResponse extends WxMaShopBaseResponse implements Serializable { + + private static final long serialVersionUID = -8923439859095040010L; + + @SerializedName("data") + private WxMaShopAddOrderResult date; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopAddSpuResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopAddSpuResponse.java new file mode 100644 index 000000000..a5b159d66 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopAddSpuResponse.java @@ -0,0 +1,21 @@ +package cn.binarywang.wx.miniapp.bean.shop.response; + +import cn.binarywang.wx.miniapp.bean.shop.WxMaShopAddSpuResult; +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; + +/** + * @author leiin + * @date 2021/3/23 + * @description: + */ +@Data +public class WxMaShopAddSpuResponse extends WxMaShopBaseResponse implements Serializable { + + private static final long serialVersionUID = 4370719678135233135L; + + + @SerializedName("data") + private WxMaShopAddSpuResult data; +} 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 new file mode 100644 index 000000000..51ca13392 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopBaseResponse.java @@ -0,0 +1,34 @@ +package cn.binarywang.wx.miniapp.bean.shop.response; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; + +/** + * @author leiin + * @date 2021/3/23 + * @description: + */ +@Data +public class WxMaShopBaseResponse implements Serializable { + + private static final long serialVersionUID = -4647161641538864187L; + + /** + * 错误码 + *
+   * 是否必填:
+   * 
+ */ + @SerializedName("errcode") + private Integer errcode; + + /** + * 错误信息 + *
+   * 是否必填:
+   * 
+ */ + @SerializedName("errmsg") + private String errmsg; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopGetOrderResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopGetOrderResponse.java new file mode 100644 index 000000000..cda070c6e --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopGetOrderResponse.java @@ -0,0 +1,20 @@ +package cn.binarywang.wx.miniapp.bean.shop.response; + +import cn.binarywang.wx.miniapp.bean.shop.WxMaShopOrderResult; +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; + +/** + * @author leiin + * @date 2021/3/23 + * @description: + */ +@Data +public class WxMaShopGetOrderResponse extends WxMaShopBaseResponse implements Serializable { + + private static final long serialVersionUID = -5036075669789800464L; + + @SerializedName("order") + private WxMaShopOrderResult order; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopGetSpuListResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopGetSpuListResponse.java new file mode 100644 index 000000000..ceae2fba5 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopGetSpuListResponse.java @@ -0,0 +1,36 @@ +package cn.binarywang.wx.miniapp.bean.shop.response; + +import cn.binarywang.wx.miniapp.bean.shop.WxMaShopGetSpuResult; +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import java.util.List; +import lombok.Data; + +/** + * @author leiin + * @date 2021/3/23 + * @description: + */ +@Data +public class WxMaShopGetSpuListResponse extends WxMaShopBaseResponse implements Serializable { + + private static final long serialVersionUID = 1423766388278762123L; + + /** + * 总数 + *
+   * 是否必填:
+   * 
+ */ + @SerializedName("total_num") + private Integer totalNum; + + /** + * spu信息 + *
+   * 是否必填:
+   * 
+ */ + @SerializedName("spus") + private List spus; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopGetSpuResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopGetSpuResponse.java new file mode 100644 index 000000000..c8a0d5d5d --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopGetSpuResponse.java @@ -0,0 +1,26 @@ +package cn.binarywang.wx.miniapp.bean.shop.response; + +import cn.binarywang.wx.miniapp.bean.shop.WxMaShopGetSpuResult; +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; + +/** + * @author leiin + * @date 2021/3/23 + * @description: + */ +@Data +public class WxMaShopGetSpuResponse extends WxMaShopBaseResponse implements Serializable { + + private static final long serialVersionUID = -3781992184787152637L; + + /** + * spu信息 + *
+   * 是否必填:
+   * 
+ */ + @SerializedName("spu") + private WxMaShopGetSpuResult spu; +} 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 84b1f806d..71ee8500e 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 @@ -296,4 +296,24 @@ public interface Ocr { String COMM = "https://api.weixin.qq.com/cv/ocr/comm?img_url=%s"; String FILE_COMM = "https://api.weixin.qq.com/cv/ocr/comm"; } + + public interface Shop { + interface Spu { + String SPU_ADD_URL = "https://api.weixin.qq.com/shop/spu/add"; + String SPU_DEL_URL = "https://api.weixin.qq.com/shop/spu/del"; + String SPU_GET_URL = "https://api.weixin.qq.com/shop/spu/get"; + String SPU_GET_LIST_URL = "https://api.weixin.qq.com/shop/spu/get_list"; + String SPU_UPDATE_URL = "https://api.weixin.qq.com/shop/spu/update"; + String SPU_UPDATE_WITHOUT_URL = "https://api.weixin.qq.com/shop/spu/update_without_audit"; + String SPU_LISTING_URL = "https://api.weixin.qq.com/shop/spu/listing"; + String SPU_DELISTING_URL = "https://api.weixin.qq.com/shop/spu/delisting"; + } + + interface Order { + String ORDER_CHECK_SCENE = "https://api.weixin.qq.com/shop/scene/check"; + String ORDER_ADD = "https://api.weixin.qq.com/shop/order/add"; + String ORDER_PAY = "https://api.weixin.qq.com/shop/order/pay"; + String ORDER_GET = "https://api.weixin.qq.com/shop/order/get"; + } + } }