新增河南转发功能
parent
845eaf3b6f
commit
1af0bdb6b8
@ -1,48 +1,20 @@
|
|||||||
//package com.shxy.xymanager_common.entity;
|
package com.shxy.xymanager_common.entity;
|
||||||
//
|
|
||||||
//import java.io.Serializable;
|
import lombok.Data;
|
||||||
//import java.util.Date;
|
|
||||||
//
|
import java.io.Serializable;
|
||||||
//public class ThirdUser implements Serializable {
|
import java.util.Date;
|
||||||
// private Integer name;
|
|
||||||
//
|
@Data
|
||||||
// private String password;
|
public class ThirdUser implements Serializable {
|
||||||
//
|
private Integer name;
|
||||||
// private Date tokenEffectTime;
|
|
||||||
//
|
private String password;
|
||||||
// private String token;
|
|
||||||
//
|
private Date tokenEffectTime;
|
||||||
// private static final long serialVersionUID = 1L;
|
|
||||||
//
|
private String token;
|
||||||
// public Integer getName() {
|
|
||||||
// return name;
|
private static final long serialVersionUID = 1L;
|
||||||
// }
|
|
||||||
//
|
}
|
||||||
// public void setName(Integer name) {
|
|
||||||
// this.name = name;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public String getPassword() {
|
|
||||||
// return password;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void setPassword(String password) {
|
|
||||||
// this.password = password == null ? null : password.trim();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public Date getTokenEffectTime() {
|
|
||||||
// return tokenEffectTime;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void setTokenEffectTime(Date tokenEffectTime) {
|
|
||||||
// this.tokenEffectTime = tokenEffectTime;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public String getToken() {
|
|
||||||
// return token;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void setToken(String token) {
|
|
||||||
// this.token = token == null ? null : token.trim();
|
|
||||||
// }
|
|
||||||
//}
|
|
@ -1,70 +1,70 @@
|
|||||||
//package com.shxy.xymanager_common.util.http;
|
package com.shxy.xymanager_common.util.http;
|
||||||
//import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
//import io.github.admin4j.http.HttpRequest;
|
import io.github.admin4j.http.HttpRequest;
|
||||||
//import io.github.admin4j.http.core.Pair;
|
import io.github.admin4j.http.core.Pair;
|
||||||
//import io.github.admin4j.http.util.HttpUtil;
|
import io.github.admin4j.http.util.HttpUtil;
|
||||||
//import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
//
|
|
||||||
//import java.io.File;
|
import java.io.File;
|
||||||
//import java.io.IOException;
|
import java.io.IOException;
|
||||||
//import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
//import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
//import java.util.List;
|
import java.util.List;
|
||||||
//import java.util.Map;
|
import java.util.Map;
|
||||||
//
|
|
||||||
//public class OkHttpUtils {
|
public class OkHttpUtils {
|
||||||
//
|
|
||||||
// public static JSONObject get(String url, Map<String, Object> queryParams) throws IOException {
|
public static JSONObject get(String url, Map<String, Object> queryParams) throws IOException {
|
||||||
// Response response = HttpUtil.get(url, queryParams);
|
Response response = HttpUtil.get(url, queryParams);
|
||||||
// return JSONObject.parseObject(response.body().string());
|
return JSONObject.parseObject(response.body().string());
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// public static JSONObject get(String url, Map<String, Object> queryParams, Map<String, Object> headers) throws IOException {
|
public static JSONObject get(String url, Map<String, Object> queryParams, Map<String, Object> headers) throws IOException {
|
||||||
// HttpRequest httpRequest = HttpRequest.get(url);
|
HttpRequest httpRequest = HttpRequest.get(url);
|
||||||
// setParams(queryParams, httpRequest);
|
setParams(queryParams, httpRequest);
|
||||||
// Response response = httpRequest.queryParams().headers(headers).execute();
|
Response response = httpRequest.queryParams().headers(headers).execute();
|
||||||
// return JSONObject.parseObject(response.body().string());
|
return JSONObject.parseObject(response.body().string());
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// public static JSONObject post(String url, String json) throws IOException {
|
public static JSONObject post(String url, String json) throws IOException {
|
||||||
// Response response = HttpUtil.post(url, json);
|
Response response = HttpUtil.post(url, json);
|
||||||
// assert response.body() != null;
|
assert response.body() != null;
|
||||||
// return JSONObject.parseObject(response.body().string());
|
return JSONObject.parseObject(response.body().string());
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// public static JSONObject postForm(String url, Map<String, Object> formParams) throws IOException {
|
public static JSONObject postForm(String url, Map<String, Object> formParams) throws IOException {
|
||||||
// Response response = HttpUtil.postForm(url, formParams);
|
Response response = HttpUtil.postForm(url, formParams);
|
||||||
// assert response.body() != null;
|
assert response.body() != null;
|
||||||
// return JSONObject.parseObject(response.body().string());
|
return JSONObject.parseObject(response.body().string());
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// public static JSONObject post(String url, String json, Map<String, Object> headers) throws IOException {
|
public static JSONObject post(String url, String json, Map<String, Object> headers) throws IOException {
|
||||||
// HttpRequest httpRequest = HttpRequest.post(url);
|
HttpRequest httpRequest = HttpRequest.post(url);
|
||||||
// httpRequest.setBody(json);
|
httpRequest.setBody(json);
|
||||||
// Response response = httpRequest.headers(headers).execute();
|
Response response = httpRequest.headers(headers).execute();
|
||||||
// return JSONObject.parseObject(response.body().string());
|
return JSONObject.parseObject(response.body().string());
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// private static void setParams(Map<String, Object> queryParams, HttpRequest httpRequest) {
|
private static void setParams(Map<String, Object> queryParams, HttpRequest httpRequest) {
|
||||||
// List<Pair> pairs = new ArrayList<>(queryParams.size());
|
List<Pair> pairs = new ArrayList<>(queryParams.size());
|
||||||
// queryParams.forEach((x, y) -> pairs.add(Pair.of(x, y)));
|
queryParams.forEach((x, y) -> pairs.add(Pair.of(x, y)));
|
||||||
// if (pairs.size() > 0) {
|
if (pairs.size() > 0) {
|
||||||
// pairs.forEach(httpRequest::queryParams);
|
pairs.forEach(httpRequest::queryParams);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// private static JSONObject upload() throws IOException {
|
private static JSONObject upload() throws IOException {
|
||||||
// File file = new File("C:\\Users\\andanyang\\Downloads\\Sql.txt");
|
File file = new File("C:\\Users\\andanyang\\Downloads\\Sql.txt");
|
||||||
// Map<String, Object> formParams = new HashMap<>();
|
Map<String, Object> formParams = new HashMap<>();
|
||||||
// formParams.put("key", "test");
|
formParams.put("key", "test");
|
||||||
// formParams.put("file", file);
|
formParams.put("file", file);
|
||||||
// formParams.put("token", "WXyUseb-D4sCum-EvTIDYL-mEehwDtrSBg-Zca7t:qgOcR2gUoKmxt-VnsNb657Oatzo=:eyJzY29wZSI6InpoYW56aGkiLCJkZWFkbGluZSI6MTY2NTMwNzUxNH0=");
|
formParams.put("token", "WXyUseb-D4sCum-EvTIDYL-mEehwDtrSBg-Zca7t:qgOcR2gUoKmxt-VnsNb657Oatzo=:eyJzY29wZSI6InpoYW56aGkiLCJkZWFkbGluZSI6MTY2NTMwNzUxNH0=");
|
||||||
// Response response = HttpUtil.upload("https://upload.qiniup.com/", formParams);
|
Response response = HttpUtil.upload("https://upload.qiniup.com/", formParams);
|
||||||
// return JSONObject.parseObject(response.body().string());
|
return JSONObject.parseObject(response.body().string());
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// private static void download() throws IOException {
|
private static void download() throws IOException {
|
||||||
// HttpUtil.down("https://gitee.com/admin4j/common-http","path/");
|
HttpUtil.down("https://gitee.com/admin4j/common-http","path/");
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
//}
|
}
|
Loading…
Reference in New Issue