From eb5d7885fa9e4bd20c0827eec9b4cdd48c47b509 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期二, 07 一月 2025 09:11:20 +0800 Subject: [PATCH] 修改bug --- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/payment/TransferUtil.java | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/payment/TransferUtil.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/payment/TransferUtil.java index c60dbc8..9d04792 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/payment/TransferUtil.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/payment/TransferUtil.java @@ -1,5 +1,6 @@ package com.ruoyi.order.util.payment; +import cn.hutool.http.ContentType; import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpResponse; import cn.hutool.http.HttpUtil; @@ -39,6 +40,7 @@ public static SinglePayResult singlePay(SinglePay singlePay){ String url = "https://www.joinpay.com/payment/pay/singlePay"; HttpRequest post = HttpUtil.createPost(url); + post.contentType(ContentType.JSON.toString()); JSONObject body = new JSONObject(); //商户编号 body.put("userNo", merchantNo); @@ -121,6 +123,7 @@ public static SinglePayQueryResult singlePayQuery(String merchantOrderNo){ String url = "https://www.joinpay.com/payment/pay/singlePayQuery"; HttpRequest post = HttpUtil.createPost(url); + post.contentType(ContentType.JSON.toString()); JSONObject body = new JSONObject(); //商户编号 body.put("userNo", merchantNo); @@ -164,6 +167,7 @@ public static AccountBalanceQueryResult accountBalanceQuery(){ String url = "https://www.joinpay.com/payment/pay/accountBalanceQuery"; HttpRequest post = HttpUtil.createPost(url); + post.contentType(ContentType.JSON.toString()); JSONObject body = new JSONObject(); //商户编号 body.put("userNo", merchantNo); @@ -200,13 +204,13 @@ - public static String sign(JSONObject body) throws Exception{ + public static String sign(JSONObject body) { Set<Map.Entry<String, Object>> entries = body.entrySet(); List<Map.Entry<String, Object>> infoIds = new ArrayList<Map.Entry<String, Object>>(entries); // 对所有传入参数按照字段名的 ASCII 码从小到大排序(字典序) Collections.sort(infoIds, new Comparator<Map.Entry<String, Object>>() { public int compare(Map.Entry<String, Object> o1, Map.Entry<String, Object> o2) { - return (o1.getKey()).toString().compareTo(o2.getKey()); + return (o1.getKey()).compareTo(o2.getKey()); } }); // 构造签名键值对的格式 @@ -223,4 +227,5 @@ return MD5AndKL.MD5(sb.toString()); } + } -- Gitblit v1.7.1