From 0a99706b7460ec30a565b360a0e0ff4c7696c5c9 Mon Sep 17 00:00:00 2001 From: S Date: Sun, 8 Mar 2020 16:18:09 +0800 Subject: [PATCH 001/114] =?UTF-8?q?:bug:=20#1426=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=A4=9A=E5=85=AC=E4=BC=97=E5=8F=B7=E7=AE=A1=E7=90=86=E7=9A=84?= =?UTF-8?q?=E4=B8=A4=E4=B8=AA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1、允许动态更新公众号的配置,原有逻辑:更新配置时会报“该公众号标识已存在,请更换其他标识!”; 2、多公众号的消息路由,原有逻辑问题:handler里WxMpConfigStorageHolder不能获取到appid,意味着用的wxmpservice不对,只会走默认的,已测试存在该问题 --- .../me/chanjar/weixin/mp/api/WxMpMessageRouter.java | 11 +++++++++++ .../weixin/mp/api/impl/BaseWxMpServiceImpl.java | 3 --- 2 files changed, 11 insertions(+), 3 deletions(-) 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 2571ebaa68..98ef7716f9 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 @@ -152,6 +152,13 @@ public WxMpXmlOutMessage route(final WxMpXmlMessage wxMessage, final Map context) { + return route(wxMessage, context, this.wxMpService.switchoverTo(appid)); + } + /** * 处理微信消息. */ @@ -228,6 +235,10 @@ public WxMpXmlOutMessage route(final WxMpXmlMessage wxMessage) { return this.route(wxMessage, new HashMap(2)); } + public WxMpXmlOutMessage route(String appid, final WxMpXmlMessage wxMessage) { + return this.route(appid, wxMessage, new HashMap(2)); + } + private boolean isMsgDuplicated(WxMpXmlMessage wxMessage) { StringBuilder messageId = new StringBuilder(); if (wxMessage.getMsgId() == null) { diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImpl.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImpl.java index e57099e9d7..73b548c24f 100644 --- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImpl.java +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImpl.java @@ -399,9 +399,6 @@ public void setMultiConfigStorages(Map configStorages @Override public void addConfigStorage(String mpId, WxMpConfigStorage configStorages) { synchronized (this) { - if (this.configStorageMap.containsKey(mpId)) { - throw new RuntimeException("该公众号标识已存在,请更换其他标识!"); - } this.configStorageMap.put(mpId, configStorages); } } From 1b193e30705f0035366b0aee97c616fa17878adb Mon Sep 17 00:00:00 2001 From: Binary Wang Date: Sun, 8 Mar 2020 16:26:49 +0800 Subject: [PATCH 002/114] =?UTF-8?q?:bug:=20#1420=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E4=BA=91=E5=BC=80=E5=8F=91=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E6=96=87=E4=BB=B6=E4=B8=8B=E8=BD=BD=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/binarywang/wx/miniapp/api/WxMaCloudService.java | 1 + .../cn/binarywang/wx/miniapp/api/impl/WxMaCloudServiceImpl.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaCloudService.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaCloudService.java index 7e59e6ec6f..2cb72fd07a 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaCloudService.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaCloudService.java @@ -19,6 +19,7 @@ public interface WxMaCloudService { String DATABASE_COLLECTION_ADD_URL = "https://api.weixin.qq.com/tcb/databasecollectionadd"; String GET_QCLOUD_TOKEN_URL = "https://api.weixin.qq.com/tcb/getqcloudtoken"; String BATCH_DELETE_FILE_URL = "https://api.weixin.qq.com/tcb/batchdeletefile"; + String BATCH_DOWNLOAD_FILE_URL = "https://api.weixin.qq.com/tcb/batchdownloadfile"; String UPLOAD_FILE_URL = "https://api.weixin.qq.com/tcb/uploadfile"; String DATABASE_MIGRATE_QUERY_INFO_URL = "https://api.weixin.qq.com/tcb/databasemigratequeryinfo"; String DATABASE_MIGRATE_EXPORT_URL = "https://api.weixin.qq.com/tcb/databasemigrateexport"; diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaCloudServiceImpl.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaCloudServiceImpl.java index 984185649c..f83a7bde65 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaCloudServiceImpl.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaCloudServiceImpl.java @@ -133,7 +133,7 @@ public WxCloudBatchDownloadFileResult batchDownloadFile(String env, String[] fil fileList.add(ImmutableMap.of("fileid", fileId, "max_age", (Serializable) maxAges[i++])); } - String response = this.wxMaService.post(GET_QCLOUD_TOKEN_URL, ImmutableMap.of("env", env, "file_list", fileList)); + String response = this.wxMaService.post(BATCH_DOWNLOAD_FILE_URL, ImmutableMap.of("env", env, "file_list", fileList)); return WxGsonBuilder.create().fromJson(response, WxCloudBatchDownloadFileResult.class); } From 06aaacce65558fe00e427967918b0a987cfe5c65 Mon Sep 17 00:00:00 2001 From: Binary Wang Date: Sun, 8 Mar 2020 19:54:20 +0800 Subject: [PATCH 003/114] =?UTF-8?q?:art:=20=E4=BC=98=E5=8C=96=E7=82=B9?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/me/chanjar/weixin/common/util/BeanUtils.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/BeanUtils.java b/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/BeanUtils.java index 4b7f9be6a7..768f2e5324 100644 --- a/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/BeanUtils.java +++ b/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/BeanUtils.java @@ -50,14 +50,13 @@ public static void checkRequiredFields(Object bean) throws WxErrorException { } } field.setAccessible(isAccessible); - } catch (SecurityException | IllegalArgumentException - | IllegalAccessException e) { + } catch (SecurityException | IllegalArgumentException | IllegalAccessException e) { log.error(e.getMessage(), e); } } if (!requiredFields.isEmpty()) { - String msg = "必填字段 " + requiredFields + " 必须提供值"; + String msg = String.format("必填字段【%s】必须提供值!", requiredFields); log.debug(msg); throw new WxErrorException(WxError.builder().errorMsg(msg).build()); } From f58ba62acc24990861a86280cf1453b743fcf16c Mon Sep 17 00:00:00 2001 From: Binary Wang Date: Sun, 8 Mar 2020 20:15:36 +0800 Subject: [PATCH 004/114] =?UTF-8?q?:art:=20#1428=20=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E7=BB=9F=E4=B8=80=E4=B8=8B=E5=8D=95=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E4=B8=AD=E7=9A=84attach=E5=92=8Cdetail=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E5=9C=A8=E7=94=9F=E6=88=90xml=E6=97=B6=E5=8A=A0?= =?UTF-8?q?=E5=85=A5CDATA=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wxpay/bean/request/WxPayUnifiedOrderRequest.java | 4 ++++ .../wxpay/service/impl/BaseWxPayServiceImplTest.java | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxPayUnifiedOrderRequest.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxPayUnifiedOrderRequest.java index fc5949dfdf..3a80c82787 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxPayUnifiedOrderRequest.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxPayUnifiedOrderRequest.java @@ -4,9 +4,11 @@ import com.github.binarywang.wxpay.constant.WxPayConstants.TradeType; import com.github.binarywang.wxpay.exception.WxPayException; import com.thoughtworks.xstream.annotations.XStreamAlias; +import com.thoughtworks.xstream.annotations.XStreamConverter; import lombok.*; import lombok.experimental.Accessors; import me.chanjar.weixin.common.annotation.Required; +import me.chanjar.weixin.common.util.xml.XStreamCDataConverter; import org.apache.commons.lang3.StringUtils; import java.util.Map; @@ -111,6 +113,7 @@ public class WxPayUnifiedOrderRequest extends BaseWxPayRequest { * */ @XStreamAlias("detail") + @XStreamConverter(value = XStreamCDataConverter.class) private String detail; /** @@ -124,6 +127,7 @@ public class WxPayUnifiedOrderRequest extends BaseWxPayRequest { * */ @XStreamAlias("attach") + @XStreamConverter(value = XStreamCDataConverter.class) private String attach; /** diff --git a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImplTest.java b/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImplTest.java index ab850d0b5b..de7b1e586e 100644 --- a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImplTest.java +++ b/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImplTest.java @@ -63,12 +63,13 @@ public void testUnifiedOrder() throws WxPayException { .notifyUrl("111111") .tradeType(TradeType.JSAPI) .openid(((XmlWxPayConfig) this.payService.getConfig()).getOpenid()) - .outTradeNo("1111112") + .outTradeNo("111111826") + .attach("#*#{\"pn\":\"粤B87965\",\"aid\":\"wx123\"}#*#") .build(); request.setSignType(SignType.HMAC_SHA256); WxPayUnifiedOrderResult result = this.payService.unifiedOrder(request); log.info(result.toString()); - log.warn(this.payService.getWxApiData().toString()); +// log.warn(this.payService.getWxApiData().toString()); } /** From fb4705281a0a0ed5e41358b7517f4e99e1abad9c Mon Sep 17 00:00:00 2001 From: Binary Wang Date: Sun, 8 Mar 2020 20:20:10 +0800 Subject: [PATCH 005/114] =?UTF-8?q?:art:=20=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=EF=BC=8C=E5=A2=9E=E5=8A=A0serialVersionUID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/github/binarywang/wxpay/bean/entpay/EntPayResult.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/entpay/EntPayResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/entpay/EntPayResult.java index 9863e83bcc..23a3cb7f23 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/entpay/EntPayResult.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/entpay/EntPayResult.java @@ -20,6 +20,8 @@ @NoArgsConstructor @XStreamAlias("xml") public class EntPayResult extends BaseWxPayResult { + private static final long serialVersionUID = 8523569987269603097L; + /** * 商户号. */ From 8aa4758e0161909ebaccd2cf1f8c293d8a7c8e06 Mon Sep 17 00:00:00 2001 From: Binary Wang Date: Sun, 8 Mar 2020 20:37:10 +0800 Subject: [PATCH 006/114] =?UTF-8?q?:bug:=20#1425=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E4=BC=81=E4=B8=9A=E5=BE=AE=E4=BF=A1OA=E5=AE=A1=E6=89=B9?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E5=87=A0=E4=B8=AA=E5=8F=82=E6=95=B0=E7=9A=84?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E6=88=96=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../weixin/cp/bean/oa/WxCpApprovalComment.java | 1 - .../weixin/cp/bean/oa/WxCpApprovalDetail.java | 8 ++++---- .../cp/bean/oa/applydata/ContentValue.java | 17 ++++------------- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/oa/WxCpApprovalComment.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/oa/WxCpApprovalComment.java index 8a70e3e6e9..1bf06ec51b 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/oa/WxCpApprovalComment.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/oa/WxCpApprovalComment.java @@ -13,7 +13,6 @@ */ @Data public class WxCpApprovalComment implements Serializable { - private static final long serialVersionUID = -5430367411926856292L; /** diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/oa/WxCpApprovalDetail.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/oa/WxCpApprovalDetail.java index 5021a57ee6..a22a435844 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/oa/WxCpApprovalDetail.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/oa/WxCpApprovalDetail.java @@ -13,7 +13,6 @@ */ @Data public class WxCpApprovalDetail implements Serializable { - private static final long serialVersionUID = 1353393306564207170L; /** @@ -49,19 +48,20 @@ public class WxCpApprovalDetail implements Serializable { /** * 申请人信息 */ - private WxCpApprovalApplyer applyer; + @SerializedName("applyer") + private WxCpApprovalApplyer applier; /** * 审批流程信息,可能有多个审批节点 */ @SerializedName("sp_record") - private WxCpApprovalRecord spRecord; + private WxCpApprovalRecord[] spRecords; /** * 抄送信息,可能有多个抄送节点 */ @SerializedName("notifyer") - private WxCpOperator notifyer; + private WxCpOperator[] notifiers; /** * 审批申请数据 diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/oa/applydata/ContentValue.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/oa/applydata/ContentValue.java index 7798338aa1..609b8dfb7c 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/oa/applydata/ContentValue.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/oa/applydata/ContentValue.java @@ -11,16 +11,15 @@ */ @Data public class ContentValue implements Serializable { - private static final long serialVersionUID = -5607678965965065261L; private String text; @SerializedName("new_number") - private Integer newNumber; + private Double newNumber; @SerializedName("new_money") - private Integer newMoney; + private Double newMoney; private ContentValue.Date date; @@ -36,24 +35,21 @@ public class ContentValue implements Serializable { @Data public static class Date implements Serializable { - private static final long serialVersionUID = -6181554080062231138L; private String type; @SerializedName("s_timestamp") - private Long timestamp; + private Double timestamp; } @Data public static class Selector implements Serializable { - private static final long serialVersionUID = 7305458759126951773L; private String type; private List