From ec1a933d30c2e3c7cd3d1ae77211486b2c2ad899 Mon Sep 17 00:00:00 2001 From: qs Date: Tue, 13 Dec 2022 15:41:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9`=E6=94=AF=E4=BB=98=E6=A8=A1?= =?UTF-8?q?=E5=9D=97>=E6=94=AF=E4=BB=98=E8=BF=87=E6=9C=9F=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E6=A0=BC=E5=BC=8F=E5=8C=96=E5=BC=82=E5=B8=B8=EF=BC=88?= =?UTF-8?q?yyyy-MM-ddTHH:mm:ssXXX=EF=BC=89`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../framework/pay/core/client/impl/wx/WXLitePayClient.java | 4 +++- .../pay/core/client/impl/wx/WXNativePayClient.java | 4 +++- .../framework/pay/core/client/impl/wx/WXPubPayClient.java | 6 ++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXLitePayClient.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXLitePayClient.java index 316447ab3..bb485f41e 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXLitePayClient.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXLitePayClient.java @@ -26,6 +26,8 @@ import com.github.binarywang.wxpay.service.WxPayService; import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl; import lombok.extern.slf4j.Slf4j; +import java.time.ZoneId; +import java.util.Date; import java.util.Objects; import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; @@ -119,7 +121,7 @@ public class WXLitePayClient extends AbstractPayClient { .setTotal(reqDTO .getAmount() .intValue())); // 单位分 - request.setTimeExpire(DateUtil.format(reqDTO.getExpireTime(), "yyyy-MM-dd'T'HH:mm:ssXXX")); // v3的时间格式 + request.setTimeExpire(DateUtil.format(Date.from(reqDTO.getExpireTime().atZone(ZoneId.systemDefault()).toInstant()), "yyyy-MM-dd'T'HH:mm:ssXXX")); // v3的时间格式 request.setPayer(new WxPayUnifiedOrderV3Request.Payer().setOpenid(getOpenid(reqDTO))); request.setSceneInfo(new WxPayUnifiedOrderV3Request.SceneInfo().setPayerClientIp(reqDTO.getUserIp())); request.setNotifyUrl(reqDTO.getNotifyUrl()); diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXNativePayClient.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXNativePayClient.java index f9ccd4629..b228213eb 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXNativePayClient.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXNativePayClient.java @@ -24,6 +24,8 @@ import com.github.binarywang.wxpay.service.WxPayService; import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl; import lombok.extern.slf4j.Slf4j; +import java.time.ZoneId; +import java.util.Date; import java.util.Objects; import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; @@ -98,7 +100,7 @@ public class WXNativePayClient extends AbstractPayClient { .outTradeNo(reqDTO.getMerchantOrderId()) .body(reqDTO.getBody()) .totalFee(reqDTO.getAmount().intValue()) // 单位分 - .timeExpire(DateUtil.format(reqDTO.getExpireTime(), "yyyy-MM-dd'T'HH:mm:ssXXX")) + .timeExpire(DateUtil.format(Date.from(reqDTO.getExpireTime().atZone(ZoneId.systemDefault()).toInstant()), "yyyy-MM-dd'T'HH:mm:ssXXX")) .spbillCreateIp(reqDTO.getUserIp()) .notifyUrl(reqDTO.getNotifyUrl()) .productId(tradeType) diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXPubPayClient.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXPubPayClient.java index 84e3064c3..88e7ac75f 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXPubPayClient.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXPubPayClient.java @@ -26,6 +26,8 @@ import com.github.binarywang.wxpay.service.WxPayService; import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl; import lombok.extern.slf4j.Slf4j; +import java.time.ZoneId; +import java.util.Date; import java.util.Objects; import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; @@ -99,7 +101,7 @@ public class WXPubPayClient extends AbstractPayClient { .outTradeNo(reqDTO.getMerchantOrderId()) .body(reqDTO.getBody()) .totalFee(reqDTO.getAmount().intValue()) // 单位分 - .timeExpire(DateUtil.format(reqDTO.getExpireTime(), "yyyy-MM-dd'T'HH:mm:ssXXX")) + .timeExpire(DateUtil.format(Date.from(reqDTO.getExpireTime().atZone(ZoneId.systemDefault()).toInstant()), "yyyy-MM-dd'T'HH:mm:ssXXX")) .spbillCreateIp(reqDTO.getUserIp()) .openid(getOpenid(reqDTO)) .notifyUrl(reqDTO.getNotifyUrl()) @@ -114,7 +116,7 @@ public class WXPubPayClient extends AbstractPayClient { request.setOutTradeNo(reqDTO.getMerchantOrderId()); request.setDescription(reqDTO.getBody()); request.setAmount(new WxPayUnifiedOrderV3Request.Amount().setTotal(reqDTO.getAmount().intValue())); // 单位分 - request.setTimeExpire(DateUtil.format(reqDTO.getExpireTime(), "yyyy-MM-dd'T'HH:mm:ssXXX")); + request.setTimeExpire(DateUtil.format(Date.from(reqDTO.getExpireTime().atZone(ZoneId.systemDefault()).toInstant()), "yyyy-MM-dd'T'HH:mm:ssXXX")); request.setPayer(new WxPayUnifiedOrderV3Request.Payer().setOpenid(getOpenid(reqDTO))); request.setSceneInfo(new WxPayUnifiedOrderV3Request.SceneInfo().setPayerClientIp(reqDTO.getUserIp())); request.setNotifyUrl(reqDTO.getNotifyUrl());