From 707108083df29fd5f190657dc18bb37fb557d196 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Thu, 27 Jul 2023 23:56:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E9=97=ADclient?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java index 9d5792b..4ee104b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/irs/sign/IRSAPIRequest.java @@ -6,6 +6,7 @@ import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.util.StrPool; import com.ningdatech.pmapi.irs.config.IrsSealPlatformProperties; import com.ningdatech.pmapi.todocenter.model.dto.SignReqDTO; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.tuple.Pair; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; @@ -34,7 +35,7 @@ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; - +@Slf4j public class IRSAPIRequest { /** @@ -121,21 +122,22 @@ public class IRSAPIRequest { .setSocketTimeout(5000) .build(); // 通过 HttpClientBuilder 的 custom() 方法创建自定义的 HttpClient - HttpClient customHttpClient = HttpClients.custom() + CloseableHttpClient customHttpClient = HttpClients.custom() .setDefaultRequestConfig(requestConfig) .build(); HttpResponse res = customHttpClient.execute(req); int statusCode = res.getStatusLine().getStatusCode(); - System.out.println(statusCode); + log.info(String.valueOf(statusCode)); if (200 != statusCode) { - System.out.println(statusCode); + log.info(String.valueOf(statusCode)); } // 获取响应 InputStream in = res.getEntity().getContent(); byte[] resp = readStream(in); String strRes = new String(resp, StandardCharsets.UTF_8); - System.out.println(strRes); + log.info(strRes); + customHttpClient.close(); return strRes; }