|
|
@@ -1,501 +0,0 @@
|
|
|
-package common.utils.tl;
|
|
|
-
|
|
|
-import java.util.*;
|
|
|
-
|
|
|
-/**
|
|
|
- * 通联支付SDK - 使用现有工具类实现
|
|
|
- * 支持H5收银台支付功能
|
|
|
- *
|
|
|
- * @author skyff
|
|
|
- * @date 2024
|
|
|
- */
|
|
|
-public class AllinpaySDK {
|
|
|
-
|
|
|
- /**
|
|
|
- * H5收银台支付 - 使用现有工具类实现
|
|
|
- *
|
|
|
- * @param trxamt 交易金额(分)
|
|
|
- * @param reqsn 商户订单号
|
|
|
- * @param body 订单标题
|
|
|
- * @param remark 订单备注信息
|
|
|
- * @param notify_url 服务器异步通知页面路径
|
|
|
- * @param returl 页面跳转同步通知页面路径
|
|
|
- * @param charset 参数字符编码集
|
|
|
- * @param validtime 有效时间(分钟)
|
|
|
- * @param limit_pay 支付限制
|
|
|
- * @param truename 付款人真实姓名
|
|
|
- * @param idno 证件号
|
|
|
- * @return 支付结果
|
|
|
- */
|
|
|
- public static PaymentResult h5Pay(Long trxamt, String reqsn, String body, String remark,
|
|
|
- String notify_url, String returl, String charset,
|
|
|
- Integer validtime, String limit_pay, String truename, String idno) {
|
|
|
- try {
|
|
|
- // 使用HttpConnectionUtil发送H5支付请求
|
|
|
- HttpConnectionUtil http = new HttpConnectionUtil(SybConstants.SYB_APIURL + "/h5unionpay/unionorder");
|
|
|
- http.init();
|
|
|
-
|
|
|
- // 构建请求参数 - 使用与测试代码相同的逻辑
|
|
|
- TreeMap<String, String> params = new TreeMap<>();
|
|
|
- if (!SybUtil.isEmpty(SybConstants.SYB_ORGID)) {
|
|
|
- params.put("orgid", SybConstants.SYB_ORGID);
|
|
|
- }
|
|
|
- params.put("cusid", SybConstants.SYB_CUSID);
|
|
|
- params.put("appid", SybConstants.SYB_APPID);
|
|
|
- params.put("version", SybConstants.VERSION);
|
|
|
- params.put("trxamt", String.valueOf(trxamt));
|
|
|
- params.put("charset", charset);
|
|
|
- params.put("returl", returl);
|
|
|
- params.put("notify_url", notify_url);
|
|
|
- params.put("body", body);
|
|
|
- params.put("remark", remark);
|
|
|
- params.put("randomstr", SybUtil.getValidatecode(8));
|
|
|
- params.put("signtype", SybConstants.SIGN_TYPE);
|
|
|
- params.put("reqsn", reqsn);
|
|
|
-
|
|
|
- // 添加可选参数
|
|
|
- if (validtime != null) params.put("validtime", String.valueOf(validtime));
|
|
|
- if (!SybUtil.isEmpty(limit_pay)) params.put("limit_pay", limit_pay);
|
|
|
- if (!SybUtil.isEmpty(truename)) params.put("truename", truename);
|
|
|
- if (!SybUtil.isEmpty(idno)) params.put("idno", idno);
|
|
|
-
|
|
|
- // 生成签名 - 使用与测试代码相同的逻辑
|
|
|
- String appkey = "MD5".equals(SybConstants.SIGN_TYPE) ? SybConstants.SYB_MD5_APPKEY :
|
|
|
- "RSA".equals(SybConstants.SIGN_TYPE) ? SybConstants.SYB_RSACUSPRIKEY :
|
|
|
- SybConstants.SYB_SM2PPRIVATEKEY;
|
|
|
-
|
|
|
- params.put("sign", SybUtil.unionSign(params, appkey, SybConstants.SIGN_TYPE));
|
|
|
-
|
|
|
- // 发送请求 - 使用与测试代码相同的逻辑
|
|
|
- byte[] response = http.postParams(params, true);
|
|
|
- String responseStr = new String(response, "UTF-8");
|
|
|
-
|
|
|
- http.destory();
|
|
|
-
|
|
|
- // 处理响应
|
|
|
- Map<String, String> resultMap = SybPayService.handleResult(responseStr);
|
|
|
-
|
|
|
- if ("SUCCESS".equals(resultMap.get("retcode"))) {
|
|
|
- String payUrl = resultMap.get("payinfo");
|
|
|
- return PaymentResult.success(payUrl, "H5支付链接生成成功");
|
|
|
- } else {
|
|
|
- return PaymentResult.error("H5支付失败: " + resultMap.get("retmsg"));
|
|
|
- }
|
|
|
-
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- return PaymentResult.error("H5支付请求失败: " + e.getMessage());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 查询支付结果 - 使用现有工具类实现
|
|
|
- *
|
|
|
- * @param reqsn 商户交易单号
|
|
|
- * @return 查询结果
|
|
|
- */
|
|
|
- public static QueryResult queryPayment(String reqsn) {
|
|
|
- try {
|
|
|
- // 直接使用SybPayService的query方法
|
|
|
- SybPayService payService = new SybPayService();
|
|
|
- Map<String, String> resultMap = payService.query(reqsn, null);
|
|
|
-
|
|
|
- if ("SUCCESS".equals(resultMap.get("retcode"))) {
|
|
|
- String trxstatus = resultMap.get("trxstatus");
|
|
|
- String trxid = resultMap.get("trxid");
|
|
|
- String trxamt = resultMap.get("trxamt");
|
|
|
- return QueryResult.success(trxstatus, trxid, trxamt, "查询成功");
|
|
|
- } else {
|
|
|
- return QueryResult.error("查询失败: " + resultMap.get("retmsg"));
|
|
|
- }
|
|
|
-
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- return QueryResult.error("查询失败: " + e.getMessage());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 处理异步通知 - 使用现有工具类实现
|
|
|
- *
|
|
|
- * @param notifyParams 通知参数
|
|
|
- * @return 处理结果
|
|
|
- */
|
|
|
- public static NotifyResult handleNotify(Map<String, String> notifyParams) {
|
|
|
- try {
|
|
|
- System.out.println("收到异步通知: " + notifyParams);
|
|
|
-
|
|
|
- // 验证签名
|
|
|
- String sign = notifyParams.get("sign");
|
|
|
- if (SybUtil.isEmpty(sign)) {
|
|
|
- return NotifyResult.error("签名为空");
|
|
|
- }
|
|
|
-
|
|
|
- // 构建验签参数
|
|
|
- TreeMap<String, String> verifyParams = new TreeMap<>();
|
|
|
- for (Map.Entry<String, String> entry : notifyParams.entrySet()) {
|
|
|
- if (!"sign".equals(entry.getKey()) && !SybUtil.isEmpty(entry.getValue())) {
|
|
|
- verifyParams.put(entry.getKey(), entry.getValue());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 使用SybUtil进行签名验证
|
|
|
- String appkey = getAppKey();
|
|
|
- boolean verifyResult = SybUtil.validSign(verifyParams, appkey, SybConstants.SIGN_TYPE);
|
|
|
-
|
|
|
- if (!verifyResult) {
|
|
|
- return NotifyResult.error("签名验证失败");
|
|
|
- }
|
|
|
-
|
|
|
- // 解析通知内容
|
|
|
- String reqsn = notifyParams.get("reqsn");
|
|
|
- String trxstatus = notifyParams.get("trxstatus");
|
|
|
- String trxid = notifyParams.get("trxid");
|
|
|
- String trxamt = notifyParams.get("trxamt");
|
|
|
-
|
|
|
- return NotifyResult.success(reqsn, trxstatus, trxid, trxamt, "通知处理成功");
|
|
|
-
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- return NotifyResult.error("通知处理失败: " + e.getMessage());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取签名密钥
|
|
|
- */
|
|
|
- private static String getAppKey() {
|
|
|
- if ("RSA".equals(SybConstants.SIGN_TYPE)) {
|
|
|
- return SybConstants.SYB_RSACUSPRIKEY;
|
|
|
- } else if ("SM2".equals(SybConstants.SIGN_TYPE)) {
|
|
|
- return SybConstants.SYB_SM2PPRIVATEKEY;
|
|
|
- } else {
|
|
|
- return SybConstants.SYB_MD5_APPKEY;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 支付结果类
|
|
|
- */
|
|
|
- public static class PaymentResult {
|
|
|
- private boolean success;
|
|
|
- private String payUrl;
|
|
|
- private String message;
|
|
|
- private String errorCode;
|
|
|
-
|
|
|
- private PaymentResult(boolean success, String payUrl, String message, String errorCode) {
|
|
|
- this.success = success;
|
|
|
- this.payUrl = payUrl;
|
|
|
- this.message = message;
|
|
|
- this.errorCode = errorCode;
|
|
|
- }
|
|
|
-
|
|
|
- public static PaymentResult success(String payUrl, String message) {
|
|
|
- return new PaymentResult(true, payUrl, message, null);
|
|
|
- }
|
|
|
-
|
|
|
- public static PaymentResult error(String message) {
|
|
|
- return new PaymentResult(false, null, message, "ERROR");
|
|
|
- }
|
|
|
-
|
|
|
- // Getters
|
|
|
- public boolean isSuccess() { return success; }
|
|
|
- public String getPayUrl() { return payUrl; }
|
|
|
- public String getMessage() { return message; }
|
|
|
- public String getErrorCode() { return errorCode; }
|
|
|
-
|
|
|
- @Override
|
|
|
- public String toString() {
|
|
|
- return "PaymentResult{" +
|
|
|
- "success=" + success +
|
|
|
- ", payUrl='" + payUrl + '\'' +
|
|
|
- ", message='" + message + '\'' +
|
|
|
- ", errorCode='" + errorCode + '\'' +
|
|
|
- '}';
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 查询结果类
|
|
|
- */
|
|
|
- public static class QueryResult {
|
|
|
- private boolean success;
|
|
|
- private String trxstatus;
|
|
|
- private String trxid;
|
|
|
- private String trxamt;
|
|
|
- private String message;
|
|
|
- private String errorCode;
|
|
|
-
|
|
|
- private QueryResult(boolean success, String trxstatus, String trxid, String trxamt, String message, String errorCode) {
|
|
|
- this.success = success;
|
|
|
- this.trxstatus = trxstatus;
|
|
|
- this.trxid = trxid;
|
|
|
- this.trxamt = trxamt;
|
|
|
- this.message = message;
|
|
|
- this.errorCode = errorCode;
|
|
|
- }
|
|
|
-
|
|
|
- public static QueryResult success(String trxstatus, String trxid, String trxamt, String message) {
|
|
|
- return new QueryResult(true, trxstatus, trxid, trxamt, message, null);
|
|
|
- }
|
|
|
-
|
|
|
- public static QueryResult error(String message) {
|
|
|
- return new QueryResult(false, null, null, null, message, "ERROR");
|
|
|
- }
|
|
|
-
|
|
|
- // Getters
|
|
|
- public boolean isSuccess() { return success; }
|
|
|
- public String getTrxstatus() { return trxstatus; }
|
|
|
- public String getTrxid() { return trxid; }
|
|
|
- public String getTrxamt() { return trxamt; }
|
|
|
- public String getMessage() { return message; }
|
|
|
- public String getErrorCode() { return errorCode; }
|
|
|
-
|
|
|
- @Override
|
|
|
- public String toString() {
|
|
|
- return "QueryResult{" +
|
|
|
- "success=" + success +
|
|
|
- ", trxstatus='" + trxstatus + '\'' +
|
|
|
- ", trxid='" + trxid + '\'' +
|
|
|
- ", trxamt='" + trxamt + '\'' +
|
|
|
- ", message='" + message + '\'' +
|
|
|
- ", errorCode='" + errorCode + '\'' +
|
|
|
- '}';
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 通知结果类
|
|
|
- */
|
|
|
- public static class NotifyResult {
|
|
|
- private boolean success;
|
|
|
- private String reqsn;
|
|
|
- private String trxstatus;
|
|
|
- private String trxid;
|
|
|
- private String trxamt;
|
|
|
- private String message;
|
|
|
- private String errorCode;
|
|
|
-
|
|
|
- private NotifyResult(boolean success, String reqsn, String trxstatus, String trxid, String trxamt, String message, String errorCode) {
|
|
|
- this.success = success;
|
|
|
- this.reqsn = reqsn;
|
|
|
- this.trxstatus = trxstatus;
|
|
|
- this.trxid = trxid;
|
|
|
- this.trxamt = trxamt;
|
|
|
- this.message = message;
|
|
|
- this.errorCode = errorCode;
|
|
|
- }
|
|
|
-
|
|
|
- public static NotifyResult success(String reqsn, String trxstatus, String trxid, String trxamt, String message) {
|
|
|
- return new NotifyResult(true, reqsn, trxstatus, trxid, trxamt, message, null);
|
|
|
- }
|
|
|
-
|
|
|
- public static NotifyResult error(String message) {
|
|
|
- return new NotifyResult(false, null, null, null, null, message, "ERROR");
|
|
|
- }
|
|
|
-
|
|
|
- // Getters
|
|
|
- public boolean isSuccess() { return success; }
|
|
|
- public String getReqsn() { return reqsn; }
|
|
|
- public String getTrxstatus() { return trxstatus; }
|
|
|
- public String getTrxid() { return trxid; }
|
|
|
- public String getTrxamt() { return trxamt; }
|
|
|
- public String getMessage() { return message; }
|
|
|
- public String getErrorCode() { return errorCode; }
|
|
|
-
|
|
|
- @Override
|
|
|
- public String toString() {
|
|
|
- return "NotifyResult{" +
|
|
|
- "success=" + success +
|
|
|
- ", reqsn='" + reqsn + '\'' +
|
|
|
- ", trxstatus='" + trxstatus + '\'' +
|
|
|
- ", trxid='" + trxid + '\'' +
|
|
|
- ", trxamt='" + trxamt + '\'' +
|
|
|
- ", message='" + message + '\'' +
|
|
|
- ", errorCode='" + errorCode + '\'' +
|
|
|
- '}';
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 测试主方法 - 专门测试H5收银台支付
|
|
|
- */
|
|
|
- public static void main(String[] args) {
|
|
|
- System.out.println("=== 通联支付H5收银台测试 ===");
|
|
|
-
|
|
|
- // 测试参数
|
|
|
- String reqsn = "H5" + System.currentTimeMillis(); // 商户订单号
|
|
|
- Long trxamt = 100L; // 1元(分为单位)
|
|
|
- String body = "鲁迅的茶";
|
|
|
- String remark = "鲁迅的书";
|
|
|
- String notify_url = "https://dlsh-nft.com.cn/api/notify/allinpay";
|
|
|
- String returl = "https://dlsh-nft.com.cn";
|
|
|
- String charset = "UTF-8";
|
|
|
- Integer validtime = 30; // 30分钟有效期
|
|
|
-
|
|
|
- System.out.println("测试订单号: " + reqsn);
|
|
|
- System.out.println("交易金额: " + trxamt + "分 (1元)");
|
|
|
- System.out.println("商品名称: " + body);
|
|
|
- System.out.println("订单备注: " + remark);
|
|
|
- System.out.println("异步通知地址: " + notify_url);
|
|
|
- System.out.println("同步跳转地址: " + returl);
|
|
|
- System.out.println("有效时间: " + validtime + "分钟");
|
|
|
- System.out.println("商户ID: " + SybConstants.SYB_CUSID);
|
|
|
- System.out.println("应用ID: " + SybConstants.SYB_APPID);
|
|
|
- System.out.println("API地址: " + SybConstants.SYB_APIURL);
|
|
|
- System.out.println("签名类型: " + SybConstants.SIGN_TYPE);
|
|
|
-
|
|
|
- try {
|
|
|
- // 测试H5收银台支付
|
|
|
- System.out.println("\n=== 开始H5收银台支付测试 ===");
|
|
|
- PaymentResult payResult = h5Pay(trxamt, reqsn, body, remark, notify_url,
|
|
|
- returl, charset, validtime, null, null, null);
|
|
|
-
|
|
|
- System.out.println("支付结果: " + payResult);
|
|
|
-
|
|
|
- if (payResult.isSuccess()) {
|
|
|
- System.out.println("\n✅ H5支付链接生成成功!");
|
|
|
- System.out.println("支付链接: " + payResult.getPayUrl());
|
|
|
- System.out.println("消息: " + payResult.getMessage());
|
|
|
- System.out.println("\n请复制上述链接到浏览器中打开完成支付测试");
|
|
|
-
|
|
|
- // 等待一段时间后查询支付结果
|
|
|
- System.out.println("\n=== 等待5秒后查询支付结果 ===");
|
|
|
- try {
|
|
|
- Thread.sleep(5000); // 等待5秒
|
|
|
- } catch (InterruptedException e) {
|
|
|
- Thread.currentThread().interrupt();
|
|
|
- }
|
|
|
-
|
|
|
- QueryResult queryResult = queryPayment(reqsn);
|
|
|
- System.out.println("查询结果: " + queryResult);
|
|
|
-
|
|
|
- if (queryResult.isSuccess()) {
|
|
|
- System.out.println("✅ 查询成功!");
|
|
|
- System.out.println("交易状态: " + queryResult.getTrxstatus());
|
|
|
- System.out.println("交易ID: " + queryResult.getTrxid());
|
|
|
- System.out.println("交易金额: " + queryResult.getTrxamt());
|
|
|
- } else {
|
|
|
- System.out.println("❌ 查询失败: " + queryResult.getMessage());
|
|
|
- }
|
|
|
-
|
|
|
- } else {
|
|
|
- System.out.println("\n❌ H5支付失败!");
|
|
|
- System.out.println("错误信息: " + payResult.getMessage());
|
|
|
- System.out.println("错误代码: " + payResult.getErrorCode());
|
|
|
- }
|
|
|
-
|
|
|
- // 测试异步通知处理
|
|
|
- System.out.println("\n=== 测试异步通知处理 ===");
|
|
|
- Map<String, String> notifyParams = new HashMap<>();
|
|
|
- notifyParams.put("reqsn", reqsn);
|
|
|
- notifyParams.put("trxstatus", "0000"); // 成功状态
|
|
|
- notifyParams.put("trxid", "TL" + System.currentTimeMillis());
|
|
|
- notifyParams.put("trxamt", String.valueOf(trxamt));
|
|
|
- notifyParams.put("cusid", SybConstants.SYB_CUSID);
|
|
|
- notifyParams.put("appid", SybConstants.SYB_APPID);
|
|
|
-
|
|
|
- // 生成模拟签名
|
|
|
- TreeMap<String, String> signParams = new TreeMap<>(notifyParams);
|
|
|
- String appkey = getAppKey();
|
|
|
- String sign = SybUtil.unionSign(signParams, appkey, SybConstants.SIGN_TYPE);
|
|
|
- notifyParams.put("sign", sign);
|
|
|
-
|
|
|
- NotifyResult notifyResult = handleNotify(notifyParams);
|
|
|
- System.out.println("通知处理结果: " + notifyResult);
|
|
|
-
|
|
|
- if (notifyResult.isSuccess()) {
|
|
|
- System.out.println("✅ 异步通知处理成功!");
|
|
|
- System.out.println("订单号: " + notifyResult.getReqsn());
|
|
|
- System.out.println("交易状态: " + notifyResult.getTrxstatus());
|
|
|
- System.out.println("交易ID: " + notifyResult.getTrxid());
|
|
|
- } else {
|
|
|
- System.out.println("❌ 异步通知处理失败: " + notifyResult.getMessage());
|
|
|
- }
|
|
|
-
|
|
|
- } catch (Exception e) {
|
|
|
- System.out.println("\n❌ 测试过程中发生异常: " + e.getMessage());
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
-
|
|
|
- System.out.println("\n=== H5收银台测试完成 ===");
|
|
|
- System.out.println("注意事项:");
|
|
|
- System.out.println("1. 如果支付链接生成成功,请在浏览器中打开进行实际支付测试");
|
|
|
- System.out.println("2. 支付完成后可以再次运行查询方法验证支付状态");
|
|
|
- System.out.println("3. 异步通知需要配置真实的回调地址才能接收到通联的通知");
|
|
|
- System.out.println("4. 生产环境使用时请确保配置正确的商户信息和密钥");
|
|
|
-
|
|
|
- /*
|
|
|
- // ========== 以下为其他测试代码,暂时注释 ==========
|
|
|
-
|
|
|
- // 测试2: 退款操作 (需要有原始交易)
|
|
|
- System.out.println("\n=== 测试退款操作 ===");
|
|
|
- String refundReqsn = "REFUND" + System.currentTimeMillis();
|
|
|
- String oldTrxId = "TL" + (System.currentTimeMillis() - 1000); // 模拟原交易ID
|
|
|
- String oldReqsn = "OLD" + (System.currentTimeMillis() - 1000); // 模拟原订单号
|
|
|
-
|
|
|
- try {
|
|
|
- Map<String, String> refundResult = payService.refund(trxamt, refundReqsn, oldTrxId, oldReqsn);
|
|
|
- System.out.println("退款结果: " + refundResult);
|
|
|
-
|
|
|
- if ("SUCCESS".equals(refundResult.get("retcode"))) {
|
|
|
- System.out.println("退款成功!");
|
|
|
- System.out.println("退款交易ID: " + refundResult.get("trxid"));
|
|
|
- } else {
|
|
|
- System.out.println("退款失败: " + refundResult.get("retmsg"));
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- System.out.println("退款异常: " + e.getMessage());
|
|
|
- }
|
|
|
-
|
|
|
- // 测试3: 撤销操作
|
|
|
- System.out.println("\n=== 测试撤销操作 ===");
|
|
|
- String cancelReqsn = "CANCEL" + System.currentTimeMillis();
|
|
|
-
|
|
|
- try {
|
|
|
- Map<String, String> cancelResult = payService.cancel(trxamt, cancelReqsn, oldTrxId, oldReqsn);
|
|
|
- System.out.println("撤销结果: " + cancelResult);
|
|
|
-
|
|
|
- if ("SUCCESS".equals(cancelResult.get("retcode"))) {
|
|
|
- System.out.println("撤销成功!");
|
|
|
- System.out.println("撤销交易ID: " + cancelResult.get("trxid"));
|
|
|
- } else {
|
|
|
- System.out.println("撤销失败: " + cancelResult.get("retmsg"));
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- System.out.println("撤销异常: " + e.getMessage());
|
|
|
- }
|
|
|
-
|
|
|
- // 测试5: HTTP连接工具测试
|
|
|
- System.out.println("\n=== 测试HTTP连接工具 ===");
|
|
|
- try {
|
|
|
- HttpConnectionUtil httpUtil = new HttpConnectionUtil(SybConstants.SYB_APIURL + "/unitorder/query");
|
|
|
- httpUtil.init();
|
|
|
-
|
|
|
- TreeMap<String, String> httpParams = new TreeMap<>();
|
|
|
- httpParams.put("appid", SybConstants.SYB_APPID);
|
|
|
- httpParams.put("cusid", SybConstants.SYB_CUSID);
|
|
|
- httpParams.put("version", "11");
|
|
|
- httpParams.put("reqsn", reqsn);
|
|
|
- httpParams.put("randomstr", SybUtil.getValidatecode(8));
|
|
|
- httpParams.put("signtype", SybConstants.SIGN_TYPE);
|
|
|
-
|
|
|
- String appkey = "MD5".equals(SybConstants.SIGN_TYPE) ? SybConstants.SYB_MD5_APPKEY :
|
|
|
- "RSA".equals(SybConstants.SIGN_TYPE) ? SybConstants.SYB_RSACUSPRIKEY :
|
|
|
- SybConstants.SYB_SM2PPRIVATEKEY;
|
|
|
-
|
|
|
- httpParams.put("sign", SybUtil.unionSign(httpParams, appkey, SybConstants.SIGN_TYPE));
|
|
|
-
|
|
|
- byte[] response = httpUtil.postParams(httpParams, true);
|
|
|
- String responseStr = new String(response, "UTF-8");
|
|
|
- System.out.println("HTTP请求响应: " + responseStr);
|
|
|
-
|
|
|
- httpUtil.destory();
|
|
|
-
|
|
|
- } catch (Exception e) {
|
|
|
- System.out.println("HTTP连接测试异常: " + e.getMessage());
|
|
|
- }
|
|
|
-
|
|
|
- */
|
|
|
- }
|
|
|
-}
|