Commit 6505906565725d352c7e298f2a5dad8e472afef8
1 parent
802a7b0a
【支付模块BUG】 修改时间 格式 yyyyMMddHHmmss 为 yyyy-MM-dd'T'HHssXXX 支付宝 获取支付回调对象
Showing
1 changed file
with
17 additions
and
2 deletions
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AbstractAlipayClient.java
| @@ -18,6 +18,7 @@ import lombok.SneakyThrows; | @@ -18,6 +18,7 @@ import lombok.SneakyThrows; | ||
| 18 | import lombok.extern.slf4j.Slf4j; | 18 | import lombok.extern.slf4j.Slf4j; |
| 19 | 19 | ||
| 20 | import java.nio.charset.StandardCharsets; | 20 | import java.nio.charset.StandardCharsets; |
| 21 | +import java.util.HashMap; | ||
| 21 | import java.util.Map; | 22 | import java.util.Map; |
| 22 | 23 | ||
| 23 | import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; | 24 | import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; |
| @@ -54,7 +55,8 @@ public abstract class AbstractAlipayClient extends AbstractPayClient<AlipayPayCl | @@ -54,7 +55,8 @@ public abstract class AbstractAlipayClient extends AbstractPayClient<AlipayPayCl | ||
| 54 | */ | 55 | */ |
| 55 | @Override | 56 | @Override |
| 56 | public PayOrderNotifyRespDTO parseOrderNotify(PayNotifyDataDTO data) throws Exception { | 57 | public PayOrderNotifyRespDTO parseOrderNotify(PayNotifyDataDTO data) throws Exception { |
| 57 | - Map<String, String> params = data.getParams(); | 58 | + Map<String, String> params = strToMap(data.getBody()); |
| 59 | + | ||
| 58 | return PayOrderNotifyRespDTO.builder().orderExtensionNo(params.get("out_trade_no")) | 60 | return PayOrderNotifyRespDTO.builder().orderExtensionNo(params.get("out_trade_no")) |
| 59 | .channelOrderNo(params.get("trade_no")).channelUserId(params.get("seller_id")) | 61 | .channelOrderNo(params.get("trade_no")).channelUserId(params.get("seller_id")) |
| 60 | .tradeStatus(params.get("trade_status")) | 62 | .tradeStatus(params.get("trade_status")) |
| @@ -64,7 +66,7 @@ public abstract class AbstractAlipayClient extends AbstractPayClient<AlipayPayCl | @@ -64,7 +66,7 @@ public abstract class AbstractAlipayClient extends AbstractPayClient<AlipayPayCl | ||
| 64 | 66 | ||
| 65 | @Override | 67 | @Override |
| 66 | public PayRefundNotifyDTO parseRefundNotify(PayNotifyDataDTO notifyData) { | 68 | public PayRefundNotifyDTO parseRefundNotify(PayNotifyDataDTO notifyData) { |
| 67 | - Map<String, String> params = notifyData.getParams(); | 69 | + Map<String, String> params = strToMap(notifyData.getBody()); |
| 68 | PayRefundNotifyDTO notifyDTO = PayRefundNotifyDTO.builder().channelOrderNo(params.get("trade_no")) | 70 | PayRefundNotifyDTO notifyDTO = PayRefundNotifyDTO.builder().channelOrderNo(params.get("trade_no")) |
| 69 | .tradeNo(params.get("out_trade_no")) | 71 | .tradeNo(params.get("out_trade_no")) |
| 70 | .reqNo(params.get("out_biz_no")) | 72 | .reqNo(params.get("out_biz_no")) |
| @@ -128,4 +130,17 @@ public abstract class AbstractAlipayClient extends AbstractPayClient<AlipayPayCl | @@ -128,4 +130,17 @@ public abstract class AbstractAlipayClient extends AbstractPayClient<AlipayPayCl | ||
| 128 | } | 130 | } |
| 129 | } | 131 | } |
| 130 | 132 | ||
| 133 | + public static Map<String, String> strToMap(String s) { | ||
| 134 | + Map<String, String> stringStringMap = new HashMap<>(); | ||
| 135 | + //调整时间格式 | ||
| 136 | + String s3 = s.replaceAll("%3A", ":"); | ||
| 137 | + //获取map | ||
| 138 | + String s4 = s3.replace("+", " "); | ||
| 139 | + String[] split = s4.split("&"); | ||
| 140 | + for (String s1 : split) { | ||
| 141 | + String[] split1 = s1.split("="); | ||
| 142 | + stringStringMap.put(split1[0], split1[1]); | ||
| 143 | + } | ||
| 144 | + return stringStringMap; | ||
| 145 | + } | ||
| 131 | } | 146 | } |