java.lang.Object
com.sankcrm.erp.auth.infrastructure.thirdauth.wechant.WechatUtils

@Component public class WechatUtils extends Object
微信配置
Since:
2.1.4
Author:
zhsxin
create time:
2023/11/23 下午4:21
  • Field Details

  • Constructor Details

    • WechatUtils

      public WechatUtils(org.springframework.web.client.RestTemplate restTemplate)
  • Method Details

    • parse

      public static <T> T parse(String jsonText, Type type)
    • toJson

      public static String toJson(Object val)
    • requestCallback

      public static org.springframework.web.client.RequestCallback requestCallback(StringBuffer debug)
      处理请求参数
      Parameters:
      debug - Debug
      Returns:
      RequestCallback
      Since:
      2.1.5
    • responseExtractor

      public static <T> org.springframework.web.client.ResponseExtractor<T> responseExtractor(Class<T> type, StringBuffer debug)
      处理响应
      Type Parameters:
      T - 类型
      Parameters:
      type - 类型
      debug - Debug
      Returns:
      ResponseExtractor
      Since:
      2.1.5
    • sha1

      public static String sha1(String src)
      数据签名
      Parameters:
      src - 数据
      Returns:
      签名
      Since:
      2.1.5
    • toWechatScope

      public static String toWechatScope(Scopes scope)
      授权范围转换
      Parameters:
      scope - 授权范围
      Returns:
      WechatScope
      Since:
      2.1.7
    • toScope

      public static Scopes toScope(String scope)
      授权范围转换
      Parameters:
      scope - 授权范围
      Returns:
      Scopes
      Since:
      2.1.7
    • getUserinfoByCode

      public static AuthCodeVerifier.UserInfo getUserinfoByCode(ThirdAppInfo thirdApp, String code)
      授权码转换帐号信息
      Parameters:
      thirdApp - 微信应用信息
      code - 微信授权码
      Returns:
      微信帐号信息
      Since:
      2.1.7
    • get

      public static <T> T get(String uri, Map<String,String> param, Class<T> retType)
      发送Get请求
      Type Parameters:
      T - 类型
      Parameters:
      uri - 请求地址
      param - 参数
      retType - 返回值类型
      Returns:
      请求结果
      Since:
      2.1.7
    • v3Request

      public static com.sankcrm.erp.auth.application.thirdauth.command.request.BizResult v3Request(ThirdAppInfo thirdApp, String url, Map<String,Object> bizContent, String appCode, String mchIdName, org.springframework.http.HttpMethod httpMethod, String mchId)
      发送微信请求
      Parameters:
      thirdApp - 应用信息
      url - 接口
      bizContent - 请求参数
      mchIdName - 商户号参数名
      Returns:
      请求结果
      Since:
      2.1.6
    • v2Request

      public static com.sankcrm.erp.auth.application.thirdauth.command.request.BizResult v2Request(ThirdAppInfo thirdApp, String url, Map<String,Object> bizContent, String appCode, String mchIdName, String mchId)
      发送微信请求
      Parameters:
      thirdApp - 应用信息
      url - 接口
      bizContent - 请求参数
      mchIdName - 商户号参数名
      mchId - 商户号
      Returns:
      请求结果
      Since:
      2.1.6
    • getV2Sign

      public static String getV2Sign(Map<String,Object> params, String payKey)
      获得支付签名(微信支付,现金红包)
      Parameters:
      params - 参数
      payKey - 密钥
      Returns:
      签名
    • v2MapToXml

      public static String v2MapToXml(Map<String,Object> params)
    • removeClient

      public static boolean removeClient(com.sankcrm.erp.auth.domain.model.thirdauth.ThirdAppId thirdAppId)
      Parameters:
      thirdAppId - 应用信息
      Returns:
      true
      Since:
      2.1.6