修改系统异常提示词

This commit is contained in:
wangxiu 2026-08-22 14:39:24 +08:00
parent 849ebe8f4d
commit 3cc2f68c97
4 changed files with 17 additions and 12 deletions

View File

@ -4,6 +4,8 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.lyxh.api.docking.exception.ApiCallException; import com.lyxh.api.docking.exception.ApiCallException;
import com.lyxh.api.docking.service.SignatureService; import com.lyxh.api.docking.service.SignatureService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -17,6 +19,8 @@ import org.springframework.stereotype.Component;
@Component @Component
public class FortispayHmacAuthStrategy implements AuthStrategy { public class FortispayHmacAuthStrategy implements AuthStrategy {
private static final Logger log = LoggerFactory.getLogger(FortispayHmacAuthStrategy.class);
private final SignatureService signatureService; private final SignatureService signatureService;
private final ObjectMapper objectMapper; private final ObjectMapper objectMapper;
@ -38,8 +42,8 @@ public class FortispayHmacAuthStrategy implements AuthStrategy {
try { try {
node = objectMapper.readTree(authConfigJson); node = objectMapper.readTree(authConfigJson);
} catch (Exception e) { } catch (Exception e) {
throw new ApiCallException("AUTH_CONFIG_ERROR", log.error("Failed to parse auth_config", e);
"Failed to parse auth_config: " + e.getMessage(), ""); throw new ApiCallException("AUTH_CONFIG_ERROR", "Service temporarily unavailable", "");
} }
String secretId = node.get("secret_id").asText(); String secretId = node.get("secret_id").asText();
String secretKey = node.get("secret_key").asText(); String secretKey = node.get("secret_key").asText();

View File

@ -96,7 +96,7 @@ public class GenericApiClient {
log.error("Third-party network error after {} attempts: url={} requestId={}", log.error("Third-party network error after {} attempts: url={} requestId={}",
attempt, url, requestId, e); attempt, url, requestId, e);
throw new ApiCallException("NETWORK_ERROR", throw new ApiCallException("NETWORK_ERROR",
"External API unreachable after " + attempt + " attempts", "") "Connection error", "")
.withRequest(url, reqHeadersJson); .withRequest(url, reqHeadersJson);
} }
} catch (RestClientException e) { } catch (RestClientException e) {
@ -109,7 +109,7 @@ public class GenericApiClient {
attempt, url, requestId, e); attempt, url, requestId, e);
Integer statusCode = e instanceof HttpStatusCodeException Integer statusCode = e instanceof HttpStatusCodeException
? ((HttpStatusCodeException) e).getRawStatusCode() : null; ? ((HttpStatusCodeException) e).getRawStatusCode() : null;
throw new ApiCallException("HTTP_ERROR", e.getMessage(), "") throw new ApiCallException("HTTP_ERROR", "Service temporarily unavailable", "")
.withRequest(url, reqHeadersJson) .withRequest(url, reqHeadersJson)
.withStatusCode(statusCode); .withStatusCode(statusCode);
} }

View File

@ -71,7 +71,8 @@ public class PaymentProfileService {
JsonNode root = objectMapper.readTree(respJson); JsonNode root = objectMapper.readTree(respJson);
return parseResponse(root, filterType); return parseResponse(root, filterType);
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
throw new ApiCallException("PARSE_ERROR", "Failed to parse Fortispay response: " + e.getMessage(), null); log.error("Failed to parse third-party response: weOrderNo={}", weOrderNo, e);
throw new ApiCallException("PARSE_ERROR", "Service temporarily unavailable", null);
} catch (ApiCallException e) { } catch (ApiCallException e) {
// 插入日志 (调用三方api失败) // 插入日志 (调用三方api失败)
invokeLogService.logError( invokeLogService.logError(

View File

@ -73,7 +73,7 @@
```json ```json
{ {
"code": "503", "code": "503",
"message": "External API unreachable after 1 attempts", "message": "Connection error",
"responseId": "a1b2c3d4e5f6789012345678abcdef01", "responseId": "a1b2c3d4e5f6789012345678abcdef01",
"data": { "data": {
"status": 0, "status": 0,
@ -82,12 +82,12 @@
} }
``` ```
| HTTP状态码 | code | 说明 | | HTTP状态码 | code | 对外 message | 说明 |
|---|---|---| |---|---|---|---|
| 400 | 400 | 请求参数校验失败 | | 400 | 400 | `{字段}: {校验提示}` | 请求参数校验失败 |
| 502 | 502 | 三方 API HTTP 错误 | | 502 | 502 | `Service temporarily unavailable` | 三方 API HTTP 错误 / 响应解析失败 / 内部配置错误 |
| 503 | 503 | 三方 API 网络不可达 | | 503 | 503 | `Connection error` | 三方 API 网络不可达 |
| 500 | 500 | 服务内部未知异常 | | 500 | 500 | `Internal server error` | 服务内部未知异常 |
--- ---