feign skd api

package com.guohuai.mmp.investor.staffcheck.http;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.guohuai.basic.component.sms.UTF8Encoder;
import feign.Feign;
import feign.Logger.Level;
import feign.slf4j.Slf4jLogger;

@lombok.Data
@Configuration
public class HTTPSdk {

@Value("${employee.verification.host:localhost}")
private String host;

@Bean
public HTTPApi httpSdk() {
System.out.println(host);
return Feign.builder().encoder(new UTF8Encoder()).logger(new Slf4jLogger()).logLevel(Level.FULL).target(HTTPApi.class, "http://" + this.host + "/");
}
}

//employee.verification.host=localhost:80

----------------------------------------------------------------------------------

package com.guohuai.mmp.investor.staffcheck.http;

import org.springframework.web.bind.annotation.RequestParam;

import feign.Param;
import feign.RequestLine;

public interface HTTPApi {

@RequestLine("POST /employee/verification")
public String verification(@Param("ctfType") String ctfType,
@Param("personalId") String personalId);
/**
* 查询总条数
* @return
*/
@RequestLine("POST /employee/total")
public String total();

/**
* 查询总条数
* @return
*/
@RequestLine("POST /employee/list")
public String list(@Param("page") String page, @Param("pageSize") String pageSize);



/**
* OAJson接口调用获取json数据
* @return
*/
@RequestLine("POST /mimosa/oa/jsonmethod")
public String OaInterface2GetJson();


@RequestLine("GET /oaorganization/api/oa/sso/users/all")
public String OaOrganizationJsonData();

}

原文地址:https://www.cnblogs.com/lize1215/p/8510285.html