Pu Zhibing
2025-04-01 8444084e6aa11efa23287e7f82474ac22378a5c4
ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/config/WxPayConfiguration.java
@@ -1,9 +1,14 @@
package com.ruoyi.order.config;
import com.github.binarywang.wxpay.config.WxPayConfig;
import com.github.binarywang.wxpay.service.WxPayService;
import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
import com.ruoyi.common.core.utils.StringUtils;
import lombok.AllArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
@@ -18,22 +23,28 @@
  private WxPayProperties properties;
  // 分账特约商户
  private static String PLATFORM_TY_MAC_ID = "";
  private static String PLATFORM_TY_MAC_ID = "1650744551";
  public static String getPlatformTyMacId() {
    return PLATFORM_TY_MAC_ID;
  }
  /*@Bean
  @Bean
  @ConditionalOnMissingBean
  public WxPayService wxService() {
    *//*WxPayConfig payConfig = new WxPayConfig();
    WxPayConfig payConfig = new WxPayConfig();
    payConfig.setAppId(StringUtils.trimToNull(this.properties.getAppId()));
    payConfig.setMchId(StringUtils.trimToNull(this.properties.getMchId()));
    payConfig.setMchKey(StringUtils.trimToNull(this.properties.getMchKey()));
    payConfig.setSubAppId(StringUtils.trimToNull(this.properties.getSubAppId()));
    payConfig.setSubMchId(StringUtils.trimToNull(this.properties.getSubMchId()));
    payConfig.setKeyPath(StringUtils.trimToNull(this.properties.getKeyPath()));
    payConfig.setApiV3Key(StringUtils.trimToNull(this.properties.getApiV3Key()));
    payConfig.setPrivateKeyPath(StringUtils.trimToNull(this.properties.getPrivateKeyPath()));
    payConfig.setPrivateCertPath(StringUtils.trimToNull(this.properties.getPrivateCertPath()));
    payConfig.setNotifyUrl("https://wxapp.hhhrt.cn/order/app/notify/payNotify");
    // 平台特约商户号
    PLATFORM_TY_MAC_ID = this.properties.getPlatformTyMacId();
@@ -43,7 +54,7 @@
    WxPayService wxPayService = new WxPayServiceImpl();
    wxPayService.setConfig(payConfig);
    return wxPayService;*//*
  }*/
    return wxPayService;
  }
}