From 47c55ef94aca19f566a85d898fcc5ca73de5bb83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A9=E6=9C=9D=E7=BA=A2=E9=9B=A8?= <44485373+tianchaohongyu@users.noreply.github.com> Date: Fri, 29 Mar 2024 19:37:04 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20#3250=E3=80=90=E5=BC=80=E6=94=BE?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E3=80=91=E8=B0=83=E6=95=B4=E5=B9=B6=E5=AE=8C?= =?UTF-8?q?=E5=96=84=E5=B0=8F=E7=A8=8B=E5=BA=8F=E8=AE=A4=E8=AF=81=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E4=BB=A3=E7=A0=81=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bean/WxMaUploadAuthMaterialResult.java | 2 + .../mp/bean/message/WxMpXmlMessage.java | 18 +++ .../weixin/open/api/WxOpenMaService.java | 4 +- .../open/bean/auth/MaAuthQueryResult.java | 12 ++ .../auth/MaAuthQueryResultDispatchInfo.java | 4 +- .../open/bean/auth/MaAuthResubmitParam.java | 4 + .../open/bean/auth/MaAuthSubmitParam.java | 5 +- .../bean/auth/MaAuthSubmitParamAuthData.java | 8 +- .../auth/MaAuthSubmitParamInvoiceInfo.java | 2 +- .../open/bean/message/WxOpenXmlMessage.java | 103 +++++++++++++++++- 10 files changed, 148 insertions(+), 14 deletions(-) diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/WxMaUploadAuthMaterialResult.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/WxMaUploadAuthMaterialResult.java index 17f6d5898..9e050ca67 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/WxMaUploadAuthMaterialResult.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/WxMaUploadAuthMaterialResult.java @@ -11,8 +11,10 @@ import java.io.Serializable; * * @author penhuozhu * @since 2024/01/07 + * @deprecated 应使用 WxOpenMaService.getAuthService() 的相关功能来处理小程序认证相关业务 */ @Data +@Deprecated public class WxMaUploadAuthMaterialResult implements Serializable { private static final long serialVersionUID = 1L; diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/message/WxMpXmlMessage.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/message/WxMpXmlMessage.java index 3a30c9f14..27b7eaecc 100644 --- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/message/WxMpXmlMessage.java +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/message/WxMpXmlMessage.java @@ -570,6 +570,10 @@ public class WxMpXmlMessage implements Serializable { /////////////////////////////////////// // 微信认证事件推送 /////////////////////////////////////// + // event=wx_verify_pay_succ支付完成 + // event=wx_verify_dispatch分配审核提供商 + // event=wx_verify_refill拒绝需重新提交 + // event=wx_verify_fail拒绝(不可重新提交) /** * 资质认证成功/名称认证成功: 有效期 (整形),指的是时间戳,将于该时间戳认证过期. * 年审通知: 有效期 (整形),指的是时间戳,将于该时间戳认证过期,需尽快年审 @@ -591,6 +595,20 @@ public class WxMpXmlMessage implements Serializable { @JacksonXmlProperty(localName = "FailReason") private String failReason; + /** + * 重新填写时间戳(秒数) + */ + @XStreamAlias("RefillTime") + @JacksonXmlProperty(localName = "RefillTime") + private Long refillTime; + + /** + * 重新填写原因 + */ + @XStreamAlias("RefillReason") + @JacksonXmlProperty(localName = "RefillReason") + private String refillReason; + /////////////////////////////////////// // 微信小店 6.1订单付款通知 /////////////////////////////////////// diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaService.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaService.java index 3ac8c03be..2afb5277d 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaService.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaService.java @@ -783,8 +783,10 @@ public interface WxOpenMaService extends WxMaService { /** * 小程序认证上传补充材料 * - * @return + * @return 结果 + * @see #getAuthService() 应使用此处方法处理小程序认证相关业务 */ + @Deprecated WxMaUploadAuthMaterialResult uploadAuthMaterial(File file) throws WxErrorException; } diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/auth/MaAuthQueryResult.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/auth/MaAuthQueryResult.java index 806490f72..a2707b0ba 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/auth/MaAuthQueryResult.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/auth/MaAuthQueryResult.java @@ -5,6 +5,7 @@ import lombok.Getter; import lombok.Setter; import me.chanjar.weixin.open.bean.result.WxOpenResult; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * 小程序认证 查询操作 响应 @@ -40,25 +41,36 @@ public class MaAuthQueryResult extends WxOpenResult { /** * 审核单状态,创建审核单成功后有效 0审核单不存在 1待支付 2审核中 3打回重填 4认证通过 5认证最终失败(不能再修改) */ + @Nullable @SerializedName("apply_status") private Integer applyStatus; /** * 小程序后台展示的认证订单号 */ + @Nullable @SerializedName("orderid") private String orderId; /** * 当审核单被打回重填(apply_status=3)时有效 */ + @Nullable @SerializedName("refill_reason") private String refillReason; /** * 审核最终失败的原因(apply_status=5)时有效 */ + @Nullable @SerializedName("fail_reason") private String failReason; + /** + * 审核提供商分配信息 + */ + @Nullable + @SerializedName("dispatch_info") + private MaAuthQueryResultDispatchInfo dispatchInfo; + } diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/auth/MaAuthQueryResultDispatchInfo.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/auth/MaAuthQueryResultDispatchInfo.java index 022e47cd2..48c7b1cf0 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/auth/MaAuthQueryResultDispatchInfo.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/auth/MaAuthQueryResultDispatchInfo.java @@ -6,7 +6,7 @@ import lombok.NoArgsConstructor; import org.jetbrains.annotations.NotNull; /** - * 小程序认证 查询操作 响应数据 + * 小程序认证 查询操作 响应数据 - 审核提供商分配信息 * * @author 广州跨界 * created on 2024/01/11 @@ -32,5 +32,5 @@ public class MaAuthQueryResultDispatchInfo { */ @NotNull @SerializedName("dispatch_time") - private Integer dispatchTime; + private Long dispatchTime; } diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/auth/MaAuthResubmitParam.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/auth/MaAuthResubmitParam.java index 5f28a2a68..4f43bb861 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/auth/MaAuthResubmitParam.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/auth/MaAuthResubmitParam.java @@ -1,7 +1,9 @@ package me.chanjar.weixin.open.bean.auth; import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; import lombok.Data; +import lombok.NoArgsConstructor; import org.jetbrains.annotations.NotNull; /** @@ -11,6 +13,8 @@ import org.jetbrains.annotations.NotNull; * created on 2024/01/11 */ @Data +@NoArgsConstructor +@AllArgsConstructor public class MaAuthResubmitParam { /** diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/auth/MaAuthSubmitParam.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/auth/MaAuthSubmitParam.java index fd1218525..1f111f772 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/auth/MaAuthSubmitParam.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/auth/MaAuthSubmitParam.java @@ -1,6 +1,7 @@ package me.chanjar.weixin.open.bean.auth; import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import org.jetbrains.annotations.NotNull; @@ -13,13 +14,11 @@ import org.jetbrains.annotations.NotNull; */ @Data @NoArgsConstructor +@AllArgsConstructor public class MaAuthSubmitParam { /** * 认证信息 - * - * @author 广州跨界 - * created on 2024/01/11 */ @NotNull @SerializedName("auth_data") diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/auth/MaAuthSubmitParamAuthData.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/auth/MaAuthSubmitParamAuthData.java index 9063ca543..89568e1cc 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/auth/MaAuthSubmitParamAuthData.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/auth/MaAuthSubmitParamAuthData.java @@ -23,7 +23,7 @@ public class MaAuthSubmitParamAuthData { */ @NotNull @SerializedName("customer_type") - private String customerType; + private Integer customerType; /** * 联系人信息 @@ -33,7 +33,7 @@ public class MaAuthSubmitParamAuthData { private MaAuthSubmitParamContactInfo contactInfo; /** - * 发票信息,如果是服务商代缴模式,不需要改参数 + * 发票信息,实测即使是服务商(第三方平台)代缴,也需要提供此参数,否则报错。官方文档为:如果是服务商代缴模式,不需要改参数 */ @Nullable @SerializedName("invoice_info") @@ -78,7 +78,7 @@ public class MaAuthSubmitParamAuthData { */ @NotNull @SerializedName("pay_type") - private String payType; + private Integer payType; /** * 认证类型为个人类型时可以选择要认证的身份,从/wxa/sec/authidentitytree 里获取,填叶节点的name @@ -106,5 +106,5 @@ public class MaAuthSubmitParamAuthData { */ @Nullable @SerializedName("service_appid") - private String serviceAppid; + private String serviceAppId; } diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/auth/MaAuthSubmitParamInvoiceInfo.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/auth/MaAuthSubmitParamInvoiceInfo.java index 36020a8eb..7b6d41783 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/auth/MaAuthSubmitParamInvoiceInfo.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/auth/MaAuthSubmitParamInvoiceInfo.java @@ -17,7 +17,7 @@ import org.springframework.lang.Nullable; public class MaAuthSubmitParamInvoiceInfo { /** - * 发票类型 1: 不开发票 2: 电子发票 3: 增值税专票 + * 发票类型 1不开发票 2电子发票 3增值税专票,服务商代缴时只能为1,即不开发票 */ @NotNull @SerializedName("invoice_type") diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/message/WxOpenXmlMessage.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/message/WxOpenXmlMessage.java index dc99fcc18..f8bde1582 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/message/WxOpenXmlMessage.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/message/WxOpenXmlMessage.java @@ -27,6 +27,9 @@ import java.nio.charset.StandardCharsets; public class WxOpenXmlMessage implements Serializable { private static final long serialVersionUID = -5641769554709507771L; + /** + * 第三方平台的APPID + */ @XStreamAlias("AppId") @XStreamConverter(value = XStreamCDataConverter.class) private String appId; @@ -57,10 +60,13 @@ public class WxOpenXmlMessage implements Serializable { @XStreamConverter(value = XStreamCDataConverter.class) private String preAuthCode; - // 以下为快速创建小程序接口推送的的信息 - + /** + * 子平台APPID(公众号/小程序的APPID) 快速创建小程序、小程序认证中 + */ @XStreamAlias("appid") - private String registAppId; + private String subAppId; + + // 以下为快速创建小程序接口推送的的信息 @XStreamAlias("status") private int status; @@ -75,6 +81,70 @@ public class WxOpenXmlMessage implements Serializable { @XStreamAlias("info") private Info info = new Info(); + // 以下为小程序认证(年审)申请审核流程 推送的消息 infoType=notify_3rd_wxa_auth + /** + * 任务ID + */ + @XStreamAlias("taskid") + @XStreamConverter(value = XStreamCDataConverter.class) + private String taskId; + + /** + * 认证任务状态 0初始 1超24小时 2用户拒绝 3用户同意 4发起人脸 5人脸失败 6人脸ok 7人脸认证后手机验证码 8手机验证失败 9手机验证成功 11创建审核单失败 12创建审核单成功 14验证失败 15等待支付 + */ + @XStreamAlias("task_status") + private Integer taskStatus; + + /** + * 审核单状态,创建审核单成功后有效 0审核单不存在 1待支付 2审核中 3打回重填 4认证通过 5认证最终失败(不能再修改) + */ + @XStreamAlias("apply_status") + private Integer applyStatus; + + /** + * 审核消息或失败原因 + */ + @XStreamAlias("message") + @XStreamConverter(value = XStreamCDataConverter.class) + private String message; + + + /** + * 审核提供商分配信息 + */ + @XStreamAlias("dispatch_info") + private DispatchInfo dispatchInfo; + + + // 以下为小程序认证(年审)即将到期通知(过期当天&过期30天&过期60) infoType=notify_3rd_wxa_wxverify,并会附带message + /** + * 过期时间戳(秒数) + */ + @XStreamAlias("expired") + private Long expired; + + + /** + * 快速创建的小程序appId,已弃用,未来将删除 + * + * @see #getSubAppId() 应使用此方法 + */ + @Deprecated + public String getRegistAppId() { + return subAppId; + } + + /** + * 快速创建的小程序appId,已弃用,未来将删除 + * + * @see #setSubAppId(String) 应使用此方法 + */ + @Deprecated + public void setRegistAppId(String value) { + subAppId = value; + } + + @XStreamAlias("info") @Data public static class Info implements Serializable { @@ -119,6 +189,33 @@ public class WxOpenXmlMessage implements Serializable { } + /** + * 审核提供商分配信息 + */ + @Data + public static class DispatchInfo { + + /** + * 提供商,如:上海倍通企业信用征信有限公司 + */ + @XStreamConverter(value = XStreamCDataConverter.class) + @XStreamAlias("provider") + private String provider; + + /** + * 联系方式,如:咨询电话:0411-84947888,咨询时间:周一至周五(工作日)8:30-17:30 + */ + @XStreamConverter(value = XStreamCDataConverter.class) + @XStreamAlias("contact") + private String contact; + + /** + * 派遣时间戳(秒),如:1704952913 + */ + @XStreamAlias("dispatch_time") + private Long dispatchTime; + } + public static String wxMpOutXmlMessageToEncryptedXml(WxMpXmlOutMessage message, WxOpenConfigStorage wxOpenConfigStorage) { String plainXml = message.toXml(); WxOpenCryptUtil pc = new WxOpenCryptUtil(wxOpenConfigStorage);