|
|
|
@ -1,13 +1,10 @@ |
|
|
|
|
package com.dxhy.order.utils; |
|
|
|
|
|
|
|
|
|
import cn.hutool.http.HttpRequest; |
|
|
|
|
import com.dxhy.order.model.R; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
|
import java.io.FileInputStream; |
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.io.InputStream; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
@ -27,6 +24,7 @@ public class HttpUtils { |
|
|
|
|
* @return |
|
|
|
|
* @throws IOException |
|
|
|
|
*/ |
|
|
|
|
//发票回推(调用外网) 调用旧开放平台 (可以不改造)
|
|
|
|
|
public static String doPost(String url, Map<String, ?> paramMap) { |
|
|
|
|
Map<String, Object> requestMap = new HashMap<>(paramMap); |
|
|
|
|
long startTime = System.currentTimeMillis(); |
|
|
|
@ -35,7 +33,7 @@ public class HttpUtils { |
|
|
|
|
log.debug("{}以Map调用post请求url:{},耗时:{}", LOGGER_MSG, url, endTime - startTime); |
|
|
|
|
return body; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//调用开放平台 bigdata 税控 票池
|
|
|
|
|
public static String doPost(String url, String request) { |
|
|
|
|
long startTime = System.currentTimeMillis(); |
|
|
|
|
String body = HttpRequest.post(url).body(request).timeout(300000).execute().body(); |
|
|
|
@ -43,7 +41,7 @@ public class HttpUtils { |
|
|
|
|
log.debug("{}以字符串调用post请求url:{},耗时:{}", LOGGER_MSG, url, endTime - startTime); |
|
|
|
|
return body; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//调用基础服务 如果不使用c48不用改造
|
|
|
|
|
public static String doPostWithHeader(String url, String data, Map<String, String> header) { |
|
|
|
|
long startTime = System.currentTimeMillis(); |
|
|
|
|
String body = HttpRequest.post(url).addHeaders(header).body(data).timeout(300000).execute().body(); |
|
|
|
@ -51,16 +49,7 @@ public class HttpUtils { |
|
|
|
|
log.debug("{}带head调用post请求url:{},耗时:{}", LOGGER_MSG, url, endTime - startTime); |
|
|
|
|
return body; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static String doPostFormWithHeader(String url, Map<String, ?> paramMap, Map<String, String> header) { |
|
|
|
|
Map<String, Object> requestMap = new HashMap<>(paramMap); |
|
|
|
|
long startTime = System.currentTimeMillis(); |
|
|
|
|
String body = HttpRequest.post(url).addHeaders(header).form(requestMap).timeout(300000).execute().body(); |
|
|
|
|
long endTime = System.currentTimeMillis(); |
|
|
|
|
log.debug("{}带head和form调用post请求url:{},耗时:{}", LOGGER_MSG, url, endTime - startTime); |
|
|
|
|
return body; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//调用大B获取用户 调用mqtt
|
|
|
|
|
public static String doGetWithHeader(String url, Map<String, String> header) { |
|
|
|
|
long startTime = System.currentTimeMillis(); |
|
|
|
|
String body = HttpRequest.get(url).addHeaders(header).timeout(300000).execute().body(); |
|
|
|
|