From 7a4f9541331bef779a506b38a27ed5c3373c0bec Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期四, 15 五月 2025 13:53:22 +0800
Subject: [PATCH] 开发二级等保功能及心跳消息队列修改

---
 ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/ali/v2/AppletPayUtil.java |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/ali/v2/AppletPayUtil.java b/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/ali/v2/AppletPayUtil.java
index c116fdc..bb0156c 100644
--- a/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/ali/v2/AppletPayUtil.java
+++ b/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/ali/v2/AppletPayUtil.java
@@ -1,6 +1,7 @@
 package com.ruoyi.payment.ali.v2;
 
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.alipay.api.AlipayClient;
 import com.alipay.api.AlipayConfig;
 import com.alipay.api.DefaultAlipayClient;
@@ -9,7 +10,7 @@
 import com.alipay.api.response.*;
 import com.ruoyi.payment.ali.config.AliProperties;
 import com.ruoyi.payment.ali.config.SignType;
-import com.ruoyi.payment.ali.v2.model.*;
+import com.ruoyi.payment.api.model.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
@@ -60,10 +61,11 @@
 			//异步返回参数
 			model.setPassbackParams(pojo.getPassbackParams());
 			request.setBizModel(model);
+			request.setNotifyUrl(aliProperties.getNotifyUrl() + pojo.getNotifyUrl());
 			
 			AlipayTradeCreateResponse response = alipayClient.execute(request);
 			log.info("-----调起支付宝支付-----");
-			log.info("请求参数:{}", pojo);
+			log.info("请求参数:{}", JSON.toJSONString(request));
 			log.info("返回结果:{}", response.getBody());
 			if (response.isSuccess()) {
 				return PaymentResp.build(response.getOutTradeNo(), response.getTradeNo());
@@ -130,7 +132,9 @@
 			log.info("请求参数:{}", req);
 			log.info("返回结果:{}", response.getBody());
 			if (response.isSuccess()) {
-				return JSON.parseObject(response.getBody(), RefundResp.class);
+				JSONObject jsonObject = JSON.parseObject(response.getBody());
+				RefundResp alipay_trade_refund_response = jsonObject.getObject("alipay_trade_refund_response", RefundResp.class);
+				return alipay_trade_refund_response;
 			}
 		}catch (Exception e){
 			e.printStackTrace();
@@ -207,12 +211,12 @@
 		alipayConfig.setSignType(SignType.RSA2.getType());
 		//判断加签方式
 		String signType = aliProperties.getSignType();
-		if(SignType.CERT.getType().equals(signType)){
+		if(SignType.SECRET_KEY.getType().equals(signType)){
 			alipayConfig.setPrivateKey(aliProperties.getPrivateKey());
 			alipayConfig.setAlipayPublicKey(aliProperties.getAlipayPublicKey());
 			return alipayConfig;
 		}
-		if(SignType.SECRET_KEY.getType().equals(signType)){
+		if(SignType.CERT.getType().equals(signType)){
 			alipayConfig.setAppCertPath(aliProperties.getAppCertPath());
 			alipayConfig.setAlipayPublicCertPath(aliProperties.getAlipayPublicCertPath());
 			alipayConfig.setRootCertPath(aliProperties.getRootCertPath());

--
Gitblit v1.7.1