|
|
@@ -1,495 +1,43 @@
|
|
|
-//package com.energy.manage.common.util;
|
|
|
-//
|
|
|
-//import com.alibaba.fastjson.JSONObject;
|
|
|
-//import org.apache.http.HttpEntity;
|
|
|
-//import org.apache.http.HttpResponse;
|
|
|
-//import org.apache.http.HttpStatus;
|
|
|
-//import org.apache.http.NameValuePair;
|
|
|
-//import org.apache.http.client.entity.UrlEncodedFormEntity;
|
|
|
-//import org.apache.http.client.methods.*;
|
|
|
-//import org.apache.http.client.utils.URIBuilder;
|
|
|
-//import org.apache.http.entity.StringEntity;
|
|
|
-//import org.apache.http.impl.client.CloseableHttpClient;
|
|
|
-//import org.apache.http.impl.client.DefaultHttpClient;
|
|
|
-//import org.apache.http.impl.client.HttpClients;
|
|
|
-//import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
|
|
-//import org.apache.http.message.BasicNameValuePair;
|
|
|
-//import org.apache.http.util.EntityUtils;
|
|
|
-//import org.slf4j.Logger;
|
|
|
-//import org.slf4j.LoggerFactory;
|
|
|
-//import org.springframework.util.CollectionUtils;
|
|
|
-//import org.springframework.util.StringUtils;
|
|
|
-//
|
|
|
-//import javax.servlet.http.HttpServletRequest;
|
|
|
-//import java.io.*;
|
|
|
-//import java.net.URISyntaxException;
|
|
|
-//import java.net.URL;
|
|
|
-//import java.net.URLConnection;
|
|
|
-//import java.net.URLDecoder;
|
|
|
-//import java.util.ArrayList;
|
|
|
-//import java.util.List;
|
|
|
-//import java.util.Map;
|
|
|
-//
|
|
|
-///**
|
|
|
-// * @author LIKE
|
|
|
-// * @date 2017年1月18日 下午6:07:06
|
|
|
-// */
|
|
|
-//public class HttpUtils {
|
|
|
-// private static Logger logger = LoggerFactory.getLogger(HttpUtils.class);
|
|
|
-// private static PoolingHttpClientConnectionManager cm;
|
|
|
-// private static String DEFAULT_ENCODING = "UTF-8";
|
|
|
-// private final static int CONNECT_TIMEOUT = 5000;
|
|
|
-//
|
|
|
-// private static void init() {
|
|
|
-// if (cm == null) {
|
|
|
-// cm = new PoolingHttpClientConnectionManager();
|
|
|
-// // 整个链接池最大链接数
|
|
|
-// cm.setMaxTotal(50);
|
|
|
-// // 每个路由最大链接数,默认是2
|
|
|
-// cm.setDefaultMaxPerRoute(5);
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * GET 请求
|
|
|
-// *
|
|
|
-// * @param url
|
|
|
-// * @return
|
|
|
-// */
|
|
|
-// public static String httpGetRequest(String url) {
|
|
|
-// return httpGetRequest(url, null, null);
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * GET 带参 请求
|
|
|
-// *
|
|
|
-// * @param url
|
|
|
-// * @param params
|
|
|
-// * @return
|
|
|
-// */
|
|
|
-// public static String httpGetRequest(String url, Map<String, Object> params) {
|
|
|
-// return httpGetRequest(url, null, params);
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * Post 请求
|
|
|
-// *
|
|
|
-// * @param url
|
|
|
-// * @return
|
|
|
-// */
|
|
|
-// public static String httpPostRequest(String url) {
|
|
|
-// return httpPostRequest(url, null, "");
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * POST 带参 请求
|
|
|
-// *
|
|
|
-// * @param url
|
|
|
-// * @param params
|
|
|
-// * @return
|
|
|
-// * @throws UnsupportedEncodingException
|
|
|
-// */
|
|
|
-// public static String httpPostRequest(String url, Map<String, Object> params) {
|
|
|
-// return httpPostRequest(url, null, params);
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * Get 带参 带header 请求
|
|
|
-// *
|
|
|
-// * @param url
|
|
|
-// * @param headers
|
|
|
-// * @param params
|
|
|
-// * @return
|
|
|
-// * @throws URISyntaxException
|
|
|
-// */
|
|
|
-// public static String httpGetRequest(String url, Map<String, Object> headers, Map<String, Object> params) {
|
|
|
-// // 创建连接地址
|
|
|
-// if (StringUtils.isEmpty(url)) {
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-// URIBuilder ub = new URIBuilder();
|
|
|
-// ub.setPath(url);
|
|
|
-// // 拼接参数
|
|
|
-// if (!CollectionUtils.isEmpty(params)) {
|
|
|
-// List<NameValuePair> pairs = covertParams2NVPS(params);
|
|
|
-// ub.setParameters(pairs);
|
|
|
-// }
|
|
|
-// try {
|
|
|
-// // 构建请求内容
|
|
|
-// HttpGet httpGet = new HttpGet(ub.build());
|
|
|
-// // 自定义header内容
|
|
|
-// if (!CollectionUtils.isEmpty(headers)) {
|
|
|
-// for (Map.Entry<String, Object> param : headers.entrySet()) {
|
|
|
-// httpGet.addHeader(param.getKey(), String.valueOf(param.getValue()));
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return getResult(httpGet);
|
|
|
-// } catch (URISyntaxException ue) {
|
|
|
-// logger.error(ue.getMessage(), ue);
|
|
|
-// } catch (IOException ie) {
|
|
|
-// logger.error(ie.getMessage(), ie);
|
|
|
-// } catch (Exception ex) {
|
|
|
-// logger.error(ex.getMessage(), ex);
|
|
|
-// }
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-//
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * POST 带参 带Header 请求
|
|
|
-// *
|
|
|
-// * @param url
|
|
|
-// * @param headers
|
|
|
-// * @param params
|
|
|
-// * @return
|
|
|
-// * @throws UnsupportedEncodingException
|
|
|
-// */
|
|
|
-// public static String httpPostRequest(String url, Map<String, Object> headers, Map<String, Object> params) {
|
|
|
-// if (StringUtils.isEmpty(url)) {
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-// HttpPost httpPost = new HttpPost(url);
|
|
|
-// if (!CollectionUtils.isEmpty(headers)) {
|
|
|
-// for (Map.Entry<String, Object> param : headers.entrySet()) {
|
|
|
-// httpPost.addHeader(param.getKey(), String.valueOf(param.getValue()));
|
|
|
-// }
|
|
|
-// }
|
|
|
-// try {
|
|
|
-// if (!CollectionUtils.isEmpty(params)) {
|
|
|
-// List<NameValuePair> pairs = covertParams2NVPS(params);
|
|
|
-// httpPost.setEntity(new UrlEncodedFormEntity(pairs, "UTF-8"));
|
|
|
-// }
|
|
|
-// return getResult(httpPost);
|
|
|
-// } catch (UnsupportedEncodingException uee) {
|
|
|
-// logger.error(uee.getMessage(), uee);
|
|
|
-// } catch (IOException ie) {
|
|
|
-// logger.error(ie.getMessage(), ie);
|
|
|
-// } catch (Exception ex) {
|
|
|
-// logger.error(ex.getMessage(), ex);
|
|
|
-// }
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * POST 带参 带Header 请求
|
|
|
-// *
|
|
|
-// * @param url
|
|
|
-// * @param headers
|
|
|
-// * @param params
|
|
|
-// * @return
|
|
|
-// * @throws UnsupportedEncodingException
|
|
|
-// */
|
|
|
-// public static String httpPostRequest(String url, Map<String, Object> headers, String params) {
|
|
|
-// if (StringUtils.isEmpty(url)) {
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-// HttpPost httpPost = new HttpPost(url);
|
|
|
-// if (!CollectionUtils.isEmpty(headers)) {
|
|
|
-// for (Map.Entry<String, Object> param : headers.entrySet()) {
|
|
|
-// httpPost.addHeader(param.getKey(), String.valueOf(param.getValue()));
|
|
|
-// }
|
|
|
-// }
|
|
|
-// try {
|
|
|
-// if (!StringUtils.isEmpty(params)) {
|
|
|
-// StringEntity stringEntity = new StringEntity(params, "UTF-8");
|
|
|
-// httpPost.setEntity(stringEntity);
|
|
|
-// }
|
|
|
-// return getResult(httpPost);
|
|
|
-// } catch (UnsupportedEncodingException uee) {
|
|
|
-// logger.error(uee.getMessage(), uee);
|
|
|
-// } catch (IOException ie) {
|
|
|
-// logger.error(ie.getMessage(), ie);
|
|
|
-// } catch (Exception ex) {
|
|
|
-// logger.error(ex.getMessage(), ex);
|
|
|
-// }
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * DELETE 带参 带Header 请求
|
|
|
-// *
|
|
|
-// * @param url
|
|
|
-// * @param headers
|
|
|
-// * @return
|
|
|
-// * @throws UnsupportedEncodingException
|
|
|
-// */
|
|
|
-// public static String httpDeleteRequest(String url, Map<String, Object> headers) {
|
|
|
-// if (StringUtils.isEmpty(url)) {
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-// HttpDelete httpDelete = new HttpDelete(url);
|
|
|
-// if (!CollectionUtils.isEmpty(headers)) {
|
|
|
-// for (String key : headers.keySet()) {
|
|
|
-// httpDelete.addHeader(key, String.valueOf(headers.get(key)));
|
|
|
-// }
|
|
|
-// }
|
|
|
-// try {
|
|
|
-// return getResult(httpDelete);
|
|
|
-// } catch (UnsupportedEncodingException uee) {
|
|
|
-// logger.error(uee.getMessage(), uee);
|
|
|
-// } catch (IOException ie) {
|
|
|
-// logger.error(ie.getMessage(), ie);
|
|
|
-// } catch (Exception ex) {
|
|
|
-// logger.error(ex.getMessage(), ex);
|
|
|
-// }
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 内部方法,构建参数链
|
|
|
-// *
|
|
|
-// * @param params
|
|
|
-// * @return
|
|
|
-// */
|
|
|
-// private static List<NameValuePair> covertParams2NVPS(Map<String, Object> params) {
|
|
|
-// List<NameValuePair> pairs = new ArrayList<NameValuePair>();
|
|
|
-// for (Map.Entry<String, Object> param : params.entrySet()) {
|
|
|
-// pairs.add(new BasicNameValuePair(param.getKey(), String.valueOf(param.getValue())));
|
|
|
-// }
|
|
|
-// return pairs;
|
|
|
-// }
|
|
|
-//
|
|
|
-// private static CloseableHttpClient getHttpClient() {
|
|
|
-// init();
|
|
|
-// return HttpClients.custom().setConnectionManager(cm).build();
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 内部方法,请求执行体
|
|
|
-// *
|
|
|
-// * @param request
|
|
|
-// * @return
|
|
|
-// * @throws IOException
|
|
|
-// */
|
|
|
-// private static String getResult(HttpRequestBase request) throws IOException {
|
|
|
-// CloseableHttpClient httpClient = getHttpClient();
|
|
|
-// CloseableHttpResponse resp = httpClient.execute(request);
|
|
|
-// //响应状态
|
|
|
-// if (resp.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
|
|
|
-// long contentLength = resp.getEntity().getContentLength();
|
|
|
-// if (contentLength == 0) {
|
|
|
-// return "";
|
|
|
-// }
|
|
|
-// // 响应实体
|
|
|
-// HttpEntity entity = resp.getEntity();
|
|
|
-// String result = EntityUtils.toString(entity);
|
|
|
-// resp.close();
|
|
|
-// logger.info("httpClient 结果=>:" + result);
|
|
|
-// return result;
|
|
|
-// } else {
|
|
|
-// logger.error(HttpUtils.class.getName() + " getResult error:" + resp.getStatusLine().getStatusCode());
|
|
|
-// }
|
|
|
-// // 响应实体
|
|
|
-// HttpEntity entity = resp.getEntity();
|
|
|
-// if (entity != null) {
|
|
|
-// // long len = entity.getContentLength();// -1 表示长度未知
|
|
|
-// String result = EntityUtils.toString(entity);
|
|
|
-// resp.close();
|
|
|
-// logger.info("httpClient 结果=>:" + result);
|
|
|
-// return result;
|
|
|
-// }
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * httpPost
|
|
|
-// * @param url
|
|
|
-// * @param jsonParam
|
|
|
-// * @param noNeedResponse
|
|
|
-// * @return
|
|
|
-// */
|
|
|
-// public static JSONObject httpPost(String url, JSONObject jsonParam, boolean noNeedResponse) {
|
|
|
-// CloseableHttpClient httpClient = HttpClients.createDefault();
|
|
|
-// JSONObject jsonResult = null;
|
|
|
-// HttpPost method = new HttpPost(url);
|
|
|
-// try {
|
|
|
-// if (jsonParam != null) {
|
|
|
-// // 解决中文乱码问题
|
|
|
-// StringEntity entity = new StringEntity(jsonParam.toString(), "utf-8");
|
|
|
-// entity.setContentEncoding("UTF-8");
|
|
|
-// entity.setContentType("application/json");
|
|
|
-// method.setEntity(entity);
|
|
|
-// }
|
|
|
-// HttpResponse result = httpClient.execute(method);
|
|
|
-// url = URLDecoder.decode(url, "UTF-8");
|
|
|
-// /** 请求发送成功,并得到响应 **/
|
|
|
-// if (result.getStatusLine().getStatusCode() == 200) {
|
|
|
-// String str = "";
|
|
|
-// try {
|
|
|
-// /** 读取服务器返回过来的json字符串数据 **/
|
|
|
-// str = EntityUtils.toString(result.getEntity());
|
|
|
-// if (noNeedResponse) {
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-// /** 把json字符串转换成json对象 **/
|
|
|
-// jsonResult = JSONObject.parseObject(str);
|
|
|
-// } catch (Exception e) {
|
|
|
-// logger.error("post请求提交失败:" + url, e);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// } catch (Exception e) {
|
|
|
-// e.printStackTrace();
|
|
|
-// }
|
|
|
-// return jsonResult;
|
|
|
-// }
|
|
|
-//
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 发送get请求
|
|
|
-// *
|
|
|
-// * @param
|
|
|
-// * @return
|
|
|
-// */
|
|
|
-// public static String httpGet(String url) {
|
|
|
-// // get请求返回结果
|
|
|
-// JSONObject jsonResult = null;
|
|
|
-// String str = null;
|
|
|
-// try {
|
|
|
-// DefaultHttpClient client = new DefaultHttpClient();
|
|
|
-// // 发送get请求
|
|
|
-// HttpGet request = new HttpGet(url);
|
|
|
-// HttpResponse response = client.execute(request);
|
|
|
-// // 请求发送成功,并得到响应
|
|
|
-// if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
|
|
|
-// // 读取服务器返回过来的json字符串数据
|
|
|
-// str = EntityUtils.toString(response.getEntity());
|
|
|
-// url = URLDecoder.decode(url, "UTF-8");
|
|
|
-// } else {
|
|
|
-// logger.error("get请求提交失败:" + url);
|
|
|
-// }
|
|
|
-// } catch (IOException e) {
|
|
|
-// logger.error("get请求提交失败:" + url, e);
|
|
|
-// }
|
|
|
-// return str;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 内部方法,获取客户端ip
|
|
|
-// */
|
|
|
-// public static String getIpAddress(HttpServletRequest request) {
|
|
|
-// String ip = request.getHeader("X-Real-IP");
|
|
|
-// if (!(StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip))) {
|
|
|
-// return ip;
|
|
|
-// }
|
|
|
-// ip = request.getHeader("x-real-ip");
|
|
|
-// if (!(StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip))) {
|
|
|
-// return ip;
|
|
|
-// }
|
|
|
-// ip = request.getHeader("X-Forwarded-For");
|
|
|
-// if (!(StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip))) {
|
|
|
-// return ip;
|
|
|
-// }
|
|
|
-// ip = request.getHeader("x-forwarded-for");
|
|
|
-// if (!(StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip))) {
|
|
|
-// return ip;
|
|
|
-// }
|
|
|
-// ip = request.getHeader("Proxy-Client-IP");
|
|
|
-// if (!(StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip))) {
|
|
|
-// return ip;
|
|
|
-// }
|
|
|
-// ip = request.getHeader("WL-Proxy-Client-IP");
|
|
|
-// if (!(StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip))) {
|
|
|
-// return ip;
|
|
|
-// }
|
|
|
-// ip = request.getHeader("HTTP_CLIENT_IP");
|
|
|
-// if (!(StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip))) {
|
|
|
-// return ip;
|
|
|
-// }
|
|
|
-// ip = request.getHeader("HTTP_X_FORWARDED_FOR");
|
|
|
-// if (!(StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip))) {
|
|
|
-// return ip;
|
|
|
-// }
|
|
|
-// ip = request.getRemoteAddr();
|
|
|
-// if (!(StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip))) {
|
|
|
-// return ip;
|
|
|
-// }
|
|
|
-// return ip;
|
|
|
-// }
|
|
|
-//
|
|
|
-// public static String postData(String urlStr, String data) {
|
|
|
-// BufferedReader reader = null;
|
|
|
-// try {
|
|
|
-// URL url = new URL(urlStr);
|
|
|
-// URLConnection conn = url.openConnection();
|
|
|
-// conn.setDoOutput(true);
|
|
|
-// conn.setConnectTimeout(CONNECT_TIMEOUT);
|
|
|
-// conn.setReadTimeout(CONNECT_TIMEOUT);
|
|
|
-// OutputStreamWriter writer = new OutputStreamWriter(conn.getOutputStream(), DEFAULT_ENCODING);
|
|
|
-// if (data == null)
|
|
|
-// data = "";
|
|
|
-// writer.write(data);
|
|
|
-// writer.flush();
|
|
|
-// writer.close();
|
|
|
-//
|
|
|
-// reader = new BufferedReader(new InputStreamReader(conn.getInputStream(), DEFAULT_ENCODING));
|
|
|
-// StringBuilder sb = new StringBuilder();
|
|
|
-// String line = null;
|
|
|
-// while ((line = reader.readLine()) != null) {
|
|
|
-// sb.append(line);
|
|
|
-// sb.append("\r\n");
|
|
|
-// }
|
|
|
-// return sb.toString();
|
|
|
-// } catch (IOException e) {
|
|
|
-// //logger.error("Error connecting to " + urlStr + ": " + e.getMessage());
|
|
|
-// } finally {
|
|
|
-// try {
|
|
|
-// if (reader != null)
|
|
|
-// reader.close();
|
|
|
-// } catch (IOException e) {
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-//
|
|
|
-// public static boolean isMobileDevice(HttpServletRequest request) {
|
|
|
-// /**
|
|
|
-// * android : 所有android设备
|
|
|
-// * mac os : iphone ipad
|
|
|
-// * windows phone:Nokia等windows系统的手机
|
|
|
-// */
|
|
|
-// try {
|
|
|
-// String requestHeader = request.getHeader("user-agent");
|
|
|
-// if (requestHeader == null) {
|
|
|
-// return false;
|
|
|
-//
|
|
|
-// }
|
|
|
-// String[] deviceArray = new String[]{"android", "mac os", "windows phone"};
|
|
|
-// requestHeader = requestHeader.toLowerCase();
|
|
|
-// for (int i = 0; i < deviceArray.length; i++) {
|
|
|
-// if (requestHeader.indexOf(deviceArray[i]) > 0) {
|
|
|
-// return true;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// } catch (Exception ex) {
|
|
|
-// ex.printStackTrace();
|
|
|
-// }
|
|
|
-// return false;
|
|
|
-// }
|
|
|
-//
|
|
|
-//
|
|
|
-// public static String httpPutRequest(String url, Map<String, Object> headers, String params) {
|
|
|
-// if (StringUtils.isEmpty(url)) {
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-// HttpPut httpPut = new HttpPut(url);
|
|
|
-// if (!CollectionUtils.isEmpty(headers)) {
|
|
|
-// for (Map.Entry<String, Object> param : headers.entrySet()) {
|
|
|
-// httpPut.addHeader(param.getKey(), String.valueOf(param.getValue()));
|
|
|
-// }
|
|
|
-// }
|
|
|
-// try {
|
|
|
-// if (!StringUtils.isEmpty(params)) {
|
|
|
-// StringEntity stringEntity = new StringEntity(params, "UTF-8");
|
|
|
-// httpPut.setEntity(stringEntity);
|
|
|
-// }
|
|
|
-// return getResult(httpPut);
|
|
|
-// } catch (UnsupportedEncodingException uee) {
|
|
|
-// logger.error(uee.getMessage(), uee);
|
|
|
-// } catch (IOException ie) {
|
|
|
-// logger.error(ie.getMessage(), ie);
|
|
|
-// } catch (Exception ex) {
|
|
|
-// logger.error(ex.getMessage(), ex);
|
|
|
-// }
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-//}
|
|
|
+package com.energy.manage.common.util;
|
|
|
+
|
|
|
+import cn.hutool.http.HttpUtil;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author LIKE
|
|
|
+ * @date 2017年1月18日 下午6:07:06
|
|
|
+ */
|
|
|
+public class HttpUtils {
|
|
|
+
|
|
|
+ private final static String GET_UNION_STR = "?";
|
|
|
+
|
|
|
+ /**
|
|
|
+ * http请求时长
|
|
|
+ */
|
|
|
+ private final static int TIME_OUT = 3000;
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * get 方法
|
|
|
+ * @param url
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static JSONObject doGet(String url, Map<String,Object> param){
|
|
|
+ //做字符串拼接
|
|
|
+ url = url + GET_UNION_STR + HttpUtil.toParams(param);
|
|
|
+ return JSONObject.parseObject(HttpUtil.get(url,TIME_OUT));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * post 方法
|
|
|
+ * @param url
|
|
|
+ * @param params
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static JSONObject doPost(String url, Map<String,Object> params){
|
|
|
+ return JSONObject.parseObject(HttpUtil.post(url,params,TIME_OUT));
|
|
|
+ }
|
|
|
+}
|