From 5dea9d9b1f672495fb47cdbed67a980e19a42472 Mon Sep 17 00:00:00 2001 From: liuxy Date: Thu, 24 Oct 2024 15:53:23 +0800 Subject: [PATCH] =?UTF-8?q?rev=EF=BC=9A=E6=97=A5=E5=BF=97=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wms/service/impl/WmsToAcsServiceImpl.java | 6 ++-- .../java/org/nl/acs/ext/xg/XgHttpUtil.java | 5 +++ .../resources/config/application-dev2.yml | 2 +- .../src/main/resources/log/AcsToXg.xml | 33 +++++++++++++++++++ .../src/main/resources/logback-spring.xml | 1 + 5 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 acs2/nladmin-system/src/main/resources/log/AcsToXg.xml diff --git a/acs2/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java b/acs2/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java index d2b8c40..eec3e08 100644 --- a/acs2/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java +++ b/acs2/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java @@ -60,7 +60,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { CreateTaskRequest tasks = JSON.toJavaObject(req, CreateTaskRequest.class); JSONObject resultJson = new JSONObject(); CreateTaskResponse resp = new CreateTaskResponse(); - log.info("createFromWms - 请求参数 {}", JSON.toJSON(resp)); + log.info("createFromWms - 请求参数 {}", req.toString()); String request_no = tasks.getRequestNo(); JSONArray errArr = new JSONArray(); try { @@ -264,8 +264,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { resp.setErrArr(errArr); } - log.info("createFromWms - 返回参数 {}", resultJson.toString()); - } catch (Exception e) { resp.setCode(400); resp.setMessage(e.getMessage()); @@ -273,7 +271,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { resp.setRequestNo(request_no); resp.setResponseDate(AgvUtil.getDate()); resp.setMessage("请求成功"); - log.info("createFromWms - 返回参数 {}", JSON.toJSON(resp)); + log.info("createFromWms - 返回参数 {}", resp.toString()); // LuceneLogDto logDto = LuceneLogDto.builder() // .requestparam(JSON.toJSON(resp).toString()) diff --git a/acs2/nladmin-system/src/main/java/org/nl/acs/ext/xg/XgHttpUtil.java b/acs2/nladmin-system/src/main/java/org/nl/acs/ext/xg/XgHttpUtil.java index 9ecd29b..c5e93f3 100644 --- a/acs2/nladmin-system/src/main/java/org/nl/acs/ext/xg/XgHttpUtil.java +++ b/acs2/nladmin-system/src/main/java/org/nl/acs/ext/xg/XgHttpUtil.java @@ -3,6 +3,7 @@ package org.nl.acs.ext.xg; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpRequest; import com.alibaba.fastjson.JSON; +import lombok.extern.slf4j.Slf4j; import org.nl.acs.config.AcsConfig; import org.nl.acs.ext.RequestAdapter; import org.nl.acs.ext.ResponseAdapter; @@ -18,6 +19,7 @@ import org.springframework.stereotype.Component; * @Date 2024/4/22 */ @Component +@Slf4j public class XgHttpUtil { private static final RequestAdapter REQUEST_ADAPTER = new XgRequestAdapter(); @@ -46,6 +48,8 @@ public class XgHttpUtil { @ToOthersInterfaceLog("ACS->AGV") public UnifiedResponse sendPostRequest(String path, W requestParam) { + log.info("sendPostRequest - 请求参数 {}", path + ":"+ requestParam.toString()); + if (!StrUtil.equals(paramService.findByCode(AcsConfig.FORK_AGV).getValue(), "1")) { return new UnifiedResponse<>(false, "未开启连接该系统!"); } @@ -56,6 +60,7 @@ public class XgHttpUtil { .body(JSON.toJSONString(requestParam)) .execute() .body(); + log.info("sendPostRequest - 返回参数 {}", body); return RESPONSE_ADAPTER.adapt(body, null); } catch (Exception e) { return new UnifiedResponse<>(false, e.getMessage()); diff --git a/acs2/nladmin-system/src/main/resources/config/application-dev2.yml b/acs2/nladmin-system/src/main/resources/config/application-dev2.yml index 3d7206a..09984e9 100644 --- a/acs2/nladmin-system/src/main/resources/config/application-dev2.yml +++ b/acs2/nladmin-system/src/main/resources/config/application-dev2.yml @@ -140,7 +140,7 @@ file: avatarMaxSize: 5 logging: file: - path: C:\log\ACS + path: C:\logs\ACS config: classpath:logback-spring.xml # Sa-Token配置 diff --git a/acs2/nladmin-system/src/main/resources/log/AcsToXg.xml b/acs2/nladmin-system/src/main/resources/log/AcsToXg.xml new file mode 100644 index 0000000..319c84e --- /dev/null +++ b/acs2/nladmin-system/src/main/resources/log/AcsToXg.xml @@ -0,0 +1,33 @@ + + + + + + + + + ${LOG_HOME}/ACS请求XG/%d{yyyy-MM-dd}.%i.log + + 15 + + 200MB + + 2GB + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + ${log.charset} + + + + + + + + 512 + + + + + diff --git a/acs2/nladmin-system/src/main/resources/logback-spring.xml b/acs2/nladmin-system/src/main/resources/logback-spring.xml index 2f9cc61..6d1c51d 100644 --- a/acs2/nladmin-system/src/main/resources/logback-spring.xml +++ b/acs2/nladmin-system/src/main/resources/logback-spring.xml @@ -24,6 +24,7 @@ https://juejin.cn/post/6844903775631572999 +