类 ApiGateWay<Config extends ApiConfig>

java.lang.Object
io.github.mangocrisp.spring.taybct.tool.core.tpa.ApiGateWay<Config>

public class ApiGateWay<Config extends ApiConfig> extends Object
广州市指挥中心110警情信息(汇聚)
  • 字段详细资料

    • loginFun

      protected BiFunction<Config extends ApiConfig,org.apache.hc.core5.http.Header[],String> loginFun
      登录的方法
    • genTokenFun

      protected Function<com.alibaba.fastjson2.JSONObject,ApiToken> genTokenFun
      生成 token 的方法
    • thirdPartName

      protected String thirdPartName
      指定第三方接口的名称
    • tokenCacheKeyFn

      protected Function<ApiConfig,String> tokenCacheKeyFn
      获取到缓存 token 的 key
    • checkResult

      protected BiConsumer<com.alibaba.fastjson2.JSONObject,String> checkResult
      检查返回结果
      resultJSON 返回结果的对象
      defaultErrorMessage 默认失败消息
    • checkLoginInfo

      protected BiFunction<Config extends ApiConfig,ConcurrentMap<String,com.alibaba.fastjson2.JSONObject>,com.alibaba.fastjson2.JSONObject> checkLoginInfo
      检查登录信息
      apiToken 登录信息
    • getRequestWithTokenHeaders

      protected Function<ApiToken,org.apache.hc.core5.http.Header[]> getRequestWithTokenHeaders
      拼接包含登录信息的请求头
      apiToken 登录信息
      return 请求头
    • clientTokenInfoMap

      protected ConcurrentMap<String,com.alibaba.fastjson2.JSONObject> clientTokenInfoMap
      缓存客户端登录信息
  • 构造器详细资料

    • ApiGateWay

      public ApiGateWay()
  • 方法详细资料

    • login

      public void login()
      登录
    • withTokenInfo

      public <E> E withTokenInfo(BiFunction<Config,org.apache.hc.core5.http.Header[],E> tokenInfoFunction)
      请求带上 token 信息
      类型参数:
      E - 返回的结果
      参数:
      tokenInfoFunction - 传 token 信息给需要调用的方法,然后返回结果
      返回:
      结果
    • clearTokenInfo

      protected void clearTokenInfo()
      清除 token 信息
    • withTokenInfoJSON

      public com.alibaba.fastjson2.JSONObject withTokenInfoJSON(BiFunction<Config,org.apache.hc.core5.http.Header[],String> tokenInfoFunction)
      带统一处理返回结果的方法
      参数:
      tokenInfoFunction - 传 token 信息给需要调用的方法,然后返回结果
      返回:
      请求的返回结果