| | |
| | | private static String tokenUrl = "https://ipaasuat.zhibang.com:4430/open-api/rest/core/auth/login"; |
| | | private static String zhanquUrl = "https://ipaasuat.zhibang.com:4430/open-api/mdm/cust-territories-trees/query"; |
| | | |
| | | public String getIPassToken() throws IOException { |
| | | public String getIPassToken(String userName,String password,String tokenUrl) throws IOException { |
| | | OkHttpClient client = new OkHttpClient().newBuilder() |
| | | .build(); |
| | | MediaType mediaType = MediaType.parse("application/json; charset=utf-8"); |
| | |
| | | |
| | | |
| | | |
| | | public List<ZhanQuVO> getIPassZhanquList() throws IOException { |
| | | public List<ZhanQuVO> getIPassZhanquList(String userName,String password,String tokenUrl,String zhanquUrl) throws IOException { |
| | | OkHttpClient client = new OkHttpClient().newBuilder() |
| | | .build(); |
| | | MediaType mediaType = MediaType.parse("application/json"); |
| | |
| | | Request request = new Request.Builder() |
| | | .url(zhanquUrl) |
| | | .method("POST", body) |
| | | .addHeader("identitytoken", getIPassToken()) |
| | | .addHeader("identitytoken", getIPassToken(userName,password,tokenUrl)) |
| | | .addHeader("User-Agent", "Apifox/1.0.0 (https://apifox.com)") |
| | | .addHeader("Content-Type", "application/json") |
| | | .build(); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | public static void main(String[] args) throws IOException { |
| | | IPass iPass = new IPass(); |
| | | iPass.getIPassZhanquList(); |
| | | } |
| | | |
| | | |
| | | } |