From ec0f58f3e1a60837401d8e01bd3a49e5e2fd4393 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=BE=E8=8A=B1=E7=83=A7=E9=A5=BC?= Date: Tue, 17 Dec 2024 00:31:48 +0800 Subject: [PATCH 01/14] =?UTF-8?q?:art:=E3=80=90=E5=BE=AE=E4=BF=A1=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E3=80=91=E9=83=A8=E5=88=86=E6=8E=A5=E5=8F=A3=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E5=AE=9E=E4=BD=93=E7=B1=BB=E5=AE=9E=E7=8E=B0=E5=BA=8F?= =?UTF-8?q?=E5=88=97=E5=8C=96=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../binarywang/wxpay/bean/bank/BankBranchesResult.java | 5 ++++- .../com/github/binarywang/wxpay/bean/bank/BankInfo.java | 7 ++++++- .../github/binarywang/wxpay/bean/bank/BankingResult.java | 5 ++++- .../github/binarywang/wxpay/bean/bank/CitiesResult.java | 5 ++++- .../github/binarywang/wxpay/bean/bank/ProvincesResult.java | 4 +++- .../binarywang/wxpay/bean/ecommerce/FundBillResult.java | 4 +++- 6 files changed, 24 insertions(+), 6 deletions(-) diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/bank/BankBranchesResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/bank/BankBranchesResult.java index 72cc4f6a76..a0ee6d3d99 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/bank/BankBranchesResult.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/bank/BankBranchesResult.java @@ -144,7 +144,10 @@ public class BankBranchesResult implements Serializable { @Getter @Setter - public static class BankBranch { + public static class BankBranch implements Serializable { + + private static final long serialVersionUID = -3500020131951579476L; + /** *
      * 字段名:开户银行支行名称
diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/bank/BankInfo.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/bank/BankInfo.java
index 89756b07d5..adafc9b280 100644
--- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/bank/BankInfo.java
+++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/bank/BankInfo.java
@@ -5,6 +5,8 @@
 import lombok.Getter;
 import lombok.Setter;
 
+import java.io.Serializable;
+
 /**
  * 银行信息
  *
@@ -12,7 +14,10 @@
  * created on  2022/5/12
  **/
 @Data
-public class BankInfo {
+public class BankInfo implements Serializable {
+
+  private static final long serialVersionUID = 1L;
+
   /**
    * 银行别名
    */
diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/bank/BankingResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/bank/BankingResult.java
index 407ad5fc55..1d3a48c200 100644
--- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/bank/BankingResult.java
+++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/bank/BankingResult.java
@@ -43,7 +43,10 @@ public class BankingResult implements Serializable {
 
   @Getter
   @Setter
-  public static class Link {
+  public static class Link implements Serializable {
+
+    private static final long serialVersionUID = -8372812998971715894L;
+
     /**
      * 下一页链接
      */
diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/bank/CitiesResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/bank/CitiesResult.java
index b5bf87c816..b6914ee814 100644
--- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/bank/CitiesResult.java
+++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/bank/CitiesResult.java
@@ -47,7 +47,10 @@ public class CitiesResult implements Serializable {
 
   @Getter
   @Setter
-  public static class CityInfo {
+  public static class CityInfo implements Serializable {
+
+    private static final long serialVersionUID = -6089905695087974693L;
+
     /**
      * 
      * 字段名:城市名称
diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/bank/ProvincesResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/bank/ProvincesResult.java
index 6525fc1c91..162c976347 100644
--- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/bank/ProvincesResult.java
+++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/bank/ProvincesResult.java
@@ -47,7 +47,9 @@ public class ProvincesResult implements Serializable {
 
   @Getter
   @Setter
-  public static class ProvinceInfo {
+  public static class ProvinceInfo implements Serializable {
+
+    private static final long serialVersionUID = -4118613374545722650L;
 
     /**
      * 
diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/FundBillResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/FundBillResult.java
index 206cd1218b..077c2c2336 100644
--- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/FundBillResult.java
+++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/FundBillResult.java
@@ -48,7 +48,9 @@ public class FundBillResult implements Serializable {
   private FundBill[] downloadBillList;
 
   @Data
-  public static class FundBill {
+  public static class FundBill implements Serializable {
+
+    private static final long serialVersionUID = 4008480977464421822L;
 
     /**
      * 

From 990b8757b87b9de734d8488aa69e7b70d703ec5a Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Tue, 17 Dec 2024 00:32:15 +0800
Subject: [PATCH 02/14] :arrow_up: Bump com.thoughtworks.xstream:xstream

---
 others/weixin-java-osgi/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/others/weixin-java-osgi/pom.xml b/others/weixin-java-osgi/pom.xml
index 67e4f42beb..b8531da88d 100644
--- a/others/weixin-java-osgi/pom.xml
+++ b/others/weixin-java-osgi/pom.xml
@@ -28,7 +28,7 @@
     
       com.thoughtworks.xstream
       xstream
-      1.4.19
+      1.4.21
       provided
       
         

From 9ceda09294628d5c5b67d5e75800598650539545 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=BD=97=E5=8B=8B?= 
Date: Wed, 18 Dec 2024 03:19:46 +0000
Subject: [PATCH 03/14] =?UTF-8?q?:bug:=20=E3=80=90=E8=A7=86=E9=A2=91?=
 =?UTF-8?q?=E5=8F=B7=E3=80=91=E4=BF=AE=E5=A4=8D=E5=BE=AE=E4=BF=A1=E5=B0=8F?=
 =?UTF-8?q?=E5=BA=97=E4=B8=BB=E9=A1=B5=E7=AE=A1=E7=90=86API=E8=8E=B7?=
 =?UTF-8?q?=E5=8F=96=E5=9C=A8=E5=BA=97=E9=93=BA=E4=B8=BB=E9=A1=B5=E5=B1=95?=
 =?UTF-8?q?=E7=A4=BA=E7=9A=84=E5=95=86=E5=93=81=E5=88=86=E7=B1=BB=E6=8E=A5?=
 =?UTF-8?q?=E5=8F=A3=E7=9A=84=E8=BF=94=E5=9B=9E=E5=AE=9E=E4=BD=93=E7=B1=BB?=
 =?UTF-8?q?=E7=9A=84=E9=83=A8=E5=88=86=E5=AD=97=E6=AE=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../chanjar/weixin/channel/bean/home/tree/LevelTreeInfo.java | 5 +++--
 .../weixin/channel/bean/home/tree/OneLevelTreeNode.java      | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/LevelTreeInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/LevelTreeInfo.java
index c74fff1246..104588202e 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/LevelTreeInfo.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/LevelTreeInfo.java
@@ -2,6 +2,7 @@
 
 import com.fasterxml.jackson.annotation.JsonProperty;
 import java.io.Serializable;
+import java.util.List;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
@@ -17,7 +18,7 @@
 public class LevelTreeInfo implements Serializable {
 
   /** 一级分类 */
-  @JsonProperty("level1")
-  private OneLevelTreeNode level1;
+  @JsonProperty("level_1")
+  private List level1;
 
 }
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/OneLevelTreeNode.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/OneLevelTreeNode.java
index 74103e2b89..76499c86e7 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/OneLevelTreeNode.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/OneLevelTreeNode.java
@@ -1,6 +1,7 @@
 package me.chanjar.weixin.channel.bean.home.tree;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.List;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
@@ -18,7 +19,7 @@
 public class OneLevelTreeNode extends CatTreeNode {
 
   /** 二级分类 */
-  @JsonProperty("level2")
-  private CatTreeNode level2;
+  @JsonProperty("level_2")
+  private List level2;
 
 }

From 86a437bc60b041dc0f3bf751d0b234b09f8de940 Mon Sep 17 00:00:00 2001
From: Binary Wang <5303+binary@user.noreply.gitee.com>
Date: Wed, 18 Dec 2024 03:23:35 +0000
Subject: [PATCH 04/14] update .gitee/ISSUE_TEMPLATE.md.

Signed-off-by: Binary Wang <5303+binary@user.noreply.gitee.com>
---
 .gitee/ISSUE_TEMPLATE.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitee/ISSUE_TEMPLATE.md b/.gitee/ISSUE_TEMPLATE.md
index cdae693d35..a0b60ba750 100644
--- a/.gitee/ISSUE_TEMPLATE.md
+++ b/.gitee/ISSUE_TEMPLATE.md
@@ -1,4 +1,4 @@
-强烈建议大家到 `github` 相关页面提交问题,方便统一查询管理,具体页面地址:https://github.com/Wechat-Group/WxJava/issues
+强烈建议大家到 `github` 相关页面提交问题,方便统一查询管理,具体页面地址:https://github.com/binarywang/WxJava/issues
 
 当然如果必须在这里提问,请务必按以下格式填写,谢谢配合~
 

From 3e28b17e9f626d947c795b6346ce30665b2b3724 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ader1y=20=E6=A0=88=E7=83=9F?= 
Date: Wed, 18 Dec 2024 11:37:37 +0800
Subject: [PATCH 05/14] =?UTF-8?q?:bug:=20#3443=20=E3=80=90=E5=BE=AE?=
 =?UTF-8?q?=E4=BF=A1=E6=94=AF=E4=BB=98=E3=80=91=E5=88=9D=E5=A7=8B=E5=8C=96?=
 =?UTF-8?q?V3=E8=AF=B7=E6=B1=82=E6=97=B6=E5=8F=96=E6=B6=88=E5=AF=B9?=
 =?UTF-8?q?=E7=A7=81=E9=92=A5=E7=9A=84=E5=8A=A0=E5=AF=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../binarywang/wxpay/config/WxPayConfig.java  |  5 ----
 .../config/CustomizedWxPayConfigTest.java     |  9 ++++---
 .../wxpay/config/WxPayConfigTest.java         | 24 -------------------
 .../testbase/CustomizedApiTestModule.java     | 20 +++++++++++++---
 4 files changed, 23 insertions(+), 35 deletions(-)

diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/WxPayConfig.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/WxPayConfig.java
index a8ad909b3e..293c52eac6 100644
--- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/WxPayConfig.java
+++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/WxPayConfig.java
@@ -14,7 +14,6 @@
 import java.security.PublicKey;
 import java.security.cert.Certificate;
 import java.security.cert.X509Certificate;
-import java.util.Base64;
 import java.util.Optional;
 import javax.net.ssl.SSLContext;
 import lombok.Data;
@@ -295,10 +294,6 @@ public CloseableHttpClient initApiV3HttpClient() throws WxPayException {
     }
     try {
       if (merchantPrivateKey == null) {
-        if (StringUtils.isNotBlank(this.getPrivateKeyString())) {
-          this.setPrivateKeyString(Base64.getEncoder().encodeToString(this.getPrivateKeyString().getBytes()));
-        }
-
         try (InputStream keyInputStream = this.loadConfigInputStream(this.getPrivateKeyString(), this.getPrivateKeyPath(),
           this.privateKeyContent, "privateKeyPath")) {
           merchantPrivateKey = PemUtils.loadPrivateKey(keyInputStream);
diff --git a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/config/CustomizedWxPayConfigTest.java b/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/config/CustomizedWxPayConfigTest.java
index a42026e3ee..3b2bdfeaa6 100644
--- a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/config/CustomizedWxPayConfigTest.java
+++ b/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/config/CustomizedWxPayConfigTest.java
@@ -1,5 +1,9 @@
 package com.github.binarywang.wxpay.config;
 
+import static org.testng.Assert.assertEquals;
+
+import com.github.binarywang.wxpay.bean.result.WxPayOrderQueryV3Result;
+import com.github.binarywang.wxpay.constant.WxPayErrorCode;
 import com.github.binarywang.wxpay.exception.WxPayException;
 import com.github.binarywang.wxpay.service.WxPayService;
 import com.github.binarywang.wxpay.testbase.CustomizedApiTestModule;
@@ -30,10 +34,9 @@ public void testCustomizerHttpClient() {
 
   public void testCustomizerV3HttpClient() {
     try {
-      wxPayService.queryOrderV3("a", null);
+      WxPayOrderQueryV3Result result = wxPayService.queryOrderV3("a", null);
     } catch (WxPayException e) {
-      // ignore
-      e.printStackTrace();
+      assertEquals(e.getErrCode(), WxPayErrorCode.RefundQuery.PARAM_ERROR);
     }
   }
 }
diff --git a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/config/WxPayConfigTest.java b/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/config/WxPayConfigTest.java
index 72750e01cd..46bc23aac2 100644
--- a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/config/WxPayConfigTest.java
+++ b/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/config/WxPayConfigTest.java
@@ -1,16 +1,7 @@
 package com.github.binarywang.wxpay.config;
 
-import com.github.binarywang.wxpay.exception.WxPayException;
-import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.bouncycastle.pqc.jcajce.provider.util.KeyUtil;
 import org.testng.annotations.Test;
 
-import java.security.KeyPair;
-import java.security.KeyPairGenerator;
-import java.security.SecureRandom;
-import java.security.Security;
-import java.util.Base64;
-
 /**
  * 
  *  Created by BinaryWang on 2017/6/18.
@@ -54,19 +45,4 @@ public void testInitSSLContext_base64() throws Exception {
     payConfig.initSSLContext();
   }
 
-
-  @Test
-  public void testInitApiV3HttpClient() throws Exception {
-    Security.addProvider(new BouncyCastleProvider());
-    KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA","BC");
-    keyPairGenerator.initialize(2048,new SecureRandom());
-    KeyPair keyPair = keyPairGenerator.genKeyPair();
-    byte[] encoded = keyPair.getPrivate().getEncoded();
-    // 模拟用户配置
-    String privateKeyString = Base64.getEncoder().encodeToString(encoded);
-    payConfig.setPrivateKeyString(privateKeyString);
-    payConfig.setApiV3Key("Test");
-    payConfig.initApiV3HttpClient();
-  }
-
 }
diff --git a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/testbase/CustomizedApiTestModule.java b/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/testbase/CustomizedApiTestModule.java
index a0cc399ea9..484227e34e 100644
--- a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/testbase/CustomizedApiTestModule.java
+++ b/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/testbase/CustomizedApiTestModule.java
@@ -6,15 +6,14 @@
 import com.google.inject.Binder;
 import com.google.inject.Module;
 import com.thoughtworks.xstream.XStream;
+import java.io.*;
+import java.nio.charset.StandardCharsets;
 import me.chanjar.weixin.common.error.WxRuntimeException;
 import me.chanjar.weixin.common.util.xml.XStreamInitializer;
 import org.apache.http.HttpRequestInterceptor;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.IOException;
-import java.io.InputStream;
-
 /**
  * The type Api test module.
  */
@@ -39,7 +38,22 @@ public void configure(Binder binder) {
       config.setHttpClientBuilderCustomizer((builder) -> {
         builder.addInterceptorLast((HttpRequestInterceptor) (r, c) -> System.out.println("--------> HttpRequestInterceptor ..."));
       });
+      try (FileInputStream fis = new FileInputStream(config.getPrivateKeyPath());
+           InputStreamReader isr = new InputStreamReader(fis, StandardCharsets.UTF_8);
+           BufferedReader reader = new BufferedReader(isr)) {
+
+        StringBuilder stringBuilder = new StringBuilder();
+        String line;
+        while ((line = reader.readLine()) != null) {
+          stringBuilder.append(line);
+          stringBuilder.append(System.lineSeparator());
+        }
 
+        String fileContent = stringBuilder.toString();
+        config.setPrivateKeyString(fileContent);
+        System.out.println(fileContent);
+
+      }
       WxPayService wxService = new WxPayServiceImpl();
       wxService.setConfig(config);
 

From 232be27ef203fd619e0185214c8f558ee86bcd84 Mon Sep 17 00:00:00 2001
From: Zeyes Lee 
Date: Wed, 18 Dec 2024 12:39:27 +0800
Subject: [PATCH 06/14] =?UTF-8?q?:bug:=20=E3=80=90=E8=A7=86=E9=A2=91?=
 =?UTF-8?q?=E5=8F=B7=E3=80=91=E4=BF=AE=E6=AD=A3=E5=BA=97=E9=93=BA=E4=B8=BB?=
 =?UTF-8?q?=E9=A1=B5=E5=B1=95=E7=A4=BA=E7=9A=84=E5=95=86=E5=93=81=E5=88=86?=
 =?UTF-8?q?=E7=B1=BB=E6=8A=A5=E9=94=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../channel/bean/home/tree/CatTreeNode.java   |  2 +-
 .../channel/bean/home/tree/TreeShowInfo.java  | 58 -------------------
 2 files changed, 1 insertion(+), 59 deletions(-)

diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/CatTreeNode.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/CatTreeNode.java
index fda794428c..c545b8637f 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/CatTreeNode.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/CatTreeNode.java
@@ -28,5 +28,5 @@ public class CatTreeNode implements Serializable {
 
   /** 是否在用户端展示该分类。1为是,0为否 */
   @JsonProperty("is_displayed")
-  private Integer displayed;
+  private Boolean displayed;
 }
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeShowInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeShowInfo.java
index 485d29ce15..09da2c5b0c 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeShowInfo.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeShowInfo.java
@@ -1,6 +1,5 @@
 package me.chanjar.weixin.channel.bean.home.tree;
 
-import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import java.io.Serializable;
 import java.util.List;
@@ -43,61 +42,4 @@ protected LevelTreeInfo createTree() {
     }
     return tree;
   }
-
-  /**
-   * 创建一级分类节点
-   *
-   * @return 一级分类节点
-   */
-  protected OneLevelTreeNode createLevel1() {
-    this.createTree();
-    if (tree.getLevel1() == null) {
-      tree.setLevel1(new OneLevelTreeNode());
-    }
-    return tree.getLevel1();
-  }
-
-  /**
-   * 创建二级分类节点
-   *
-   * @return 二级分类节点
-   */
-  protected CatTreeNode createLevel2() {
-    OneLevelTreeNode level1 = this.createLevel1();
-    if (level1.getLevel2() == null) {
-      level1.setLevel2(new CatTreeNode());
-    }
-    return level1.getLevel2();
-  }
-
-
-  @JsonIgnore
-  public void setLevel1Id(Integer id) {
-    createLevel1().setId(id);
-  }
-
-  @JsonIgnore
-  public void setLevel1Name(String name) {
-    createLevel1().setName(name);
-  }
-
-  @JsonIgnore
-  public void setLevel1Displayed(Integer displayed) {
-    createLevel1().setDisplayed(displayed);
-  }
-
-  @JsonIgnore
-  public void setLevel2Id(Integer id) {
-    createLevel2().setId(id);
-  }
-
-  @JsonIgnore
-  public void setLevel2Name(String name) {
-    createLevel2().setName(name);
-  }
-
-  @JsonIgnore
-  public void setLevel2Displayed(Integer displayed) {
-    createLevel2().setDisplayed(displayed);
-  }
 }

From d53c09c40facc2d3287f5081d0228c8f2f6c9b72 Mon Sep 17 00:00:00 2001
From: Binary Wang 
Date: Wed, 18 Dec 2024 12:37:54 +0800
Subject: [PATCH 07/14] =?UTF-8?q?:art:=20=E4=BC=98=E5=8C=96=E9=A6=96?=
 =?UTF-8?q?=E9=A1=B5=E6=96=87=E6=A1=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 README.md | 56 ++++++++++++++++++++++++-------------------------------
 1 file changed, 24 insertions(+), 32 deletions(-)

diff --git a/README.md b/README.md
index c61c8d48da..ab645b7c4f 100644
--- a/README.md
+++ b/README.md
@@ -50,21 +50,23 @@
         Featured|HelloGitHub
       
+      binarywang%2FWxJava | 趋势转变
+      
     
   
 
 
 ### 重要信息
-0. [`WxJava` 荣获 `GitCode` 2024年度十大开源社区奖项](https://mp.weixin.qq.com/s/wM_UlMsDm3IZ1CPPDvcvQw)。
-1. 项目合作洽谈请联系微信`binary0000`(在微信里自行搜索并添加好友,请注明来意,如有关于SDK问题需讨论请参考下文入群讨论,不要加此微信)。
-2. **2023-12-28 发布 [【4.6.0正式版】](https://mp.weixin.qq.com/s/9Hhc_8w-v7ogS_TEAsqfAg)**!
-3. 贡献源码可以参考视频:[【贡献源码全过程(上集)】](https://mp.weixin.qq.com/s/3xUZSATWwHR_gZZm207h7Q)、[【贡献源码全过程(下集)】](https://mp.weixin.qq.com/s/nyzJwVVoYSJ4hSbwyvTx9A) ,友情提供:[程序员小山与Bug](https://space.bilibili.com/473631007)
-4. 新手重要提示:本项目仅是一个SDK开发工具包,未提供Web实现,建议使用 `maven` 或 `gradle` 引用本项目即可使用本SDK提供的各种功能,详情可参考 **[【Demo项目】](demo.md)** 或本项目中的部分单元测试代码;
-5. 微信开发新手请务必阅读【开发文档】([Gitee Wiki](https://gitee.com/binary/weixin-java-tools/wikis/Home) 或者 [Github Wiki](https://github.com/binarywang/WxJava/wiki))的常见问题部分,可以少走很多弯路,节省不少时间。
-6. 技术交流群:想获得QQ群/微信群/钉钉企业群等信息的同学,请使用微信扫描上面的微信公众号二维码关注 `WxJava` 后点击相关菜单即可获取加入方式,同时也可以在微信中搜索 `weixin-java-tools` 或 `WxJava` 后选择正确的公众号进行关注,该公众号会及时通知SDK相关更新信息,并不定期分享微信Java开发相关技术知识;
-7. 钉钉技术交流群:`32206329`(技术交流2群), `30294972`(技术交流1群,目前已满),`35724728`(通知群,实时通知Github项目变更记录)。
-8. 微信开发新手或者Java开发新手在群内提问或新开Issue提问前,请先阅读[【提问的智慧】](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/master/README-zh_CN.md),并确保已查阅过 [【开发文档Wiki】](https://github.com/binarywang/WxJava/wiki) ,避免浪费大家的宝贵时间;
-9. 寻求帮助时需贴代码或大长串异常信息的,请利用 http://paste.ubuntu.com 
+1. [`WxJava` 荣获 `GitCode` 2024年度十大开源社区奖项](https://mp.weixin.qq.com/s/wM_UlMsDm3IZ1CPPDvcvQw)。
+2. 项目合作洽谈请联系微信`binary0000`(在微信里自行搜索并添加好友,请注明来意,如有关于SDK问题需讨论请参考下文入群讨论,不要加此微信)。
+3. **2023-12-28 发布 [【4.6.0正式版】](https://mp.weixin.qq.com/s/9Hhc_8w-v7ogS_TEAsqfAg)**!
+4. 贡献源码可以参考视频:[【贡献源码全过程(上集)】](https://mp.weixin.qq.com/s/3xUZSATWwHR_gZZm207h7Q)、[【贡献源码全过程(下集)】](https://mp.weixin.qq.com/s/nyzJwVVoYSJ4hSbwyvTx9A) ,友情提供:[程序员小山与Bug](https://space.bilibili.com/473631007)
+5. 新手重要提示:本项目仅是一个SDK开发工具包,未提供Web实现,建议使用 `maven` 或 `gradle` 引用本项目即可使用本SDK提供的各种功能,详情可参考 **[【Demo项目】](demo.md)** 或本项目中的部分单元测试代码;
+6. 微信开发新手请务必阅读【开发文档】([Gitee Wiki](https://gitee.com/binary/weixin-java-tools/wikis/Home) 或者 [Github Wiki](https://github.com/binarywang/WxJava/wiki))的常见问题部分,可以少走很多弯路,节省不少时间。
+7. 技术交流群:想获得QQ群/微信群/钉钉企业群等信息的同学,请使用微信扫描上面的微信公众号二维码关注 `WxJava` 后点击相关菜单即可获取加入方式,同时也可以在微信中搜索 `weixin-java-tools` 或 `WxJava` 后选择正确的公众号进行关注,该公众号会及时通知SDK相关更新信息,并不定期分享微信Java开发相关技术知识;
+8. 钉钉技术交流群:`32206329`(技术交流2群), `30294972`(技术交流1群,目前已满),`35724728`(通知群,实时通知Github项目变更记录)。
+9. 微信开发新手或者Java开发新手在群内提问或新开Issue提问前,请先阅读[【提问的智慧】](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/master/README-zh_CN.md),并确保已查阅过 [【开发文档Wiki】](https://github.com/binarywang/WxJava/wiki) ,避免浪费大家的宝贵时间;
+10. 寻求帮助时需贴代码或大长串异常信息的,请利用 http://paste.ubuntu.com 
 
 --------------------------------
 ### 其他说明
@@ -95,9 +97,9 @@
   - 微信小程序:`weixin-java-miniapp`   
   - 微信支付:`weixin-java-pay`
   - 微信开放平台:`weixin-java-open`   
-  - 公众号(包括订阅号和服务号):`weixin-java-mp`    
-  - 企业号/企业微信:`weixin-java-cp`
-  - 视频号/微信小店:`weixin-java-channel`
+  - 微信公众号:`weixin-java-mp`    
+  - 企业微信:`weixin-java-cp`
+  - 微信视频号/微信小店:`weixin-java-channel`
 
 
 ---------------------------------
@@ -117,7 +119,8 @@
 ### 应用案例
 完整案例登记列表,请[【访问这里】](https://github.com/binarywang/WxJava/issues/729)查看,欢迎登记更多的案例。
 
-以下为节选的部分案例:
+
+以下为节选的部分案例, 点此展开查看 #### 开源项目: - 基于微信公众号的签到、抽奖、发送弹幕程序:https://github.com/workcheng/weiya @@ -180,26 +183,15 @@ - 微信公众号管理系统:http://demo.joolun.com - 锐捷网络:Saleslink +
+ ---------------------------------- ### 贡献者列表 特别感谢参与贡献的所有同学,所有贡献者列表请在[此处](https://github.com/binarywang/WxJava/graphs/contributors)查看,欢迎大家继续踊跃贡献代码! -
-点击此处展开查看贡献次数最多的几位小伙伴 - -1. [chanjarster (Daniel Qian)](https://github.com/chanjarster) -2. [binarywang (Binary Wang)](https://github.com/binarywang) -3. [007gzs](https://github.com/007gzs) -4. [Silloy](https://github.com/silloy) -5. [mgcnrx11](https://github.com/mgcnrx11) -6. [0katekate0 (Wang_Wong)](https://github.com/0katekate0) -7. [yuanqixun](https://github.com/yuanqixun) -8. [kakotor](https://github.com/kakotor) -9. [aimilin6688 (Jonk)](https://github.com/aimilin6688) -10. [lkqm (Mario Luo)](https://github.com/lkqm) -11. [kareanyi (MillerLin)](https://github.com/kareanyi) -12. [Bincent (Hongbin.hsu)](https://gitee.com/bincent) -
-### GitHub Stargazers over time + + + -[![Stargazers over time](https://starchart.cc/Wechat-Group/WxJava.svg)](https://starchart.cc/Wechat-Group/WxJava) +### GitHub Stargazers over time +[![Star History Chart](https://api.star-history.com/svg?repos=binarywang/WxJava&type=Date)](https://star-history.com/#binarywang/WxJava&Date) From a429e74a741e3390363a98e42b695467cbe9e17b Mon Sep 17 00:00:00 2001 From: Zeyes Lee Date: Wed, 18 Dec 2024 21:50:53 +0800 Subject: [PATCH 08/14] =?UTF-8?q?:art:=20#3445=20=E3=80=90=E4=BC=81?= =?UTF-8?q?=E4=B8=9A=E5=BE=AE=E4=BF=A1=E3=80=91=E7=AC=AC=E4=B8=89=E6=96=B9?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E5=BC=80=E5=8F=91=E6=B6=88=E6=81=AF=E5=A4=84?= =?UTF-8?q?=E7=90=86=E5=88=A4=E6=96=AD=E9=87=8D=E5=A4=8D=E7=9A=84=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E8=BF=9B=E8=A1=8C=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../weixin/channel/message/WxChannelMessageRouter.java | 4 ++-- .../java/me/chanjar/weixin/cp/message/WxCpMessageRouter.java | 2 +- .../me/chanjar/weixin/cp/tp/message/WxCpTpMessageRouter.java | 5 +++-- .../cn/binarywang/wx/miniapp/message/WxMaMessageRouter.java | 2 +- .../java/me/chanjar/weixin/mp/api/WxMpMessageRouter.java | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/message/WxChannelMessageRouter.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/message/WxChannelMessageRouter.java index 8ccc2c5050..16fb0781cb 100644 --- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/message/WxChannelMessageRouter.java +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/message/WxChannelMessageRouter.java @@ -178,7 +178,7 @@ public Object route(final WxChannelMessage message, final String content, final * @param wxMessage 消息 * @return 是否重复 */ - private boolean isMsgDuplicated(WxChannelMessage wxMessage) { + protected boolean isMsgDuplicated(WxChannelMessage wxMessage) { String messageId = this.generateMessageId(wxMessage); return this.messageDuplicateChecker.isDuplicate(messageId); } @@ -188,7 +188,7 @@ private boolean isMsgDuplicated(WxChannelMessage wxMessage) { * * @return 消息id */ - private String generateMessageId(WxChannelMessage wxMessage) { + protected String generateMessageId(WxChannelMessage wxMessage) { StringBuilder sb = new StringBuilder(); if (wxMessage.getMsgId() == null) { sb.append(wxMessage.getCreateTime()) diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/message/WxCpMessageRouter.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/message/WxCpMessageRouter.java index e2daeab546..a2417ec86d 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/message/WxCpMessageRouter.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/message/WxCpMessageRouter.java @@ -258,7 +258,7 @@ public WxCpXmlOutMessage route(final WxCpXmlMessage wxMessage) { return this.route(wxMessage, new HashMap<>(2)); } - private boolean isMsgDuplicated(WxCpXmlMessage wxMessage) { + protected boolean isMsgDuplicated(WxCpXmlMessage wxMessage) { StringBuilder messageId = new StringBuilder(); if (wxMessage.getMsgId() == null) { messageId.append(wxMessage.getCreateTime()) diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/message/WxCpTpMessageRouter.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/message/WxCpTpMessageRouter.java index 1df52149c8..8887a23d5f 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/message/WxCpTpMessageRouter.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/message/WxCpTpMessageRouter.java @@ -278,7 +278,7 @@ public WxCpXmlOutMessage route(final WxCpTpXmlMessage wxMessage) { return this.route(wxMessage, new HashMap<>(2)); } - private boolean isMsgDuplicated(final String suiteId, WxCpTpXmlMessage wxMessage) { + protected boolean isMsgDuplicated(final String suiteId, WxCpTpXmlMessage wxMessage) { StringBuilder messageId = new StringBuilder(); messageId.append(wxMessage.getToUserName()); if (wxMessage.getInfoType() != null) { @@ -306,7 +306,8 @@ private boolean isMsgDuplicated(final String suiteId, WxCpTpXmlMessage wxMessage .append("-").append(wxMessage.getCreateTime()) .append("-").append(wxMessage.getFromUserName()) .append("-").append(StringUtils.trimToEmpty(wxMessage.getEvent())) - .append("-").append(StringUtils.trimToEmpty(wxMessage.getEventKey())); + .append("-").append(StringUtils.trimToEmpty(wxMessage.getEventKey())) + .append("-").append(StringUtils.trimToEmpty(wxMessage.getExternalUserID())); } } diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/message/WxMaMessageRouter.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/message/WxMaMessageRouter.java index 6cd603929d..3d81b6d66a 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/message/WxMaMessageRouter.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/message/WxMaMessageRouter.java @@ -173,7 +173,7 @@ public WxMaXmlOutMessage route(final WxMaMessage wxMessage) { return this.route(wxMessage, new HashMap<>(2)); } - private boolean isMsgDuplicated(WxMaMessage wxMessage) { + protected boolean isMsgDuplicated(WxMaMessage wxMessage) { StringBuilder messageId = new StringBuilder(); if (wxMessage.getMsgId() == null) { messageId.append(wxMessage.getCreateTime()) diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpMessageRouter.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpMessageRouter.java index 070e952c0f..f2a28c668c 100644 --- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpMessageRouter.java +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpMessageRouter.java @@ -315,7 +315,7 @@ public WxMpXmlOutMessage route(String appid, final WxMpXmlMessage wxMessage) { return this.route(appid, wxMessage, new HashMap<>(2)); } - private boolean isMsgDuplicated(WxMpXmlMessage wxMessage) { + protected boolean isMsgDuplicated(WxMpXmlMessage wxMessage) { StringBuilder messageId = new StringBuilder(); if (wxMessage.getMsgId() == null) { messageId.append(wxMessage.getCreateTime()) From 220cf1a530595f688b01e38768fc223e9055bf86 Mon Sep 17 00:00:00 2001 From: Zeyes Lee Date: Wed, 18 Dec 2024 22:40:10 +0800 Subject: [PATCH 09/14] =?UTF-8?q?:art:=20#3449=E3=80=90=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E5=8F=B7=E3=80=91=E8=AE=A2=E5=8D=95=E8=AF=A6=E6=83=85=E5=92=8C?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E8=AF=A6=E6=83=85=E6=8E=A5=E5=8F=A3=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E9=83=A8=E5=88=86=E5=AD=97=E6=AE=B5=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=B0=E5=A2=9E=E5=BA=93=E5=AD=98=E4=B8=8D?= =?UTF-8?q?=E8=B6=B3=E3=80=81=E5=9B=A2=E8=B4=AD=E4=BC=98=E6=83=A0=E5=8F=91?= =?UTF-8?q?=E6=94=BE=E7=9A=84=E5=9B=9E=E8=B0=83=E9=80=9A=E7=9F=A5=E5=A4=84?= =?UTF-8?q?=E7=90=86=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/BaseWxChannelMessageService.java | 25 +++++ .../impl/BaseWxChannelMessageServiceImpl.java | 19 ++++ .../bean/category/CategoryDetailResult.java | 4 + .../bean/category/CategoryQualification.java | 4 + .../bean/message/product/SpuStockMessage.java | 88 +++++++++++++++ .../bean/message/voucher/VoucherInfo.java | 106 ++++++++++++++++++ .../bean/message/voucher/VoucherMessage.java | 29 +++++ .../channel/bean/order/OrderAgentInfo.java | 30 +++++ .../channel/bean/order/OrderDetailInfo.java | 8 ++ .../channel/bean/order/OrderSourceInfo.java | 48 ++++++++ .../constant/MessageEventConstants.java | 4 + .../message/WxChannelMessageRouter.java | 7 +- 12 files changed, 369 insertions(+), 3 deletions(-) create mode 100644 weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/message/product/SpuStockMessage.java create mode 100644 weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/message/voucher/VoucherInfo.java create mode 100644 weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/message/voucher/VoucherMessage.java create mode 100644 weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/OrderAgentInfo.java create mode 100644 weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/OrderSourceInfo.java diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/BaseWxChannelMessageService.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/BaseWxChannelMessageService.java index 6f7be2f63f..a908da9479 100644 --- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/BaseWxChannelMessageService.java +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/BaseWxChannelMessageService.java @@ -20,11 +20,13 @@ import me.chanjar.weixin.channel.bean.message.product.BrandMessage; import me.chanjar.weixin.channel.bean.message.product.CategoryAuditMessage; import me.chanjar.weixin.channel.bean.message.product.SpuAuditMessage; +import me.chanjar.weixin.channel.bean.message.product.SpuStockMessage; import me.chanjar.weixin.channel.bean.message.store.CloseStoreMessage; import me.chanjar.weixin.channel.bean.message.store.NicknameUpdateMessage; import me.chanjar.weixin.channel.bean.message.supplier.SupplierItemMessage; import me.chanjar.weixin.channel.bean.message.vip.ExchangeInfoMessage; import me.chanjar.weixin.channel.bean.message.vip.UserInfoMessage; +import me.chanjar.weixin.channel.bean.message.voucher.VoucherMessage; import me.chanjar.weixin.channel.message.WxChannelMessage; import me.chanjar.weixin.channel.message.WxChannelMessageRouterRule; import me.chanjar.weixin.common.session.WxSessionManager; @@ -197,6 +199,18 @@ void spuStatusUpdate(SpuAuditMessage message, final String content, final String void spuUpdate(SpuAuditMessage message, final String content, final String appId, final Map context, final WxSessionManager sessionManager); + /** + * 商品库存不足通知 + * + * @param message 消息 + * @param content 消息原始内容 + * @param appId appId + * @param context 上下文 + * @param sessionManager session管理器 + */ + void stockNoEnough(SpuStockMessage message, final String content, final String appId, + final Map context, final WxSessionManager sessionManager); + /** * 类目审核结果 * @@ -353,6 +367,17 @@ void userCouponUse(UserCouponExpireMessage message, final String content, final void userCouponUnuse(UserCouponExpireMessage message, final String content, final String appId, final Map context, final WxSessionManager sessionManager); + /** + * 发放团购优惠成功回调 + * + * @param message 消息 + * @param content 消息原始内容 + * @param appId appId + * @param context 上下文 + * @param sessionManager session管理器 + */ + void voucherSendSucc(VoucherMessage message, final String content, final String appId, + final Map context, final WxSessionManager sessionManager); /** * 结算账户变更回调 * diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/BaseWxChannelMessageServiceImpl.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/BaseWxChannelMessageServiceImpl.java index ea0ee6c444..0aeabdd7c6 100644 --- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/BaseWxChannelMessageServiceImpl.java +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/BaseWxChannelMessageServiceImpl.java @@ -23,12 +23,14 @@ import me.chanjar.weixin.channel.bean.message.product.BrandMessage; import me.chanjar.weixin.channel.bean.message.product.CategoryAuditMessage; import me.chanjar.weixin.channel.bean.message.product.SpuAuditMessage; +import me.chanjar.weixin.channel.bean.message.product.SpuStockMessage; import me.chanjar.weixin.channel.bean.message.sharer.SharerChangeMessage; import me.chanjar.weixin.channel.bean.message.store.CloseStoreMessage; import me.chanjar.weixin.channel.bean.message.store.NicknameUpdateMessage; import me.chanjar.weixin.channel.bean.message.supplier.SupplierItemMessage; import me.chanjar.weixin.channel.bean.message.vip.ExchangeInfoMessage; import me.chanjar.weixin.channel.bean.message.vip.UserInfoMessage; +import me.chanjar.weixin.channel.bean.message.voucher.VoucherMessage; import me.chanjar.weixin.channel.message.WxChannelMessage; import me.chanjar.weixin.channel.message.WxChannelMessageRouter; import me.chanjar.weixin.channel.message.WxChannelMessageRouterRule; @@ -64,6 +66,8 @@ protected void addDefaultRule() { this.addRule(SpuAuditMessage.class, PRODUCT_SPU_STATUS_UPDATE, this::spuStatusUpdate); /* 商品更新 */ this.addRule(SpuAuditMessage.class, PRODUCT_SPU_UPDATE, this::spuUpdate); + /* 商品库存不足 */ + this.addRule(SpuStockMessage.class, PRODUCT_STOCK_NO_ENOUGH, this::stockNoEnough); /* 类目审核结果 */ this.addRule(CategoryAuditMessage.class, PRODUCT_CATEGORY_AUDIT, this::categoryAudit); /* 订单下单 */ @@ -106,6 +110,8 @@ protected void addDefaultRule() { this.addRule(UserCouponExpireMessage.class, USER_COUPON_UNUSE, this::userCouponUnuse); /* 优惠券返还通知 */ this.addRule(UserCouponExpireMessage.class, USER_COUPON_USE, this::userCouponUse); + /* 发放团购优惠成功通知 */ + this.addRule(VoucherMessage.class, VOUCHER_SEND_SUCC, this::voucherSendSucc); /* 结算账户变更回调 */ this.addRule(AccountNotifyMessage.class, ACCOUNT_NOTIFY, this::accountNotify); /* 提现回调 */ @@ -151,6 +157,7 @@ protected void addRule(Class clazz, String event consumer.accept(message, content, appId, context, sessionManager); return "success"; }); + rule.setNext(true); this.addRule(rule); } @@ -242,6 +249,12 @@ public void spuUpdate(SpuAuditMessage message, String content, String appId, log.info("商品更新:{}", JsonUtils.encode(message)); } + @Override + public void stockNoEnough(SpuStockMessage message, String content, String appId, + Map context, WxSessionManager sessionManager) { + log.info("商品库存不足:{}", JsonUtils.encode(message)); + } + @Override public void categoryAudit(CategoryAuditMessage message, String content, String appId, Map context, WxSessionManager sessionManager) { @@ -320,6 +333,12 @@ public void userCouponUnuse(UserCouponExpireMessage message, String content, Str log.info("用户优惠券取消使用:{}", JsonUtils.encode(message)); } + @Override + public void voucherSendSucc(VoucherMessage message, String content, String appId, + Map context, WxSessionManager sessionManager) { + log.info("发放团购优惠成功:{}", JsonUtils.encode(message)); + } + @Override public void accountNotify(AccountNotifyMessage message, String content, String appId, Map context, WxSessionManager sessionManager) { diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/CategoryDetailResult.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/CategoryDetailResult.java index a59559fb6c..32313b7e34 100644 --- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/CategoryDetailResult.java +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/CategoryDetailResult.java @@ -99,6 +99,10 @@ public static class Attr implements Serializable { @JsonProperty("size_chart") private SizeChart sizeChart; + /** 放心买必须打开坏损包赔 */ + @JsonProperty("is_confidence_require_bad_must_pay") + private Boolean confidenceRequireBadMustPay; + /** 资质信息 */ @JsonProperty("product_qua_list") private List productQuaList; diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/CategoryQualification.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/CategoryQualification.java index 40258e067f..9cac327d6c 100644 --- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/CategoryQualification.java +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/CategoryQualification.java @@ -39,4 +39,8 @@ public class CategoryQualification implements Serializable { @JsonProperty("product_qua_list") private List productQuaList; + /** 放心买必须打开坏损包赔 */ + @JsonProperty("is_confidence_require_bad_must_pay") + private Boolean confidenceRequireBadMustPay; + } diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/message/product/SpuStockMessage.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/message/product/SpuStockMessage.java new file mode 100644 index 0000000000..96feac5a4a --- /dev/null +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/message/product/SpuStockMessage.java @@ -0,0 +1,88 @@ +package me.chanjar.weixin.channel.bean.message.product; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.util.Map; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import me.chanjar.weixin.channel.message.WxChannelMessage; + +/** + * SPU库存不足消息 + * + * @author Zeyes + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +@JacksonXmlRootElement(localName = "xml") +public class SpuStockMessage extends WxChannelMessage { + + private static final long serialVersionUID = 2250860804161527363L; + + /** 商品id */ + @JsonProperty("product_id") + @JacksonXmlProperty(localName = "product_id") + private String productId; + + /** 平台商品id */ + @JsonProperty("sku_id") + @JacksonXmlProperty(localName = "sku_id") + private String skuId; + + /** 剩余库存:当前实时库存数量 */ + @JsonProperty("remaining_stock_amount") + @JacksonXmlProperty(localName = "remaining_stock_amount") + private Long remainingStockAmount; + + /** 未发放的预存code数【该字段对code_source_type=2的团购优惠生效,其他类型该字段值为0】 */ + @JsonProperty("remaining_code_amount") + @JacksonXmlProperty(localName = "remaining_code_amount") + private Long remainingCodeAmount; + + /** ChannelsEcStockNoEnough */ + @JsonProperty("channels_ec_stock_no_enough") + @JacksonXmlProperty(localName = "channels_ec_stock_no_enough") + private void stockNoEnough(Map map) { + this.unpackNameFromNestedObject(map); + } + + /** + * 从嵌套对象中解析字段 + * + * @param map 嵌套对象 + */ + protected void unpackNameFromNestedObject(Map map) { + if (map == null) { + return; + } + Object obj = null; + obj = map.get("product_id"); + if (obj != null) { + this.productId = (obj instanceof String ? (String) obj : String.valueOf(obj)); + } + obj = map.get("sku_id"); + if (obj != null) { + this.skuId = (obj instanceof String ? (String) obj : String.valueOf(obj)); + } + + obj = map.get("remaining_stock_amount"); + if (obj != null) { + if (obj instanceof Number) { + this.remainingStockAmount = ((Number) obj).longValue(); + } else if (obj instanceof String) { + this.remainingStockAmount = Long.parseLong((String) obj); + } + } + obj = map.get("remaining_code_amount"); + if (obj != null) { + if (obj instanceof Number) { + this.remainingCodeAmount = ((Number) obj).longValue(); + } else if (obj instanceof String) { + this.remainingCodeAmount = Long.parseLong((String) obj); + } + } + } +} diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/message/voucher/VoucherInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/message/voucher/VoucherInfo.java new file mode 100644 index 0000000000..1b5a926205 --- /dev/null +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/message/voucher/VoucherInfo.java @@ -0,0 +1,106 @@ +package me.chanjar.weixin.channel.bean.message.voucher; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; +import java.io.Serializable; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author Zeyes + */ +@Data +@NoArgsConstructor +public class VoucherInfo implements Serializable { + private static final long serialVersionUID = 6007964849358969438L; + + /** 券code */ + @JsonProperty("code") + @JacksonXmlProperty(localName = "code") + private String code; + + /** 劵码类型,1商户实时code 2户预存 3平台生成 */ + @JsonProperty("code_type") + @JacksonXmlProperty(localName = "code_type") + private Integer codeType; + + /** 券状态 */ + @JsonProperty("status") + @JacksonXmlProperty(localName = "status") + private Integer status; + + /** 发放时间,时间戳 */ + @JsonProperty("send_time") + @JacksonXmlProperty(localName = "send_time") + private Long sendTime; + + /** 最近更新时间,时间戳 */ + @JsonProperty("update_time") + @JacksonXmlProperty(localName = "update_time") + private Long updateTime; + + /** 核销生效时间,时间戳 */ + @JsonProperty("start_time") + @JacksonXmlProperty(localName = "start_time") + private Long startTime; + + /** 核销结束时间,时间戳 */ + @JsonProperty("end_time") + @JacksonXmlProperty(localName = "end_time") + private Long endTime; + + /** 核销时间,时间戳。次卡时不返回此字段 */ + @JsonProperty("consume_time") + @JacksonXmlProperty(localName = "consume_time") + private Long consumeTime; + + /** 退券时间,时间戳。次卡时不返回此字段 */ + @JsonProperty("refund_time") + @JacksonXmlProperty(localName = "refund_time") + private Long refundTime; + + /** 核销门店名称 */ + @JsonProperty("consume_store_name") + @JacksonXmlProperty(localName = "consume_store_name") + private String consumeStoreName; + + /** */ + @JsonProperty("voucher_type") + @JacksonXmlProperty(localName = "voucher_type") + private Integer voucherType; + + /** 券的售卖价格(分) */ + @JsonProperty("voucher_buy_amount") + @JacksonXmlProperty(localName = "voucher_buy_amount") + private Integer voucherBuyAmount; + + /** 券市场金额(分) */ + @JsonProperty("voucher_actual_amount") + @JacksonXmlProperty(localName = "voucher_actual_amount") + private Integer voucherActualAmount; + + /** 用户手机号 */ + @JsonProperty("telphone_no") + @JacksonXmlProperty(localName = "telphone_no") + private String telPhoneNo; + + /** 商品id */ + @JsonProperty("product_id") + @JacksonXmlProperty(localName = "product_id") + private String productId; + + /** 商品下的skuId */ + @JsonProperty("sku_id") + @JacksonXmlProperty(localName = "sku_id") + private String skuId; + + /** 购买券的订单id */ + @JsonProperty("order_id") + @JacksonXmlProperty(localName = "order_id") + private String orderId; + + /** 用户在商家品牌appid下的openid */ + @JsonProperty("openid") + @JacksonXmlProperty(localName = "openid") + private String openId; +} diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/message/voucher/VoucherMessage.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/message/voucher/VoucherMessage.java new file mode 100644 index 0000000000..941828969d --- /dev/null +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/message/voucher/VoucherMessage.java @@ -0,0 +1,29 @@ +package me.chanjar.weixin.channel.bean.message.voucher; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.util.List; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import me.chanjar.weixin.channel.message.WxChannelMessage; + +/** + * 发放团购优惠成功消息 + * + * @author Zeyes + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +@JacksonXmlRootElement(localName = "xml") +public class VoucherMessage extends WxChannelMessage { + + private static final long serialVersionUID = 975858675917036089L; + + /** 发放团购优惠成功消息 */ + @JsonProperty("voucher_list") + @JacksonXmlProperty(localName = "voucher_list") + private List voucherInfo; +} diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/OrderAgentInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/OrderAgentInfo.java new file mode 100644 index 0000000000..548e36dd49 --- /dev/null +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/OrderAgentInfo.java @@ -0,0 +1,30 @@ +package me.chanjar.weixin.channel.bean.order; + +import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.Serializable; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 授权账号信息 + * + * @author Zeyes + */ +@Data +@NoArgsConstructor +public class OrderAgentInfo implements Serializable { + + private static final long serialVersionUID = 6396067079343033841L; + + /** + * 授权视频号id + */ + @JsonProperty("agent_finder_id") + private String agentFinderId; + + /** + * 授权视频号昵称 + */ + @JsonProperty("agent_finder_nickname") + private String agentFinderNickname; +} diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/OrderDetailInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/OrderDetailInfo.java index 8a17140cc1..282f2f99f6 100644 --- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/OrderDetailInfo.java +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/OrderDetailInfo.java @@ -56,4 +56,12 @@ public class OrderDetailInfo implements Serializable { @JsonProperty("sku_sharer_infos") private List skuSharerInfos; + /** 授权账号信息 */ + @JsonProperty("agent_info") + private OrderAgentInfo agentInfo; + + /** 订单来源信息 */ + @JsonProperty("source_info") + private OrderSourceInfo sourceInfo; + } diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/OrderSourceInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/OrderSourceInfo.java new file mode 100644 index 0000000000..fbdd663a5a --- /dev/null +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/OrderSourceInfo.java @@ -0,0 +1,48 @@ +package me.chanjar.weixin.channel.bean.order; + +import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.Serializable; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 订单带货来源信息 + * + * @author Zeyes + */ +@Data +@NoArgsConstructor +public class OrderSourceInfo implements Serializable { + + private static final long serialVersionUID = 3131907659419977296L; + + /** + * sku_id + */ + @JsonProperty("sku_id") + private String skuId; + + /** + * 带货账户类型,1:视频号,2:公众号,3:小程序 + */ + @JsonProperty("account_type") + private Integer accountType; + + /** + * 带货账户id,如果带货账户类型是视频号,此id为视频号id; 如果带货类型为 公众号/小程序, 此id 为对应 公众号/小程序 的appid + */ + @JsonProperty("account_id") + private String accountId; + + /** + * 销售渠道, 0:关联账号,1:合作账号,100:联盟达人带货 + */ + @JsonProperty("sale_channel") + private Integer saleChannel; + + /** + * 带货账户昵称 + */ + @JsonProperty("account_nickname") + private String accountNickname; +} diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/constant/MessageEventConstants.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/constant/MessageEventConstants.java index 0a945b1f35..675b5d8a57 100644 --- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/constant/MessageEventConstants.java +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/constant/MessageEventConstants.java @@ -16,6 +16,8 @@ public interface MessageEventConstants { String PRODUCT_SPU_UPDATE = "product_spu_update"; /** 类目审核结果 */ String PRODUCT_CATEGORY_AUDIT = "product_category_audit"; + /** 库存不足 */ + String PRODUCT_STOCK_NO_ENOUGH = "channels_ec_stock_no_enough"; /** 订单下单 */ String ORDER_NEW = "channels_ec_order_new"; /** 订单取消 */ @@ -57,6 +59,8 @@ public interface MessageEventConstants { String USER_COUPON_UNUSE = "channels_ec_user_coupon_unuse"; /** 优惠券核销通知 */ String USER_COUPON_USE = "channels_ec_user_coupon_use"; + /** 发放团购优惠成功回调 */ + String VOUCHER_SEND_SUCC = "channels_ec_voucher_send_succ"; // 资金相关 /** 结算账户变更回调 */ String ACCOUNT_NOTIFY = "channels_ec_acct_notify"; diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/message/WxChannelMessageRouter.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/message/WxChannelMessageRouter.java index 16fb0781cb..c35f75ac0b 100644 --- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/message/WxChannelMessageRouter.java +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/message/WxChannelMessageRouter.java @@ -121,6 +121,7 @@ public Object route(final WxChannelMessage message, final String content, final final Map context, final WxChannelService service, final WxSessionManager sessionManager) { // 如果是重复消息,那么就不做处理 if (isMsgDuplicated(message)) { + log.info("收到重复消息,{}", content); return null; } @@ -211,10 +212,10 @@ protected String generateMessageId(WxChannelMessage wxMessage) { * * @param sessionManager session管理器 * @param message 消息 - * @param sync 是否同步 打印log用 + * @param async 是否异步 打印log用 */ - private void sessionEndAccess(WxSessionManager sessionManager, WxChannelMessage message, boolean sync) { - log.debug("End session access: async={}, sessionId={}", sync, message.getFromUser()); + private void sessionEndAccess(WxSessionManager sessionManager, WxChannelMessage message, boolean async) { + log.debug("End session access: async={}, sessionId={}", async, message.getFromUser()); InternalSession session = ((InternalSessionManager) sessionManager).findSession(message.getFromUser()); if (session != null) { session.endAccess(); From 091bab97a3b6296c5871904f613a9b34a2256e9a Mon Sep 17 00:00:00 2001 From: Binary Wang Date: Wed, 18 Dec 2024 23:19:15 +0800 Subject: [PATCH 10/14] =?UTF-8?q?:art:=20#3439=20=E3=80=90=E5=85=AC?= =?UTF-8?q?=E4=BC=97=E5=8F=B7=E3=80=91=E6=A8=A1=E7=89=88=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E9=95=BF=E5=BA=A6=E9=99=90=E5=88=B6=E9=97=AE=E9=A2=98=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mp/bean/template/WxMpTemplateMessage.java | 41 ++++++++++++++----- .../template/WxMpTemplateMessageTest.java | 26 +++++++++++- 2 files changed, 55 insertions(+), 12 deletions(-) diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/template/WxMpTemplateMessage.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/template/WxMpTemplateMessage.java index a04d8bb896..02211937f9 100644 --- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/template/WxMpTemplateMessage.java +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/template/WxMpTemplateMessage.java @@ -1,20 +1,16 @@ package me.chanjar.weixin.mp.bean.template; +import lombok.*; +import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; +import org.apache.commons.lang3.StringUtils; + import java.io.Serializable; import java.util.ArrayList; import java.util.List; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; - /** * 模板消息. - * 参考 http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1433751277&token=&lang=zh_CN 发送模板消息接口部分 + * 参考 发送模板消息接口部分 * * @author Binary Wang */ @@ -67,10 +63,35 @@ public WxMpTemplateMessage addData(WxMpTemplateData datum) { if (this.data == null) { this.data = new ArrayList<>(); } - this.data.add(datum); + this.data.add(resetValue(datum)); return this; } + /** + * 处理微信模版消息字符串长度问题 + * + * @link 模板消息 + */ + private WxMpTemplateData resetValue(WxMpTemplateData datum) { + String name = datum.getName(); + String value = datum.getValue(); + + if (StringUtils.startsWith(name, "thing") && value.length() > 20) { + value = StringUtils.substring(value, 0, 17) + "..."; + } else if (StringUtils.startsWith(name, "character_string") && value.length() > 32) { + value = StringUtils.substring(value, 0, 29) + "..."; + } else if (StringUtils.startsWith(name, "phone_number") && value.length() > 17) { + value = StringUtils.substring(value, 0, 14) + "..."; + } else if (StringUtils.startsWith(name, "car_number") && value.length() > 8) { + value = StringUtils.substring(value, 0, 5) + "..."; + } else if (StringUtils.startsWith(name, "const") && value.length() > 20) { + value = StringUtils.substring(value, 0, 17) + "..."; + } + + datum.setValue(value); + return datum; + } + public String toJson() { return WxMpGsonBuilder.create().toJson(this); } diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/template/WxMpTemplateMessageTest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/template/WxMpTemplateMessageTest.java index fa7cd92967..5012be59a8 100644 --- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/template/WxMpTemplateMessageTest.java +++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/template/WxMpTemplateMessageTest.java @@ -17,7 +17,7 @@ public void testToJson() { WxMpTemplateMessage tm = WxMpTemplateMessage.builder() .toUser("OPENID") .templateId("ngqIpbwh8bUfcSsECmogfXcV14J0tQlEpBO27izEYtY") - .miniProgram(new WxMpTemplateMessage.MiniProgram("xiaochengxuappid12345", "index?foo=bar",true)) + .miniProgram(new WxMpTemplateMessage.MiniProgram("xiaochengxuappid12345", "index?foo=bar", true)) .url("http://weixin.qq.com/download") .clientMsgId("MSG_000001") .build(); @@ -26,7 +26,29 @@ public void testToJson() { new WxMpTemplateData("first", "haahah", "#FF00FF")); tm.addData( new WxMpTemplateData("remark", "heihei", "#FF00FF")); - assertEquals(tm.toJson(), "{\"touser\":\"OPENID\",\"template_id\":\"ngqIpbwh8bUfcSsECmogfXcV14J0tQlEpBO27izEYtY\",\"client_msg_id\":\"MSG_000001\",\"url\":\"http://weixin.qq.com/download\",\"miniprogram\":{\"appid\":\"xiaochengxuappid12345\",\"path\":\"index?foo=bar\"},\"data\":{\"first\":{\"value\":\"haahah\",\"color\":\"#FF00FF\"},\"remark\":{\"value\":\"heihei\",\"color\":\"#FF00FF\"}}}"); + + assertEquals("{\"touser\":\"OPENID\",\"template_id\":\"ngqIpbwh8bUfcSsECmogfXcV14J0tQlEpBO27izEYtY\",\"client_msg_id\":\"MSG_000001\",\"url\":\"http://weixin.qq.com/download\",\"miniprogram\":{\"appid\":\"xiaochengxuappid12345\",\"path\":\"index?foo=bar\"},\"data\":{\"first\":{\"value\":\"haahah\",\"color\":\"#FF00FF\"},\"remark\":{\"value\":\"heihei\",\"color\":\"#FF00FF\"}}}", tm.toJson()); } + @Test + public void testAddData() { + WxMpTemplateMessage tm = WxMpTemplateMessage.builder().build() + .addData(new WxMpTemplateData("thing01", "张三李四王麻子张三李四王麻子张三李四王麻子张三李四王麻子")) + .addData(new WxMpTemplateData("time01", "2019年10月1日 15:01")) + .addData(new WxMpTemplateData("character_string01", "1234567890123456789012345678901234567890")) + .addData(new WxMpTemplateData("amount01", "¥100.21")) + .addData(new WxMpTemplateData("phone_number01", "+86-0766-668888661111")) + .addData(new WxMpTemplateData("car_number01", "粤A8Z888挂9")) + .addData(new WxMpTemplateData("const01", "支付状态、排队状态、天气状态、物流状态、用药提醒、还款提醒")); + + assertEquals(7, tm.getData().size()); + + assertEquals("张三李四王麻子张三李四王麻子张三李...", tm.getData().get(0).getValue()); + assertEquals("2019年10月1日 15:01", tm.getData().get(1).getValue()); + assertEquals("12345678901234567890123456789...", tm.getData().get(2).getValue()); + assertEquals("¥100.21", tm.getData().get(3).getValue()); + assertEquals("+86-0766-66888...", tm.getData().get(4).getValue()); + assertEquals("粤A8Z8...", tm.getData().get(5).getValue()); + assertEquals("支付状态、排队状态、天气状态、物流...", tm.getData().get(6).getValue()); + } } From 095fec27295069a37b11a77e6802d90e037d4441 Mon Sep 17 00:00:00 2001 From: GeXiangDong Date: Fri, 20 Dec 2024 15:46:13 +0800 Subject: [PATCH 11/14] =?UTF-8?q?:art:=20#3453=20=E3=80=90=E5=B0=8F?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E3=80=91=E4=BF=AE=E5=A4=8D=E5=90=8C=E5=9F=8E?= =?UTF-8?q?=E9=85=8D=E9=80=81=E6=9F=A5=E8=AF=A2=E8=BF=90=E8=B4=B9=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=BF=94=E5=9B=9E=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wx/miniapp/api/WxMaIntracityService.java | 2 +- .../api/impl/WxMaIntracityServiceImpl.java | 5 +- .../intractiy/WxMaPreAddOrderResponse.java | 63 +++++++++++++++++++ .../impl/WxMaIntracityServiceImpleTest.java | 4 +- 4 files changed, 69 insertions(+), 5 deletions(-) create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/intractiy/WxMaPreAddOrderResponse.java diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaIntracityService.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaIntracityService.java index 80cd88b463..4359fc7b1c 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaIntracityService.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaIntracityService.java @@ -57,7 +57,7 @@ WxMaStoreBalance balanceQuery(String wxStoreId, String serviceTransId, PayMode p WxMaGetPayModeResponse getPayMode() throws WxErrorException; /** 查询运费 */ - WxMaAddOrderResponse preAddOrder(WxMaPreAddOrderRequest request) throws WxErrorException; + WxMaPreAddOrderResponse preAddOrder(WxMaPreAddOrderRequest request) throws WxErrorException; /** 创建配送单 */ WxMaAddOrderResponse addOrder(WxMaAddOrderRequest order) throws WxErrorException; diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaIntracityServiceImpl.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaIntracityServiceImpl.java index 46a728eca9..3e21dab79f 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaIntracityServiceImpl.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaIntracityServiceImpl.java @@ -205,9 +205,10 @@ public WxMaGetPayModeResponse getPayMode() throws WxErrorException { } @Override - public WxMaAddOrderResponse preAddOrder(WxMaPreAddOrderRequest request) throws WxErrorException { + public WxMaPreAddOrderResponse preAddOrder(WxMaPreAddOrderRequest request) + throws WxErrorException { String response = this.wxMaService.postWithSignature(Intracity.PRE_ADD_ORDER, request); - return gson.fromJson(response, WxMaAddOrderResponse.class); + return gson.fromJson(response, WxMaPreAddOrderResponse.class); } @Override diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/intractiy/WxMaPreAddOrderResponse.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/intractiy/WxMaPreAddOrderResponse.java new file mode 100644 index 0000000000..f198c81baa --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/intractiy/WxMaPreAddOrderResponse.java @@ -0,0 +1,63 @@ +package cn.binarywang.wx.miniapp.bean.intractiy; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class WxMaPreAddOrderResponse { + private static final Logger logger = LoggerFactory.getLogger(WxMaPreAddOrderResponse.class); + + /** 运力公司ID */ + private String serviceTransId; + + /** 配送距离 */ + private int distance; + + /** 预估配送费 */ + private int estFee; + + /** 商品预计送达时间 */ + private long expectedFinishedTime; + + /** 配送时长(单位:分钟) */ + private int promiseDeliveryTime; + + public String getServiceTransId() { + return serviceTransId; + } + + public void setServiceTransId(String serviceTransId) { + this.serviceTransId = serviceTransId; + } + + public int getDistance() { + return distance; + } + + public void setDistance(int distance) { + this.distance = distance; + } + + public int getEstFee() { + return estFee; + } + + public void setEstFee(int estFee) { + this.estFee = estFee; + } + + public long getExpectedFinishedTime() { + return expectedFinishedTime; + } + + public void setExpectedFinishedTime(long expectedFinishedTime) { + this.expectedFinishedTime = expectedFinishedTime; + } + + public int getPromiseDeliveryTime() { + return promiseDeliveryTime; + } + + public void setPromiseDeliveryTime(int promiseDeliveryTime) { + this.promiseDeliveryTime = promiseDeliveryTime; + } +} diff --git a/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaIntracityServiceImpleTest.java b/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaIntracityServiceImpleTest.java index 9828542a46..e16fc424c7 100644 --- a/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaIntracityServiceImpleTest.java +++ b/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaIntracityServiceImpleTest.java @@ -254,8 +254,8 @@ public void testOrderRelatived() throws Exception { cargo.setCargoPrice(10000); cargo.setCargoWeight(1000); request.setCargo(cargo); - WxMaAddOrderResponse response = wxService.getIntracityService().preAddOrder(request); - logger.debug("查询运费返回 {}, 预估运费{}元", response, response.getFee() / 100.0); + WxMaPreAddOrderResponse response = wxService.getIntracityService().preAddOrder(request); + logger.debug("查询运费返回 {}, 预估运费{}元", response, response.getEstFee() / 100.0); } String wxOrderId = null; { From d6fad6386e281fc388d46de3d05adee3d87a5566 Mon Sep 17 00:00:00 2001 From: Molzx <31435895+Molzx@users.noreply.github.com> Date: Sat, 21 Dec 2024 14:02:43 +0800 Subject: [PATCH 12/14] =?UTF-8?q?:new:=20#3455=20=E3=80=90=E5=BC=80?= =?UTF-8?q?=E6=94=BE=E5=B9=B3=E5=8F=B0=E3=80=91=E5=A2=9E=E5=8A=A0=E5=B0=8F?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E8=AE=A4=E8=AF=81=E5=8F=8A=E5=A4=87=E6=A1=88?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../weixin/open/api/WxOpenMaIcpService.java | 40 +++++++++ .../open/api/impl/WxOpenMaIcpServiceImpl.java | 44 +++++++++- .../bean/icp/WxOpenApplyIcpFilingParam.java | 3 +- .../WxOpenIcpCreateIcpVerifyTaskResult.java | 5 ++ .../bean/icp/WxOpenIcpVerifyTaskResult.java | 6 ++ .../bean/icp/WxOpenQueryAuthAndIcpResult.java | 85 +++++++++++++++++++ .../bean/icp/WxOpenSubmitAuthAndIcpParam.java | 29 +++++++ .../icp/WxOpenSubmitAuthAndIcpResult.java | 30 +++++++ .../open/bean/message/WxOpenXmlMessage.java | 19 +++++ 9 files changed, 259 insertions(+), 2 deletions(-) create mode 100644 weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenQueryAuthAndIcpResult.java create mode 100644 weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenSubmitAuthAndIcpParam.java create mode 100644 weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenSubmitAuthAndIcpResult.java diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaIcpService.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaIcpService.java index ad59b246c7..9b936b1572 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaIcpService.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaIcpService.java @@ -97,6 +97,19 @@ public interface WxOpenMaIcpService { */ String GET_ICP_MEDIA = "https://api.weixin.qq.com/wxa/icp/get_icp_media"; + /** + * 申请小程序认证及备案 + * https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/wxverifyicp/submitAuthAndIcp.html + */ + String SUBMIT_AUTH_AND_ICP = "https://api.weixin.qq.com/wxa/sec/submit_auth_and_icp"; + + /** + * 查询小程序认证及备案进度 + * https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/wxverifyicp/queryAuthAndIcp.html + */ + String QUERY_AUTH_AND_ICP = "https://api.weixin.qq.com/wxa/sec/query_auth_and_icp"; + + /** * 查询人脸核身任务状态 * @@ -114,6 +127,15 @@ public interface WxOpenMaIcpService { */ WxOpenIcpCreateIcpVerifyTaskResult createIcpVerifyTask() throws WxErrorException; + /** + * 发起小程序管理员人脸核身 + * + * @param alongWithAuth 小程序认证及备案二合一场景,填 true,否则为小程序备案场景。默认值为 false。 + * @return 人脸核验任务结果 + * @throws WxErrorException e + */ + WxOpenIcpCreateIcpVerifyTaskResult createIcpVerifyTask(boolean alongWithAuth) throws WxErrorException; + /** * 上传小程序备案媒体材料 * @@ -204,4 +226,22 @@ public interface WxOpenMaIcpService { * @throws WxErrorException e */ File getIcpMedia(String mediaId) throws WxErrorException; + + /** + * 申请小程序认证及备案 + * + * @param param 参数 + * @return r + * @throws WxErrorException e + */ + WxOpenSubmitAuthAndIcpResult submitAuthAndIcp(WxOpenSubmitAuthAndIcpParam param) throws WxErrorException; + + /** + * 查询小程序认证及备案进度 + * @param procedureId 小程序认证及备案任务流程id + * @return r + * @throws WxErrorException e + */ + WxOpenQueryAuthAndIcpResult queryAuthAndIcp(String procedureId) throws WxErrorException; + } diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaIcpServiceImpl.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaIcpServiceImpl.java index dc78f22fe3..db9654f287 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaIcpServiceImpl.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaIcpServiceImpl.java @@ -54,7 +54,21 @@ public WxOpenIcpVerifyTaskResult queryIcpVerifyTask(String taskId) throws WxErro */ @Override public WxOpenIcpCreateIcpVerifyTaskResult createIcpVerifyTask() throws WxErrorException { - String response = wxMaService.post(CREATE_ICP_VERIFY_TASK, ""); + return createIcpVerifyTask(false); + } + + /** + * 发起小程序管理员人脸核身 + * + * @param alongWithAuth 小程序认证及备案二合一场景,填 true,否则为小程序备案场景。默认值为 false。 + * @return 人脸核验任务结果 + * @throws WxErrorException e + */ + @Override + public WxOpenIcpCreateIcpVerifyTaskResult createIcpVerifyTask(boolean alongWithAuth) throws WxErrorException { + JsonObject params = new JsonObject(); + params.addProperty("along_with_auth", alongWithAuth); + String response = wxMaService.post(CREATE_ICP_VERIFY_TASK, params); return WxMaGsonBuilder.create().fromJson(response, WxOpenIcpCreateIcpVerifyTaskResult.class); } @@ -212,4 +226,32 @@ public File getIcpMedia(String mediaId) throws WxErrorException { throw new WxErrorException(WxError.builder().errorMsg(e.getMessage()).build(), e); } } + + /** + * 申请小程序认证及备案 + * + * @param param 参数 + * @return r + * @throws WxErrorException e + */ + @Override + public WxOpenSubmitAuthAndIcpResult submitAuthAndIcp(WxOpenSubmitAuthAndIcpParam param) throws WxErrorException { + String response = wxMaService.post(SUBMIT_AUTH_AND_ICP, param); + return WxMaGsonBuilder.create().fromJson(response, WxOpenSubmitAuthAndIcpResult.class); + } + + /** + * 查询小程序认证及备案进度 + * + * @param procedureId 小程序认证及备案任务流程id + * @return r + * @throws WxErrorException e + */ + @Override + public WxOpenQueryAuthAndIcpResult queryAuthAndIcp(String procedureId) throws WxErrorException { + JsonObject params = new JsonObject(); + params.addProperty("procedure_id", procedureId); + String response = wxMaService.post(QUERY_AUTH_AND_ICP, params); + return WxOpenGsonBuilder.create().fromJson(response, WxOpenQueryAuthAndIcpResult.class); + } } diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenApplyIcpFilingParam.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenApplyIcpFilingParam.java index 37f84cf3d5..ef24a5360c 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenApplyIcpFilingParam.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenApplyIcpFilingParam.java @@ -2,6 +2,7 @@ import com.google.gson.annotations.SerializedName; import lombok.*; +import lombok.experimental.SuperBuilder; import java.io.Serializable; import java.util.List; @@ -12,7 +13,7 @@ * @createTime 2024/08/14 15:09 */ @Data -@Builder +@SuperBuilder @NoArgsConstructor @AllArgsConstructor public class WxOpenApplyIcpFilingParam implements Serializable { diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenIcpCreateIcpVerifyTaskResult.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenIcpCreateIcpVerifyTaskResult.java index 8deb401335..967e81fa95 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenIcpCreateIcpVerifyTaskResult.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenIcpCreateIcpVerifyTaskResult.java @@ -26,4 +26,9 @@ public class WxOpenIcpCreateIcpVerifyTaskResult extends WxOpenResult { @SerializedName("task_id") private String taskId; + /** + * 人脸核验任务url,along_with_auth 填 true 时返回。 + */ + @SerializedName("verify_url") + private String verifyUrl; } diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenIcpVerifyTaskResult.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenIcpVerifyTaskResult.java index cb59fac1c0..5290748b2a 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenIcpVerifyTaskResult.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenIcpVerifyTaskResult.java @@ -30,4 +30,10 @@ public class WxOpenIcpVerifyTaskResult extends WxOpenResult { */ @SerializedName("face_status") private Integer faceStatus; + + /** + * 发起时 along_with_auth 填 true 时有效:9. 认证短信核验通过。 + */ + @SerializedName("along_with_auth_result") + private Integer alongWithAuthResult; } diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenQueryAuthAndIcpResult.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenQueryAuthAndIcpResult.java new file mode 100644 index 0000000000..42a996d9b4 --- /dev/null +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenQueryAuthAndIcpResult.java @@ -0,0 +1,85 @@ +package me.chanjar.weixin.open.bean.icp; + +import com.google.gson.annotations.SerializedName; +import lombok.*; +import me.chanjar.weixin.open.bean.result.WxOpenResult; + +import java.util.List; + +/** + * @author xzh + * @Description + * @createTime 2024/12/19 16:56 + */ +@Getter +@Setter +@NoArgsConstructor +public class WxOpenQueryAuthAndIcpResult extends WxOpenResult { + private static final long serialVersionUID = 1626895037788760364L; + + + /** + * 当前任务流程状态,见下方任务流程状态枚举 + * 值 含义 + * 15 等待支付认证审核费用 + * 16 认证审核费用支付成功 + * 17 认证审核中 + * 18 认证审核驳回 + * 19 认证审核通过 + * 20 认证审核最终失败(不能再修改) + * 21 创建备案审核单失败 + * 22 备案平台审核中 + * 23 备案平台审核驳回 + * 24 备案管局审核中 + * 25 管局审核驳回 + * 26 认证及备案完成 + */ + @SerializedName("procedure_status") + private Integer procedureStatus; + + /** + * 小程序后台展示的认证订单号 + */ + @SerializedName("orderid") + private Long orderId; + + /** + * 小程序认证审核单被驳回(procedure_status 为 18)时有效 + */ + @SerializedName("refill_reason") + private String refillReason; + /** + * 小程序认证审核最终失败的原因(procedure_status 为 20)时有效 + */ + @SerializedName("fail_reason") + private String failReason; + + /** + * 小程序备案相关信息 + */ + @SerializedName("icp_audit") + private IcpAudit icpAudit; + + @Data + public static class IcpAudit { + + /** + * 错误提示,创建备案审核单失败时返回(procedure_status 为 21) + */ + @SerializedName("hints") + private List hints; + + /** + * 驳回原因,备案不通过时返回(procedure_status 为 23、25) + */ + @SerializedName("audit_data") + private List auditData; + + /** + * 管局短信核验状态,仅当任务流程状态为 24(备案管局审核中)的时候才有效。1:等待核验中,2:核验完成,3:核验超时。 + */ + @SerializedName("sms_verify_status") + private Integer smsVerifyStatus; + } + +} diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenSubmitAuthAndIcpParam.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenSubmitAuthAndIcpParam.java new file mode 100644 index 0000000000..31d4f158f8 --- /dev/null +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenSubmitAuthAndIcpParam.java @@ -0,0 +1,29 @@ +package me.chanjar.weixin.open.bean.icp; + +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; +import me.chanjar.weixin.open.bean.auth.MaAuthSubmitParamAuthData; +import org.jetbrains.annotations.NotNull; + +/** + * @author xzh + * @Description + * @createTime 2024/12/19 16:42 + */ +@Data +@SuperBuilder +@NoArgsConstructor +@AllArgsConstructor +public class WxOpenSubmitAuthAndIcpParam extends WxOpenApplyIcpFilingParam { + private static final long serialVersionUID = -1302523168779484802L; + + /** + * 认证信息 + */ + @NotNull + @SerializedName("auth_data") + private MaAuthSubmitParamAuthData authData; +} diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenSubmitAuthAndIcpResult.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenSubmitAuthAndIcpResult.java new file mode 100644 index 0000000000..53f04412f5 --- /dev/null +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenSubmitAuthAndIcpResult.java @@ -0,0 +1,30 @@ +package me.chanjar.weixin.open.bean.icp; + +import com.google.gson.annotations.SerializedName; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +/** + * @author xzh + * @Description + * @createTime 2024/12/19 16:47 + */ +@Getter +@Setter +@NoArgsConstructor +public class WxOpenSubmitAuthAndIcpResult extends WxOpenApplyIcpFilingResult { + private static final long serialVersionUID = 2338143380820535842L; + + /** + * 小程序认证及备案任务流程 id + */ + @SerializedName("procedure_id") + private String procedureId; + + /** + * 小程序认证认证审核费用付费链接,当 pay_type 为 2 时返回 + */ + @SerializedName("pay_url") + private String payUrl; +} 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 dc6839c1a5..df782e6a0c 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 @@ -140,6 +140,11 @@ public class WxOpenXmlMessage implements Serializable { */ @XStreamAlias("result") private Integer result; + /** + * 发起时 along_with_auth 填 true 时有效:9. 认证短信核验通过。 + */ + @XStreamAlias("along_with_auth_result") + private Integer alongWithAuthResult; //endregion //region 当备案审核被驳回或通过时会推送该事件 推送的消息 infoType=notify_apply_icpfiling_result @@ -155,6 +160,20 @@ public class WxOpenXmlMessage implements Serializable { private Integer beianStatus; //endregion + //region 认证及备案流程的主要节点均有事件推送到第三方平台的授权事件接收接口,包括支付完成、派单给审核机构、审核打回、审核通过、审核失败等。消息类型,固定为 notify_3rd_wxa_auth_and_icp + + /** + * 小程序认证及备案任务流程 id + */ + @XStreamAlias("procedure_id") + private String procedureId; + /** + * 当前任务流程状态,见“小程序认证及备案进度查询” API 文档中的任务流程状态枚举 + */ + @XStreamAlias("procedure_status") + private Integer procedureStatus; + //endregion + /** * 快速创建的小程序appId,已弃用,未来将删除 * From e87a93e5db967e32da846665f988f4b4d3e3f975 Mon Sep 17 00:00:00 2001 From: Molzx <31435895+Molzx@users.noreply.github.com> Date: Tue, 24 Dec 2024 13:19:14 +0800 Subject: [PATCH 13/14] =?UTF-8?q?:new:=20=20#3457=E3=80=90=E5=B0=8F?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E3=80=91=E5=A2=9E=E5=8A=A0=E5=8F=91=E8=B4=A7?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=AE=A1=E7=90=86=E9=87=8C=E7=9A=84=E7=89=B9?= =?UTF-8?q?=E6=AE=8A=E5=8F=91=E8=B4=A7=E6=8A=A5=E5=A4=87=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=92=8C=E6=9F=A5=E8=AF=A2=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E5=B7=B2=E5=AE=8C=E6=88=90=E4=BA=A4=E6=98=93=E7=BB=93?= =?UTF-8?q?=E7=AE=97=E7=AE=A1=E7=90=86=E7=A1=AE=E8=AE=A4=E7=9A=84=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../miniapp/api/WxMaOrderShippingService.java | 26 +++++++++++--- .../impl/WxMaOrderShippingServiceImpl.java | 33 +++++++++++++++--- .../WxMaOrderShippingITMCCompletedResult.java | 34 +++++++++++++++++++ .../miniapp/constant/WxMaApiUrlConstants.java | 18 ++++++++++ 4 files changed, 103 insertions(+), 8 deletions(-) create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaOrderShippingITMCCompletedResult.java diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaOrderShippingService.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaOrderShippingService.java index 322d740d5b..8332ae7af4 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaOrderShippingService.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaOrderShippingService.java @@ -1,10 +1,7 @@ package cn.binarywang.wx.miniapp.api; import cn.binarywang.wx.miniapp.bean.shop.request.shipping.*; -import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingInfoBaseResponse; -import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingInfoGetListResponse; -import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingInfoGetResponse; -import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingIsTradeManagedResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.*; import me.chanjar.weixin.common.error.WxErrorException; /** @@ -86,4 +83,25 @@ WxMaOrderShippingInfoBaseResponse notifyConfirmReceive(WxMaOrderShippingInfoNoti */ WxMaOrderShippingInfoBaseResponse setMsgJumpPath(String path) throws WxErrorException; + + /** + * 查询小程序是否已完成交易结算管理确认 + * + * @param appId 待查询小程序的 appid,非服务商调用时仅能查询本账号 + * @return WxMaOrderShippingITMCCompletedResult + * @throws WxErrorException e + */ + WxMaOrderShippingITMCCompletedResult isTradeManagementConfirmationCompleted(String appId) + throws WxErrorException; + + /** + * 特殊发货报备 + * @param orderId 需要特殊发货报备的订单号,可传入微信支付单号或商户单号 + * @param type 特殊发货报备类型,1为预售商品订单,2为测试订单 + * @param delayTo 预计发货时间的unix时间戳,type为1时必填,type为2可省略 + * @return WxMaOrderShippingInfoBaseResponse + * @throws WxErrorException e + */ + WxMaOrderShippingInfoBaseResponse opSpecialOrder(String orderId, Integer type, Long delayTo) + throws WxErrorException; } diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaOrderShippingServiceImpl.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaOrderShippingServiceImpl.java index 4aee53e15d..98135cb466 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaOrderShippingServiceImpl.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaOrderShippingServiceImpl.java @@ -4,10 +4,7 @@ import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.shop.request.WxMaOrderShippingIsTradeManagedRequest; import cn.binarywang.wx.miniapp.bean.shop.request.shipping.*; -import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingInfoBaseResponse; -import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingInfoGetListResponse; -import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingInfoGetResponse; -import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingIsTradeManagedResponse; +import cn.binarywang.wx.miniapp.bean.shop.response.*; import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder; import com.google.gson.JsonObject; import lombok.RequiredArgsConstructor; @@ -123,6 +120,34 @@ public WxMaOrderShippingInfoBaseResponse setMsgJumpPath(String path) throws WxEr return request(SET_MSG_JUMP_PATH, jsonObject, WxMaOrderShippingInfoBaseResponse.class); } + /** + * 查询小程序是否已完成交易结算管理确认 + * + * @param appId 待查询小程序的 appid,非服务商调用时仅能查询本账号 + * @return WxMaOrderShippingITMCCompletedResult + * @throws WxErrorException e + */ + @Override + public WxMaOrderShippingITMCCompletedResult isTradeManagementConfirmationCompleted(String appId) throws WxErrorException { + JsonObject jsonObject = GsonHelper.buildJsonObject("appid", appId); + return request(IS_TRADE_MANAGEMENT_CONFIRMATION_COMPLETED, jsonObject, WxMaOrderShippingITMCCompletedResult.class); + } + + /** + * 特殊发货报备 + * + * @param orderId 需要特殊发货报备的订单号,可传入微信支付单号或商户单号 + * @param type 特殊发货报备类型,1为预售商品订单,2为测试订单 + * @param delayTo 预计发货时间的unix时间戳,type为1时必填,type为2可省略 + * @return WxMaOrderShippingInfoBaseResponse + * @throws WxErrorException e + */ + @Override + public WxMaOrderShippingInfoBaseResponse opSpecialOrder(String orderId, Integer type, Long delayTo) throws WxErrorException { + JsonObject jsonObject = GsonHelper.buildJsonObject("order_id", orderId, "type", type, "delay_to", delayTo); + return request(OP_SPECIAL_ORDER, jsonObject, WxMaOrderShippingInfoBaseResponse.class); + } + private T request(String url, Object request, Class resultT) throws WxErrorException { String responseContent = this.wxMaService.post(url, request); JsonObject jsonObject = GsonParser.parse(responseContent); diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaOrderShippingITMCCompletedResult.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaOrderShippingITMCCompletedResult.java new file mode 100644 index 0000000000..e2f352a543 --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/shop/response/WxMaOrderShippingITMCCompletedResult.java @@ -0,0 +1,34 @@ +package cn.binarywang.wx.miniapp.bean.shop.response; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; + +import java.io.Serializable; + +/** + * @author xzh + * @Description 小程序是否已完成交易结算管理确认结果 + * @createTime 2024/12/21 15:01 + */ +@Data +public class WxMaOrderShippingITMCCompletedResult implements Serializable { + + private static final long serialVersionUID = -5397007157487018762L; + /** + * 错误码 + */ + @SerializedName("errcode") + private Integer errCode; + + /** + * 错误原因 + */ + @SerializedName("errmsg") + private String errMsg; + + /** + * 是否已完成交易结算管理确认 + */ + @SerializedName("completed") + private Boolean completed; +} 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 ab47d3e64d..5908385790 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 @@ -789,6 +789,24 @@ public interface OrderShipping { *
*/ String SET_MSG_JUMP_PATH = "https://api.weixin.qq.com/wxa/sec/order/set_msg_jump_path"; + + /** + * 查询小程序是否已完成交易结算管理确认. + * + *
+     * 文档地址: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order-shipping/order-shipping.html#%E5%85%AB%E3%80%81%E6%9F%A5%E8%AF%A2%E5%B0%8F%E7%A8%8B%E5%BA%8F%E6%98%AF%E5%90%A6%E5%B7%B2%E5%AE%8C%E6%88%90%E4%BA%A4%E6%98%93%E7%BB%93%E7%AE%97%E7%AE%A1%E7%90%86%E7%A1%AE%E8%AE%A4
+     * 
+ */ + String IS_TRADE_MANAGEMENT_CONFIRMATION_COMPLETED = "https://api.weixin.qq.com/wxa/sec/order/is_trade_management_confirmation_completed"; + /** + * 特殊发货报备. + * + *
+     * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order-shipping/order-shipping.html#%E5%8D%81%E3%80%81%E7%89%B9%E6%AE%8A%E5%8F%91%E8%B4%A7%E6%8A%A5%E5%A4%87
+     * 
+ */ + String OP_SPECIAL_ORDER = "https://api.weixin.qq.com/wxa/sec/order/opspecialorder"; + } public interface Vod { From 6a3be0b2242734f6013c9b525abffd0fdadb2992 Mon Sep 17 00:00:00 2001 From: Jacky Tse Date: Tue, 24 Dec 2024 13:21:00 +0800 Subject: [PATCH 14/14] =?UTF-8?q?:new:=20#3452=20=E3=80=90=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E6=94=AF=E4=BB=98=E3=80=91=E6=96=B0=E5=A2=9E=E6=B6=88?= =?UTF-8?q?=E8=B4=B9=E8=80=85=E6=8A=95=E8=AF=892.0=E7=9A=84=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E9=80=80=E6=AC=BE=E5=AE=A1=E6=89=B9=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UpdateRefundProgressRequest.java | 90 +++++++++++++++++++ .../wxpay/service/ComplaintService.java | 14 +++ .../service/impl/ComplaintServiceImpl.java | 8 ++ 3 files changed, 112 insertions(+) create mode 100644 weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/complaint/UpdateRefundProgressRequest.java diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/complaint/UpdateRefundProgressRequest.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/complaint/UpdateRefundProgressRequest.java new file mode 100644 index 0000000000..f7715c522e --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/complaint/UpdateRefundProgressRequest.java @@ -0,0 +1,90 @@ +package com.github.binarywang.wxpay.bean.complaint; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * 微信消费者投诉2.0 + * 更新退款审批结果请求实体 + * + * @author jackytse + * created on 2024-12-21 + */ +@Data +@Builder(builderMethodName = "newBuilder") +@NoArgsConstructor +@AllArgsConstructor +public class UpdateRefundProgressRequest implements Serializable { + private static final long serialVersionUID = 6975811815225228118L; + + /** + *
+   * 字段名:投诉单号
+   * 是否必填:是
+   * 描述:投诉单对应的投诉单号
+   * 
+ */ + @SerializedName("complaint_id") + @Expose + private String complaintId; + + /** + *
+   * 字段名:审批动作
+   * 是否必填:是
+   * 描述:同意 或 拒绝
+   * 可选取值:
+   * REJECT: 拒绝退款
+   * APPROVE: 同意退款
+   * 
+ */ + @SerializedName("action") + private String action; + + /** + *
+   * 字段名:预计发起退款时间
+   * 是否必填:否
+   * 描述:在同意退款时返回,预计将在多少个工作日内能发起退款, 0代表当天
+   * 
+ */ + @SerializedName("launch_refund_day") + private Integer launchRefundDay; + + /** + *
+   * 字段名:拒绝退款原因
+   * 是否必填:否
+   * 描述:在拒绝退款时返回拒绝退款的原因
+   * 
+ */ + @SerializedName("reject_reason") + private String rejectReason; + + /** + *
+   * 字段名:拒绝退款的举证图片列表
+   * 是否必填:否
+   * 描述:在拒绝退款时,如果有拒绝的图片举证,可以提供 最多上传4张图片, 传入调用“商户上传反馈图片”接口返回的media_id,最多上传4张图片凭证
+   * 
+ */ + @SerializedName("reject_media_list") + private List rejectMediaList; + + /** + *
+   * 字段名:备注
+   * 是否必填:否
+   * 描述:任何需要向微信支付客服反馈的信息
+   * 
+ */ + @SerializedName("remark") + private String remark; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/ComplaintService.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/ComplaintService.java index 8e86692cd6..66de1458a3 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/ComplaintService.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/ComplaintService.java @@ -135,6 +135,20 @@ public interface ComplaintService { */ void complete(CompleteRequest request) throws WxPayException; + /** + *
+   * 更新退款审批结果API
+   * 针对“申请退款单”,需要商户明确返回是否可退款的审批结果。
+   * 若根据用户描述,核实可以退款,审批动作传入“APPROVE”,同意退款,并给出一个预计退款时间。传入“同意退款”后,需要额外调退款接口发起原路退款。退款到账后,投诉单的状态将自动扭转为“处理完成”。
+   * 若根据用户描述,核实不能退款,审批动作传入“REJECT”,拒绝退款,并说明拒绝退款原因。驳回退款后,投诉单的状态将自动扭转为“处理完成”。
+   * 文档详见: ...
+   * 
+ * + * @param request {@link UpdateRefundProgressRequest} 请求数据 + * @throws WxPayException the wx pay exception + */ + void updateRefundProgress(UpdateRefundProgressRequest request) throws WxPayException; + /** *
    * 商户上传反馈图片API
diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/ComplaintServiceImpl.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/ComplaintServiceImpl.java
index 51d9609c41..32d57e081e 100644
--- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/ComplaintServiceImpl.java
+++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/ComplaintServiceImpl.java
@@ -112,6 +112,14 @@ public void complete(CompleteRequest request) throws WxPayException {
     this.payService.postV3(url, GSON.toJson(request));
   }
 
+  @Override
+  public void updateRefundProgress(UpdateRefundProgressRequest request) throws WxPayException {
+    String url = String.format("%s/v3/merchant-service/complaints-v2/%s/update-refund-progress", this.payService.getPayBaseUrl(), request.getComplaintId());
+    // 上面url已经含有complaintId,这里设置为空,避免在body中再次传递,否则微信会报错
+    request.setComplaintId(null);
+    this.payService.postV3(url, GSON.toJson(request));
+  }
+
   @Override
   public ImageUploadResult uploadResponseImage(File imageFile) throws WxPayException, IOException {
     String url = String.format("%s/v3/merchant-service/images/upload", this.payService.getPayBaseUrl());