From 332e8924468d445559c18990d53e1e4778f2c9a4 Mon Sep 17 00:00:00 2001 From: wanglei Date: Wed, 26 Jan 2022 20:04:21 +0800 Subject: [PATCH 01/43] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=AE=A2=E6=9C=8D=20?= =?UTF-8?q?=E6=8E=A5=E5=BE=85=E4=BA=BA=E5=91=98=E7=AE=A1=E7=90=86=EF=BC=8C?= =?UTF-8?q?=E4=BC=9A=E8=AF=9D=E5=88=86=E9=85=8D=E4=B8=8E=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=94=B6=E5=8F=91=EF=BC=8C=E5=9F=BA=E7=A1=80=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chanjar/weixin/cp/api/WxCpKfService.java | 121 ++++++++++++++ .../weixin/cp/api/impl/WxCpKfServiceImpl.java | 127 +++++++++++++++ .../external/contact/ExternalContact.java | 3 + .../bean/kf/WxCpKfCustomerBatchGetResp.java | 32 ++++ .../weixin/cp/bean/kf/WxCpKfMsgListResp.java | 73 +++++++++ .../cp/bean/kf/WxCpKfMsgSendRequest.java | 151 ++++++++++++++++++ .../weixin/cp/bean/kf/WxCpKfMsgSendResp.java | 24 +++ .../cp/bean/kf/WxCpKfServiceStateResp.java | 28 ++++ .../bean/kf/WxCpKfServiceStateTransResp.java | 27 ++++ .../cp/bean/kf/WxCpKfServicerListResp.java | 35 ++++ .../cp/bean/kf/WxCpKfServicerOpResp.java | 38 +++++ .../cp/bean/kf/msg/WxCpKfBusinessCardMsg.java | 16 ++ .../weixin/cp/bean/kf/msg/WxCpKfEventMsg.java | 40 +++++ .../weixin/cp/bean/kf/msg/WxCpKfLinkMsg.java | 53 ++++++ .../cp/bean/kf/msg/WxCpKfLocationMsg.java | 41 +++++ .../weixin/cp/bean/kf/msg/WxCpKfMenuMsg.java | 128 +++++++++++++++ .../cp/bean/kf/msg/WxCpKfMiniProgramMsg.java | 46 ++++++ .../cp/bean/kf/msg/WxCpKfResourceMsg.java | 16 ++ .../weixin/cp/bean/kf/msg/WxCpKfTextMsg.java | 26 +++ .../weixin/cp/constant/WxCpApiPathConsts.java | 13 ++ 20 files changed, 1038 insertions(+) create mode 100644 weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfCustomerBatchGetResp.java create mode 100644 weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfMsgListResp.java create mode 100644 weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfMsgSendRequest.java create mode 100644 weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfMsgSendResp.java create mode 100644 weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfServiceStateResp.java create mode 100644 weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfServiceStateTransResp.java create mode 100644 weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfServicerListResp.java create mode 100644 weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfServicerOpResp.java create mode 100644 weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfBusinessCardMsg.java create mode 100644 weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfEventMsg.java create mode 100644 weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfLinkMsg.java create mode 100644 weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfLocationMsg.java create mode 100644 weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfMenuMsg.java create mode 100644 weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfMiniProgramMsg.java create mode 100644 weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfResourceMsg.java create mode 100644 weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfTextMsg.java diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpKfService.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpKfService.java index a77b42a6c2..0da548905c 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpKfService.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpKfService.java @@ -1,5 +1,6 @@ package me.chanjar.weixin.cp.api; +import java.util.List; import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.cp.bean.WxCpBaseResp; import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountAdd; @@ -9,6 +10,14 @@ import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountLinkResp; import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountListResp; import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountUpd; +import me.chanjar.weixin.cp.bean.kf.WxCpKfCustomerBatchGetResp; +import me.chanjar.weixin.cp.bean.kf.WxCpKfMsgListResp; +import me.chanjar.weixin.cp.bean.kf.WxCpKfMsgSendRequest; +import me.chanjar.weixin.cp.bean.kf.WxCpKfMsgSendResp; +import me.chanjar.weixin.cp.bean.kf.WxCpKfServiceStateResp; +import me.chanjar.weixin.cp.bean.kf.WxCpKfServiceStateTransResp; +import me.chanjar.weixin.cp.bean.kf.WxCpKfServicerListResp; +import me.chanjar.weixin.cp.bean.kf.WxCpKfServicerOpResp; /** * 微信客服接口 @@ -67,4 +76,116 @@ public interface WxCpKfService { */ WxCpKfAccountLinkResp getAccountLink(WxCpKfAccountLink link) throws WxErrorException; + /** + * 接待人员管理 + * 添加指定客服帐号的接待人员,每个客服帐号目前最多可添加500个接待人员。 + * @param openKfid 客服帐号ID + * @param userIdList 接待人员userid列表。第三方应用填密文userid,即open_userid + * 可填充个数:1 ~ 100。超过100个需分批调用。 + * @return 添加客服账号结果 + * @throws WxErrorException 异常 + */ + WxCpKfServicerOpResp addServicer(String openKfid, List userIdList) throws WxErrorException; + + /** + * 接待人员管理 + * 从客服帐号删除接待人员 + * @param openKfid 客服帐号ID + * @param userIdList 接待人员userid列表。第三方应用填密文userid,即open_userid + * 可填充个数:1 ~ 100。超过100个需分批调用。 + * @return 删除客服账号结果 + * @throws WxErrorException 异常 + */ + WxCpKfServicerOpResp delServicer(String openKfid, List userIdList) throws WxErrorException; + + /** + * 接待人员管理 + * 获取某个客服帐号的接待人员列表 + * @param openKfid 客服帐号ID + * @return 接待人员列表 + * @throws WxErrorException 异常 + */ + WxCpKfServicerListResp listServicer(String openKfid) throws WxErrorException; + + /** + * 分配客服会话 + * 获取会话状态 + * @param openKfid 客服帐号ID + * @param externalUserId 微信客户的external_userid + * @return + * @throws WxErrorException + */ + WxCpKfServiceStateResp getServiceState(String openKfid, String externalUserId) + throws WxErrorException; + + /** + * 分配客服会话 + * 变更会话状态 + * @param openKfid 客服帐号ID + * @param externalUserId 微信客户的external_userid + * @param serviceState 变更的目标状态,状态定义和所允许的变更可参考概述中的流程图和表格 + * @param servicerUserId 接待人员的userid。第三方应用填密文userid,即open_userid。当state=3时要求必填,接待人员须处于“正在接待”中。 + * @return 部分状态返回回复语code + * @throws WxErrorException + */ + WxCpKfServiceStateTransResp transServiceState(String openKfid, String externalUserId, + Integer serviceState, String servicerUserId) throws WxErrorException; + + /** + * 读取消息 + * 微信客户发送的消息、接待人员在企业微信回复的消息、发送消息接口发送失败事件(如被用户拒收)、客户点击菜单消息的回复消息, + * 可以通过该接口获取具体的消息内容和事件。不支持读取通过发送消息接口发送的消息。 + * 支持的消息类型:文本、图片、语音、视频、文件、位置、链接、名片、小程序、菜单、事件。 + * @param cursor 上一次调用时返回的next_cursor,第一次拉取可以不填。不多于64字节 + * @param token 回调事件返回的token字段,10分钟内有效;可不填,如果不填接口有严格的频率限制。不多于128字节 + * @param limit 期望请求的数据量,默认值和最大值都为1000。 + * 注意:可能会出现返回条数少于limit的情况,需结合返回的has_more字段判断是否继续请求。 + * @param voiceFormat 语音消息类型,0-Amr 1-Silk,默认0。可通过该参数控制返回的语音格式 + * @return 微信消息 + * @throws WxErrorException 异常 + */ + WxCpKfMsgListResp syncMsg(String cursor, String token, Integer limit, Integer voiceFormat) + throws WxErrorException; + + /** + * 发送消息 + * 当微信客户处于“新接入待处理”或“由智能助手接待”状态下,可调用该接口给用户发送消息。 + * 注意仅当微信客户在主动发送消息给客服后的48小时内,企业可发送消息给客户,最多可发送5条消息;若用户继续发送消息,企业可再次下发消息。 + * 支持发送消息类型:文本、图片、语音、视频、文件、图文、小程序、菜单消息、地理位置。 + * @param request 发送信息 + * @return 发送结果 + * @throws WxErrorException 异常 + */ + WxCpKfMsgSendResp sendMsg(WxCpKfMsgSendRequest request) throws WxErrorException; + + /** + * 发送欢迎语等事件响应消息 + * 当特定的事件回调消息包含code字段,或通过接口变更到特定的会话状态,会返回code字段。 + * 开发者可以此code为凭证,调用该接口给用户发送相应事件场景下的消息,如客服欢迎语、客服提示语和会话结束语等。 + * 除"用户进入会话事件"以外,响应消息仅支持会话处于获取该code的会话状态时发送,如将会话转入待接入池时获得的code仅能在会话状态为”待接入池排队中“时发送。 + * + * 目前支持的事件场景和相关约束如下: + * + * 事件场景 允许下发条数 code有效期 支持的消息类型 获取code途径 + * 用户进入会话,用于发送客服欢迎语 1条 20秒 文本、菜单 事件回调 + * 进入接待池,用于发送排队提示语等 1条 48小时 文本 转接会话接口 + * 从接待池接入会话,用于发送非工作 + * 时间的提示语或超时未回复的提示语 + * 等 1条 48小时 文本 事件回调、转接会话接口 + * 结束会话,用于发送结束会话提示语 + * 或满意度评价等 1条 20秒 文本、菜单 事件回调、转接会话接口 + * @param request + * @return + * @throws WxErrorException + */ + WxCpKfMsgSendResp sendMsgOnEvent(WxCpKfMsgSendRequest request) throws WxErrorException; + + /** + * 获取客户基础信息 + * @param externalUserIdList + * @return + * @throws WxErrorException + */ + WxCpKfCustomerBatchGetResp customerBatchGet(List externalUserIdList) + throws WxErrorException; } diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpKfServiceImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpKfServiceImpl.java index 53e520d3c4..12f1062b0c 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpKfServiceImpl.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpKfServiceImpl.java @@ -1,5 +1,10 @@ package me.chanjar.weixin.cp.api.impl; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import java.util.List; import lombok.RequiredArgsConstructor; import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.cp.api.WxCpKfService; @@ -12,6 +17,14 @@ import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountLinkResp; import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountListResp; import me.chanjar.weixin.cp.bean.kf.WxCpKfAccountUpd; +import me.chanjar.weixin.cp.bean.kf.WxCpKfCustomerBatchGetResp; +import me.chanjar.weixin.cp.bean.kf.WxCpKfMsgListResp; +import me.chanjar.weixin.cp.bean.kf.WxCpKfMsgSendRequest; +import me.chanjar.weixin.cp.bean.kf.WxCpKfMsgSendResp; +import me.chanjar.weixin.cp.bean.kf.WxCpKfServiceStateResp; +import me.chanjar.weixin.cp.bean.kf.WxCpKfServiceStateTransResp; +import me.chanjar.weixin.cp.bean.kf.WxCpKfServicerListResp; +import me.chanjar.weixin.cp.bean.kf.WxCpKfServicerOpResp; import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder; import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.Kf.*; @@ -25,6 +38,7 @@ @RequiredArgsConstructor public class WxCpKfServiceImpl implements WxCpKfService { private final WxCpService cpService; + private static final Gson GSON = new GsonBuilder().create(); @Override public WxCpKfAccountAddResp addAccount(WxCpKfAccountAdd add) throws WxErrorException { @@ -61,4 +75,117 @@ public WxCpKfAccountLinkResp getAccountLink(WxCpKfAccountLink link) throws WxErr return WxCpKfAccountLinkResp.fromJson(responseContent); } + @Override + public WxCpKfServicerOpResp addServicer(String openKfid, List userIdList) throws WxErrorException { + return servicerOp(openKfid, userIdList, SERVICER_ADD); + } + + @Override + public WxCpKfServicerOpResp delServicer(String openKfid, List userIdList) throws WxErrorException { + return servicerOp(openKfid, userIdList, SERVICER_DEL); + } + + private WxCpKfServicerOpResp servicerOp(String openKfid, List userIdList, String uri) throws WxErrorException { + String url = cpService.getWxCpConfigStorage().getApiUrl(uri); + + JsonObject json = new JsonObject(); + json.addProperty("open_kfid", openKfid); + JsonArray userIdArray = new JsonArray(); + userIdList.forEach(userIdArray::add); + json.add("userid_list", userIdArray); + + String responseContent = cpService.post(url, json.toString()); + return WxCpKfServicerOpResp.fromJson(responseContent); + } + + @Override + public WxCpKfServicerListResp listServicer(String openKfid) throws WxErrorException { + String url = cpService.getWxCpConfigStorage().getApiUrl(SERVICER_LIST + openKfid); + String responseContent = cpService.get(url, null); + return WxCpKfServicerListResp.fromJson(responseContent); + } + + @Override + public WxCpKfServiceStateResp getServiceState(String openKfid, String externalUserId) + throws WxErrorException { + String url = cpService.getWxCpConfigStorage().getApiUrl(SERVICE_STATE_GET); + + JsonObject json = new JsonObject(); + json.addProperty("open_kfid", openKfid); + json.addProperty("external_userid", externalUserId); + + String responseContent = cpService.post(url, json.toString()); + return WxCpKfServiceStateResp.fromJson(responseContent); + } + + @Override + public WxCpKfServiceStateTransResp transServiceState(String openKfid, String externalUserId, + Integer serviceState, String servicerUserId) throws WxErrorException { + String url = cpService.getWxCpConfigStorage().getApiUrl(SERVICE_STATE_TRANS); + + JsonObject json = new JsonObject(); + json.addProperty("open_kfid", openKfid); + json.addProperty("external_userid", externalUserId); + json.addProperty("service_state", serviceState); + json.addProperty("servicer_userid", servicerUserId); + + String responseContent = cpService.post(url, json.toString()); + return WxCpKfServiceStateTransResp.fromJson(responseContent); + } + + @Override + public WxCpKfMsgListResp syncMsg(String cursor, String token, Integer limit, Integer voiceFormat) + throws WxErrorException { + String url = cpService.getWxCpConfigStorage().getApiUrl(SYNC_MSG); + + JsonObject json = new JsonObject(); + if (cursor!=null) { + json.addProperty("cursor", cursor); + } + if (token!=null) { + json.addProperty("token", token); + } + if (limit!=null) { + json.addProperty("limit", limit); + } + if (voiceFormat!=null) { + json.addProperty("voice_format", voiceFormat); + } + + String responseContent = cpService.post(url, json); + return WxCpKfMsgListResp.fromJson(responseContent); + } + + @Override + public WxCpKfMsgSendResp sendMsg(WxCpKfMsgSendRequest request) throws WxErrorException { + String url = cpService.getWxCpConfigStorage().getApiUrl(SEND_MSG); + + String responseContent = cpService.post(url, GSON.toJson(request)); + + return WxCpKfMsgSendResp.fromJson(responseContent); + } + + @Override + public WxCpKfMsgSendResp sendMsgOnEvent(WxCpKfMsgSendRequest request) throws WxErrorException { + String url = cpService.getWxCpConfigStorage().getApiUrl(SEND_MSG_ON_EVENT); + + String responseContent = cpService.post(url, GSON.toJson(request)); + + return WxCpKfMsgSendResp.fromJson(responseContent); + } + + @Override + public WxCpKfCustomerBatchGetResp customerBatchGet(List externalUserIdList) + throws WxErrorException { + String url = cpService.getWxCpConfigStorage().getApiUrl(CUSTOMER_BATCH_GET); + + JsonArray array = new JsonArray(); + + externalUserIdList.forEach(array::add); + JsonObject json = new JsonObject(); + json.add("external_userid_list", array); + String responseContent = cpService.post(url, json.toString()); + return WxCpKfCustomerBatchGetResp.fromJson(responseContent); + } + } diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/contact/ExternalContact.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/contact/ExternalContact.java index f19584ed90..07d490ac1f 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/contact/ExternalContact.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/contact/ExternalContact.java @@ -26,6 +26,9 @@ public class ExternalContact implements Serializable { @SerializedName("name") private String name; + @SerializedName("nickname") + private String nickname; + @SerializedName("avatar") private String avatar; diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfCustomerBatchGetResp.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfCustomerBatchGetResp.java new file mode 100644 index 0000000000..dd3ea38b17 --- /dev/null +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfCustomerBatchGetResp.java @@ -0,0 +1,32 @@ +package me.chanjar.weixin.cp.bean.kf; + +import com.google.gson.annotations.SerializedName; +import java.util.List; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import me.chanjar.weixin.cp.bean.WxCpBaseResp; +import me.chanjar.weixin.cp.bean.external.contact.ExternalContact; +import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder; + +/** + * @author leiin + * @date 2022/1/26 7:56 下午 + */ +@EqualsAndHashCode(callSuper = true) +@NoArgsConstructor +@Data +public class WxCpKfCustomerBatchGetResp extends WxCpBaseResp { + + private static final long serialVersionUID = -3697709507605389887L; + + @SerializedName("customer_list") + private List customerList; + + @SerializedName("invalid_external_userid") + private List invalidExternalUserId; + + public static WxCpKfCustomerBatchGetResp fromJson(String json) { + return WxCpGsonBuilder.create().fromJson(json, WxCpKfCustomerBatchGetResp.class); + } +} diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfMsgListResp.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfMsgListResp.java new file mode 100644 index 0000000000..140670afa8 --- /dev/null +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfMsgListResp.java @@ -0,0 +1,73 @@ +package me.chanjar.weixin.cp.bean.kf; + +import com.google.gson.annotations.SerializedName; +import java.util.List; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import me.chanjar.weixin.cp.bean.WxCpBaseResp; +import me.chanjar.weixin.cp.bean.kf.msg.WxCpKfBusinessCardMsg; +import me.chanjar.weixin.cp.bean.kf.msg.WxCpKfEventMsg; +import me.chanjar.weixin.cp.bean.kf.msg.WxCpKfLinkMsg; +import me.chanjar.weixin.cp.bean.kf.msg.WxCpKfLocationMsg; +import me.chanjar.weixin.cp.bean.kf.msg.WxCpKfMenuMsg; +import me.chanjar.weixin.cp.bean.kf.msg.WxCpKfMiniProgramMsg; +import me.chanjar.weixin.cp.bean.kf.msg.WxCpKfResourceMsg; +import me.chanjar.weixin.cp.bean.kf.msg.WxCpKfTextMsg; +import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder; + +/** + * @author leiin + * @date 2022/1/26 5:24 下午 + */ +@EqualsAndHashCode(callSuper = true) +@NoArgsConstructor +@Data +public class WxCpKfMsgListResp extends WxCpBaseResp { + + private static final long serialVersionUID = -3115552079069452091L; + @SerializedName("next_cursor") + private String nextCursor; + + @SerializedName("has_more") + private Integer hasMore; + + @SerializedName("msg_list") + private List msgList; + + @NoArgsConstructor + @Data + public static class WxCpKfMsgItem { + @SerializedName("msgid") + private String msgId; + @SerializedName("open_kfid") + private String openKfid; + @SerializedName("external_userid") + private String externalUserId; + @SerializedName("send_time") + private Long sendTime; + private Integer origin; + @SerializedName("servicer_userid") + private String servicerUserId; + @SerializedName("msgtype") + private String msgType; + private WxCpKfTextMsg text; + private WxCpKfResourceMsg image; + private WxCpKfResourceMsg voice; + private WxCpKfResourceMsg video; + private WxCpKfResourceMsg file; + private WxCpKfLocationMsg location; + private WxCpKfLinkMsg link; + @SerializedName("business_card") + private WxCpKfBusinessCardMsg businessCard; + @SerializedName("miniprogram") + private WxCpKfMiniProgramMsg miniProgram; + @SerializedName("msgmenu") + private WxCpKfMenuMsg msgMenu; + private WxCpKfEventMsg event; + } + + public static WxCpKfMsgListResp fromJson(String json) { + return WxCpGsonBuilder.create().fromJson(json, WxCpKfMsgListResp.class); + } +} diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfMsgSendRequest.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfMsgSendRequest.java new file mode 100644 index 0000000000..25dd5c7645 --- /dev/null +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfMsgSendRequest.java @@ -0,0 +1,151 @@ +package me.chanjar.weixin.cp.bean.kf; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; +import me.chanjar.weixin.cp.bean.kf.msg.WxCpKfLinkMsg; +import me.chanjar.weixin.cp.bean.kf.msg.WxCpKfLocationMsg; +import me.chanjar.weixin.cp.bean.kf.msg.WxCpKfMenuMsg; +import me.chanjar.weixin.cp.bean.kf.msg.WxCpKfMiniProgramMsg; +import me.chanjar.weixin.cp.bean.kf.msg.WxCpKfResourceMsg; +import me.chanjar.weixin.cp.bean.kf.msg.WxCpKfTextMsg; + +/** + * @author leiin + * @date 2022/1/26 7:00 下午 + */ +@NoArgsConstructor +@Data +public class WxCpKfMsgSendRequest { + /** + * (发送欢迎语等事件响应消息) 事件响应消息对应的code。通过事件回调下发,仅可使用一次。 + */ + private String code; + /** + *
+   *   参数:touser
+   *   是否必须:是
+   *   类型:string
+   *   说明:指定接收消息的客户UserID
+   * 
+ */ + @SerializedName("touser") + private String toUser; + /** + *
+   *   参数:open_kfid
+   *   是否必须:是
+   *   类型:string
+   *   说明:指定发送消息的客服帐号ID
+   * 
+ */ + @SerializedName("open_kfid") + private String openKfid; + /** + *
+   *   参数:msgid
+   *   是否必须:否
+   *   类型:string
+   *   说明:指定消息ID
+   * 
+ */ + @SerializedName("msgid") + private String msgId; + /** + *
+   *   参数:msgtype
+   *   是否必须:是
+   *   类型:string
+   *   说明:消息类型,(text,image,voice,video,file,link,miniprogram,msgmenu,location)
+   * 
+ */ + @SerializedName("msgtype") + private String msgType; + /** + *
+   *   参数:text
+   *   是否必须:是
+   *   类型:obj
+   *   说明:文本消息
+   * 
+ */ + private WxCpKfTextMsg text; + + /** + *
+   *   参数:image
+   *   是否必须:是
+   *   类型:obj
+   *   说明:图片消息
+   * 
+ */ + private WxCpKfResourceMsg image; + /** + *
+   *   参数:voice
+   *   是否必须:是
+   *   类型:obj
+   *   说明:语音消息
+   * 
+ */ + private WxCpKfResourceMsg voice; + /** + *
+   *   参数:video
+   *   是否必须:是
+   *   类型:obj
+   *   说明:视频消息
+   * 
+ */ + private WxCpKfResourceMsg video; + /** + *
+   *   参数:file
+   *   是否必须:是
+   *   类型:obj
+   *   说明:文件消息
+   * 
+ */ + private WxCpKfResourceMsg file; + /** + *
+   *   参数:link
+   *   是否必须:是
+   *   类型:obj
+   *   说明:链接消息
+   * 
+ */ + private WxCpKfLinkMsg link; + /** + *
+   *   参数:miniprogram
+   *   是否必须:是
+   *   类型:obj
+   *   说明:小程序消息
+   * 
+ */ + @SerializedName("miniprogram") + private WxCpKfMiniProgramMsg miniProgram; + + /** + *
+   *   参数:msgmenu
+   *   是否必须:是
+   *   类型:obj
+   *   说明:菜单消息
+   * 
+ */ + @SerializedName("msgmenu") + private WxCpKfMenuMsg msgMenu; + + /** + *
+   *   参数:location
+   *   是否必须:是
+   *   类型:obj
+   *   说明:菜单消息
+   * 
+ */ + @SerializedName("location") + private WxCpKfLocationMsg location; +} diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfMsgSendResp.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfMsgSendResp.java new file mode 100644 index 0000000000..416edba3bf --- /dev/null +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfMsgSendResp.java @@ -0,0 +1,24 @@ +package me.chanjar.weixin.cp.bean.kf; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import me.chanjar.weixin.cp.bean.WxCpBaseResp; +import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder; + +/** + * @author leiin + * @date 2022/1/26 7:41 下午 + */ +@EqualsAndHashCode(callSuper = true) +@NoArgsConstructor +@Data +public class WxCpKfMsgSendResp extends WxCpBaseResp { + @SerializedName("msgid") + private String msgId; + + public static WxCpKfMsgSendResp fromJson(String json) { + return WxCpGsonBuilder.create().fromJson(json, WxCpKfMsgSendResp.class); + } +} diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfServiceStateResp.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfServiceStateResp.java new file mode 100644 index 0000000000..da4aabcdbb --- /dev/null +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfServiceStateResp.java @@ -0,0 +1,28 @@ +package me.chanjar.weixin.cp.bean.kf; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import me.chanjar.weixin.cp.bean.WxCpBaseResp; +import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder; + +/** + * @author leiin + * @date 2022/1/26 5:00 下午 + */ +@EqualsAndHashCode(callSuper = true) +@NoArgsConstructor +@Data +public class WxCpKfServiceStateResp extends WxCpBaseResp { + + private static final long serialVersionUID = 8077134413448067090L; + @SerializedName("service_state") + private Integer serviceState; + @SerializedName("servicer_userid") + private String servicerUserId; + + public static WxCpKfServiceStateResp fromJson(String json) { + return WxCpGsonBuilder.create().fromJson(json, WxCpKfServiceStateResp.class); + } +} diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfServiceStateTransResp.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfServiceStateTransResp.java new file mode 100644 index 0000000000..a4988873c0 --- /dev/null +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfServiceStateTransResp.java @@ -0,0 +1,27 @@ +package me.chanjar.weixin.cp.bean.kf; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import me.chanjar.weixin.cp.bean.WxCpBaseResp; +import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder; + +/** + * @author leiin + * @date 2022/1/26 5:03 下午 + */ +@EqualsAndHashCode(callSuper = true) +@NoArgsConstructor +@Data +public class WxCpKfServiceStateTransResp extends WxCpBaseResp { + + private static final long serialVersionUID = -7874378445629022791L; + + @SerializedName("msg_code") + private String msgCode; + + public static WxCpKfServiceStateTransResp fromJson(String json) { + return WxCpGsonBuilder.create().fromJson(json, WxCpKfServiceStateTransResp.class); + } +} diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfServicerListResp.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfServicerListResp.java new file mode 100644 index 0000000000..c37e5df133 --- /dev/null +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfServicerListResp.java @@ -0,0 +1,35 @@ +package me.chanjar.weixin.cp.bean.kf; + +import com.google.gson.annotations.SerializedName; +import java.util.List; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import me.chanjar.weixin.cp.bean.WxCpBaseResp; +import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder; + +/** + * @author leiin + * @date 2022/1/26 4:29 下午 + */ +@EqualsAndHashCode(callSuper = true) +@NoArgsConstructor +@Data +public class WxCpKfServicerListResp extends WxCpBaseResp { + + private static final long serialVersionUID = -5079770046571012449L; + @SerializedName("servicer_list") + private List servicerList; + + @NoArgsConstructor + @Data + public static class WxCpKfServicerStatus { + @SerializedName("userid") + private String userId; + private Integer status; + } + + public static WxCpKfServicerListResp fromJson(String json) { + return WxCpGsonBuilder.create().fromJson(json, WxCpKfServicerListResp.class); + } +} diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfServicerOpResp.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfServicerOpResp.java new file mode 100644 index 0000000000..e14dccd03a --- /dev/null +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfServicerOpResp.java @@ -0,0 +1,38 @@ +package me.chanjar.weixin.cp.bean.kf; + + +import com.google.gson.annotations.SerializedName; +import java.util.List; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import me.chanjar.weixin.cp.bean.WxCpBaseResp; +import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder; + +/** + * 添加/删除客服接待人员返回结果 + * @author leiin + * @date 2022/1/26 4:11 下午 + */ +@EqualsAndHashCode(callSuper = true) +@NoArgsConstructor +@Data +public class WxCpKfServicerOpResp extends WxCpBaseResp { + + private static final long serialVersionUID = -4082459764202987034L; + + @SerializedName("result_list") + private List resultList; + + @Data + @NoArgsConstructor + public static class WxCpKfServicerResp extends WxCpBaseResp { + + @SerializedName("userid") + private String userId; + } + + public static WxCpKfServicerOpResp fromJson(String json) { + return WxCpGsonBuilder.create().fromJson(json, WxCpKfServicerOpResp.class); + } +} diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfBusinessCardMsg.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfBusinessCardMsg.java new file mode 100644 index 0000000000..e739112ec1 --- /dev/null +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfBusinessCardMsg.java @@ -0,0 +1,16 @@ +package me.chanjar.weixin.cp.bean.kf.msg; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author leiin + * @date 2022/1/26 5:35 下午 + */ +@NoArgsConstructor +@Data +public class WxCpKfBusinessCardMsg { + @SerializedName("userid") + private String userId; +} diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfEventMsg.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfEventMsg.java new file mode 100644 index 0000000000..96782a1015 --- /dev/null +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfEventMsg.java @@ -0,0 +1,40 @@ +package me.chanjar.weixin.cp.bean.kf.msg; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author leiin + * @date 2022/1/26 6:44 下午 + */ +@NoArgsConstructor +@Data +public class WxCpKfEventMsg { + @SerializedName("event_type") + private String eventType; + @SerializedName("open_kfid") + private String openKfid; + @SerializedName("external_userid") + private String externalUserId; + @SerializedName("servicer_userid") + private String servicerUserId; + @SerializedName("old_servicer_userid") + private String oldServicerUserId; + @SerializedName("new_servicer_userid") + private String newServicerUserId; + private String scene; + @SerializedName("scene_param") + private String sceneParam; + @SerializedName("welcome_code") + private String welcomeCode; + @SerializedName("fail_msgid") + private String failMsgId; + @SerializedName("fail_type") + private Integer failType; + private Integer status; + @SerializedName("change_type") + private Integer changeType; + @SerializedName("msg_code") + private String msgCode; +} diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfLinkMsg.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfLinkMsg.java new file mode 100644 index 0000000000..1281389a10 --- /dev/null +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfLinkMsg.java @@ -0,0 +1,53 @@ +package me.chanjar.weixin.cp.bean.kf.msg; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author leiin + * @date 2022/1/26 5:33 下午 + */ +@NoArgsConstructor +@Data +public class WxCpKfLinkMsg { + + /** + * 参数:title + * 是否必须:是 + * 类型:string + * 说明:标题,不超过128个字节,超过会自动截断 + */ + @SerializedName("title") + private String title; + /** + * 参数:desc + * 是否必须:否 + * 类型:string + * 说明:描述,不超过512个字节,超过会自动截断 + */ + @SerializedName("desc") + private String desc; + /** + * 参数:url + * 是否必须:是 + * 类型:string + * 说明:点击后跳转的链接。 最长2048字节,请确保包含了协议头(http/https) + */ + @SerializedName("url") + private String url; + /** + * 参数:thumb_media_id + * 是否必须:是 + * 类型:string + * 说明:发送消息参数,缩略图的media_id, 可以通过素材管理接口获得。此处thumb_media_id即上传接口返回的media_id + */ + @SerializedName("thumb_media_id") + private String thumb_media_id; + + /** + * 返回消息参数 + */ + @SerializedName("pic_url") + private String picUrl; +} diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfLocationMsg.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfLocationMsg.java new file mode 100644 index 0000000000..245da52619 --- /dev/null +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfLocationMsg.java @@ -0,0 +1,41 @@ +package me.chanjar.weixin.cp.bean.kf.msg; + +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author leiin + * @date 2022/1/26 5:32 下午 + */ +@NoArgsConstructor +@Data +public class WxCpKfLocationMsg { + /** + * 参数:name + * 是否必须:否 + * 类型:string + * 说明:位置名 + */ + private String name; + /** + * 参数:address + * 是否必须:否 + * 类型:string + * 说明:地址详情说明 + */ + private String address; + /** + * 参数:latitude + * 是否必须:是 + * 类型:float + * 说明:纬度,浮点数,范围为90 ~ -90 + */ + private Float latitude; + /** + * 参数:longitude + * 是否必须:是 + * 类型:float + * 说明:经度,浮点数,范围为180 ~ -180 + */ + private Float longitude; +} diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfMenuMsg.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfMenuMsg.java new file mode 100644 index 0000000000..73df6abf94 --- /dev/null +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfMenuMsg.java @@ -0,0 +1,128 @@ +package me.chanjar.weixin.cp.bean.kf.msg; + +import com.google.gson.annotations.SerializedName; +import java.util.List; +import lombok.Data; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +/** + * @author leiin + * @date 2022/1/26 6:33 下午 + */ +@NoArgsConstructor +@Data +public class WxCpKfMenuMsg { + + /** + * 参数:head_content + * 是否必须:否 + * 类型:string + * 说明:起始文本 不多于1024字节 + */ + @SerializedName("head_content") + private String headContent; + + private List list; + + /** + * 参数:tail_content + * 是否必须:否 + * 类型:string + * 说明:结束文本 不多于1024字节 + */ + @SerializedName("tail_content") + private String tailContent; + + @NoArgsConstructor + @Data + public static class WxCpKfMenuItem { + /** + * 参数:type + * 是否必须:是 + * 类型:string + * 说明:菜单类型。click-回复菜单 view-超链接菜单 miniprogram-小程序菜单 + */ + private String type; + + /** + * type为click的菜单项 + */ + private MenuClick click; + /** + * type为view的菜单项 + */ + private MenuView view; + /** + * type为miniprogram的菜单项 + */ + @SerializedName("miniprogram") + private MiniProgram miniProgram; + } + + @Getter + @Setter + public static class MenuClick { + + /** + *
+     *   是否必须:否
+     *   说明:菜单ID。不少于1字节 不多于128字节
+     * 
+ */ + private String id; + /** + *
+     *   是否必须:是
+     *   说明:菜单显示内容。不少于1字节 不多于128字节
+     * 
+ */ + private String content; + } + + @Getter + @Setter + public static class MenuView { + /** + *
+     *   是否必须:是
+     *   说明:点击后跳转的链接。不少于1字节 不多于2048字节
+     * 
+ */ + private String url; + /** + *
+     *   是否必须:是
+     *   说明:菜单显示内容。不少于1字节 不多于1024字节
+     * 
+ */ + private String content; + } + + @Getter + @Setter + public static class MiniProgram { + /** + *
+     *   是否必须:是
+     *   说明:小程序appid。
+     * 
+ */ + @SerializedName("appid") + private String appId; + /** + *
+     *   点击后进入的小程序页面。
+     * 
+ */ + @SerializedName("pagepath") + private String pagePath; + /** + *
+     *   菜单显示内容。不多于1024字节
+     * 
+ */ + private String content; + } +} diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfMiniProgramMsg.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfMiniProgramMsg.java new file mode 100644 index 0000000000..4e5ce5f2d4 --- /dev/null +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfMiniProgramMsg.java @@ -0,0 +1,46 @@ +package me.chanjar.weixin.cp.bean.kf.msg; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author leiin + * @date 2022/1/26 6:22 下午 + */ +@NoArgsConstructor +@Data +public class WxCpKfMiniProgramMsg { + /** + * 参数:appid + * 是否必须:是 + * 类型:string + * 说明:小程序appid + */ + @SerializedName("appid") + private String appId; + /** + * 参数:title + * 是否必须:否 + * 类型:string + * 说明:小程序消息标题,最多64个字节,超过会自动截断 + */ + @SerializedName("title") + private String title; + /** + * 参数:thumb_media_id + * 是否必须:是 + * 类型:string + * 说明:小程序消息封面的mediaid,封面图建议尺寸为520*416 + */ + @SerializedName("thumb_media_id") + private String thumbMediaId; + /** + * 参数:pagepath + * 是否必须:是 + * 类型:string + * 说明:点击消息卡片后进入的小程序页面路径。注意路径要以.html为后缀,否则在微信中打开会提示找不到页面 + */ + @SerializedName("pagepath") + private String pagePath; +} diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfResourceMsg.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfResourceMsg.java new file mode 100644 index 0000000000..43cba65b67 --- /dev/null +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfResourceMsg.java @@ -0,0 +1,16 @@ +package me.chanjar.weixin.cp.bean.kf.msg; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author leiin + * @date 2022/1/26 5:31 下午 + */ +@NoArgsConstructor +@Data +public class WxCpKfResourceMsg { + @SerializedName("media_id") + private String mediaId; +} diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfTextMsg.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfTextMsg.java new file mode 100644 index 0000000000..1e0ccf076c --- /dev/null +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/msg/WxCpKfTextMsg.java @@ -0,0 +1,26 @@ +package me.chanjar.weixin.cp.bean.kf.msg; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author leiin + * @date 2022/1/26 5:30 下午 + */ +@NoArgsConstructor +@Data +public class WxCpKfTextMsg { + + /** + *
+   *   参数:content
+   *   是否必须:是
+   *   类型:string
+   *   说明:消息内容,最长不超过2048个字节
+   * 
+ */ + private String content; + @SerializedName("menu_id") + private String menuId; +} diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/constant/WxCpApiPathConsts.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/constant/WxCpApiPathConsts.java index a55b4726f1..0ee13aca2f 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/constant/WxCpApiPathConsts.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/constant/WxCpApiPathConsts.java @@ -252,5 +252,18 @@ interface Kf { String ACCOUNT_LIST = "/cgi-bin/kf/account/list"; String ADD_CONTACT_WAY = "/cgi-bin/kf/add_contact_way"; + String SERVICER_ADD = "/cgi-bin/kf/servicer/add"; + String SERVICER_DEL = "/cgi-bin/kf/servicer/del"; + String SERVICER_LIST = "/cgi-bin/kf/servicer/list?open_kfid="; + + String SERVICE_STATE_GET = "/cgi-bin/kf/service_state/get"; + String SERVICE_STATE_TRANS = "/cgi-bin/kf/service_state/trans"; + + String SYNC_MSG = "/cgi-bin/kf/sync_msg"; + String SEND_MSG = "/cgi-bin/kf/send_msg"; + + String SEND_MSG_ON_EVENT = "/cgi-bin/kf/send_msg_on_event"; + String CUSTOMER_BATCH_GET = "/cgi-bin/kf/customer/batchget"; + } } From 8a4c58dc8346f68d9af5f29ef0c404b6e1afb324 Mon Sep 17 00:00:00 2001 From: wanglei Date: Wed, 26 Jan 2022 21:42:09 +0800 Subject: [PATCH 02/43] =?UTF-8?q?=E7=B4=A0=E6=9D=90=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cp/api/WxCpExternalContactService.java | 34 +++++++++++++++++++ .../impl/WxCpExternalContactServiceImpl.java | 22 ++++++++++++ .../weixin/cp/constant/WxCpApiPathConsts.java | 2 ++ 3 files changed, 58 insertions(+) diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpExternalContactService.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpExternalContactService.java index 76ab62350e..8e04977ff4 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpExternalContactService.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpExternalContactService.java @@ -1,6 +1,10 @@ package me.chanjar.weixin.cp.api; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; import lombok.NonNull; +import me.chanjar.weixin.common.bean.result.WxMediaUploadResult; import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.cp.bean.WxCpBaseResp; import me.chanjar.weixin.cp.bean.external.*; @@ -921,5 +925,35 @@ WxCpGetMomentComments getMomentComments(String momentId, String userId) */ WxCpProductAlbumResult getProductAlbum(String productId) throws WxErrorException; + /** + *
+   * 上传附件资源
+   * https://open.work.weixin.qq.com/api/doc/90001/90143/95178
+   * 
+ * @param mediaType + * @param fileType + * @param attachmentType + * @param inputStream + * @return + * @throws WxErrorException + * @throws IOException + */ + WxMediaUploadResult uploadAttachment(String mediaType, String fileType, Integer attachmentType, + InputStream inputStream) throws WxErrorException, IOException; + + /** + *
+   * 上传附件资源
+   * https://open.work.weixin.qq.com/api/doc/90001/90143/95178
+   * 
+ * @param mediaType + * @param attachmentType + * @param file + * @return + * @throws WxErrorException + */ + WxMediaUploadResult uploadAttachment(String mediaType, Integer attachmentType, File file) + throws WxErrorException; + } diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpExternalContactServiceImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpExternalContactServiceImpl.java index 87e9895784..3997f50768 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpExternalContactServiceImpl.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpExternalContactServiceImpl.java @@ -2,12 +2,19 @@ import com.google.gson.Gson; import com.google.gson.JsonObject; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.UUID; import lombok.NonNull; import lombok.RequiredArgsConstructor; +import me.chanjar.weixin.common.bean.result.WxMediaUploadResult; import me.chanjar.weixin.common.error.WxCpErrorMsgEnum; import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.common.error.WxRuntimeException; import me.chanjar.weixin.common.util.BeanUtils; +import me.chanjar.weixin.common.util.fs.FileUtils; +import me.chanjar.weixin.common.util.http.MediaUploadRequestExecutor; import me.chanjar.weixin.common.util.json.GsonParser; import me.chanjar.weixin.cp.api.WxCpExternalContactService; import me.chanjar.weixin.cp.api.WxCpService; @@ -814,4 +821,19 @@ public WxCpProductAlbumResult getProductAlbum(String productId) throws WxErrorEx return WxCpProductAlbumResult.fromJson(result); } + @Override + public WxMediaUploadResult uploadAttachment(String mediaType, String fileType, Integer attachmentType, + InputStream inputStream) throws WxErrorException, IOException { + return uploadAttachment(mediaType, attachmentType, FileUtils.createTmpFile(inputStream, + UUID.randomUUID().toString(), fileType)); + } + + @Override + public WxMediaUploadResult uploadAttachment(String mediaType, Integer attachmentType, File file) + throws WxErrorException { + String params = "?media_type=" + mediaType + "&attachment_type=" + attachmentType; + final String url = this.mainService.getWxCpConfigStorage().getApiUrl(UPLOAD_ATTACHMENT + params); + return this.mainService.execute(MediaUploadRequestExecutor.create( + this.mainService.getRequestHttp()), url, file); + } } diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/constant/WxCpApiPathConsts.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/constant/WxCpApiPathConsts.java index 0ee13aca2f..c1e7e4c3c8 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/constant/WxCpApiPathConsts.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/constant/WxCpApiPathConsts.java @@ -243,6 +243,8 @@ interface ExternalContact { String GROUP_WELCOME_TEMPLATE_GET = "/cgi-bin/externalcontact/group_welcome_template/get"; String GROUP_WELCOME_TEMPLATE_DEL = "/cgi-bin/externalcontact/group_welcome_template/del"; + String UPLOAD_ATTACHMENT = "/cgi-bin/media/upload_attachment"; + } interface Kf { From 7a4efe37f503c416438447831349d362ea70ce24 Mon Sep 17 00:00:00 2001 From: wanglei Date: Thu, 10 Feb 2022 10:16:58 +0800 Subject: [PATCH 03/43] =?UTF-8?q?=E5=BA=8F=E5=88=97=E5=8C=96=E6=B3=A8?= =?UTF-8?q?=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../me/chanjar/weixin/cp/bean/kf/WxCpKfAccountListResp.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfAccountListResp.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfAccountListResp.java index c2676a44dd..67df6eb813 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfAccountListResp.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfAccountListResp.java @@ -26,7 +26,7 @@ public class WxCpKfAccountListResp extends WxCpBaseResp { /** * 帐号信息列表 */ - @JsonProperty("account_list") + @SerializedName("account_list") private List accountList; @NoArgsConstructor From c86852be0b107304a3d09ce597736a7a4c695fa3 Mon Sep 17 00:00:00 2001 From: "boris.bao" Date: Sat, 2 Apr 2022 00:02:21 +0800 Subject: [PATCH 04/43] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=20=E7=89=A9=E6=B5=81=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E4=B8=AD=E7=9A=84=E6=9F=A5=E8=AF=A2=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wx/miniapp/api/WxMaExpressService.java | 3 + .../api/WxMaImmediateDeliveryService.java | 164 +++++++++++------- .../WxMaImmediateDeliveryServiceImpl.java | 29 ++++ .../delivery/QueryWaybillTraceRequest.java | 50 ++++++ .../delivery/QueryWaybillTraceResponse.java | 123 +++++++++++++ .../bean/delivery/TraceWaybillRequest.java | 92 ++++++++++ .../bean/delivery/TraceWaybillResponse.java | 34 ++++ .../bean/delivery/WaybillGoodsInfo.java | 59 +++++++ .../miniapp/constant/WxMaApiUrlConstants.java | 14 ++ 9 files changed, 502 insertions(+), 66 deletions(-) create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceRequest.java create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceResponse.java create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillRequest.java create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillResponse.java create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/WaybillGoodsInfo.java diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaExpressService.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaExpressService.java index b8229ceeb3..cbac84c744 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaExpressService.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaExpressService.java @@ -136,4 +136,7 @@ public interface WxMaExpressService { * @throws WxErrorException 模拟更新订单状态失败时返回 */ void testUpdateOrder(WxMaExpressTestUpdateOrderRequest wxMaExpressTestUpdateOrderRequest) throws WxErrorException; + + + } diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaImmediateDeliveryService.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaImmediateDeliveryService.java index d372799ecf..f08f510e39 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaImmediateDeliveryService.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaImmediateDeliveryService.java @@ -11,6 +11,10 @@ import cn.binarywang.wx.miniapp.bean.delivery.GetOrderResponse; import cn.binarywang.wx.miniapp.bean.delivery.MockUpdateOrderRequest; import cn.binarywang.wx.miniapp.bean.delivery.MockUpdateOrderResponse; +import cn.binarywang.wx.miniapp.bean.delivery.QueryWaybillTraceRequest; +import cn.binarywang.wx.miniapp.bean.delivery.QueryWaybillTraceResponse; +import cn.binarywang.wx.miniapp.bean.delivery.TraceWaybillRequest; +import cn.binarywang.wx.miniapp.bean.delivery.TraceWaybillResponse; import me.chanjar.weixin.common.error.WxErrorException; /** @@ -25,76 +29,104 @@ */ public interface WxMaImmediateDeliveryService { - /** - * 拉取已绑定账号. - *
-     * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.getBindAccount.html
-     * 
- * - * @return 响应 - * @throws WxErrorException 异常 - */ - BindAccountResponse getBindAccount() throws WxErrorException; + /** + * 拉取已绑定账号. + *
+   * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.getBindAccount.html
+   * 
+ * + * @return 响应 + * @throws WxErrorException 异常 + */ + BindAccountResponse getBindAccount() throws WxErrorException; - /** - * 下配送单接口. - *
-     * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.addOrder.html
-     * 
- * - * @param request request - * @return 响应 - * @throws WxErrorException 异常 - */ - AddOrderResponse addOrder(AddOrderRequest request) throws WxErrorException; + /** + * 下配送单接口. + *
+   * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.addOrder.html
+   * 
+ * + * @param request request + * @return 响应 + * @throws WxErrorException 异常 + */ + AddOrderResponse addOrder(AddOrderRequest request) throws WxErrorException; - /** - * 拉取配送单信息. - *
-     * 商家可使用本接口查询某一配送单的配送状态,便于商家掌握配送情况。
-     * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.getOrder.html
-     * 
- * - * @param request request - * @return 响应 - * @throws WxErrorException 异常 - */ - GetOrderResponse getOrder(GetOrderRequest request) throws WxErrorException; + /** + * 拉取配送单信息. + *
+   * 商家可使用本接口查询某一配送单的配送状态,便于商家掌握配送情况。
+   * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.getOrder.html
+   * 
+ * + * @param request request + * @return 响应 + * @throws WxErrorException 异常 + */ + GetOrderResponse getOrder(GetOrderRequest request) throws WxErrorException; - /** - * 取消配送单接口. - *
-     * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.cancelOrder.html
-     * 
- * - * @param request request - * @return 响应 - * @throws WxErrorException 异常 - */ - CancelOrderResponse cancelOrder(CancelOrderRequest request) throws WxErrorException; + /** + * 取消配送单接口. + *
+   * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.cancelOrder.html
+   * 
+ * + * @param request request + * @return 响应 + * @throws WxErrorException 异常 + */ + CancelOrderResponse cancelOrder(CancelOrderRequest request) throws WxErrorException; - /** - * 异常件退回商家商家确认收货接口. - *
-     * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.abnormalConfirm.html
-     * 
- * - * @param request request - * @return 响应 - * @throws WxErrorException 异常 - */ - AbnormalConfirmResponse abnormalConfirm(AbnormalConfirmRequest request) throws WxErrorException; + /** + * 异常件退回商家商家确认收货接口. + *
+   * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.abnormalConfirm.html
+   * 
+ * + * @param request request + * @return 响应 + * @throws WxErrorException 异常 + */ + AbnormalConfirmResponse abnormalConfirm(AbnormalConfirmRequest request) throws WxErrorException; + + /** + * 模拟配送公司更新配送单状态, 该接口只用于沙盒环境,即订单并没有真实流转到运力方. + *
+   * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.mockUpdateOrder.html
+   * 
+ * + * @param request request + * @return 响应 + * @throws WxErrorException 异常 + */ + MockUpdateOrderResponse mockUpdateOrder(MockUpdateOrderRequest request) throws WxErrorException; + + + /** + * 商户使用此接口向微信提供某交易单号对应的运单号。微信后台会跟踪运单的状态变化 + *
+   * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/express_search.html
+   * 
+ * + * @param request request + * @return 响应 + * @throws WxErrorException 异常 + */ + TraceWaybillResponse traceWaybill(TraceWaybillRequest request) throws WxErrorException; + + + /** + * 商户在调用完trace_waybill接口后,可以使用本接口查询到对应运单的详情信息 + *
+   * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/express_search.html
+   * 
+ * + * @param request request + * @return 响应 + * @throws WxErrorException 异常 + */ + QueryWaybillTraceResponse queryWaybillTrace(QueryWaybillTraceRequest request) + throws WxErrorException; - /** - * 模拟配送公司更新配送单状态, 该接口只用于沙盒环境,即订单并没有真实流转到运力方. - *
-     * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.mockUpdateOrder.html
-     * 
- * - * @param request request - * @return 响应 - * @throws WxErrorException 异常 - */ - MockUpdateOrderResponse mockUpdateOrder(MockUpdateOrderRequest request) throws WxErrorException; } diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaImmediateDeliveryServiceImpl.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaImmediateDeliveryServiceImpl.java index 75f88eb63c..18f99a8600 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaImmediateDeliveryServiceImpl.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaImmediateDeliveryServiceImpl.java @@ -13,8 +13,14 @@ import cn.binarywang.wx.miniapp.bean.delivery.GetOrderResponse; import cn.binarywang.wx.miniapp.bean.delivery.MockUpdateOrderRequest; import cn.binarywang.wx.miniapp.bean.delivery.MockUpdateOrderResponse; +import cn.binarywang.wx.miniapp.bean.delivery.QueryWaybillTraceRequest; +import cn.binarywang.wx.miniapp.bean.delivery.QueryWaybillTraceResponse; +import cn.binarywang.wx.miniapp.bean.delivery.TraceWaybillRequest; +import cn.binarywang.wx.miniapp.bean.delivery.TraceWaybillResponse; import cn.binarywang.wx.miniapp.bean.delivery.base.WxMaDeliveryBaseResponse; import cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants; +import cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.InstantDelivery; +import cn.binarywang.wx.miniapp.constant.WxMaConstants; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import javassist.bytecode.ConstPool; @@ -157,6 +163,29 @@ public MockUpdateOrderResponse mockUpdateOrder(final MockUpdateOrderRequest requ MockUpdateOrderResponse.class); } + @Override + public TraceWaybillResponse traceWaybill( + TraceWaybillRequest request) throws WxErrorException { + String responseContent = this.wxMaService.post(InstantDelivery.TRACE_WAYBILL_URL, request); + TraceWaybillResponse response = TraceWaybillResponse.fromJson(responseContent); + if (response.getErrcode() == -1) { + throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp)); + } + return response; + + } + + @Override + public QueryWaybillTraceResponse queryWaybillTrace( + QueryWaybillTraceRequest request) throws WxErrorException { + String responseContent = this.wxMaService.post(InstantDelivery.QUERY_WAYBILL_TRACE_URL, request); + QueryWaybillTraceResponse response = QueryWaybillTraceResponse.fromJson(responseContent); + if (response.getErrcode() == -1) { + throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp)); + } + return response; + } + /** * 解析响应. * diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceRequest.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceRequest.java new file mode 100644 index 0000000000..2af2058e36 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceRequest.java @@ -0,0 +1,50 @@ +package cn.binarywang.wx.miniapp.bean.delivery; + + +import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder; +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +/** + *
+ * 查询运单接口 query_trace
+ *
+ * 商户在调用完trace_waybill接口后,可以使用本接口查询到对应运单的详情信息
+ * 
+ * + * @author boris + * @since 2022-04-01 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +public class QueryWaybillTraceRequest implements Serializable { + + private static final long serialVersionUID = -7538739003766268386L; + + + + + + + /** + * 查询id + *
+   * 是否必填: 是
+   * 描述: 可以从 传运单接口 trace_waybill 取数据
+   * 
+ */ + @SerializedName("waybill_token") + private Integer waybillToken; + + public String toJson() { + return WxMaGsonBuilder.create().toJson(this); + } +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceResponse.java new file mode 100644 index 0000000000..e1dc2f4403 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceResponse.java @@ -0,0 +1,123 @@ +package cn.binarywang.wx.miniapp.bean.delivery; + +import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse; +import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder; +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + *
+ * 查询运单接口 query_trace 响应参数
+ *
+ * 商户在调用完trace_waybill接口后,可以使用本接口查询到对应运单的详情信息
+ * 
+ * + * @author boris + * @since 2022-04-01 + */ +@Data +@Accessors(chain = true) +public class QueryWaybillTraceResponse extends WxMaBaseResponse implements Serializable { + + private static final long serialVersionUID = 3773007367000633663L; + + /** + * 运单信息. + */ + @SerializedName("waybill_info") + private WaybillInfo waybillInfo; + + /** + * 商品信息 + */ + @SerializedName("shop_info") + private ShopInfo shopInfo; + + /** + * 运力信息. + */ + @SerializedName("delivery_info") + private DeliveryInfo deliveryInfo; + + + public static QueryWaybillTraceResponse fromJson(String json) { + return WxMaGsonBuilder.create().fromJson(json, QueryWaybillTraceResponse.class); + } + + /** + * 运单信息. + */ + @Data + @Accessors(chain = true) + public static class WaybillInfo implements Serializable { + + private static final long serialVersionUID = -3759074878713856529L; + + /** + * 运单状态 释义 + *
+     *
+     * 0	运单不存在或者未揽收
+     * 1	已揽件
+     * 2	运输中
+     * 3	派件中
+     * 4	已签收
+     * 5	异常
+     * 6	代签收
+     *
+     * 
+ */ + @SerializedName("status") + private Integer status; + + /** + * 查询id. + */ + @SerializedName("waybill_token") + private Integer waybillToken; + } + + /** + * 商品信息. + */ + @Data + @Accessors(chain = true) + public static class ShopInfo implements Serializable { + + private static final long serialVersionUID = -3759074878713856529L; + + /** + * 配送公司Id. + */ + @SerializedName("goods_info") + private WaybillGoodsInfo goodsInfo; + + + } + + + /** + * 运力信息. + */ + @Data + @Accessors(chain = true) + public static class DeliveryInfo implements Serializable { + + private static final long serialVersionUID = -3759074878713856529L; + + /** + * 配送公司Id. + */ + @SerializedName("delivery_id") + private String deliveryId; + + /** + * 运力公司名称. + */ + @SerializedName("delivery_name") + private String deliveryName; + + } +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillRequest.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillRequest.java new file mode 100644 index 0000000000..386d0435fd --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillRequest.java @@ -0,0 +1,92 @@ +package cn.binarywang.wx.miniapp.bean.delivery; + + +import cn.binarywang.wx.miniapp.bean.express.WxMaExpressDelivery; +import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder; +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +/** + *
+ * 传运单接口 trace_waybill
+ * 
+ * @author boris + * @since 2022-04-01 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +public class TraceWaybillRequest implements Serializable { + + private static final long serialVersionUID = -7538739003766268386L; + + + /** + * 用户openid + *
+   * 是否必填: 是
+   * 描述: 用户openid
+   * 
+ */ + @SerializedName("openid") + private Integer openid; + + /** + * 寄件人手机号 + *
+   * 是否必填: 否
+   * 描述:
+   * 
+ */ + @SerializedName("sender_phone") + private Integer senderPhone; + + /** + * 收件人手机号 + *
+   * 是否必填: 否
+   * 描述:部分运力需要用户手机号作为查单依据
+   * 
+ */ + @SerializedName("receiver_phone") + private Integer receiverPhone; + + /** + * 运单ID + *
+   * 是否必填: 是
+   * 
+ */ + @SerializedName("waybill_id") + private String waybillId; + + /** + * 交易单号(微信支付生成的交易单号,一般以420开头) + *
+   * 是否必填: 是
+   * 
+ */ + @SerializedName("trans_id") + private String transId; + + + /** + * 点击落地页商品卡片跳转路径(建议为订单详情页path),不传默认跳转小程序首页。 + *
+   * 是否必填: 否
+   * 
+ */ + @SerializedName("order_detail_path") + private String orderDetailPath; + + public String toJson() { + return WxMaGsonBuilder.create().toJson(this); + } +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillResponse.java new file mode 100644 index 0000000000..0b2ebabc1f --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillResponse.java @@ -0,0 +1,34 @@ +package cn.binarywang.wx.miniapp.bean.delivery; + +import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse; +import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder; +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + *
+ * 传运单接口 trace_waybill 响应参数
+ * 
+ * + * @author boris + * @since 2022-04-01 + */ +@Data +@Accessors(chain = true) +public class TraceWaybillResponse extends WxMaBaseResponse implements Serializable { + + private static final long serialVersionUID = 3773007367000633663L; + + /** + * 查询id. + */ + @SerializedName("waybill_token") + private Integer waybillToken; + + + public static TraceWaybillResponse fromJson(String json) { + return WxMaGsonBuilder.create().fromJson(json, TraceWaybillResponse.class); + } +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/WaybillGoodsInfo.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/WaybillGoodsInfo.java new file mode 100644 index 0000000000..709d316ec6 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/WaybillGoodsInfo.java @@ -0,0 +1,59 @@ +package cn.binarywang.wx.miniapp.bean.delivery; + +import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder; +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import java.util.List; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 运单商品信息 + * + * @author boris + * @since 2022-04-01 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class WaybillGoodsInfo implements Serializable { + + private static final long serialVersionUID = 5643624677715536605L; + + + + /** + * 商品信息 + */ + @SerializedName("detail_list") + private List goodsItemList; + + public static WaybillGoodsInfo fromJson(String json) { + return WxMaGsonBuilder.create().fromJson(json, WaybillGoodsInfo.class); + } + + @Data + public static class GoodsItem { + + /** + * 商品名称 + *
+     * 是否必填: 是
+     * 
+ */ + @SerializedName("goods_name") + private Long goodsName; + + /** + * 商品图片URL + *
+     * 是否必填: 是
+     * 
+ */ + @SerializedName("goods_img_url") + private Integer goodsImgUrl; + + + } +} 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 4fd7ce1dbc..8a149b4d73 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 @@ -529,6 +529,20 @@ public interface InstantDelivery { */ String MOCK_UPDATE_ORDER = "https://api.weixin.qq.com/cgi-bin/express/local/business/test_update_order"; + /** + * 物流服务-查询组件-跟踪物流面单 + * 商户使用此接口向微信提供某交易单号对应的运单号。微信后台会跟踪运单的状态变化 + */ + String TRACE_WAYBILL_URL = "https://api.weixin.qq.com/cgi-bin/express/delivery/open_msg/trace_waybill"; + + + /** + * 物流服务-查询组件-查询运单接口 query_trace + * 商户在调用完trace_waybill接口后,可以使用本接口查询到对应运单的详情信息 + */ + String QUERY_WAYBILL_TRACE_URL = "https://api.weixin.qq.com/cgi-bin/express/delivery/open_msg/query_trace"; + + /** * 下单接口. */ From ead997230738d067bedfc8f2a408e8e402488137 Mon Sep 17 00:00:00 2001 From: "boris.bao" Date: Sat, 2 Apr 2022 15:16:38 +0800 Subject: [PATCH 05/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wx/miniapp/bean/delivery/QueryWaybillTraceRequest.java | 2 +- .../wx/miniapp/bean/delivery/QueryWaybillTraceResponse.java | 2 +- .../wx/miniapp/bean/delivery/TraceWaybillRequest.java | 6 +++--- .../wx/miniapp/bean/delivery/TraceWaybillResponse.java | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceRequest.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceRequest.java index 2af2058e36..21a8221037 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceRequest.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceRequest.java @@ -42,7 +42,7 @@ public class QueryWaybillTraceRequest implements Serializable { * */ @SerializedName("waybill_token") - private Integer waybillToken; + private String waybillToken; public String toJson() { return WxMaGsonBuilder.create().toJson(this); diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceResponse.java index e1dc2f4403..726705cf8d 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceResponse.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceResponse.java @@ -76,7 +76,7 @@ public static class WaybillInfo implements Serializable { * 查询id. */ @SerializedName("waybill_token") - private Integer waybillToken; + private String waybillToken; } /** diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillRequest.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillRequest.java index 386d0435fd..fa498526be 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillRequest.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillRequest.java @@ -36,7 +36,7 @@ public class TraceWaybillRequest implements Serializable { * */ @SerializedName("openid") - private Integer openid; + private String openid; /** * 寄件人手机号 @@ -46,7 +46,7 @@ public class TraceWaybillRequest implements Serializable { * */ @SerializedName("sender_phone") - private Integer senderPhone; + private String senderPhone; /** * 收件人手机号 @@ -56,7 +56,7 @@ public class TraceWaybillRequest implements Serializable { * */ @SerializedName("receiver_phone") - private Integer receiverPhone; + private String receiverPhone; /** * 运单ID diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillResponse.java index 0b2ebabc1f..836e51ba07 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillResponse.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillResponse.java @@ -25,7 +25,7 @@ public class TraceWaybillResponse extends WxMaBaseResponse implements Serializab * 查询id. */ @SerializedName("waybill_token") - private Integer waybillToken; + private String waybillToken; public static TraceWaybillResponse fromJson(String json) { From 0c31b53ff6ff3c050c4354adffbd7043dc718d4e Mon Sep 17 00:00:00 2001 From: "boris.bao" Date: Sat, 2 Apr 2022 16:22:35 +0800 Subject: [PATCH 06/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bean/delivery/QueryWaybillTraceRequest.java | 4 ---- .../wx/miniapp/bean/delivery/TraceWaybillRequest.java | 11 ++++++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceRequest.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceRequest.java index 21a8221037..b7069a8737 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceRequest.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceRequest.java @@ -30,10 +30,6 @@ public class QueryWaybillTraceRequest implements Serializable { private static final long serialVersionUID = -7538739003766268386L; - - - - /** * 查询id *
diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillRequest.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillRequest.java
index fa498526be..0f929956a2 100644
--- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillRequest.java
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillRequest.java
@@ -1,7 +1,6 @@
 package cn.binarywang.wx.miniapp.bean.delivery;
 
 
-import cn.binarywang.wx.miniapp.bean.express.WxMaExpressDelivery;
 import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
 import com.google.gson.annotations.SerializedName;
 import java.io.Serializable;
@@ -15,6 +14,7 @@
  * 
  * 传运单接口 trace_waybill
  * 
+ * * @author boris * @since 2022-04-01 */ @@ -86,6 +86,15 @@ public class TraceWaybillRequest implements Serializable { @SerializedName("order_detail_path") private String orderDetailPath; + /** + * 商品信息 + *
+   * 是否必填: 是
+   * 
+ */ + @SerializedName("goods_info") + private WaybillGoodsInfo goodsInfo; + public String toJson() { return WxMaGsonBuilder.create().toJson(this); } From 318b76ba39452507c3094c8ff0d1ec5d04f95d5c Mon Sep 17 00:00:00 2001 From: "boris.bao" Date: Sat, 2 Apr 2022 00:02:21 +0800 Subject: [PATCH 07/43] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=20=E7=89=A9=E6=B5=81=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E4=B8=AD=E7=9A=84=E6=9F=A5=E8=AF=A2=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bean/delivery/QueryWaybillTraceRequest.java | 6 +++++- .../delivery/QueryWaybillTraceResponse.java | 2 +- .../bean/delivery/TraceWaybillRequest.java | 17 ++++------------- .../bean/delivery/TraceWaybillResponse.java | 2 +- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceRequest.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceRequest.java index b7069a8737..2af2058e36 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceRequest.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceRequest.java @@ -30,6 +30,10 @@ public class QueryWaybillTraceRequest implements Serializable { private static final long serialVersionUID = -7538739003766268386L; + + + + /** * 查询id *
@@ -38,7 +42,7 @@ public class QueryWaybillTraceRequest implements Serializable {
    * 
*/ @SerializedName("waybill_token") - private String waybillToken; + private Integer waybillToken; public String toJson() { return WxMaGsonBuilder.create().toJson(this); diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceResponse.java index 726705cf8d..e1dc2f4403 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceResponse.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceResponse.java @@ -76,7 +76,7 @@ public static class WaybillInfo implements Serializable { * 查询id. */ @SerializedName("waybill_token") - private String waybillToken; + private Integer waybillToken; } /** diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillRequest.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillRequest.java index 0f929956a2..386d0435fd 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillRequest.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillRequest.java @@ -1,6 +1,7 @@ package cn.binarywang.wx.miniapp.bean.delivery; +import cn.binarywang.wx.miniapp.bean.express.WxMaExpressDelivery; import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder; import com.google.gson.annotations.SerializedName; import java.io.Serializable; @@ -14,7 +15,6 @@ *
  * 传运单接口 trace_waybill
  * 
- * * @author boris * @since 2022-04-01 */ @@ -36,7 +36,7 @@ public class TraceWaybillRequest implements Serializable { *
*/ @SerializedName("openid") - private String openid; + private Integer openid; /** * 寄件人手机号 @@ -46,7 +46,7 @@ public class TraceWaybillRequest implements Serializable { * */ @SerializedName("sender_phone") - private String senderPhone; + private Integer senderPhone; /** * 收件人手机号 @@ -56,7 +56,7 @@ public class TraceWaybillRequest implements Serializable { * */ @SerializedName("receiver_phone") - private String receiverPhone; + private Integer receiverPhone; /** * 运单ID @@ -86,15 +86,6 @@ public class TraceWaybillRequest implements Serializable { @SerializedName("order_detail_path") private String orderDetailPath; - /** - * 商品信息 - *
-   * 是否必填: 是
-   * 
- */ - @SerializedName("goods_info") - private WaybillGoodsInfo goodsInfo; - public String toJson() { return WxMaGsonBuilder.create().toJson(this); } diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillResponse.java index 836e51ba07..0b2ebabc1f 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillResponse.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillResponse.java @@ -25,7 +25,7 @@ public class TraceWaybillResponse extends WxMaBaseResponse implements Serializab * 查询id. */ @SerializedName("waybill_token") - private String waybillToken; + private Integer waybillToken; public static TraceWaybillResponse fromJson(String json) { From a91a0d4d7f7add640042c2276e57da1d4dfb2625 Mon Sep 17 00:00:00 2001 From: "boris.bao" Date: Sat, 2 Apr 2022 15:16:38 +0800 Subject: [PATCH 08/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wx/miniapp/bean/delivery/QueryWaybillTraceRequest.java | 2 +- .../wx/miniapp/bean/delivery/QueryWaybillTraceResponse.java | 2 +- .../wx/miniapp/bean/delivery/TraceWaybillRequest.java | 6 +++--- .../wx/miniapp/bean/delivery/TraceWaybillResponse.java | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceRequest.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceRequest.java index 2af2058e36..21a8221037 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceRequest.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceRequest.java @@ -42,7 +42,7 @@ public class QueryWaybillTraceRequest implements Serializable { * */ @SerializedName("waybill_token") - private Integer waybillToken; + private String waybillToken; public String toJson() { return WxMaGsonBuilder.create().toJson(this); diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceResponse.java index e1dc2f4403..726705cf8d 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceResponse.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceResponse.java @@ -76,7 +76,7 @@ public static class WaybillInfo implements Serializable { * 查询id. */ @SerializedName("waybill_token") - private Integer waybillToken; + private String waybillToken; } /** diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillRequest.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillRequest.java index 386d0435fd..fa498526be 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillRequest.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillRequest.java @@ -36,7 +36,7 @@ public class TraceWaybillRequest implements Serializable { * */ @SerializedName("openid") - private Integer openid; + private String openid; /** * 寄件人手机号 @@ -46,7 +46,7 @@ public class TraceWaybillRequest implements Serializable { * */ @SerializedName("sender_phone") - private Integer senderPhone; + private String senderPhone; /** * 收件人手机号 @@ -56,7 +56,7 @@ public class TraceWaybillRequest implements Serializable { * */ @SerializedName("receiver_phone") - private Integer receiverPhone; + private String receiverPhone; /** * 运单ID diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillResponse.java index 0b2ebabc1f..836e51ba07 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillResponse.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillResponse.java @@ -25,7 +25,7 @@ public class TraceWaybillResponse extends WxMaBaseResponse implements Serializab * 查询id. */ @SerializedName("waybill_token") - private Integer waybillToken; + private String waybillToken; public static TraceWaybillResponse fromJson(String json) { From bf098f543a1159d70dbcd41970dc626d8a239e0f Mon Sep 17 00:00:00 2001 From: "boris.bao" Date: Sat, 2 Apr 2022 16:22:35 +0800 Subject: [PATCH 09/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bean/delivery/QueryWaybillTraceRequest.java | 4 ---- .../wx/miniapp/bean/delivery/TraceWaybillRequest.java | 11 ++++++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceRequest.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceRequest.java index 21a8221037..b7069a8737 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceRequest.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryWaybillTraceRequest.java @@ -30,10 +30,6 @@ public class QueryWaybillTraceRequest implements Serializable { private static final long serialVersionUID = -7538739003766268386L; - - - - /** * 查询id *
diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillRequest.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillRequest.java
index fa498526be..0f929956a2 100644
--- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillRequest.java
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/TraceWaybillRequest.java
@@ -1,7 +1,6 @@
 package cn.binarywang.wx.miniapp.bean.delivery;
 
 
-import cn.binarywang.wx.miniapp.bean.express.WxMaExpressDelivery;
 import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
 import com.google.gson.annotations.SerializedName;
 import java.io.Serializable;
@@ -15,6 +14,7 @@
  * 
  * 传运单接口 trace_waybill
  * 
+ * * @author boris * @since 2022-04-01 */ @@ -86,6 +86,15 @@ public class TraceWaybillRequest implements Serializable { @SerializedName("order_detail_path") private String orderDetailPath; + /** + * 商品信息 + *
+   * 是否必填: 是
+   * 
+ */ + @SerializedName("goods_info") + private WaybillGoodsInfo goodsInfo; + public String toJson() { return WxMaGsonBuilder.create().toJson(this); } From aa33ad97d6d2ccf51246a3cd66d86394ee2b4476 Mon Sep 17 00:00:00 2001 From: "boris.bao" Date: Sun, 3 Apr 2022 20:42:02 +0800 Subject: [PATCH 10/43] =?UTF-8?q?=E7=89=A9=E6=B5=81=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/WxMaImmediateDeliveryService.java | 34 +++++ .../WxMaImmediateDeliveryServiceImpl.java | 26 ++++ .../bean/delivery/FollowWaybillRequest.java | 103 +++++++++++++++ .../bean/delivery/FollowWaybillResponse.java | 34 +++++ .../delivery/QueryFollowTraceRequest.java | 46 +++++++ .../delivery/QueryFollowTraceResponse.java | 123 ++++++++++++++++++ .../bean/delivery/WaybillGoodsInfo.java | 4 +- .../miniapp/constant/WxMaApiUrlConstants.java | 12 ++ 8 files changed, 380 insertions(+), 2 deletions(-) create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/FollowWaybillRequest.java create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/FollowWaybillResponse.java create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryFollowTraceRequest.java create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryFollowTraceResponse.java diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaImmediateDeliveryService.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaImmediateDeliveryService.java index f08f510e39..aeef617235 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaImmediateDeliveryService.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaImmediateDeliveryService.java @@ -7,10 +7,14 @@ import cn.binarywang.wx.miniapp.bean.delivery.BindAccountResponse; import cn.binarywang.wx.miniapp.bean.delivery.CancelOrderRequest; import cn.binarywang.wx.miniapp.bean.delivery.CancelOrderResponse; +import cn.binarywang.wx.miniapp.bean.delivery.FollowWaybillRequest; +import cn.binarywang.wx.miniapp.bean.delivery.FollowWaybillResponse; import cn.binarywang.wx.miniapp.bean.delivery.GetOrderRequest; import cn.binarywang.wx.miniapp.bean.delivery.GetOrderResponse; import cn.binarywang.wx.miniapp.bean.delivery.MockUpdateOrderRequest; import cn.binarywang.wx.miniapp.bean.delivery.MockUpdateOrderResponse; +import cn.binarywang.wx.miniapp.bean.delivery.QueryFollowTraceRequest; +import cn.binarywang.wx.miniapp.bean.delivery.QueryFollowTraceResponse; import cn.binarywang.wx.miniapp.bean.delivery.QueryWaybillTraceRequest; import cn.binarywang.wx.miniapp.bean.delivery.QueryWaybillTraceResponse; import cn.binarywang.wx.miniapp.bean.delivery.TraceWaybillRequest; @@ -129,4 +133,34 @@ QueryWaybillTraceResponse queryWaybillTrace(QueryWaybillTraceRequest request) throws WxErrorException; + /** + * 传运单接口 follow_waybill 订阅微信后台会跟踪运单的状态变化 + *
+   * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/express_open_msg.html
+   * 
+ * + * @param request request + * @return 响应 + * @throws WxErrorException 异常 + */ + FollowWaybillResponse followWaybill(FollowWaybillRequest request) + throws WxErrorException; + + + /** + * 查运单接口 query_follow_trace + * + *
+   * 商户在调用完trace_waybill接口后,可以使用本接口查询到对应运单的详情信息
+   * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/express_open_msg.html
+   * 
+ * + * @param request request + * @return 响应 + * @throws WxErrorException 异常 + */ + QueryFollowTraceResponse queryFollowTrace(QueryFollowTraceRequest request) + throws WxErrorException ; + + } diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaImmediateDeliveryServiceImpl.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaImmediateDeliveryServiceImpl.java index 18f99a8600..ba774d3326 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaImmediateDeliveryServiceImpl.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaImmediateDeliveryServiceImpl.java @@ -9,10 +9,14 @@ import cn.binarywang.wx.miniapp.bean.delivery.BindAccountResponse; import cn.binarywang.wx.miniapp.bean.delivery.CancelOrderRequest; import cn.binarywang.wx.miniapp.bean.delivery.CancelOrderResponse; +import cn.binarywang.wx.miniapp.bean.delivery.FollowWaybillRequest; +import cn.binarywang.wx.miniapp.bean.delivery.FollowWaybillResponse; import cn.binarywang.wx.miniapp.bean.delivery.GetOrderRequest; import cn.binarywang.wx.miniapp.bean.delivery.GetOrderResponse; import cn.binarywang.wx.miniapp.bean.delivery.MockUpdateOrderRequest; import cn.binarywang.wx.miniapp.bean.delivery.MockUpdateOrderResponse; +import cn.binarywang.wx.miniapp.bean.delivery.QueryFollowTraceRequest; +import cn.binarywang.wx.miniapp.bean.delivery.QueryFollowTraceResponse; import cn.binarywang.wx.miniapp.bean.delivery.QueryWaybillTraceRequest; import cn.binarywang.wx.miniapp.bean.delivery.QueryWaybillTraceResponse; import cn.binarywang.wx.miniapp.bean.delivery.TraceWaybillRequest; @@ -186,6 +190,28 @@ public QueryWaybillTraceResponse queryWaybillTrace( return response; } + @Override + public FollowWaybillResponse followWaybill( + FollowWaybillRequest request) throws WxErrorException { + String responseContent = this.wxMaService.post(InstantDelivery.FOLLOW_WAYBILL_URL, request); + FollowWaybillResponse response = FollowWaybillResponse.fromJson(responseContent); + if (response.getErrcode() == -1) { + throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp)); + } + return response; + } + + @Override + public QueryFollowTraceResponse queryFollowTrace( + QueryFollowTraceRequest request) throws WxErrorException { + String responseContent = this.wxMaService.post(InstantDelivery.QUERY_FOLLOW_TRACE_URL, request); + QueryFollowTraceResponse response = QueryFollowTraceResponse.fromJson(responseContent); + if (response.getErrcode() == -1) { + throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp)); + } + return response; + } + /** * 解析响应. * diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/FollowWaybillRequest.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/FollowWaybillRequest.java new file mode 100644 index 0000000000..92add53aa2 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/FollowWaybillRequest.java @@ -0,0 +1,103 @@ +package cn.binarywang.wx.miniapp.bean.delivery; + + +import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder; +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +/** + *
+ * 传运单接口 follow_waybil
+ *
+ * 商户使用此接口向微信提供某交易单号对应的运单号。微信后台会跟踪运单的状态变化,在关键物流节点给下单用户推送消息通知。
+ * 
+ * + * @author boris + * @since 2022-04-01 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +public class FollowWaybillRequest implements Serializable { + + private static final long serialVersionUID = -7538739003766268386L; + + + /** + * 用户openid + *
+   * 是否必填: 是
+   * 描述: 用户openid
+   * 
+ */ + @SerializedName("openid") + private String openid; + + /** + * 寄件人手机号 + *
+   * 是否必填: 否
+   * 描述:
+   * 
+ */ + @SerializedName("sender_phone") + private String senderPhone; + + /** + * 收件人手机号 + *
+   * 是否必填: 否
+   * 描述:部分运力需要用户手机号作为查单依据
+   * 
+ */ + @SerializedName("receiver_phone") + private String receiverPhone; + + /** + * 运单ID + *
+   * 是否必填: 是
+   * 
+ */ + @SerializedName("waybill_id") + private String waybillId; + + /** + * 交易单号(微信支付生成的交易单号,一般以420开头) + *
+   * 是否必填: 是
+   * 
+ */ + @SerializedName("trans_id") + private String transId; + + + /** + * 点击落地页商品卡片跳转路径(建议为订单详情页path),不传默认跳转小程序首页。 + *
+   * 是否必填: 否
+   * 
+ */ + @SerializedName("order_detail_path") + private String orderDetailPath; + + /** + * 商品信息 + *
+   * 是否必填: 是
+   * 
+ */ + @SerializedName("goods_info") + private WaybillGoodsInfo goodsInfo; + + public String toJson() { + return WxMaGsonBuilder.create().toJson(this); + } +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/FollowWaybillResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/FollowWaybillResponse.java new file mode 100644 index 0000000000..748f9465aa --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/FollowWaybillResponse.java @@ -0,0 +1,34 @@ +package cn.binarywang.wx.miniapp.bean.delivery; + +import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse; +import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder; +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + *
+ * 查运单接口 query_follow_trace 响应参数
+ * 
+ * + * @author boris + * @since 2022-04-01 + */ +@Data +@Accessors(chain = true) +public class FollowWaybillResponse extends WxMaBaseResponse implements Serializable { + + private static final long serialVersionUID = 3773007367000633663L; + + /** + * 查询id. + */ + @SerializedName("waybill_token") + private String waybillToken; + + + public static FollowWaybillResponse fromJson(String json) { + return WxMaGsonBuilder.create().fromJson(json, FollowWaybillResponse.class); + } +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryFollowTraceRequest.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryFollowTraceRequest.java new file mode 100644 index 0000000000..600ea0f14c --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryFollowTraceRequest.java @@ -0,0 +1,46 @@ +package cn.binarywang.wx.miniapp.bean.delivery; + + +import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder; +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +/** + *
+ * 消息组件-查运单接口 query_follow_trace
+ *
+ * 商户在调用完trace_waybill接口后,可以使用本接口查询到对应运单的详情信息
+ * 
+ * + * @author boris + * @since 2022-04-01 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +public class QueryFollowTraceRequest implements Serializable { + + private static final long serialVersionUID = -7538739003766268386L; + + + /** + * 查询id + *
+   * 是否必填: 是
+   * 描述: 可以从 传运单接口 follow_waybill 取数据
+   * 
+ */ + @SerializedName("waybill_token") + private String waybillToken; + + public String toJson() { + return WxMaGsonBuilder.create().toJson(this); + } +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryFollowTraceResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryFollowTraceResponse.java new file mode 100644 index 0000000000..a6e698d0df --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/QueryFollowTraceResponse.java @@ -0,0 +1,123 @@ +package cn.binarywang.wx.miniapp.bean.delivery; + +import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse; +import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder; +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + *
+ * 消息组件-查运单接口 query_follow_trace 响应参数
+ *
+ * 商户在调用完follow_waybill/trace_waybill接口后,可以使用本接口查询到对应运单的详情信息
+ * 
+ * + * @author boris + * @since 2022-04-01 + */ +@Data +@Accessors(chain = true) +public class QueryFollowTraceResponse extends WxMaBaseResponse implements Serializable { + + private static final long serialVersionUID = 3773007367000633663L; + + /** + * 运单信息. + */ + @SerializedName("waybill_info") + private WaybillInfo waybillInfo; + + /** + * 商品信息 + */ + @SerializedName("shop_info") + private ShopInfo shopInfo; + + /** + * 运力信息. + */ + @SerializedName("delivery_info") + private DeliveryInfo deliveryInfo; + + + public static QueryFollowTraceResponse fromJson(String json) { + return WxMaGsonBuilder.create().fromJson(json, QueryFollowTraceResponse.class); + } + + /** + * 运单信息. + */ + @Data + @Accessors(chain = true) + public static class WaybillInfo implements Serializable { + + private static final long serialVersionUID = -3759074878713856529L; + + /** + * 运单状态 释义 + *
+     *
+     * 0	运单不存在或者未揽收
+     * 1	已揽件
+     * 2	运输中
+     * 3	派件中
+     * 4	已签收
+     * 5	异常
+     * 6	代签收
+     *
+     * 
+ */ + @SerializedName("status") + private Integer status; + + /** + * 查询id. + */ + @SerializedName("waybill_token") + private String waybillToken; + } + + /** + * 商品信息. + */ + @Data + @Accessors(chain = true) + public static class ShopInfo implements Serializable { + + private static final long serialVersionUID = -3759074878713856529L; + + /** + * 配送公司Id. + */ + @SerializedName("goods_info") + private WaybillGoodsInfo goodsInfo; + + + } + + + /** + * 运力信息. + */ + @Data + @Accessors(chain = true) + public static class DeliveryInfo implements Serializable { + + private static final long serialVersionUID = -3759074878713856529L; + + /** + * 配送公司Id. + */ + @SerializedName("delivery_id") + private String deliveryId; + + /** + * 运力公司名称. + */ + @SerializedName("delivery_name") + private String deliveryName; + + } +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/WaybillGoodsInfo.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/WaybillGoodsInfo.java index 709d316ec6..8695efec1a 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/WaybillGoodsInfo.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/delivery/WaybillGoodsInfo.java @@ -43,7 +43,7 @@ public static class GoodsItem { *
*/ @SerializedName("goods_name") - private Long goodsName; + private String goodsName; /** * 商品图片URL @@ -52,7 +52,7 @@ public static class GoodsItem { * */ @SerializedName("goods_img_url") - private Integer goodsImgUrl; + private String goodsImgUrl; } 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 8a149b4d73..0f6bd29633 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 @@ -542,6 +542,18 @@ public interface InstantDelivery { */ String QUERY_WAYBILL_TRACE_URL = "https://api.weixin.qq.com/cgi-bin/express/delivery/open_msg/query_trace"; + /** + * 物流服务-消息组件-传运单接口(订阅消息) follow_waybill + * 商户在调用完trace_waybill接口后,可以使用本接口查询到对应运单的详情信息 + */ + String FOLLOW_WAYBILL_URL = "https://api.weixin.qq.com/cgi-bin/express/delivery/open_msg/follow_waybill"; + + /** + * 物流服务-消息组件-查运单接口(订阅消息) query_follow_trace + * 商户在调用完trace_waybill接口后,可以使用本接口查询到对应运单的详情信息 + */ + String QUERY_FOLLOW_TRACE_URL = "https://api.weixin.qq.com/cgi-bin/express/delivery/open_msg/query_follow_trace"; + /** * 下单接口. From 6c48307d4f8e33ff21f23d3324543b3fd6688cfa Mon Sep 17 00:00:00 2001 From: wanglei Date: Tue, 5 Apr 2022 16:38:17 +0800 Subject: [PATCH 11/43] =?UTF-8?q?=E5=BA=8F=E5=88=97=E5=8C=96=E6=B3=A8?= =?UTF-8?q?=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cp/bean/external/WxCpUserExternalGroupChatTransferResp.java | 1 + 1 file changed, 1 insertion(+) diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpUserExternalGroupChatTransferResp.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpUserExternalGroupChatTransferResp.java index 4f4ee7ef1c..ed40f8acfa 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpUserExternalGroupChatTransferResp.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpUserExternalGroupChatTransferResp.java @@ -39,6 +39,7 @@ public static class GroupChatFailedTransfer extends WxCpBaseResp { /** * 没能成功继承的群ID */ + @SerializedName("chat_id") private String chatId; public static WxCpUserExternalGroupChatTransferResp.GroupChatFailedTransfer fromJson(String json) { From 9e21001e2bf95bc181286a641806f03ede9e6d1c Mon Sep 17 00:00:00 2001 From: wanglei Date: Tue, 5 Apr 2022 16:40:22 +0800 Subject: [PATCH 12/43] =?UTF-8?q?=E4=BA=A4=E6=98=93=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E8=A1=A5=E5=85=85=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../binarywang/wx/miniapp/bean/shop/WxMaShopProductInfo.java | 3 +++ 1 file changed, 3 insertions(+) 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 index b381b18f66..37898b243d 100644 --- 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 @@ -88,5 +88,8 @@ public class WxMaShopProductInfo implements Serializable { */ @SerializedName("real_price") private Integer realPrice; + + @SerializedName("sku_real_price") + private Integer skuRealPrice; } From 36071f81b3f246977c20ff6335f580657f17b390 Mon Sep 17 00:00:00 2001 From: wanglei Date: Tue, 26 Apr 2022 17:41:06 +0800 Subject: [PATCH 13/43] =?UTF-8?q?=E5=AE=A2=E6=9C=8D=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chanjar/weixin/cp/api/WxCpKfService.java | 43 ++++++++++++++ .../weixin/cp/api/impl/WxCpKfServiceImpl.java | 58 +++++++++++++++++++ .../kf/WxCpKfServiceUpgradeConfigResp.java | 48 +++++++++++++++ .../weixin/cp/constant/WxCpApiPathConsts.java | 3 + 4 files changed, 152 insertions(+) create mode 100644 weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfServiceUpgradeConfigResp.java diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpKfService.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpKfService.java index 0da548905c..c51eb5c7e2 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpKfService.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpKfService.java @@ -16,6 +16,7 @@ import me.chanjar.weixin.cp.bean.kf.WxCpKfMsgSendResp; import me.chanjar.weixin.cp.bean.kf.WxCpKfServiceStateResp; import me.chanjar.weixin.cp.bean.kf.WxCpKfServiceStateTransResp; +import me.chanjar.weixin.cp.bean.kf.WxCpKfServiceUpgradeConfigResp; import me.chanjar.weixin.cp.bean.kf.WxCpKfServicerListResp; import me.chanjar.weixin.cp.bean.kf.WxCpKfServicerOpResp; @@ -188,4 +189,46 @@ WxCpKfMsgListResp syncMsg(String cursor, String token, Integer limit, Integer vo */ WxCpKfCustomerBatchGetResp customerBatchGet(List externalUserIdList) throws WxErrorException; + + // 「升级服务」配置 + /** + * 获取配置的专员与客户群 + * @return + * @throws WxErrorException + */ + WxCpKfServiceUpgradeConfigResp getUpgradeServiceConfig() throws WxErrorException; + + /** + * 升级专员服务 + * @param openKfid 客服帐号ID + * @param externalUserId 微信客户的external_userid + * @param userid 服务专员的userid + * @param wording 推荐语 + * @return + * @throws WxErrorException + */ + WxCpBaseResp upgradeMemberService(String openKfid, String externalUserId, + String userid, String wording) throws WxErrorException; + + /** + * 升级客户群服务 + * @param openKfid 客服帐号ID + * @param externalUserId 微信客户的external_userid + * @param chatId 客户群id + * @param wording 推荐语 + * @return + * @throws WxErrorException + */ + WxCpBaseResp upgradeGroupchatService(String openKfid, String externalUserId, + String chatId, String wording) throws WxErrorException; + + /** + * 为客户取消推荐 + * @param openKfid 客服帐号ID + * @param externalUserId 微信客户的external_userid + * @return + * @throws WxErrorException + */ + WxCpBaseResp cancelUpgradeService(String openKfid, String externalUserId) + throws WxErrorException; } diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpKfServiceImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpKfServiceImpl.java index 12f1062b0c..72fed48965 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpKfServiceImpl.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpKfServiceImpl.java @@ -23,6 +23,7 @@ import me.chanjar.weixin.cp.bean.kf.WxCpKfMsgSendResp; import me.chanjar.weixin.cp.bean.kf.WxCpKfServiceStateResp; import me.chanjar.weixin.cp.bean.kf.WxCpKfServiceStateTransResp; +import me.chanjar.weixin.cp.bean.kf.WxCpKfServiceUpgradeConfigResp; import me.chanjar.weixin.cp.bean.kf.WxCpKfServicerListResp; import me.chanjar.weixin.cp.bean.kf.WxCpKfServicerOpResp; import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder; @@ -188,4 +189,61 @@ public WxCpKfCustomerBatchGetResp customerBatchGet(List externalUserIdLi return WxCpKfCustomerBatchGetResp.fromJson(responseContent); } + @Override + public WxCpKfServiceUpgradeConfigResp getUpgradeServiceConfig() throws WxErrorException { + String url = cpService.getWxCpConfigStorage().getApiUrl(CUSTOMER_GET_UPGRADE_SERVICE_CONFIG); + + String response = cpService.get(url, null); + return WxCpKfServiceUpgradeConfigResp.fromJson(response); + } + + @Override + public WxCpBaseResp upgradeMemberService(String openKfid, String externalUserId, + String userid, String wording) throws WxErrorException { + String url = cpService.getWxCpConfigStorage().getApiUrl(CUSTOMER_UPGRADE_SERVICE); + + JsonObject json = new JsonObject(); + json.addProperty("open_kfid", openKfid); + json.addProperty("external_userid", externalUserId); + json.addProperty("type", 1); + + JsonObject memberJson = new JsonObject(); + memberJson.addProperty("userid", userid); + memberJson.addProperty("wording", wording); + json.add("member", memberJson); + + String response = cpService.post(url, json); + return WxCpBaseResp.fromJson(response); + } + + @Override + public WxCpBaseResp upgradeGroupchatService(String openKfid, String externalUserId, + String chatId, String wording) throws WxErrorException { + String url = cpService.getWxCpConfigStorage().getApiUrl(CUSTOMER_UPGRADE_SERVICE); + + JsonObject json = new JsonObject(); + json.addProperty("open_kfid", openKfid); + json.addProperty("external_userid", externalUserId); + json.addProperty("type", 2); + + JsonObject groupchatJson = new JsonObject(); + groupchatJson.addProperty("chat_id", chatId); + groupchatJson.addProperty("wording", wording); + json.add("groupchat", groupchatJson); + + String response = cpService.post(url, json); + return WxCpBaseResp.fromJson(response); + } + + @Override + public WxCpBaseResp cancelUpgradeService(String openKfid, String externalUserId) + throws WxErrorException { + String url = cpService.getWxCpConfigStorage().getApiUrl(CUSTOMER_CANCEL_UPGRADE_SERVICE); + + JsonObject json = new JsonObject(); + json.addProperty("open_kfid", openKfid); + json.addProperty("external_userid", externalUserId); + String response = cpService.post(url, json); + return WxCpBaseResp.fromJson(response); + } } diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfServiceUpgradeConfigResp.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfServiceUpgradeConfigResp.java new file mode 100644 index 0000000000..9ef4412652 --- /dev/null +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfServiceUpgradeConfigResp.java @@ -0,0 +1,48 @@ +package me.chanjar.weixin.cp.bean.kf; + +import com.google.gson.annotations.SerializedName; +import java.util.List; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import me.chanjar.weixin.cp.bean.WxCpBaseResp; +import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder; + +/** + * @author leiin + * @date 2022/4/26 5:21 下午 + */ +@EqualsAndHashCode(callSuper = true) +@NoArgsConstructor +@Data +public class WxCpKfServiceUpgradeConfigResp extends WxCpBaseResp { + + private static final long serialVersionUID = -3212550906238196617L; + + @SerializedName("member_range") + private MemberRange memberRange; + + @SerializedName("groupchat_range") + private GroupchatRange groupchatRange; + + public static WxCpKfServiceUpgradeConfigResp fromJson(String json) { + return WxCpGsonBuilder.create().fromJson(json, WxCpKfServiceUpgradeConfigResp.class); + } + + @Data + @NoArgsConstructor + public class MemberRange { + @SerializedName("userid_list") + private List useridList; + + @SerializedName("department_id_list") + private List departmentIdList; + } + + @Data + @NoArgsConstructor + private class GroupchatRange { + @SerializedName("chat_id_list") + private List chatIdList; + } +} diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/constant/WxCpApiPathConsts.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/constant/WxCpApiPathConsts.java index 2155b4c611..0783d8dfdd 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/constant/WxCpApiPathConsts.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/constant/WxCpApiPathConsts.java @@ -274,6 +274,9 @@ interface Kf { String SEND_MSG_ON_EVENT = "/cgi-bin/kf/send_msg_on_event"; String CUSTOMER_BATCH_GET = "/cgi-bin/kf/customer/batchget"; + String CUSTOMER_GET_UPGRADE_SERVICE_CONFIG = "/cgi-bin/kf/customer/get_upgrade_service_config"; + String CUSTOMER_UPGRADE_SERVICE = "/cgi-bin/kf/customer/upgrade_service"; + String CUSTOMER_CANCEL_UPGRADE_SERVICE = "/cgi-bin/kf/customer/cancel_upgrade_service"; } } From db26bf626377d3fd4ae3ad3e79f8feb8727b46de Mon Sep 17 00:00:00 2001 From: wanglei Date: Tue, 26 Apr 2022 17:55:25 +0800 Subject: [PATCH 14/43] =?UTF-8?q?=E5=86=85=E9=83=A8=E7=B1=BB=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wanglei --- .../weixin/cp/bean/kf/WxCpKfServiceUpgradeConfigResp.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfServiceUpgradeConfigResp.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfServiceUpgradeConfigResp.java index 9ef4412652..2e9d36d715 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfServiceUpgradeConfigResp.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/kf/WxCpKfServiceUpgradeConfigResp.java @@ -31,7 +31,7 @@ public static WxCpKfServiceUpgradeConfigResp fromJson(String json) { @Data @NoArgsConstructor - public class MemberRange { + public static class MemberRange { @SerializedName("userid_list") private List useridList; @@ -41,7 +41,7 @@ public class MemberRange { @Data @NoArgsConstructor - private class GroupchatRange { + public static class GroupchatRange { @SerializedName("chat_id_list") private List chatIdList; } From 1249dff0b3081963355a1a24baab01b6a8868580 Mon Sep 17 00:00:00 2001 From: wanglei Date: Sat, 18 Jun 2022 15:57:47 +0800 Subject: [PATCH 15/43] =?UTF-8?q?=E8=A7=86=E9=A2=91=E5=8F=B7=E5=88=86?= =?UTF-8?q?=E4=BA=AB=E4=BA=BA=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wanglei --- .../wx/miniapp/api/WxMaShopSharerService.java | 83 +++++++++++++ .../api/impl/WxMaShopSharerServiceImpl.java | 113 ++++++++++++++++++ .../miniapp/bean/shop/WxMaPromotionInfo.java | 24 ++++ .../bean/shop/WxMaShopOrderDetail.java | 3 + .../wx/miniapp/bean/shop/WxMaShopPayInfo.java | 3 + .../WxMaShopSearchSharerResponse.java | 24 ++++ .../response/WxMaShopSharerBindResponse.java | 40 +++++++ .../WxMaShopSharerDataSummaryResponse.java | 21 ++++ .../response/WxMaShopSharerListResponse.java | 30 +++++ .../WxMaShopSharerLiveOrderListResponse.java | 22 ++++ ...WxMaShopSharerLiveSummaryListResponse.java | 41 +++++++ .../WxMaShopSharerUnbindResponse.java | 25 ++++ .../miniapp/constant/WxMaApiUrlConstants.java | 10 ++ 13 files changed, 439 insertions(+) create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopSharerService.java create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopSharerServiceImpl.java create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaPromotionInfo.java create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSearchSharerResponse.java create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSharerBindResponse.java create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSharerDataSummaryResponse.java create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSharerListResponse.java create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSharerLiveOrderListResponse.java create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSharerLiveSummaryListResponse.java create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSharerUnbindResponse.java diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopSharerService.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopSharerService.java new file mode 100644 index 0000000000..76a4e95485 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopSharerService.java @@ -0,0 +1,83 @@ +package cn.binarywang.wx.miniapp.api; + +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopSearchSharerResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopSharerBindResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopSharerDataSummaryResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopSharerListResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopSharerLiveOrderListResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopSharerLiveSummaryListResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopSharerUnbindResponse; +import me.chanjar.weixin.common.error.WxErrorException; + +/** + * 分享员 + * @author leiin + * @date 2022/6/18 2:48 下午 + */ +public interface WxMaShopSharerService { + + /** + * 绑定分享员 + * 用来批量邀请分享员 + * @param openids + * @return + * @throws WxErrorException + */ + WxMaShopSharerBindResponse bindSharer(String[] openids) throws WxErrorException; + + /** + * 获取分享员的总带货数据 + * @param openid + * @return + * @throws WxErrorException + */ + WxMaShopSharerDataSummaryResponse getSharerDataSummary(String openid) throws WxErrorException; + + /** + * 获取已经绑定的分享员列表 + * @param page + * @param pageSize + * @return + * @throws WxErrorException + */ + WxMaShopSharerListResponse getSharerList(Integer page, Integer pageSize) throws WxErrorException; + + /** + * 获取分享员的直播间订单汇总 + * @param openid + * @param liveExportId + * @param page + * @param pageSize + * @return + * @throws WxErrorException + */ + WxMaShopSharerLiveOrderListResponse getSharerLiveOrderList(String openid, String liveExportId, + Integer page, Integer pageSize) throws WxErrorException; + + /** + * 获取分享员的直播间带货数据汇总 + * @param openid + * @param page + * @param pageSize + * @return + * @throws WxErrorException + */ + WxMaShopSharerLiveSummaryListResponse getSharerLiveSummaryList(String openid, + Integer page, Integer pageSize) throws WxErrorException; + + /** + * 查看分享员 + * @param openid + * @return + * @throws WxErrorException + */ + WxMaShopSearchSharerResponse searchSharer(String openid) throws WxErrorException; + + /** + * 解绑分享员 + * @param openids + * @return + * @throws WxErrorException + */ + WxMaShopSharerUnbindResponse unbindSharer(String[] openids) throws WxErrorException; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopSharerServiceImpl.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopSharerServiceImpl.java new file mode 100644 index 0000000000..af8abe50b5 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopSharerServiceImpl.java @@ -0,0 +1,113 @@ +package cn.binarywang.wx.miniapp.api.impl; + +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Shop.Sharer; + +import cn.binarywang.wx.miniapp.api.WxMaService; +import cn.binarywang.wx.miniapp.api.WxMaShopSharerService; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopSearchSharerResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopSharerBindResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopSharerDataSummaryResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopSharerListResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopSharerLiveOrderListResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopSharerLiveSummaryListResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopSharerUnbindResponse; +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/6/18 3:38 下午 + */ +@RequiredArgsConstructor +@Slf4j +public class WxMaShopSharerServiceImpl implements WxMaShopSharerService { + private static final String ERR_CODE = "errcode"; + private final WxMaService wxMaService; + + @Override + public WxMaShopSharerBindResponse bindSharer(String[] openids) throws WxErrorException { + JsonObject json = GsonHelper.buildJsonObject("openids", openids); + String responseContent = this.wxMaService.post(Sharer.BIND, 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, WxMaShopSharerBindResponse.class); + } + + @Override + public WxMaShopSharerDataSummaryResponse getSharerDataSummary(String openid) throws WxErrorException { + JsonObject json = GsonHelper.buildJsonObject("openid", openid); + String responseContent = this.wxMaService.post(Sharer.GET_SHARER_DATA_SUMMARY, 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, WxMaShopSharerDataSummaryResponse.class); + } + + @Override + public WxMaShopSharerListResponse getSharerList(Integer page, Integer pageSize) throws WxErrorException { + JsonObject json = GsonHelper.buildJsonObject("page", page, "page_size", pageSize); + String responseContent = this.wxMaService.post(Sharer.GET_SHARER_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, WxMaShopSharerListResponse.class); + } + + @Override + public WxMaShopSharerLiveOrderListResponse getSharerLiveOrderList(String openid, String liveExportId, + Integer page, Integer pageSize) throws WxErrorException { + JsonObject json = GsonHelper.buildJsonObject("openid", openid, "live_export_id", liveExportId, + "page", page, "page_size", pageSize); + String responseContent = this.wxMaService.post(Sharer.GET_SHARER_LIVE_ORDER_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, WxMaShopSharerLiveOrderListResponse.class); + } + + @Override + public WxMaShopSharerLiveSummaryListResponse getSharerLiveSummaryList(String openid, + Integer page, Integer pageSize) throws WxErrorException { + JsonObject json = GsonHelper.buildJsonObject("openid", openid, "page", page, "page_size", pageSize); + String responseContent = this.wxMaService.post(Sharer.GET_SHARER_LIVE_SUMMARY_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, WxMaShopSharerLiveSummaryListResponse.class); + } + + @Override + public WxMaShopSearchSharerResponse searchSharer(String openid) throws WxErrorException { + JsonObject json = GsonHelper.buildJsonObject("openid", openid); + String responseContent = this.wxMaService.post(Sharer.SEARCH_SHARER, 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, WxMaShopSearchSharerResponse.class); + } + + @Override + public WxMaShopSharerUnbindResponse unbindSharer(String[] openids) throws WxErrorException { + JsonObject json = GsonHelper.buildJsonObject("openids", openids); + String responseContent = this.wxMaService.post(Sharer.UNBIND, 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, WxMaShopSharerUnbindResponse.class); + } +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaPromotionInfo.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaPromotionInfo.java new file mode 100644 index 0000000000..332e187206 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaPromotionInfo.java @@ -0,0 +1,24 @@ +package cn.binarywang.wx.miniapp.bean.shop; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; + +/** + * @author leiin + * @date 2022/6/18 3:14 下午 + */ +@Data +public class WxMaPromotionInfo implements Serializable { + + private static final long serialVersionUID = 2090629980847386450L; + + @SerializedName("finder_username") + private String finderUsername; + @SerializedName("finder_nickname") + private String finderNickname; + @SerializedName("sharer_openid") + private String sharerOpenid; + @SerializedName("live_start_time") + private String liveStartTime; +} 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 index 661fa3208a..1c3a9ad406 100644 --- 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 @@ -14,6 +14,9 @@ public class WxMaShopOrderDetail implements Serializable { private static final long serialVersionUID = 3325843289672341160L; + @SerializedName("promotion_info") + private WxMaPromotionInfo promotionInfo; + /** * 下单商品信息 *
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
index 7ea749e197..24d772c236 100644
--- 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
@@ -21,6 +21,9 @@ public class WxMaShopPayInfo implements Serializable {
   @SerializedName("pay_method_type")
   private Integer payMethodType;
 
+  @SerializedName("pay_method")
+  private String payMethod;
+
   /**
    * 预支付ID
    * 
diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSearchSharerResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSearchSharerResponse.java
new file mode 100644
index 0000000000..9366a50146
--- /dev/null
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSearchSharerResponse.java
@@ -0,0 +1,24 @@
+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/18 2:58 下午
+ */
+@Data
+public class WxMaShopSearchSharerResponse extends WxMaShopBaseResponse implements Serializable {
+
+  private static final long serialVersionUID = 2049214239752832818L;
+
+  @SerializedName("invited_time")
+  private Long invitedTime;
+  @SerializedName("bind_time")
+  private Long bindTime;
+  @SerializedName("nickname")
+  private String nickname;
+  @SerializedName("bind_status")
+  private Integer bindStatus;
+}
diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSharerBindResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSharerBindResponse.java
new file mode 100644
index 0000000000..d88a482987
--- /dev/null
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSharerBindResponse.java
@@ -0,0 +1,40 @@
+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;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author leiin
+ * @date 2022/6/18 2:51 下午
+ */
+@Data
+public class WxMaShopSharerBindResponse extends WxMaShopBaseResponse implements Serializable {
+
+  private static final long serialVersionUID = 5648529892711033276L;
+
+  @SerializedName("success_list")
+  private List successList;
+
+  @SerializedName("fail_list")
+  private List failList;
+
+  @SerializedName("refuse_list")
+  private List refuseList;
+
+  @SerializedName("result_list")
+  private List resultList;
+
+  @Getter
+  @Setter
+  public static class ResultListItem {
+    private String openid;
+    @SerializedName("result_code")
+    private Integer resultCode;
+    @SerializedName("reason_code")
+    private Integer reasonCode;
+  }
+}
diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSharerDataSummaryResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSharerDataSummaryResponse.java
new file mode 100644
index 0000000000..304bf3d18d
--- /dev/null
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSharerDataSummaryResponse.java
@@ -0,0 +1,21 @@
+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/18 2:53 下午
+ */
+@Data
+public class WxMaShopSharerDataSummaryResponse extends WxMaShopBaseResponse implements Serializable {
+
+  private static final long serialVersionUID = 3985829585979186778L;
+
+  private Long gmv;
+  @SerializedName("order_cnt")
+  private Long orderCnt;
+  @SerializedName("user_cnt")
+  private Long userCnt;
+}
diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSharerListResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSharerListResponse.java
new file mode 100644
index 0000000000..c49c0c5f0f
--- /dev/null
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSharerListResponse.java
@@ -0,0 +1,30 @@
+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/6/18 2:55 下午
+ */
+@Data
+public class WxMaShopSharerListResponse extends WxMaShopBaseResponse implements Serializable {
+
+  private static final long serialVersionUID = -8533731677643022825L;
+
+  private List sharers;
+  @SerializedName("total_num")
+  private Integer totalNum;
+
+  @Data
+  public static class SharerInfo {
+    private String openid;
+    @SerializedName("invited_time")
+    private Long invitedTime;
+    @SerializedName("bind_time")
+    private Long bindTime;
+    private String nickname;
+  }
+}
diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSharerLiveOrderListResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSharerLiveOrderListResponse.java
new file mode 100644
index 0000000000..8764363582
--- /dev/null
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSharerLiveOrderListResponse.java
@@ -0,0 +1,22 @@
+package cn.binarywang.wx.miniapp.bean.shop.response;
+
+import cn.binarywang.wx.miniapp.bean.shop.WxMaShopOrderDetail;
+import com.google.gson.annotations.SerializedName;
+import java.io.Serializable;
+import java.util.List;
+import lombok.Data;
+
+/**
+ * @author leiin
+ * @date 2022/6/18 2:56 下午
+ */
+@Data
+public class WxMaShopSharerLiveOrderListResponse extends WxMaShopBaseResponse implements Serializable {
+
+  private static final long serialVersionUID = -4190199778148290127L;
+
+  private List orders;
+
+  @SerializedName("total_num")
+  private Integer totalNum;
+}
diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSharerLiveSummaryListResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSharerLiveSummaryListResponse.java
new file mode 100644
index 0000000000..bb3fa927b8
--- /dev/null
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSharerLiveSummaryListResponse.java
@@ -0,0 +1,41 @@
+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/6/18 2:57 下午
+ */
+@Data
+public class WxMaShopSharerLiveSummaryListResponse extends WxMaShopBaseResponse implements Serializable {
+
+  private static final long serialVersionUID = -2085366863029618067L;
+
+  private List lives;
+
+  @SerializedName("total_num")
+  private Integer totalNum;
+
+  @Data
+  public static class LiveSummaryItem {
+    @SerializedName("live_export_id")
+    private String liveExportId;
+    @SerializedName("live_nickname")
+    private String liveNickname;
+    @SerializedName("live_start_time")
+    private Long liveStartTime;
+    @SerializedName("live_end_time")
+    private Long liveEndTime;
+    @SerializedName("live_status")
+    private Long liveStatus;
+    @SerializedName("gmv")
+    private Long gmv;
+    @SerializedName("order_cnt")
+    private Long orderCnt;
+    @SerializedName("user_cnt")
+    private Long userCnt;
+  }
+}
diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSharerUnbindResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSharerUnbindResponse.java
new file mode 100644
index 0000000000..6ce228a8ce
--- /dev/null
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSharerUnbindResponse.java
@@ -0,0 +1,25 @@
+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/6/18 3:00 下午
+ */
+@Data
+public class WxMaShopSharerUnbindResponse extends WxMaShopBaseResponse implements Serializable {
+
+  private static final long serialVersionUID = -9015680115600175408L;
+
+  @SerializedName("success_list")
+  private List successList;
+
+  @SerializedName("fail_list")
+  private List failList;
+
+  @SerializedName("refuse_list")
+  private List refuseList;
+}
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 0f6bd29633..fc8f2c35c0 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
@@ -451,6 +451,16 @@ interface Aftersale {
       String AFTERSALE_GET = "https://api.weixin.qq.com/shop/aftersale/get";
       String AFTERSALE_UPDATE = "https://api.weixin.qq.com/shop/aftersale/update";
     }
+
+    interface Sharer {
+      String BIND = "https://api.weixin.qq.com/shop/sharer/bind";
+      String GET_SHARER_DATA_SUMMARY = "https://api.weixin.qq.com/shop/sharer/get_sharer_data_summary";
+      String GET_SHARER_LIST = "https://api.weixin.qq.com/shop/sharer/get_sharer_list";
+      String GET_SHARER_LIVE_ORDER_LIST = "https://api.weixin.qq.com/shop/sharer/get_sharer_live_order_list";
+      String GET_SHARER_LIVE_SUMMARY_LIST = "https://api.weixin.qq.com/shop/sharer/get_sharer_live_summary_list";
+      String SEARCH_SHARER = "https://api.weixin.qq.com/shop/sharer/search_sharer";
+      String UNBIND = "https://api.weixin.qq.com/shop/sharer/unbind";
+    }
   }
 
   /**

From 029661eff65b8b2d03e9c29b54109061633f7039 Mon Sep 17 00:00:00 2001
From: wanglei 
Date: Sat, 18 Jun 2022 16:06:54 +0800
Subject: [PATCH 16/43] =?UTF-8?q?=E8=A7=86=E9=A2=91=E5=8F=B7=E5=88=86?=
 =?UTF-8?q?=E4=BA=AB=E4=BA=BA=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: wanglei 
---
 .../main/java/cn/binarywang/wx/miniapp/api/WxMaService.java | 6 ++++++
 .../binarywang/wx/miniapp/api/impl/BaseWxMaServiceImpl.java | 4 ++++
 2 files changed, 10 insertions(+)

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 8b357a8476..9e00a5f6bf 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
@@ -492,4 +492,10 @@ public interface WxMaService extends WxService {
    */
   WxMaSafetyRiskControlService getSafetyRiskControlService();
 
+  /**
+   * 分享人接口
+   * @return
+   */
+  WxMaShopSharerService getShopSharerService();
+
 }
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 62ca188d53..9e218f00f8 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
@@ -79,6 +79,7 @@ public abstract class BaseWxMaServiceImpl implements WxMaService, RequestH
   private final WxMaMarketingService marketingService = new WxMaMarketingServiceImpl(this);
   private final WxMaImmediateDeliveryService immediateDeliveryService = new WxMaImmediateDeliveryServiceImpl(this);
   private final WxMaSafetyRiskControlService safetyRiskControlService = new WxMaSafetyRiskControlServiceImpl(this);
+  private final WxMaShopSharerService shopSharerService = new WxMaShopSharerServiceImpl(this);
   private Map configMap;
   private int retrySleepMillis = 1000;
   private int maxRetryTimes = 5;
@@ -592,4 +593,7 @@ public WxMaImmediateDeliveryService getWxMaImmediateDeliveryService() {
   @Override
   public WxMaSafetyRiskControlService getSafetyRiskControlService(){ return this.safetyRiskControlService; }
 
+  @Override
+  public WxMaShopSharerService getShopSharerService() {return this.shopSharerService; }
+
 }

From 35c30048ea278d5d45a196444f5adf83d4af6d4f Mon Sep 17 00:00:00 2001
From: "boris.bao" 
Date: Mon, 20 Jun 2022 09:12:50 +0800
Subject: [PATCH 17/43] fix

---
 .../cn/binarywang/wx/miniapp/bean/shop/WxMaShopOrderDetail.java | 2 --
 1 file changed, 2 deletions(-)

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
index cca33dfd56..c977d48f9f 100644
--- 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
@@ -14,8 +14,6 @@
 public class WxMaShopOrderDetail implements Serializable {
   private static final long serialVersionUID = 3325843289672341160L;
 
-  @SerializedName("promotion_info")
-  private WxMaPromotionInfo promotionInfo;
 
   /**
    * 推广员、分享员信息

From e0b06803b71f234f446a3a03024e0fc71a79da85 Mon Sep 17 00:00:00 2001
From: wanglei 
Date: Mon, 20 Jun 2022 19:46:23 +0800
Subject: [PATCH 18/43] =?UTF-8?q?=E6=A0=87=E5=87=86=E4=BA=A4=E6=98=93?=
 =?UTF-8?q?=E7=BB=84=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: wanglei 
---
 .../wx/miniapp/api/WxMaProductService.java    | 119 +++++++
 .../wx/miniapp/api/WxMaService.java           |   5 +
 .../miniapp/api/impl/BaseWxMaServiceImpl.java |   4 +
 .../api/impl/WxMaProductServiceImpl.java      | 298 ++++++++++++++++++
 .../miniapp/bean/product/MinishopShopCat.java |  23 ++
 .../bean/product/WxMiniAfterSaleDetail.java   |  24 ++
 .../product/WxMinishopAddGoodsSkuData.java    |  16 +
 .../product/WxMinishopAddGoodsSpuData.java    |  16 +
 .../bean/product/WxMinishopAddressInfo.java   |  28 ++
 .../product/WxMinishopDeliveryCompany.java    |  12 +
 .../bean/product/WxMinishopDeliveryInfo.java  |  62 ++++
 .../bean/product/WxMinishopGoodsSkuAttr.java  |  25 ++
 .../bean/product/WxMinishopOrderDetail.java   |  48 +++
 .../product/WxMinishopOrderListResponse.java  |  17 +
 .../bean/product/WxMinishopOrderResult.java   |  61 ++++
 .../bean/product/WxMinishopPayInfo.java       |  54 ++++
 .../bean/product/WxMinishopPriceInfo.java     |  44 +++
 .../bean/product/WxMinishopProductInfo.java   |  65 ++++
 .../bean/product/WxMinishopResult.java        |  14 +
 .../miniapp/bean/product/WxMinishopSku.java   |  41 +++
 .../miniapp/bean/product/WxMinishopSpu.java   |  51 +++
 .../bean/product/WxMinishopSpuGet.java        |  16 +
 .../product/WxMinishopSpuGetResponse.java     |  12 +
 .../product/WxMinishopSpuListResponse.java    |  17 +
 .../product/WxMinishopUpdateGoodsSkuData.java |  16 +
 .../miniapp/constant/WxMaApiUrlConstants.java |  25 ++
 26 files changed, 1113 insertions(+)
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaProductService.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaProductServiceImpl.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/MinishopShopCat.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMiniAfterSaleDetail.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopAddGoodsSkuData.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopAddGoodsSpuData.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopAddressInfo.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopDeliveryCompany.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopDeliveryInfo.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopGoodsSkuAttr.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopOrderDetail.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopOrderListResponse.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopOrderResult.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopPayInfo.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopPriceInfo.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopProductInfo.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopResult.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopSku.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopSpu.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopSpuGet.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopSpuGetResponse.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopSpuListResponse.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopUpdateGoodsSkuData.java

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
new file mode 100644
index 0000000000..b496470749
--- /dev/null
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaProductService.java
@@ -0,0 +1,119 @@
+package cn.binarywang.wx.miniapp.api;
+
+import cn.binarywang.wx.miniapp.bean.product.WxMinishopAddGoodsSkuData;
+import cn.binarywang.wx.miniapp.bean.product.WxMinishopAddGoodsSpuData;
+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.WxMinishopSpu;
+import cn.binarywang.wx.miniapp.bean.product.WxMinishopSpuGet;
+import cn.binarywang.wx.miniapp.bean.product.WxMinishopSpuGetResponse;
+import cn.binarywang.wx.miniapp.bean.product.WxMinishopSpuListResponse;
+import cn.binarywang.wx.miniapp.bean.product.WxMinishopUpdateGoodsSkuData;
+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.util.List;
+import me.chanjar.weixin.common.error.WxErrorException;
+
+/**
+ * 小程序交易组件-商品服务
+ *
+ * @author boris
+ */
+public interface WxMaProductService {
+  WxMinishopResult addSpu(WxMinishopSpu spuInfo) throws WxErrorException;
+
+  WxMaShopBaseResponse deleteSpu(Integer productId, String outProductId) throws WxErrorException;
+
+  WxMinishopSpuGetResponse getSpu(Integer productId, String outProductId, Integer needEditSpu)
+    throws WxErrorException;
+
+  WxMinishopSpuListResponse getSpuList(WxMaShopSpuPageRequest request)
+    throws WxErrorException;
+
+  WxMinishopResult updateSpu(WxMinishopSpu spuInfo) throws WxErrorException;
+
+  WxMaShopBaseResponse listingSpu(Integer productId, String outProductId)
+    throws WxErrorException;
+
+  WxMaShopBaseResponse delistingSpu(Integer productId, String outProductId)
+    throws WxErrorException;
+
+  /**
+   * 小商店新增sku信息
+   *
+   * @param sku
+   * @return
+   * @throws WxErrorException
+   */
+  WxMinishopResult minishiopGoodsAddSku(WxMinishopSku sku) throws WxErrorException;
+
+
+  /**
+   * 小商店批量新增sku信息
+   *
+   * @param skuList
+   * @return
+   * @throws WxErrorException
+   */
+  WxMinishopResult> minishopGoodsBatchAddSku(List skuList) throws WxErrorException;
+
+
+  /**
+   * 小商店删除sku消息
+   *
+   * @param productId
+   * @param outProductId
+   * @param outSkuId
+   * @param skuId
+   * @return
+   * @throws WxErrorException
+   */
+  WxMaShopBaseResponse minishopGoodsDelSku(Long productId, Long outProductId, String outSkuId, Long skuId) throws WxErrorException;
+
+
+  /**
+   * 小商店更新sku
+   *
+   * @param sku
+   * @return
+   * @throws WxErrorException
+   */
+  WxMinishopResult minishopGoodsUpdateSku(WxMinishopSku sku) throws WxErrorException;
+
+
+  /**
+   * 小商店更新sku价格
+   *
+   * @param productId
+   * @param outProductId
+   * @param outSkuId
+   * @param skuId
+   * @param salePrice
+   * @param marketPrice
+   * @return
+   * @throws WxErrorException
+   */
+  WxMinishopResult minishopGoodsUpdateSkuPrice(Long productId,
+    Long outProductId, String outSkuId, Long skuId, Long salePrice, Long marketPrice) throws WxErrorException;
+
+
+  /**
+   * 小商店更新sku库存
+   *
+   * @param productId
+   * @param outProductId
+   * @param outSkuId
+   * @param skuId
+   * @param type
+   * @param stockNum
+   * @return
+   * @throws WxErrorException
+   */
+  WxMinishopResult minishopGoodsUpdateSkuStock(Long productId,
+    Long 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 9e00a5f6bf..f424ed4552 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
@@ -498,4 +498,9 @@ public interface WxMaService extends WxService {
    */
   WxMaShopSharerService getShopSharerService();
 
+  /**
+   * 标准交易组件接口
+   * @return
+   */
+  WxMaProductService getProductService();
 }
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 9e218f00f8..8151af88b0 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
@@ -80,6 +80,7 @@ public abstract class BaseWxMaServiceImpl implements WxMaService, RequestH
   private final WxMaImmediateDeliveryService immediateDeliveryService = new WxMaImmediateDeliveryServiceImpl(this);
   private final WxMaSafetyRiskControlService safetyRiskControlService = new WxMaSafetyRiskControlServiceImpl(this);
   private final WxMaShopSharerService shopSharerService = new WxMaShopSharerServiceImpl(this);
+  private final WxMaProductService productService = new WxMaProductServiceImpl(this);
   private Map configMap;
   private int retrySleepMillis = 1000;
   private int maxRetryTimes = 5;
@@ -596,4 +597,7 @@ public WxMaImmediateDeliveryService getWxMaImmediateDeliveryService() {
   @Override
   public WxMaShopSharerService getShopSharerService() {return this.shopSharerService; }
 
+  @Override
+  public WxMaProductService getProductService() { return this.productService; }
+
 }
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
new file mode 100644
index 0000000000..6652cd3b0d
--- /dev/null
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaProductServiceImpl.java
@@ -0,0 +1,298 @@
+package cn.binarywang.wx.miniapp.api.impl;
+
+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;
+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_UPDATE_SKU_PRICE_URL;
+import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Sku.PRODUCT_UPDATE_SKU_STOCK_URL;
+import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Sku.PRODUCT_UPDATE_SKU_URL;
+import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Spu.PRODUCT_SPU_ADD_URL;
+import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Spu.PRODUCT_SPU_DELISTING_URL;
+import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Spu.PRODUCT_SPU_DEL_URL;
+import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Spu.PRODUCT_SPU_GET_LIST_URL;
+import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Spu.PRODUCT_SPU_GET_URL;
+import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Spu.PRODUCT_SPU_LISTING_URL;
+import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Spu.PRODUCT_SPU_UPDATE_URL;
+
+import cn.binarywang.wx.miniapp.api.WxMaProductService;
+import cn.binarywang.wx.miniapp.api.WxMaService;
+import cn.binarywang.wx.miniapp.bean.product.WxMinishopAddGoodsSkuData;
+import cn.binarywang.wx.miniapp.bean.product.WxMinishopAddGoodsSpuData;
+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.WxMinishopSpu;
+import cn.binarywang.wx.miniapp.bean.product.WxMinishopSpuGetResponse;
+import cn.binarywang.wx.miniapp.bean.product.WxMinishopSpuListResponse;
+import cn.binarywang.wx.miniapp.bean.product.WxMinishopUpdateGoodsSkuData;
+import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopSpuPageRequest;
+import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse;
+import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import java.util.ArrayList;
+import java.util.List;
+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 WxMaProductServiceImpl implements WxMaProductService {
+
+  private static final String ERR_CODE = "errcode";
+  private final WxMaService wxMaService;
+
+  @Override
+  public WxMinishopResult addSpu(WxMinishopSpu spu) throws WxErrorException {
+
+    String response = this.wxMaService.post(PRODUCT_SPU_ADD_URL, spu);
+
+    JsonObject respObj = GsonParser.parse(response);
+
+    if (respObj.get(ERR_CODE).getAsInt() != 0) {
+      throw new WxErrorException(WxError.fromJson(response, WxType.MiniApp));
+    }
+    WxMinishopResult result = new WxMinishopResult();
+    result.setErrcode(respObj.get("errcode").getAsInt());
+    JsonObject dataObj = respObj.get("data").getAsJsonObject();
+    WxMinishopAddGoodsSpuData resultData = new WxMinishopAddGoodsSpuData();
+    resultData.setProductId(dataObj.get("product_id").getAsLong());
+    resultData.setOutProductId(dataObj.get("out_product_id").getAsString());
+    resultData.setCreateTime(dataObj.get("create_time").getAsString());
+    result.setData(resultData);
+    return result;
+  }
+
+  @Override
+  public WxMaShopBaseResponse deleteSpu(Integer productId, String outProductId)
+    throws WxErrorException {
+    String responseContent = this.wxMaService
+      .post(PRODUCT_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 WxMinishopSpuGetResponse getSpu(Integer productId, String outProductId, Integer needEditSpu)
+    throws WxErrorException {
+    String response = this.wxMaService
+      .post(PRODUCT_SPU_GET_URL, GsonHelper.buildJsonObject("product_id", productId,
+        "out_product_id", outProductId, "need_edit_spu", needEditSpu));
+    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, WxMinishopSpuGetResponse.class);
+  }
+
+  @Override
+  public WxMinishopSpuListResponse getSpuList(WxMaShopSpuPageRequest request)
+    throws WxErrorException {
+    String responseContent = this.wxMaService.post(PRODUCT_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, WxMinishopSpuListResponse.class);
+  }
+
+  @Override
+  public WxMinishopResult updateSpu(WxMinishopSpu spu) throws WxErrorException {
+    String response = this.wxMaService.post(PRODUCT_SPU_UPDATE_URL, spu);
+
+    JsonObject respObj = GsonParser.parse(response);
+
+    if (respObj.get(ERR_CODE).getAsInt() != 0) {
+      throw new WxErrorException(WxError.fromJson(response, WxType.MiniApp));
+    }
+    WxMinishopResult result = new WxMinishopResult();
+    result.setErrcode(respObj.get("errcode").getAsInt());
+    JsonObject dataObj = respObj.get("data").getAsJsonObject();
+    WxMinishopAddGoodsSpuData resultData = new WxMinishopAddGoodsSpuData();
+    resultData.setProductId(dataObj.get("product_id").getAsLong());
+    resultData.setOutProductId(dataObj.get("out_product_id").getAsString());
+    resultData.setUpdateTime(dataObj.get("update_time").getAsString());
+    result.setData(resultData);
+    return result;
+  }
+
+  @Override
+  public WxMaShopBaseResponse listingSpu(Integer productId, String outProductId)
+    throws WxErrorException {
+    String responseContent = this.wxMaService
+      .post(PRODUCT_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(PRODUCT_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);
+  }
+
+  @Override
+  public WxMinishopResult minishiopGoodsAddSku(
+    WxMinishopSku sku) throws WxErrorException {
+    String response = this.wxMaService
+      .post(PRODUCT_ADD_SKU_URL, sku);
+    JsonObject jsonObject = GsonParser.parse(response);
+    if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
+      throw new WxErrorException(WxError.fromJson(response, WxType.MiniApp));
+    }
+    WxMinishopResult result = new WxMinishopResult();
+    result.setErrcode(jsonObject.get("errcode").getAsInt());
+    JsonObject dataObj = jsonObject.get("data").getAsJsonObject();
+    WxMinishopAddGoodsSkuData resultData = new WxMinishopAddGoodsSkuData();
+    resultData.setSkuId(dataObj.get("sku_id").getAsLong());
+    resultData.setCreateTime(dataObj.get("create_time").getAsString());
+    result.setData(resultData);
+    return result;
+  }
+
+  @Override
+  public WxMinishopResult> minishopGoodsBatchAddSku(
+    List skuList) throws WxErrorException {
+    String response = this.wxMaService
+      .post(PRODUCT_BATCH_ADD_SKU_URL, GsonHelper.buildJsonObject("skus", skuList));
+    JsonObject jsonObject = GsonParser.parse(response);
+    if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
+      throw new WxErrorException(WxError.fromJson(response, WxType.MiniApp));
+    }
+
+    WxMinishopResult result = new WxMinishopResult();
+    result.setErrcode(jsonObject.get("errcode").getAsInt());
+    JsonArray jsonArray = jsonObject.get("data").getAsJsonArray();
+    List skuData = new ArrayList<>();
+    for (JsonElement jsonElement : jsonArray) {
+      JsonObject element = jsonElement.getAsJsonObject();
+      WxMinishopAddGoodsSkuData resultData = new WxMinishopAddGoodsSkuData();
+      resultData.setSkuId(element.get("sku_id").getAsLong());
+      resultData.setOutSkuId(element.get("out_sku_id").getAsString());
+      resultData.setCreateTime(element.get("create_time").getAsString());
+      skuData.add(resultData);
+    }
+    result.setData(skuData);
+    return result;
+  }
+
+  @Override
+  public WxMaShopBaseResponse minishopGoodsDelSku(Long productId, Long outProductId,
+    String outSkuId, Long skuId) throws WxErrorException {
+    String response = this.wxMaService
+      .post(PRODUCT_DEL_SKU_URL, GsonHelper.buildJsonObject("product_id", productId,
+        "out_product_id", outProductId, "out_sku_id", outSkuId, "sku_id", skuId));
+    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, WxMaShopBaseResponse.class);
+  }
+
+  @Override
+  public WxMinishopResult minishopGoodsUpdateSku(
+    WxMinishopSku sku) throws WxErrorException {
+    String response = this.wxMaService
+      .post(PRODUCT_UPDATE_SKU_URL, sku);
+    JsonObject jsonObject = GsonParser.parse(response);
+    if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
+      throw new WxErrorException(WxError.fromJson(response, WxType.MiniApp));
+    }
+    WxMinishopResult result = new WxMinishopResult();
+    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;
+  }
+
+  @Override
+  public WxMinishopResult minishopGoodsUpdateSkuPrice(
+    Long productId, Long outProductId, String outSkuId, Long skuId, Long salePrice,
+    Long marketPrice) throws WxErrorException {
+    String response = this.wxMaService
+      .post(PRODUCT_UPDATE_SKU_PRICE_URL, GsonHelper.buildJsonObject(
+        "product_id", productId, "out_product_id", outProductId,
+        "sku_id", skuId, "out_sku_id", outSkuId, "sale_price", salePrice, "market_price", marketPrice));
+    JsonObject jsonObject = GsonParser.parse(response);
+    if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
+      throw new WxErrorException(WxError.fromJson(response, WxType.MiniApp));
+    }
+
+    WxMinishopResult result = new WxMinishopResult();
+    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;
+  }
+
+  @Override
+  public WxMinishopResult minishopGoodsUpdateSkuStock(
+    Long productId, Long outProductId, String outSkuId, Long skuId, Integer type,
+    Integer stockNum) throws WxErrorException {
+    String response = this.wxMaService
+      .post(PRODUCT_UPDATE_SKU_STOCK_URL, GsonHelper.buildJsonObject(
+        "product_id", productId, "out_product_id", outProductId,
+        "sku_id", skuId, "out_sku_id", outSkuId, "type", type, "stock_num", stockNum));
+    JsonObject jsonObject = GsonParser.parse(response);
+    if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
+      throw new WxErrorException(WxError.fromJson(response, WxType.MiniApp));
+    }
+
+    WxMinishopResult result = new WxMinishopResult();
+    result.setErrcode(jsonObject.get("errcode").getAsInt());
+    JsonObject dataObj = jsonObject.get("data").getAsJsonObject();
+    WxMinishopUpdateGoodsSkuData resultData = new WxMinishopUpdateGoodsSkuData();
+    resultData.setUpdateTime(dataObj.get("update_time").getAsString());
+    result.setData(resultData);
+    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/bean/product/MinishopShopCat.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/MinishopShopCat.java
new file mode 100644
index 0000000000..54015f2ed1
--- /dev/null
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/MinishopShopCat.java
@@ -0,0 +1,23 @@
+package cn.binarywang.wx.miniapp.bean.product;
+
+import com.google.gson.annotations.SerializedName;
+import java.io.Serializable;
+import lombok.Data;
+
+/**
+ * 店铺的商品分类
+ */
+@Data
+public class MinishopShopCat implements Serializable {
+  private static final long serialVersionUID = 4179473856929659641L;
+
+  @SerializedName("cat_id")
+  private Integer shopCatId;
+
+  private String shopCatName;
+
+  private Integer fShopCatId;
+
+  @SerializedName("level")
+  private Integer catLevel;
+}
diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMiniAfterSaleDetail.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMiniAfterSaleDetail.java
new file mode 100644
index 0000000000..edf074b4fc
--- /dev/null
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMiniAfterSaleDetail.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 WxMiniAfterSaleDetail {
+  @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/WxMinishopAddGoodsSkuData.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopAddGoodsSkuData.java
new file mode 100644
index 0000000000..6645140787
--- /dev/null
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopAddGoodsSkuData.java
@@ -0,0 +1,16 @@
+package cn.binarywang.wx.miniapp.bean.product;
+
+import com.google.gson.annotations.SerializedName;
+import java.io.Serializable;
+import lombok.Data;
+
+@Data
+public class WxMinishopAddGoodsSkuData implements Serializable {
+  private static final long serialVersionUID = -2596988603027040989L;
+  @SerializedName("sku_id")
+  private Long skuId;
+  @SerializedName("out_sku_id")
+  private String outSkuId;
+  @SerializedName("create_time")
+  private String createTime;
+}
diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopAddGoodsSpuData.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopAddGoodsSpuData.java
new file mode 100644
index 0000000000..bf9bb5c757
--- /dev/null
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopAddGoodsSpuData.java
@@ -0,0 +1,16 @@
+package cn.binarywang.wx.miniapp.bean.product;
+
+import java.io.Serializable;
+import lombok.Data;
+
+@Data
+public class WxMinishopAddGoodsSpuData implements Serializable {
+  private static final long serialVersionUID = 2023708625713948192L;
+  private Long productId;
+
+  private String outProductId;
+
+  private String createTime;
+
+  private String updateTime;
+}
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
new file mode 100644
index 0000000000..0e140883eb
--- /dev/null
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopAddressInfo.java
@@ -0,0 +1,28 @@
+package cn.binarywang.wx.miniapp.bean.product;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+
+/**
+ * @author leiin
+ * @date 2022/6/20 7:32 下午
+ */
+@Data
+public class WxMinishopAddressInfo {
+  @SerializedName("user_name")
+  private String userName;
+  @SerializedName("postal_code")
+  private String postalCode;
+  @SerializedName("province_name")
+  private String provinceName;
+  @SerializedName("city_name")
+  private String cityame;
+  @SerializedName("county_name")
+  private String countyName;
+  @SerializedName("detail_info")
+  private String detailInfo;
+  @SerializedName("national_code")
+  private String nationalCode;
+  @SerializedName("tel_number")
+  private String telNumber;
+}
diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopDeliveryCompany.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopDeliveryCompany.java
new file mode 100644
index 0000000000..7534a94553
--- /dev/null
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopDeliveryCompany.java
@@ -0,0 +1,12 @@
+package cn.binarywang.wx.miniapp.bean.product;
+
+import java.io.Serializable;
+import lombok.Data;
+
+@Data
+public class WxMinishopDeliveryCompany implements Serializable {
+  private static final long serialVersionUID = 3736970376549639779L;
+  private String deliveryId;
+
+  private String deliveryName;
+}
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
new file mode 100644
index 0000000000..b8098edb30
--- /dev/null
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopDeliveryInfo.java
@@ -0,0 +1,62 @@
+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:28 下午
+ */
+@Data
+public class WxMinishopDeliveryInfo {
+  @SerializedName("address_info")
+  private WxMinishopAddressInfo addressInfo;
+  @SerializedName("delivery_method")
+  private String deliveryMethod;
+  @SerializedName("delivery_product_info")
+  private List deliveryProductInfo;
+  @SerializedName("ship_done_time")
+  private Long ship_done_time;
+  @SerializedName("insurance_info")
+  private InsuranceInfo insuranceInfo;
+  @SerializedName("deliver_type")
+  private String deliverType;
+  @SerializedName("offline_delivery_time")
+  private Long offlineDeliveryTime;
+  @SerializedName("offline_pickup_time")
+  private Long offlinePickupTime;
+
+  @Data
+  public static class DeliveryProductInfo {
+    @SerializedName("waybill_id")
+    private String waybillId;
+    @SerializedName("delivery_id")
+    private String deliveryId;
+    @SerializedName("delivery_time")
+    private String deliveryTime;
+    @SerializedName("deliver_type")
+    private String deliverType;
+    @SerializedName("delivery_address")
+    private WxMinishopAddressInfo deliveryAddress;
+    @SerializedName("product_infos")
+    private List productInfos;
+  }
+
+  @Data
+  public static class InsuranceInfo {
+    private String type;
+    @SerializedName("insurance_price")
+    private Long insurancePrice;
+  }
+
+  @Data
+  public static class ProductInfo {
+    @SerializedName("product_id")
+    private Long product_id;
+    @SerializedName("sku_id")
+    private Long sku_id;
+    @SerializedName("product_cnt")
+    private Long product_cnt;
+  }
+}
diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopGoodsSkuAttr.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopGoodsSkuAttr.java
new file mode 100644
index 0000000000..5b0b2735e4
--- /dev/null
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopGoodsSkuAttr.java
@@ -0,0 +1,25 @@
+package cn.binarywang.wx.miniapp.bean.product;
+
+import com.google.gson.JsonObject;
+import com.google.gson.annotations.SerializedName;
+import java.io.Serializable;
+import lombok.Data;
+
+@Data
+public class WxMinishopGoodsSkuAttr implements Serializable {
+  private static final long serialVersionUID = -7274443170526394680L;
+
+  @SerializedName("attr_key")
+  private String attrKey;
+
+  @SerializedName("attr_value")
+  private String attrValue;
+
+  public JsonObject toJsonObject() {
+    JsonObject jsonObject = new JsonObject();
+    jsonObject.addProperty("attr_key", attrKey);
+    jsonObject.addProperty("attr_value", attrValue);
+
+    return jsonObject;
+  }
+}
diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopOrderDetail.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopOrderDetail.java
new file mode 100644
index 0000000000..09da6dd583
--- /dev/null
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopOrderDetail.java
@@ -0,0 +1,48 @@
+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 2021/3/23
+ */
+@Data
+public class WxMinishopOrderDetail implements Serializable {
+  private static final long serialVersionUID = 3325843289672341160L;
+
+  /**
+   * 下单商品信息
+   * 
+   * 是否必填:是
+   * 
+ */ + @SerializedName("product_infos") + private List productInfos; + + /** + * 支付信息 (当作为返回结果,payorder时action_type!=6时存在) + *
+   * 是否必填:
+   * 
+ */ + @SerializedName("pay_info") + private WxMinishopPayInfo payInfo; + + /** + * 价格信息 + *
+   * 是否必填:
+   * 
+ */ + @SerializedName("price_info") + private WxMinishopPriceInfo priceInfo; + + /** + * 必须调过发货接口才会存在这个字段 + */ + @SerializedName("delivery_info") + private WxMinishopDeliveryInfo deliveryInfo; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopOrderListResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopOrderListResponse.java new file mode 100644 index 0000000000..bca2a7be42 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopOrderListResponse.java @@ -0,0 +1,17 @@ +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/6/20 7:09 下午 + */ +@Data +public class WxMinishopOrderListResponse extends WxMaShopBaseResponse { + private List orders; + @SerializedName("total_num") + private Long totalNum; +} 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 new file mode 100644 index 0000000000..ed3d02cd92 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopOrderResult.java @@ -0,0 +1,61 @@ +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; + +/** + * @author leiin + * @date 2021/3/23 + */ +@Data +public class WxMinishopOrderResult implements Serializable { + private static final long serialVersionUID = -2665426592693969921L; + + /** + * 交易组件平台订单ID + */ + @SerializedName("order_id") + private Long orderId; + + /** + * 订单状态 + */ + @SerializedName("status") + private Integer status; + + @SerializedName("create_time") + private String createTime; + + @SerializedName("update_time") + private String updateTime; + /** + * 订单详情 + */ + @SerializedName("order_detail") + private WxMinishopOrderDetail orderDetail; + + @SerializedName("aftersale_detail") + private WxMiniAfterSaleDetail afterSaleDetail; + + /** + * 商家小程序该订单的用户id + */ + @SerializedName("openid") + private String openid; + + @SerializedName("ext_info") + private ExtInfo extInfo; + + @SerializedName("order_type") + private Integer orderType; + + @Data + public static class ExtInfo { + @SerializedName("customer_notes") + private String customerNotes; + @SerializedName("merchant_notes") + private String merchantNotes; + } +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopPayInfo.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopPayInfo.java new file mode 100644 index 0000000000..5acb048a64 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopPayInfo.java @@ -0,0 +1,54 @@ +package cn.binarywang.wx.miniapp.bean.product; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; + +/** + * @author leiin + * @date 2021/3/23 + */ +@Data +public class WxMinishopPayInfo 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/product/WxMinishopPriceInfo.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopPriceInfo.java new file mode 100644 index 0000000000..ba146e8e1c --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopPriceInfo.java @@ -0,0 +1,44 @@ +package cn.binarywang.wx.miniapp.bean.product; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; + +/** + * @author leiin + * @date 2021/3/23 + */ +@Data +public class WxMinishopPriceInfo implements Serializable { + private static final long serialVersionUID = 1588840927992523263L; + + @SerializedName("product_price") + private Integer productPrice; + /** + * 该订单最终的金额(单位:分) + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("order_price") + private Integer orderPrice; + /** + * 运费(单位:分) + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("freight") + private Integer freight; + /** + * 优惠金额(单位:分) + *
+   * 是否必填:否
+   * 
+ */ + @SerializedName("discounted_price") + private Integer discountedPrice; + + @SerializedName("is_discounted") + private Boolean isDiscounted; +} 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 new file mode 100644 index 0000000000..5e709120e8 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopProductInfo.java @@ -0,0 +1,65 @@ +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 2021/3/23 + */ +@Data +public class WxMinishopProductInfo implements Serializable { + private static final long serialVersionUID = 8979181840150112093L; + /** + * 交易组件平台内部商品ID + */ + @SerializedName("product_id") + private Integer productId; + + /** + * 交易组件平台内部skuID,可填0(如果这个product_id下没有sku) + */ + @SerializedName("sku_id") + private Integer skuId; + /** + * 购买的数量 + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("sku_cnt") + private Integer skuCnt; + + @SerializedName("on_aftersale_sku_cnt") + private Integer onAftersaleSkuCnt; + + @SerializedName("finish_aftersale_sku_cnt") + private Integer finishAftersaleSkuCnt; + /** + * 生成订单时商品的标题 + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("title") + private String title; + @SerializedName("thumb_img") + private String thumbImg; + + @SerializedName("sku_attrs") + private List skuAttrs; + /** + * 生成订单时商品的售卖价(单位:分) + *
+   * 是否必填:是
+   * 
+ */ + @SerializedName("sale_price") + private Integer salePrice; + + @SerializedName("market_price") + private Integer marketPrice; +} + diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopResult.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopResult.java new file mode 100644 index 0000000000..c47fcddd99 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopResult.java @@ -0,0 +1,14 @@ +package cn.binarywang.wx.miniapp.bean.product; + +import java.io.Serializable; +import lombok.Data; + +@Data +public class WxMinishopResult implements Serializable { + private static final long serialVersionUID = 4323118714581265968L; + private Integer errcode; + + private String errmsg; + + private T data; +} 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 new file mode 100644 index 0000000000..8fa8712e25 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopSku.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; + +@Data +public class WxMinishopSku implements Serializable { + private static final long serialVersionUID = 12373392723136246L; + + @SerializedName("product_id") + private Long productId; + + @SerializedName("out_product_id") + private String outProductId; + + @SerializedName("out_sku_id") + private String outSkuId; + + @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("sku_code") + private String skuCode; + + @SerializedName("barcode") + private String barCode; + + @SerializedName("sku_attrs") + private List skuAttrs; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopSpu.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopSpu.java new file mode 100644 index 0000000000..b6fe852849 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopSpu.java @@ -0,0 +1,51 @@ +package cn.binarywang.wx.miniapp.bean.product; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import java.util.List; +import lombok.Data; + +@Data +public class WxMinishopSpu implements Serializable { + private static final long serialVersionUID = 6689040014027161007L; + + @SerializedName("out_product_id") + private String outProductId; + + private String title; + + @SerializedName("sub_title") + private String subTitle; + + @SerializedName("head_img") + private List headImgs; + + @SerializedName("desc_info") + private DescInfo descInfo; + + @SerializedName("brand_id") + private Long brandId; + + @SerializedName("cats") + private List shopCats; + + private List attrs; + + private String model; + + @SerializedName("express_info") + private ExpressInfo expressInfo; + + private List skus; + + @Data + public static class DescInfo { + private List imgs; + } + + @Data + public static class ExpressInfo { + @SerializedName("template_id") + private Long templateId; + } +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopSpuGet.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopSpuGet.java new file mode 100644 index 0000000000..f40adc0944 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopSpuGet.java @@ -0,0 +1,16 @@ +package cn.binarywang.wx.miniapp.bean.product; + +import java.io.Serializable; +import lombok.Data; + +/** + * @author leiin + * @date 2022/6/20 4:36 下午 + */ +@Data +public class WxMinishopSpuGet implements Serializable { + + private static final long serialVersionUID = -957810527714924409L; + + private WxMinishopSpu spu; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopSpuGetResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopSpuGetResponse.java new file mode 100644 index 0000000000..94dff9b4e1 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopSpuGetResponse.java @@ -0,0 +1,12 @@ +package cn.binarywang.wx.miniapp.bean.product; + +import lombok.Data; + +/** + * @author leiin + * @date 2022/6/20 4:46 下午 + */ +@Data +public class WxMinishopSpuGetResponse extends WxMinishopResult { + +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopSpuListResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopSpuListResponse.java new file mode 100644 index 0000000000..a60d630007 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopSpuListResponse.java @@ -0,0 +1,17 @@ +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 4:46 下午 + */ +@Data +public class WxMinishopSpuListResponse extends WxMinishopResult { + @SerializedName("total_num") + private Long totalNum; + + private List spus; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopUpdateGoodsSkuData.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopUpdateGoodsSkuData.java new file mode 100644 index 0000000000..446404e4a4 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopUpdateGoodsSkuData.java @@ -0,0 +1,16 @@ +package cn.binarywang.wx.miniapp.bean.product; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; + +@Data +public class WxMinishopUpdateGoodsSkuData implements Serializable { + private static final long serialVersionUID = -2596988603027040989L; + @SerializedName("sku_id") + private Long skuId; + @SerializedName("out_sku_id") + private String outSkuId; + @SerializedName("update_time") + private String updateTime; +} 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 cb2cac5c98..fbe7c36cb0 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 @@ -400,6 +400,31 @@ public interface Ocr { String FILE_COMM = "https://api.weixin.qq.com/cv/ocr/comm"; } + public interface Product { + interface Spu { + String PRODUCT_SPU_ADD_URL = "https://api.weixin.qq.com/product/spu/add"; + String PRODUCT_SPU_DEL_URL = "https://api.weixin.qq.com/product/spu/del"; + String PRODUCT_SPU_GET_URL = "https://api.weixin.qq.com/product/spu/get"; + String PRODUCT_SPU_GET_LIST_URL = "https://api.weixin.qq.com/product/spu/get_list"; + String PRODUCT_SPU_UPDATE_URL = "https://api.weixin.qq.com/product/spu/update"; + String PRODUCT_SPU_LISTING_URL = "https://api.weixin.qq.com/product/spu/listing"; + String PRODUCT_SPU_DELISTING_URL = "https://api.weixin.qq.com/product/spu/delisting"; + } + + interface Sku { + String PRODUCT_ADD_SKU_URL = "https://api.weixin.qq.com/product/sku/add"; + String PRODUCT_BATCH_ADD_SKU_URL = "https://api.weixin.qq.com/product/sku/batch_add"; + String PRODUCT_DEL_SKU_URL = "https://api.weixin.qq.com/product/sku/del"; + 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"; + } + + interface Order { + String PRODUCT_ORDER_GET_LIST = "https://api.weixin.qq.com/product/order/get_list"; + } + } + public interface Shop { interface Spu { String SPU_ADD_URL = "https://api.weixin.qq.com/shop/spu/add"; From debcb4c3fa3989032953de21280c2fefdcb1e155 Mon Sep 17 00:00:00 2001 From: wanglei Date: Tue, 21 Jun 2022 15:22:36 +0800 Subject: [PATCH 19/43] =?UTF-8?q?=E5=88=86=E4=BA=AB=E5=91=98=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E7=BB=93=E6=9E=84=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WxMaShopSharerLiveOrderListResponse.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSharerLiveOrderListResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSharerLiveOrderListResponse.java index 8764363582..319b726683 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSharerLiveOrderListResponse.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopSharerLiveOrderListResponse.java @@ -15,8 +15,20 @@ public class WxMaShopSharerLiveOrderListResponse extends WxMaShopBaseResponse im private static final long serialVersionUID = -4190199778148290127L; - private List orders; + private List orders; @SerializedName("total_num") private Integer totalNum; + + @Data + public static class WxMaShopOrderItem { + @SerializedName("order_id") + private Long orderId; + @SerializedName("out_order_id") + private String outOrderId; + private Integer status; + private String path; + @SerializedName("order_detail") + private WxMaShopOrderDetail orderDetail; + } } From dbdba966cf4b88b035f3bb4ef6f6cfc1025bf165 Mon Sep 17 00:00:00 2001 From: wanglei Date: Fri, 24 Jun 2022 20:42:43 +0800 Subject: [PATCH 20/43] =?UTF-8?q?=E8=A1=A5=E5=85=85=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wanglei --- .../bean/shop/request/WxMaShopDeliverySendRequest.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopDeliverySendRequest.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopDeliverySendRequest.java index bf8acced5e..47615c5e52 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopDeliverySendRequest.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopDeliverySendRequest.java @@ -1,5 +1,6 @@ package cn.binarywang.wx.miniapp.bean.shop.request; +import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAfterSaleAddRequest.ProductInfosBean; import com.google.gson.annotations.SerializedName; import lombok.AllArgsConstructor; import lombok.Builder; @@ -38,6 +39,8 @@ public class WxMaShopDeliverySendRequest implements Serializable { private Integer finishAllDelivery; @SerializedName("delivery_list") private List deliveryList; + @SerializedName("ship_done_time") + private String shipDoneTme; @Data @Builder @@ -53,5 +56,7 @@ public static class DeliveryListBean implements Serializable { private String deliveryId; @SerializedName("waybill_id") private String waybillId; + @SerializedName("product_info_list") + private List productInfoList; } } From 547f889101777b1436bf3aedee4d4b7576f3be75 Mon Sep 17 00:00:00 2001 From: wanglei Date: Tue, 28 Jun 2022 14:21:28 +0800 Subject: [PATCH 21/43] =?UTF-8?q?=E5=94=AE=E5=90=8E=E5=8D=95=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=A1=A5=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wanglei --- .../miniapp/api/WxMaShopAfterSaleService.java | 85 ++++++++- .../impl/WxMaShopAfterSaleServiceImpl.java | 161 +++++++++++++++++- .../request/WxMaShopAcceptReturnRequest.java | 43 +++++ .../request/WxMaShopAfterSaleAddRequest.java | 24 ++- .../request/WxMaShopAfterSaleListRequest.java | 36 ++++ .../WxMaShopAfterSaleUpdateRequest.java | 11 ++ ...aShopAfterSaleUploadReturnInfoRequest.java | 31 ++++ .../WxMaShopUploadCerficatesRequest.java | 28 +++ .../WxMaShopAfterSaleAddResponse.java | 15 ++ .../WxMaShopAfterSaleGetResponse.java | 66 +++++-- .../WxMaShopAfterSaleListResponse.java | 25 +++ .../miniapp/constant/WxMaApiUrlConstants.java | 14 +- .../WxMaShopAfterSaleServiceImplTest.java | 1 - 13 files changed, 517 insertions(+), 23 deletions(-) create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopAcceptReturnRequest.java create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopAfterSaleListRequest.java create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopAfterSaleUploadReturnInfoRequest.java create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/request/WxMaShopUploadCerficatesRequest.java create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopAfterSaleAddResponse.java create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopAfterSaleListResponse.java 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/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/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..5bcf9857d2 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 List productInfos; + @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/constant/WxMaApiUrlConstants.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/WxMaApiUrlConstants.java index fbe7c36cb0..d65ac5e3a0 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 @@ -483,9 +483,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 { 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..976a4ca16c 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,7 +38,6 @@ 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") From 52f64b1b2d07a5a1e1670bf31adb79bfef095186 Mon Sep 17 00:00:00 2001 From: wanglei Date: Wed, 29 Jun 2022 12:32:31 +0800 Subject: [PATCH 22/43] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E4=BA=A4?= =?UTF-8?q?=E6=98=93=E7=BB=84=E4=BB=B6=E4=B8=8B=E5=8D=95=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E8=A1=A5=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wanglei --- .../miniapp/bean/shop/WxMaShopOrderInfo.java | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) 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..360ba67775 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 trace_id; // 会影响主播归因、分享员归因等,从下单前置检查获取 + /** + * 默认退货地址,退货售后超时时,会让用户将货物寄往此地址 + *
+   * 是否必填:选填
+   * 
œ + */ + @SerializedName("default_receiving_address") + private WxMaShopAddressInfo defaultReceivingAddress; // 默认退货地址,退货售后超时时,会让用户将货物寄往此地址 + /** + * 生成的order_id以字符串形式返回 + *
+   * 是否必填:选填
+   * 
+ */ + @SerializedName("stringify_64bits_number") + private Boolean stringify64bitsNumber; // 生成的order_id以字符串形式返回 + } From b15379aea7c3b1520fe0fac3557cfeaa3e734080 Mon Sep 17 00:00:00 2001 From: wanglei Date: Wed, 29 Jun 2022 19:37:36 +0800 Subject: [PATCH 23/43] =?UTF-8?q?=E5=AD=97=E6=AE=B5=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wanglei --- .../cn/binarywang/wx/miniapp/bean/shop/WxMaShopOrderInfo.java | 2 +- .../miniapp/bean/shop/request/WxMaShopAfterSaleAddRequest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 360ba67775..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 @@ -115,7 +115,7 @@ public class WxMaShopOrderInfo implements Serializable { *
*/ @SerializedName("trace_id") - private String trace_id; // 会影响主播归因、分享员归因等,从下单前置检查获取 + private String traceId; // 会影响主播归因、分享员归因等,从下单前置检查获取 /** * 默认退货地址,退货售后超时时,会让用户将货物寄往此地址 *
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 5bcf9857d2..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
@@ -44,7 +44,7 @@ public class WxMaShopAfterSaleAddRequest implements Serializable {
   @SerializedName("type")
   private Integer type;
   @SerializedName("product_info")
-  private List productInfos;
+  private ProductInfosBean productInfo;
   @SerializedName("orderamt")
   private Long orderamt;
   @SerializedName("refund_reason")

From bd328328a0051fbd057d455e97744585593d1578 Mon Sep 17 00:00:00 2001
From: wanglei 
Date: Fri, 1 Jul 2022 16:44:19 +0800
Subject: [PATCH 24/43] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E4=BA=A4?=
 =?UTF-8?q?=E6=98=93=E7=BB=84=E4=BB=B6=E4=BC=98=E6=83=A0=E5=88=B8=E6=8E=A5?=
 =?UTF-8?q?=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: wanglei 
---
 .../wx/miniapp/api/WxMaService.java           |   2 +
 .../wx/miniapp/api/WxMaShopCouponService.java |  40 +++
 .../miniapp/api/impl/BaseWxMaServiceImpl.java |   6 +
 .../api/impl/WxMaShopCouponServiceImpl.java   | 165 +++++++++
 .../miniapp/bean/shop/WxMaShopCouponInfo.java | 319 ++++++++++++++++++
 .../response/WxMaShopCouponListResponse.java  |  23 ++
 .../shop/response/WxMaShopCouponResponse.java |  18 +
 .../WxMaShopUserCouponListResponse.java       |  76 +++++
 .../miniapp/constant/WxMaApiUrlConstants.java |  13 +
 9 files changed, 662 insertions(+)
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopCouponService.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopCouponServiceImpl.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/WxMaShopCouponInfo.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopCouponListResponse.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopCouponResponse.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaShopUserCouponListResponse.java

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..ca49fa2d0a 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
@@ -503,4 +503,6 @@ public interface WxMaService extends WxService {
    * @return
    */
   WxMaProductService getProductService();
+
+  WxMaShopCouponService getWxMaShopCouponService();
 }
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 8151af88b0..aa9d0b7e42 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,7 @@ 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 WxMaShopCouponService wxMaShopCouponService = new WxMaShopCouponServiceImpl(this);
   private Map configMap;
   private int retrySleepMillis = 1000;
   private int maxRetryTimes = 5;
@@ -600,4 +601,9 @@ public WxMaImmediateDeliveryService getWxMaImmediateDeliveryService() {
   @Override
   public WxMaProductService getProductService() { return this.productService; }
 
+  @Override
+  public WxMaShopCouponService getWxMaShopCouponService() {
+    return this.wxMaShopCouponService;
+  }
+
 }
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/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/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 d65ac5e3a0..097f729619 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
@@ -505,6 +505,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";
+    }
   }
 
   /**

From 268972e08c102d9866d1d3b75b485bcc4e95ff8e Mon Sep 17 00:00:00 2001
From: wanglei 
Date: Fri, 8 Jul 2022 15:54:51 +0800
Subject: [PATCH 25/43] =?UTF-8?q?=E4=BA=A4=E6=98=93=E7=BB=84=E4=BB=B6?=
 =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=A1=A5=E5=85=85?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: wanglei 
---
 .../wx/miniapp/api/WxMaProductService.java    | 10 +++++
 .../api/impl/WxMaProductServiceImpl.java      | 43 +++++++++++++++++++
 .../product/WxMinishopGetBrandResponse.java   | 35 +++++++++++++++
 .../WxMinishopGetCategoryResponse.java        | 25 +++++++++++
 .../WxMinishopGetFrightTemplateResponse.java  | 26 +++++++++++
 .../miniapp/constant/WxMaApiUrlConstants.java |  6 +++
 6 files changed, 145 insertions(+)
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopGetBrandResponse.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopGetCategoryResponse.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopGetFrightTemplateResponse.java

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..045eea2a03 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,6 +2,9 @@
 
 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;
@@ -22,6 +25,13 @@
  * @author boris
  */
 public interface WxMaProductService {
+
+  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;
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..eaf115591a 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,8 @@
 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.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;
@@ -19,6 +22,9 @@
 import cn.binarywang.wx.miniapp.api.WxMaService;
 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;
@@ -52,6 +58,43 @@ public class WxMaProductServiceImpl implements WxMaProductService {
   private static final String ERR_CODE = "errcode";
   private final WxMaService wxMaService;
 
+  @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 {
 
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..09facaba67
--- /dev/null
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopGetCategoryResponse.java
@@ -0,0 +1,25 @@
+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:39 下午
+ */
+@Data
+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/constant/WxMaApiUrlConstants.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/WxMaApiUrlConstants.java
index 097f729619..1f0ffaf9ee 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
@@ -423,6 +423,12 @@ interface Sku {
     interface Order {
       String PRODUCT_ORDER_GET_LIST = "https://api.weixin.qq.com/product/order/get_list";
     }
+
+    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";
+    }
   }
 
   public interface Shop {

From 362f1eaac87ff3d3f7c2857c0a97e264aeac7431 Mon Sep 17 00:00:00 2001
From: "boris.bao" 
Date: Fri, 8 Jul 2022 21:18:09 +0800
Subject: [PATCH 26/43] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E5=B0=8F=E7=A8=8B?=
 =?UTF-8?q?=E5=BA=8F=E4=BA=A4=E6=98=93=E7=BB=84=E4=BB=B6-=E6=A0=87?=
 =?UTF-8?q?=E5=87=86=E7=89=88--=E8=AE=A2=E5=8D=95=E7=9B=B8=E5=85=B3?=
 =?UTF-8?q?=E6=9C=8D=E5=8A=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../miniapp/api/WxMaProductOrderService.java  | 56 ++++++++++++
 .../wx/miniapp/api/WxMaProductService.java    |  2 -
 .../api/impl/WxMaProductOrderServiceImpl.java | 87 +++++++++++++++++++
 .../api/impl/WxMaProductServiceImpl.java      | 14 ---
 .../WxMinishopOrderDetailResponse.java        | 19 ++++
 .../product/WxMinishopOrderListResponse.java  |  2 +-
 .../bean/product/WxMinishopOrderResult.java   |  1 -
 .../shop/response/WxMaShopBaseResponse.java   |  4 +-
 .../miniapp/constant/WxMaApiUrlConstants.java |  2 +
 9 files changed, 167 insertions(+), 20 deletions(-)
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaProductOrderService.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaProductOrderServiceImpl.java
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopOrderDetailResponse.java

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..60e01284b4
--- /dev/null
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaProductOrderService.java
@@ -0,0 +1,56 @@
+package cn.binarywang.wx.miniapp.api;
+
+import cn.binarywang.wx.miniapp.bean.product.WxMinishopOrderDetailResponse;
+import cn.binarywang.wx.miniapp.bean.product.WxMinishopOrderListResponse;
+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;
+}
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 045eea2a03..88a3d20771 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
@@ -124,6 +124,4 @@ WxMinishopResult minishopGoodsUpdateSkuPrice(Long
   WxMinishopResult minishopGoodsUpdateSkuStock(Long productId,
     Long 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/impl/WxMaProductOrderServiceImpl.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaProductOrderServiceImpl.java
new file mode 100644
index 0000000000..e043dfffae
--- /dev/null
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaProductOrderServiceImpl.java
@@ -0,0 +1,87 @@
+package cn.binarywang.wx.miniapp.api.impl;
+
+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.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 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;
+
+/**
+ * 小程序交易组件-标准版-订单服务
+ *
+ * @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()));
+    }
+  }
+
+
+}
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 eaf115591a..5ebfc229ec 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
@@ -322,20 +322,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/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/WxMinishopOrderListResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopOrderListResponse.java
index bca2a7be42..ecb4dfd70a 100644
--- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopOrderListResponse.java
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopOrderListResponse.java
@@ -11,7 +11,7 @@
  */
 @Data
 public class WxMinishopOrderListResponse extends WxMaShopBaseResponse {
-  private List orders;
+  private List orders;
   @SerializedName("total_num")
   private Long totalNum;
 }
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..7a1685a704 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;
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/constant/WxMaApiUrlConstants.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/WxMaApiUrlConstants.java index 1f0ffaf9ee..ab184eca1c 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 @@ -422,6 +422,8 @@ interface Sku { 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"; } interface OTHER { From 4e75379276ca5d59645de50b9cbfc2c5445cce68 Mon Sep 17 00:00:00 2001 From: wanglei Date: Fri, 8 Jul 2022 21:43:58 +0800 Subject: [PATCH 27/43] =?UTF-8?q?=E4=BA=A4=E6=98=93=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wanglei --- .../wx/miniapp/api/WxMaProductService.java | 6 +++++ .../api/impl/WxMaProductServiceImpl.java | 27 +++++++++++++++++++ .../miniapp/constant/WxMaApiUrlConstants.java | 1 + 3 files changed, 34 insertions(+) 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 88a3d20771..5084d6bf1f 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 @@ -16,7 +16,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; /** @@ -26,6 +28,10 @@ */ public interface WxMaProductService { + 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; 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 5ebfc229ec..d368f9b2e8 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 @@ -3,6 +3,7 @@ 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.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; @@ -38,13 +39,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.util.json.GsonHelper; import me.chanjar.weixin.common.util.json.GsonParser; @@ -58,6 +62,29 @@ 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); 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 ab184eca1c..1d5219243f 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 @@ -430,6 +430,7 @@ 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"; } } From 33e224c18a0434b4941e21dfa594cbd78bcb615a Mon Sep 17 00:00:00 2001 From: wanglei Date: Sat, 9 Jul 2022 15:18:41 +0800 Subject: [PATCH 28/43] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wanglei --- .../cn/binarywang/wx/miniapp/api/WxMaProductService.java | 6 +++--- .../wx/miniapp/api/impl/WxMaProductServiceImpl.java | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) 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 5084d6bf1f..7ac7c9a241 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 @@ -38,7 +38,7 @@ public interface WxMaProductService { WxMinishopGetFrightTemplateResponse getFreightTemplate() throws WxErrorException; - WxMinishopResult addSpu(WxMinishopSpu spuInfo) throws WxErrorException; + WxMinishopResult addSpu(WxMinishopSpu spuInfo) throws WxErrorException; WxMaShopBaseResponse deleteSpu(Integer productId, String outProductId) throws WxErrorException; @@ -112,7 +112,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; /** @@ -128,6 +128,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; } 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 d368f9b2e8..51638ad426 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 @@ -306,7 +306,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( @@ -329,7 +329,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( From 09cad8bd36f673b3482f8d38fee93c5ba42f5935 Mon Sep 17 00:00:00 2001 From: wanglei Date: Mon, 11 Jul 2022 11:57:19 +0800 Subject: [PATCH 29/43] common Signed-off-by: wanglei --- .../weixin/common/bean/result/WxMinishopImageUploadResult.java | 1 + .../weixin/common/bean/result/WxMinishopPicFileResult.java | 1 + 2 files changed, 2 insertions(+) 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..096b15dc44 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 @@ -27,6 +27,7 @@ public static WxMinishopImageUploadResult fromJson(String json) { JsonObject picObject = jsonObject.get("pic_file").getAsJsonObject(); picFileResult.setMediaId(picObject.get("media_id").getAsString()); picFileResult.setPayMediaId(picObject.get("pay_media_id").getAsString()); + picFileResult.setTempImgUrl(picObject.get("temp_img_url").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; } From aa18a484a7be747e7a9fa4478be3c23c4974bfc9 Mon Sep 17 00:00:00 2001 From: wanglei Date: Mon, 11 Jul 2022 16:39:22 +0800 Subject: [PATCH 30/43] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dnpe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wanglei --- .../bean/result/WxMinishopImageUploadResult.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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 096b15dc44..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,9 +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()); - picFileResult.setTempImgUrl(picObject.get("temp_img_url").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); } From f69a25303d5f7149789c09499bfdfc419d8a0223 Mon Sep 17 00:00:00 2001 From: wanglei Date: Mon, 11 Jul 2022 21:09:49 +0800 Subject: [PATCH 31/43] =?UTF-8?q?=E5=94=AE=E5=90=8E=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wanglei --- .../miniapp/api/WxMaProductOrderService.java | 16 ++++ .../api/impl/WxMaProductOrderServiceImpl.java | 65 +++++++++++++ .../api/impl/WxMaProductServiceImpl.java | 2 - .../bean/product/WxMiniAfterSaleOrder.java | 95 +++++++++++++++++++ .../WxMiniBatchGetAfterSaleOrderResponse.java | 16 ++++ .../WxMiniGetAfterSaleOrderResponse.java | 15 +++ ...l.java => WxMiniOrderAfterSaleDetail.java} | 2 +- .../bean/product/WxMinishopOrderResult.java | 2 +- .../miniapp/constant/WxMaApiUrlConstants.java | 5 + 9 files changed, 214 insertions(+), 4 deletions(-) create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMiniAfterSaleOrder.java create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMiniBatchGetAfterSaleOrderResponse.java create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMiniGetAfterSaleOrderResponse.java rename weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/{WxMiniAfterSaleDetail.java => WxMiniOrderAfterSaleDetail.java} (92%) 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 index 60e01284b4..79b3418f02 100644 --- 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 @@ -1,7 +1,11 @@ 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.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; /** @@ -53,4 +57,16 @@ WxMinishopOrderListResponse getOrderList( * @param merchantNotes 备注内容 */ void changeMerchantNotes(Long orderId,String merchantNotes) 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/impl/WxMaProductOrderServiceImpl.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaProductOrderServiceImpl.java index e043dfffae..9dffccb07e 100644 --- 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 @@ -1,20 +1,28 @@ 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_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.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; /** * 小程序交易组件-标准版-订单服务 @@ -83,5 +91,62 @@ public void changeMerchantNotes(Long orderId, String merchantNotes) throws WxErr } } + @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.getErrCode() != 0) { + throw new WxErrorException( + new WxError(orderResponse.getErrCode(), orderResponse.getErrMsg())); + } + 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 51638ad426..0dc0764d47 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 @@ -4,7 +4,6 @@ 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.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; import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Sku.PRODUCT_DEL_SKU_URL; @@ -26,7 +25,6 @@ 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.WxMinishopSpu; 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/WxMiniAfterSaleDetail.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMiniOrderAfterSaleDetail.java similarity index 92% rename from weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMiniAfterSaleDetail.java rename to weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMiniOrderAfterSaleDetail.java index edf074b4fc..b5bfbe7950 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMiniAfterSaleDetail.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMiniOrderAfterSaleDetail.java @@ -9,7 +9,7 @@ * @date 2022/6/20 7:16 下午 */ @Data -public class WxMiniAfterSaleDetail { +public class WxMiniOrderAfterSaleDetail { @SerializedName("aftersale_order_list") private List aftersaleOrderList; @SerializedName("on_aftersale_order_cnt") 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 7a1685a704..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 @@ -36,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/constant/WxMaApiUrlConstants.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/WxMaApiUrlConstants.java index 1d5219243f..44d9aab1ec 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 @@ -424,6 +424,11 @@ 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 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 { From f5a1d4490b5d7b2982e5ca6d09b433e7b753e840 Mon Sep 17 00:00:00 2001 From: wanglei Date: Tue, 12 Jul 2022 15:45:44 +0800 Subject: [PATCH 32/43] =?UTF-8?q?=E4=BA=A4=E6=98=93=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wanglei --- .../main/java/cn/binarywang/wx/miniapp/api/WxMaService.java | 2 ++ .../binarywang/wx/miniapp/api/impl/BaseWxMaServiceImpl.java | 6 ++++++ 2 files changed, 8 insertions(+) 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 ca49fa2d0a..6134e3dc77 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 @@ -504,5 +504,7 @@ public interface WxMaService extends WxService { */ WxMaProductService getProductService(); + WxMaProductOrderService getProductOrderService(); + WxMaShopCouponService getWxMaShopCouponService(); } 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 aa9d0b7e42..fe027ab0f2 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,7 @@ 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; @@ -601,6 +602,11 @@ public WxMaImmediateDeliveryService getWxMaImmediateDeliveryService() { @Override public WxMaProductService getProductService() { return this.productService; } + @Override + public WxMaProductOrderService getProductOrderService() { + return this.productOrderService; + } + @Override public WxMaShopCouponService getWxMaShopCouponService() { return this.wxMaShopCouponService; From b023ae9d8e661265658716ba2e768b622c357b38 Mon Sep 17 00:00:00 2001 From: wanglei Date: Tue, 12 Jul 2022 16:07:32 +0800 Subject: [PATCH 33/43] =?UTF-8?q?=E4=BA=A4=E6=98=93=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wanglei --- .../wx/miniapp/bean/product/WxMinishopProductInfo.java | 6 ++++++ 1 file changed, 6 insertions(+) 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; /** * 购买的数量 *

From 2b201137dabad254960382636244c395ef36a79a Mon Sep 17 00:00:00 2001
From: wanglei 
Date: Tue, 12 Jul 2022 20:58:51 +0800
Subject: [PATCH 34/43] =?UTF-8?q?=E4=BA=A4=E6=98=93=E7=BB=84=E4=BB=B6?=
 =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=9C=8D=E5=8A=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: wanglei 
---
 .../wx/miniapp/bean/product/WxMinishopAddressInfo.java    | 2 +-
 .../wx/miniapp/bean/product/WxMinishopDeliveryInfo.java   | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

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;
   }
 }

From 3baaa41cfa36d2632df79da39d865c778259d136 Mon Sep 17 00:00:00 2001
From: wanglei 
Date: Wed, 13 Jul 2022 20:02:44 +0800
Subject: [PATCH 35/43] =?UTF-8?q?=E8=8E=B7=E5=8F=96sku=E5=88=97=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: wanglei 
---
 .../wx/miniapp/api/WxMaProductService.java        |  4 ++++
 .../miniapp/api/impl/WxMaProductServiceImpl.java  | 15 +++++++++++++++
 .../bean/product/WxMinishopSkuListResponse.java   | 14 ++++++++++++++
 .../wx/miniapp/constant/WxMaApiUrlConstants.java  |  1 +
 4 files changed, 34 insertions(+)
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMinishopSkuListResponse.java

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 7ac7c9a241..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
@@ -8,6 +8,7 @@
 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;
@@ -56,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信息
    *
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 0dc0764d47..f0a0eb17b6 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
@@ -7,6 +7,7 @@
 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.Sku.PRODUCT_UPDATE_SKU_PRICE_URL;
 import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Sku.PRODUCT_UPDATE_SKU_STOCK_URL;
 import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Product.Sku.PRODUCT_UPDATE_SKU_URL;
@@ -27,6 +28,7 @@
 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;
@@ -225,6 +227,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 {
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/constant/WxMaApiUrlConstants.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/WxMaApiUrlConstants.java
index 44d9aab1ec..2158516737 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,6 +418,7 @@ 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 {

From bb5dedfcff9a4a763900c1fd45cd9abf32a8998a Mon Sep 17 00:00:00 2001
From: wanglei 
Date: Wed, 13 Jul 2022 20:40:00 +0800
Subject: [PATCH 36/43] =?UTF-8?q?sku=E5=AD=97=E6=AE=B5=E8=A1=A5=E5=85=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: wanglei 
---
 .../cn/binarywang/wx/miniapp/bean/product/WxMinishopSku.java   | 3 +++
 1 file changed, 3 insertions(+)

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;
 

From 37a4ba90668b636790417455e301a5171acc1272 Mon Sep 17 00:00:00 2001
From: wanglei 
Date: Wed, 13 Jul 2022 21:02:01 +0800
Subject: [PATCH 37/43] =?UTF-8?q?sku=E8=BF=94=E5=9B=9E=E5=80=BC=E4=BF=AE?=
 =?UTF-8?q?=E5=A4=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: wanglei 
---
 .../binarywang/wx/miniapp/api/impl/WxMaProductServiceImpl.java   | 1 -
 1 file changed, 1 deletion(-)

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 f0a0eb17b6..d0921fc8dd 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
@@ -334,7 +334,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;

From ebdf03fc7237069757c0504082ce040d1ed50af4 Mon Sep 17 00:00:00 2001
From: wanglei 
Date: Wed, 13 Jul 2022 21:10:39 +0800
Subject: [PATCH 38/43] =?UTF-8?q?sku=E8=BF=94=E5=9B=9E=E5=80=BC=E4=BF=AE?=
 =?UTF-8?q?=E5=A4=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: wanglei 
---
 .../binarywang/wx/miniapp/api/impl/WxMaProductServiceImpl.java   | 1 -
 1 file changed, 1 deletion(-)

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 d0921fc8dd..1a7cee9d53 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
@@ -311,7 +311,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;

From 24daf64d430f59a9683453b5876273612e7eb96f Mon Sep 17 00:00:00 2001
From: wanglei 
Date: Thu, 14 Jul 2022 16:42:52 +0800
Subject: [PATCH 39/43] =?UTF-8?q?=E5=94=AE=E5=90=8E=E5=8D=95=E5=88=97?=
 =?UTF-8?q?=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: wanglei 
---
 .../wx/miniapp/api/impl/WxMaProductOrderServiceImpl.java      | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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
index 9dffccb07e..c27a140541 100644
--- 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
@@ -115,9 +115,9 @@ public WxMiniBatchGetAfterSaleOrderResponse batchGetAfterSaleOrder(
 
     WxMiniBatchGetAfterSaleOrderResponse orderResponse = WxMaGsonBuilder.create()
       .fromJson(response, WxMiniBatchGetAfterSaleOrderResponse.class);
-    if (orderResponse.getErrCode() != 0) {
+    if (orderResponse.getAfterSaleOrderList() == null) {
       throw new WxErrorException(
-        new WxError(orderResponse.getErrCode(), orderResponse.getErrMsg()));
+        new WxError(orderResponse.getErrCode(), "售后查询不存在"));
     }
     return orderResponse;
   }

From b97b7267b67109e51b49c58e244da527147cd238 Mon Sep 17 00:00:00 2001
From: wanglei 
Date: Thu, 14 Jul 2022 19:14:33 +0800
Subject: [PATCH 40/43] =?UTF-8?q?=E8=AF=B7=E6=B1=82=E5=8F=91=E8=B4=A7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: wanglei 
---
 .../miniapp/api/WxMaProductOrderService.java  |  4 ++
 .../api/impl/WxMaProductOrderServiceImpl.java | 15 +++++++
 .../product/WxMiniOrderDeliveryRequest.java   | 41 +++++++++++++++++++
 .../miniapp/constant/WxMaApiUrlConstants.java |  2 +
 4 files changed, 62 insertions(+)
 create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/product/WxMiniOrderDeliveryRequest.java

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
index 79b3418f02..793df60a27 100644
--- 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
@@ -2,6 +2,7 @@
 
 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;
@@ -58,6 +59,9 @@ WxMinishopOrderListResponse getOrderList(
    */
   void changeMerchantNotes(Long orderId,String merchantNotes) throws WxErrorException;
 
+  WxMaShopBaseResponse deliverySend(WxMiniOrderDeliveryRequest request)
+    throws WxErrorException;
+
   WxMiniGetAfterSaleOrderResponse getAfterSaleOrder(Long afterSaleOrderId)
     throws WxErrorException;
 
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
index c27a140541..15ed07a945 100644
--- 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
@@ -4,6 +4,7 @@
 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;
@@ -12,6 +13,7 @@
 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;
@@ -91,6 +93,19 @@ public void changeMerchantNotes(Long orderId, String merchantNotes) throws WxErr
     }
   }
 
+  @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 {
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/constant/WxMaApiUrlConstants.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/WxMaApiUrlConstants.java
index 2158516737..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
@@ -426,6 +426,8 @@ interface Order {
       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";

From edde6b87ef9de06c348acf1aeb7a2bf74ab556a2 Mon Sep 17 00:00:00 2001
From: "boris.bao" 
Date: Tue, 26 Jul 2022 19:50:00 +0800
Subject: [PATCH 41/43] =?UTF-8?q?fix=20=E5=B1=9E=E6=80=A7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../wx/miniapp/api/impl/WxMaShopAfterSaleServiceImplTest.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 976a4ca16c..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
@@ -42,7 +42,7 @@ public void testAdd() throws WxErrorException {
       .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();

From 494c5fbf4e1dac41ca591215c21b4ff3651a3a6e Mon Sep 17 00:00:00 2001
From: "boris.bao" 
Date: Tue, 26 Jul 2022 20:48:59 +0800
Subject: [PATCH 42/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E6=8E=A5=E5=8F=A3?=
 =?UTF-8?q?=E6=B3=A8=E9=87=8A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../cn/binarywang/wx/miniapp/api/WxMaService.java    | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

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 6134e3dc77..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,17 +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();
 }

From fd0077e4c2635e61c5487d38f16f086882a1822e Mon Sep 17 00:00:00 2001
From: "boris.bao" 
Date: Tue, 26 Jul 2022 21:02:09 +0800
Subject: [PATCH 43/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E6=8E=A5=E5=8F=A3?=
 =?UTF-8?q?=E6=B3=A8=E9=87=8A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../miniapp/bean/product/WxMinishopGetCategoryResponse.java  | 5 +++++
 1 file changed, 5 insertions(+)

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
index 09facaba67..55954d8b32 100644
--- 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
@@ -4,22 +4,27 @@
 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;
   }
 }