Commit ec1a933d30c2e3c7cd3d1ae77211486b2c2ad899
1 parent
24ed7be5
修改`支付模块>支付过期时间格式化异常(yyyy-MM-ddTHH
ssXXX)`
Showing
3 changed files
with
10 additions
and
4 deletions
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; |
| 26 | 26 | import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl; |
| 27 | 27 | import lombok.extern.slf4j.Slf4j; |
| 28 | 28 | |
| 29 | +import java.time.ZoneId; | |
| 30 | +import java.util.Date; | |
| 29 | 31 | import java.util.Objects; |
| 30 | 32 | |
| 31 | 33 | import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; |
| ... | ... | @@ -119,7 +121,7 @@ public class WXLitePayClient extends AbstractPayClient<WXPayClientConfig> { |
| 119 | 121 | .setTotal(reqDTO |
| 120 | 122 | .getAmount() |
| 121 | 123 | .intValue())); // 单位分 |
| 122 | - request.setTimeExpire(DateUtil.format(reqDTO.getExpireTime(), "yyyy-MM-dd'T'HH:mm:ssXXX")); // v3的时间格式 | |
| 124 | + request.setTimeExpire(DateUtil.format(Date.from(reqDTO.getExpireTime().atZone(ZoneId.systemDefault()).toInstant()), "yyyy-MM-dd'T'HH:mm:ssXXX")); // v3的时间格式 | |
| 123 | 125 | request.setPayer(new WxPayUnifiedOrderV3Request.Payer().setOpenid(getOpenid(reqDTO))); |
| 124 | 126 | request.setSceneInfo(new WxPayUnifiedOrderV3Request.SceneInfo().setPayerClientIp(reqDTO.getUserIp())); |
| 125 | 127 | request.setNotifyUrl(reqDTO.getNotifyUrl()); | ... | ... |
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; |
| 24 | 24 | import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl; |
| 25 | 25 | import lombok.extern.slf4j.Slf4j; |
| 26 | 26 | |
| 27 | +import java.time.ZoneId; | |
| 28 | +import java.util.Date; | |
| 27 | 29 | import java.util.Objects; |
| 28 | 30 | |
| 29 | 31 | import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; |
| ... | ... | @@ -98,7 +100,7 @@ public class WXNativePayClient extends AbstractPayClient<WXPayClientConfig> { |
| 98 | 100 | .outTradeNo(reqDTO.getMerchantOrderId()) |
| 99 | 101 | .body(reqDTO.getBody()) |
| 100 | 102 | .totalFee(reqDTO.getAmount().intValue()) // 单位分 |
| 101 | - .timeExpire(DateUtil.format(reqDTO.getExpireTime(), "yyyy-MM-dd'T'HH:mm:ssXXX")) | |
| 103 | + .timeExpire(DateUtil.format(Date.from(reqDTO.getExpireTime().atZone(ZoneId.systemDefault()).toInstant()), "yyyy-MM-dd'T'HH:mm:ssXXX")) | |
| 102 | 104 | .spbillCreateIp(reqDTO.getUserIp()) |
| 103 | 105 | .notifyUrl(reqDTO.getNotifyUrl()) |
| 104 | 106 | .productId(tradeType) | ... | ... |
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; |
| 26 | 26 | import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl; |
| 27 | 27 | import lombok.extern.slf4j.Slf4j; |
| 28 | 28 | |
| 29 | +import java.time.ZoneId; | |
| 30 | +import java.util.Date; | |
| 29 | 31 | import java.util.Objects; |
| 30 | 32 | |
| 31 | 33 | import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; |
| ... | ... | @@ -99,7 +101,7 @@ public class WXPubPayClient extends AbstractPayClient<WXPayClientConfig> { |
| 99 | 101 | .outTradeNo(reqDTO.getMerchantOrderId()) |
| 100 | 102 | .body(reqDTO.getBody()) |
| 101 | 103 | .totalFee(reqDTO.getAmount().intValue()) // 单位分 |
| 102 | - .timeExpire(DateUtil.format(reqDTO.getExpireTime(), "yyyy-MM-dd'T'HH:mm:ssXXX")) | |
| 104 | + .timeExpire(DateUtil.format(Date.from(reqDTO.getExpireTime().atZone(ZoneId.systemDefault()).toInstant()), "yyyy-MM-dd'T'HH:mm:ssXXX")) | |
| 103 | 105 | .spbillCreateIp(reqDTO.getUserIp()) |
| 104 | 106 | .openid(getOpenid(reqDTO)) |
| 105 | 107 | .notifyUrl(reqDTO.getNotifyUrl()) |
| ... | ... | @@ -114,7 +116,7 @@ public class WXPubPayClient extends AbstractPayClient<WXPayClientConfig> { |
| 114 | 116 | request.setOutTradeNo(reqDTO.getMerchantOrderId()); |
| 115 | 117 | request.setDescription(reqDTO.getBody()); |
| 116 | 118 | request.setAmount(new WxPayUnifiedOrderV3Request.Amount().setTotal(reqDTO.getAmount().intValue())); // 单位分 |
| 117 | - request.setTimeExpire(DateUtil.format(reqDTO.getExpireTime(), "yyyy-MM-dd'T'HH:mm:ssXXX")); | |
| 119 | + request.setTimeExpire(DateUtil.format(Date.from(reqDTO.getExpireTime().atZone(ZoneId.systemDefault()).toInstant()), "yyyy-MM-dd'T'HH:mm:ssXXX")); | |
| 118 | 120 | request.setPayer(new WxPayUnifiedOrderV3Request.Payer().setOpenid(getOpenid(reqDTO))); |
| 119 | 121 | request.setSceneInfo(new WxPayUnifiedOrderV3Request.SceneInfo().setPayerClientIp(reqDTO.getUserIp())); |
| 120 | 122 | request.setNotifyUrl(reqDTO.getNotifyUrl()); | ... | ... |