From 4815b5d1c49425c34fcf88aa97765baaf9091f99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E9=B9=8F=E9=A3=9E?= Date: Fri, 29 Mar 2024 16:42:08 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=B8=80=E7=82=B9=E7=82=B9?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/nflg/product/bomnew/util/HttpUtils.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/util/HttpUtils.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/util/HttpUtils.java index ab9a4bd6..fadf73fe 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/util/HttpUtils.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/util/HttpUtils.java @@ -6,8 +6,6 @@ import com.nflg.product.base.core.exception.NflgBusinessException; import lombok.extern.slf4j.Slf4j; import nflg.product.common.constant.STATE; import okhttp3.*; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; import java.io.File; @@ -26,8 +24,6 @@ public class HttpUtils { //请求类 private OkHttpClient okHttpClient; - private static final Logger LOGGER = LoggerFactory.getLogger(HttpUtils.class); - //请求头类型 private final MediaType jsonMediaType = MediaType.parse("application/json;charset=utf-8"); @@ -217,7 +213,7 @@ public class HttpUtils { public String doPost(String url, String json) throws IOException { String ret = null; String traceId = IdWorker.getIdStr(); - LOGGER.info(traceId + ",http请求,地址:" + url + ",参数:" + json); + log.info(traceId + ",http请求,地址:" + url + ",参数:" + json); long start = System.currentTimeMillis(); try (Response response = doPostRtnRsp(url, json)) { if (response == null || response.body() == null) { @@ -225,10 +221,10 @@ public class HttpUtils { } ret = response.body().string(); } catch (Exception ex) { - LOGGER.error(traceId + ",http请求,出错", ex); + log.error(traceId + ",http请求,出错", ex); } finally { long end = System.currentTimeMillis(); - LOGGER.info(traceId + ",http请求,耗时:" + (end - start) + "毫秒,返回:" + ret); + log.info(traceId + ",http请求,耗时:" + (end - start) + "毫秒,返回:" + ret); } return ret; }