From a30d166148f0c385562eb748e5a81420b5ba93d6 Mon Sep 17 00:00:00 2001 From: xin <1099200748@qq.com> Date: Thu, 10 Jul 2025 18:05:41 +0800 Subject: [PATCH] 汇旺财下单返回序列化-new --- oying-system/src/main/java/com/oying/modules/hwc/service/impl/SwiftPassServiceImpl.java | 4 +--- oying-system/src/main/java/com/oying/modules/hwc/domain/HwcResponse.java | 16 ++++++++-------- pom.xml | 7 ------- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/oying-system/src/main/java/com/oying/modules/hwc/domain/HwcResponse.java b/oying-system/src/main/java/com/oying/modules/hwc/domain/HwcResponse.java index 729294b..83b1942 100644 --- a/oying-system/src/main/java/com/oying/modules/hwc/domain/HwcResponse.java +++ b/oying-system/src/main/java/com/oying/modules/hwc/domain/HwcResponse.java @@ -1,6 +1,6 @@ package com.oying.modules.hwc.domain; -import com.google.gson.annotations.SerializedName; +import com.alibaba.fastjson2.annotation.JSONField; import lombok.Getter; import lombok.Setter; @@ -13,18 +13,18 @@ @Setter public class HwcResponse { - @SerializedName("appId") + @JSONField(name = "appId") private String appId; - @SerializedName("timeStamp") + @JSONField(name = "timeStamp") private String timeStamp; - @SerializedName("nonceStr") + @JSONField(name = "nonceStr") private String nonceStr; - @SerializedName("package") + @JSONField(name = "package") private String packageVal; - @SerializedName("signType") + @JSONField(name = "signType") private String signType; - @SerializedName("paySign") + @JSONField(name = "paySign") private String paySign; - @SerializedName("status") + @JSONField(name = "status") private String status; } diff --git a/oying-system/src/main/java/com/oying/modules/hwc/service/impl/SwiftPassServiceImpl.java b/oying-system/src/main/java/com/oying/modules/hwc/service/impl/SwiftPassServiceImpl.java index 4a63f07..e0a7063 100644 --- a/oying-system/src/main/java/com/oying/modules/hwc/service/impl/SwiftPassServiceImpl.java +++ b/oying-system/src/main/java/com/oying/modules/hwc/service/impl/SwiftPassServiceImpl.java @@ -1,7 +1,6 @@ package com.oying.modules.hwc.service.impl; import com.alibaba.fastjson2.JSONObject; -import com.google.gson.Gson; import com.oying.exception.BadRequestException; import com.oying.modules.hwc.domain.HwcResponse; import com.oying.modules.hwc.service.SwiftPassService; @@ -103,8 +102,7 @@ throw new BadRequestException("验证签名错误"); } else { if ("0".equals(resultMap.get("status")) && "0".equals(resultMap.get("result_code"))) { - Gson gson = new Gson(); - return gson.fromJson(resultMap.get("pay_info"), HwcResponse.class); + return JSONObject.parseObject(resultMap.get("pay_info"), HwcResponse.class); } else { throw new BadRequestException(resultMap.get("err_code") + " : " + resultMap.get("err_msg") + "\n" + resultMap.get("status") + " : " + resultMap.get("message")); diff --git a/pom.xml b/pom.xml index cf63f1b..6005c46 100644 --- a/pom.xml +++ b/pom.xml @@ -48,13 +48,6 @@ </exclusions> </dependency> - <!-- Google Gson 依赖 --> - <dependency> - <groupId>com.google.code.gson</groupId> - <artifactId>gson</artifactId> - <version>2.10.1</version> <!-- 使用最新版本 --> - </dependency> - <!--Spring boot 测试--> <dependency> <groupId>org.springframework.boot</groupId> -- Gitblit v1.9.3