From 152d72020690625c269f27861d6e5a0923a71eb7 Mon Sep 17 00:00:00 2001
From: heheng <heheng@123456>
Date: Wed, 19 Feb 2025 17:26:01 +0800
Subject: [PATCH] 测试
---
exam-system/src/main/java/com/gkhy/exam/pay/utils/PayUtils.java | 50 +++++++++++++++++++++++++++++++-------------------
1 files changed, 31 insertions(+), 19 deletions(-)
diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/utils/PayUtils.java b/exam-system/src/main/java/com/gkhy/exam/pay/utils/PayUtils.java
index a12e483..980b8b7 100644
--- a/exam-system/src/main/java/com/gkhy/exam/pay/utils/PayUtils.java
+++ b/exam-system/src/main/java/com/gkhy/exam/pay/utils/PayUtils.java
@@ -582,31 +582,43 @@
String appid = "A1749891493E4CDDBFE4506357B1F0AB";
- String orderUrl = "http://finpt.xjcz.gov.cn/fs-service/fs-pay/uploadXml.do";
+ String uploadUrl = "http://finpt.xjcz.gov.cn/fs-service/fs-pay/uploadXml.do";
SignatureFileVo signatureFile = new SignatureFileVo();
signatureFile.setFileData(plain);
signatureFile.setOrderNo(orderId);
+ String reqdatastr = JSONObject.toJSONString(signatureFile);
- String reqdata = getBase64(signatureFile.toString());
- String mac = appid + "||" + reqdata;
- mac = DigestUtils.md5Hex(mac.getBytes());
+ String mac = this.getMD5("A1749891493E4CDDBFE4506357B1F0AB||" + this.getBase64(reqdatastr));
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put("appid", "A1749891493E4CDDBFE4506357B1F0AB");
+ jsonObject.put("mac", mac);
+ jsonObject.put("reqdata", this.getBase64(reqdatastr));
+ Map<String, String> header = new HashMap();
+ header.put("Accept", "application/json;charset=utf-8");
+ header.put("Content-Type", "application/json;charset=utf-8");
+ String resultStr = HttpUtil.post(uploadUrl, jsonObject);
+ JSONObject result = JSONObject.parseObject(resultStr);
- params.put("appid", appid);
- params.put("reqdata", reqdata);
- params.put("mac", mac);
-
- HttpPost httpPost = new HttpPost(orderUrl);
- httpPost.setEntity(assemblyFormEntity(params, "utf-8"));
- HttpClient httpClient = getHttpClient(orderUrl);
- HttpResultVo execute = null;
- try {
- execute = httpClient.execute(httpPost, getResponseHandler());
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- String stringContent = execute.getStringContent();
- ResultVo resultVo = JSONObject.parseObject(stringContent, ResultVo.class);
+// String reqdata = getBase64(signatureFile.toString());
+// String mac = appid + "||" + reqdata;
+// mac = DigestUtils.md5Hex(mac.getBytes());
+//
+// params.put("appid", appid);
+// params.put("reqdata", reqdata);
+// params.put("mac", mac);
+//
+// HttpPost httpPost = new HttpPost(orderUrl);
+// httpPost.setEntity(assemblyFormEntity(params, "utf-8"));
+// HttpClient httpClient = getHttpClient(orderUrl);
+// HttpResultVo execute = null;
+// try {
+// execute = httpClient.execute(httpPost, getResponseHandler());
+// } catch (IOException e) {
+// throw new RuntimeException(e);
+// }
+// String stringContent = execute.getStringContent();
+ ResultVo resultVo = JSONObject.parseObject(resultStr, ResultVo.class);
log.info("请求结果转为:" + resultVo);
return resultVo;
}
--
Gitblit v1.9.2