Commit a9bf63b0d0a721a0518206258348d11c495ec90f
1 parent
0b89179e
fix(erp): unwrap execStaging result from ERP response envelope (dataset.rows[0])
Verified exec-staging=true end-to-end against rebuilt local xlyEntry: proposal → /ai/execStaging → DB value changed, status written back by ERP, user-token identity enforced by @Authorization.
Showing
1 changed file
with
7 additions
and
1 deletions
src/main/java/com/xly/service/ErpClient.java
| @@ -251,7 +251,13 @@ public class ErpClient { | @@ -251,7 +251,13 @@ public class ErpClient { | ||
| 251 | .POST(HttpRequest.BodyPublishers.ofString("{}", StandardCharsets.UTF_8)) | 251 | .POST(HttpRequest.BodyPublishers.ofString("{}", StandardCharsets.UTF_8)) |
| 252 | .build(); | 252 | .build(); |
| 253 | HttpResponse<String> resp = http.send(req, HttpResponse.BodyHandlers.ofString(StandardCharsets.UTF_8)); | 253 | HttpResponse<String> resp = http.send(req, HttpResponse.BodyHandlers.ofString(StandardCharsets.UTF_8)); |
| 254 | - return mapper.readTree(resp.body()); | 254 | + JsonNode root = mapper.readTree(resp.body()); |
| 255 | + if (root.has("status")) { | ||
| 256 | + return root; | ||
| 257 | + } | ||
| 258 | + // ERP 统一响应包装:真实结果 {status,msg,billId} 在 dataset.rows[0] | ||
| 259 | + JsonNode row = root.path("dataset").path("rows").path(0); | ||
| 260 | + return row.isObject() ? row : root; | ||
| 255 | } catch (Exception e) { | 261 | } catch (Exception e) { |
| 256 | throw new RuntimeException("ERP 暂存执行异常: " + e.getMessage(), e); | 262 | throw new RuntimeException("ERP 暂存执行异常: " + e.getMessage(), e); |
| 257 | } | 263 | } |