This commit is contained in:
2026-10-21 10:52:17 +08:00
parent f00d0e16cf
commit e5f9cdcf01
8 changed files with 144 additions and 73 deletions
@@ -716,13 +716,22 @@ public class UnifiedOrderQueryService {
|| StringUtils.hasText(query.measurementReviewStatus());
}
/** 保留内部调用的原始异常,便于按请求链路定位连接和协议故障。 */
private <T> ApiResponse<T> call(java.util.concurrent.Callable<ApiResponse<T>> invocation) {
try { return invocation.call(); }
catch (FeignException exception) { throw new BizException(ResultCode.SERVICE_UNAVAILABLE, "头程服务暂时不可用"); }
catch (Exception exception) { throw new BizException(ResultCode.SERVICE_UNAVAILABLE, "头程服务查询失败"); }
catch (FeignException exception) {
throw (BizException) new BizException(ResultCode.SERVICE_UNAVAILABLE, "头程服务暂时不可用").initCause(exception);
}
catch (Exception exception) {
throw (BizException) new BizException(ResultCode.SERVICE_UNAVAILABLE, "头程服务查询失败").initCause(exception);
}
}
/** 失败关闭时保留下游错误码与链路标识,不记录业务载荷或服务令牌。 */
private <T> T require(ApiResponse<T> response, String message) {
if (response == null || !response.successful() || response.data() == null) {
LOGGER.warn("头程查询响应无效 operation={} downstreamCode={} downstreamMessage={} downstreamRequestId={} downstreamTraceId={}",
message, response == null ? null : response.code(), response == null ? null : response.message(),
response == null ? null : response.requestId(), response == null ? null : response.traceId());
throw new BizException(ResultCode.SERVICE_UNAVAILABLE, message);
}
return response.data();