luofl
2025-03-06 2ed6444f45d227e2acc6de65c3e8b582440fb83a
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/util/payment/PaymentUtil.java
@@ -6,6 +6,7 @@
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.other.util.payment.model.*;
import lombok.extern.slf4j.Slf4j;
@@ -30,9 +31,13 @@
    */
   private static final String merchantNo = "888122600004175";
   /**
    * 平台-报备商户号
    */
   private static final String sysTradeMerchantNo = "777168500885852";
   /**
    * 支付回调地址
    */
   private static final String callbackUrl = "http://221.182.45.100:9000";
   private static final String callbackUrl = "https://www.qijisheng.top";
   
   
   /**
@@ -77,7 +82,7 @@
      //APPID
      body.put("q7_AppId", appId);
      //报备商户号
      body.put("qa_TradeMerchantNo", tradeMerchantNo);
      body.put("qa_TradeMerchantNo", StringUtils.isNotEmpty(tradeMerchantNo) ? tradeMerchantNo : sysTradeMerchantNo);
      String sign = null;
      try {
         sign = sign(body);
@@ -252,13 +257,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());
         }
      });
      // 构造签名键值对的格式