From 46adaaea3e240432a158ce0e59058474c71c651f Mon Sep 17 00:00:00 2001
From: cl <1442464845@qq.com>
Date: 星期四, 16 四月 2026 16:23:05 +0800
Subject: [PATCH] 无单据组托优化
---
rsf-open-api/src/main/java/com/vincent/rsf/openApi/tv/TvRcsStationPollService.java | 33 ++++++++++++++++++++++++++++-----
1 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/rsf-open-api/src/main/java/com/vincent/rsf/openApi/tv/TvRcsStationPollService.java b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/tv/TvRcsStationPollService.java
index 1973e7d..36944ef 100644
--- a/rsf-open-api/src/main/java/com/vincent/rsf/openApi/tv/TvRcsStationPollService.java
+++ b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/tv/TvRcsStationPollService.java
@@ -28,6 +28,7 @@
@Slf4j
@Service
public class TvRcsStationPollService {
+ private static final int MAX_LOG_LEN = 2000;
@Resource
private RestTemplate restTemplate;
@@ -46,7 +47,10 @@
String stationId = pollProperties.getTaskNoStationId();
if (StringUtils.hasText(pollProperties.getTaskNoPollUrl())) {
try {
- String raw = restTemplate.getForObject(pollProperties.getTaskNoPollUrl(), String.class);
+ String url = pollProperties.getTaskNoPollUrl();
+ log.info("RCS绔欑偣杞璇锋眰 GET /cv/station/getTaskNo url={}", url);
+ String raw = restTemplate.getForObject(url, String.class);
+ log.info("RCS绔欑偣杞鍝嶅簲 GET /cv/station/getTaskNo body={}", trimForLog(raw));
String taskNo = applyTaskNoResponse(raw, stationId);
enrichSnapshotFromWms(stationId, taskNo);
} catch (RestClientException e) {
@@ -118,17 +122,25 @@
}
private String pollErrorRaw() throws Exception {
+ String url = pollProperties.getErrorPollUrl();
if (pollProperties.isErrorPollUsePost()) {
ObjectNode body = objectMapper.createObjectNode();
body.put("staNo", pollProperties.getErrorStationId());
+ String reqBody = objectMapper.writeValueAsString(body);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
- HttpEntity<String> entity = new HttpEntity<>(objectMapper.writeValueAsString(body), headers);
+ HttpEntity<String> entity = new HttpEntity<>(reqBody, headers);
+ log.info("RCS绔欑偣杞璇锋眰 POST /cv/station/getError url={} body={}", url, trimForLog(reqBody));
ResponseEntity<String> resp = restTemplate.exchange(
- pollProperties.getErrorPollUrl(), HttpMethod.POST, entity, String.class);
- return resp.getBody();
+ url, HttpMethod.POST, entity, String.class);
+ String respBody = resp.getBody();
+ log.info("RCS绔欑偣杞鍝嶅簲 POST /cv/station/getError body={}", trimForLog(respBody));
+ return respBody;
}
- return restTemplate.getForObject(pollProperties.getErrorPollUrl(), String.class);
+ log.info("RCS绔欑偣杞璇锋眰 GET /cv/station/getError url={}", url);
+ String raw = restTemplate.getForObject(url, String.class);
+ log.info("RCS绔欑偣杞鍝嶅簲 GET /cv/station/getError body={}", trimForLog(raw));
+ return raw;
}
/** 鍐欏叆 tvRcs 浠诲姟鍙� Hash锛涜繑鍥炶В鏋愬嚭鐨� taskNo锛堢敤浜� WMS 鍚堝苟锛� */
@@ -291,4 +303,15 @@
}
return arr;
}
+
+ private static String trimForLog(String raw) {
+ if (raw == null) {
+ return "null";
+ }
+ String text = raw.trim();
+ if (text.length() <= MAX_LOG_LEN) {
+ return text;
+ }
+ return text.substring(0, MAX_LOG_LEN) + "...(truncated)";
+ }
}
--
Gitblit v1.9.1