From 33686e35470b3548053d03532fbefa40f2470a2b Mon Sep 17 00:00:00 2001
From: lty <876263681@qq.com>
Date: 星期四, 07 五月 2026 09:56:04 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/task/kingdee/handler/InboundOrderHandler.java | 49 +++++++++++++++++++++++++++++++++++++++----------
1 files changed, 39 insertions(+), 10 deletions(-)
diff --git a/src/main/java/com/zy/asrs/task/kingdee/handler/InboundOrderHandler.java b/src/main/java/com/zy/asrs/task/kingdee/handler/InboundOrderHandler.java
index f962a47..6a46b23 100644
--- a/src/main/java/com/zy/asrs/task/kingdee/handler/InboundOrderHandler.java
+++ b/src/main/java/com/zy/asrs/task/kingdee/handler/InboundOrderHandler.java
@@ -262,14 +262,27 @@
.setJson(add)
.build()
.doPost();
+ if (response == null || response.trim().isEmpty()) {
+ log.error("妫�绱㈠け璐ワ細杩斿洖绌哄搷搴旓紝path={}", path);
+ continue;
+ }
JSONObject jsonResponse = JSON.parseObject(response);
- if(jsonResponse.getString("errorCode").equals("401")){
+ if (jsonResponse == null) {
+ log.error("妫�绱㈠け璐ワ細鍝嶅簲鏃犳硶瑙f瀽涓篔SON锛宲ath={}锛宺esponse={}", path, response);
+ continue;
+ }
+ if ("401".equals(jsonResponse.getString("errorCode"))) {
log.error("妫�绱㈠け璐ラ敊璇俊鎭細{}", jsonResponse.getString("message"));
loginAuthenticationHandler.start();
continue;
}
- JSONArray data = jsonResponse.getJSONObject("data").getJSONArray("rows");
- if(data == null){
+ JSONObject dataObj = jsonResponse.getJSONObject("data");
+ if (dataObj == null) {
+ log.error("妫�绱㈠け璐ワ細鍝嶅簲data涓虹┖锛宲ath={}锛宺esponse={}", path, response);
+ continue;
+ }
+ JSONArray data = dataObj.getJSONArray("rows");
+ if (data == null) {
continue;
}
if(data.size()<=0) continue;
@@ -277,8 +290,8 @@
if(kingDeeUtilType.formId.equals("BD_MATERIAL")) {
Tag tag = tagService.selectByName("鍏ㄩ儴", 1);
// 澶勭悊鍒嗛〉锛氭牴鎹繑鍥炵殑totalCount鍜宲ageSize璁$畻椤垫暟
- int pageSize = jsonResponse.getJSONObject("data").getIntValue("pageSize");
- int totalCount = jsonResponse.getJSONObject("data").getIntValue("totalCount");
+ int pageSize = dataObj.getIntValue("pageSize");
+ int totalCount = dataObj.getIntValue("totalCount");
int totalPages = (int) Math.ceil((double) totalCount / pageSize);
for (int page = 1; page <= totalPages; page++) {
@@ -293,8 +306,24 @@
.build()
.doPost();
+ if (response == null || response.trim().isEmpty()) {
+ log.error("妫�绱㈠け璐ワ細鍒嗛〉杩斿洖绌哄搷搴旓紝path={}锛宲ageNo={}", path, page);
+ continue;
+ }
jsonResponse = JSON.parseObject(response);
- data = jsonResponse.getJSONObject("data").getJSONArray("rows");
+ if (jsonResponse == null) {
+ log.error("妫�绱㈠け璐ワ細鍒嗛〉鍝嶅簲鏃犳硶瑙f瀽涓篔SON锛宲ath={}锛宲ageNo={}锛宺esponse={}", path, page, response);
+ continue;
+ }
+ dataObj = jsonResponse.getJSONObject("data");
+ if (dataObj == null) {
+ log.error("妫�绱㈠け璐ワ細鍒嗛〉鍝嶅簲data涓虹┖锛宲ath={}锛宲ageNo={}锛宺esponse={}", path, page, response);
+ continue;
+ }
+ data = dataObj.getJSONArray("rows");
+ if (data == null) {
+ continue;
+ }
for (int j = 0; j < data.size(); j++) {
JSONObject jsonObjectNew = data.getJSONObject(j);
Date modifyTime = sdf1.parse(jsonObjectNew.get("modifytime").toString());
@@ -466,11 +495,11 @@
String ownerUuid = jsonObjectNew.get("org_number").toString();//erp璐т富缂栧彿
String orderId = jsonObjectNew.get("id").toString();
JSONObject detailParam = new JSONObject();
- JSONObject dataObj = new JSONObject();
- dataObj.put("billno", billNo);
+ JSONObject billnoParam = new JSONObject();
+ billnoParam.put("billno", billNo);
detailParam.put("pageNo", 1);
detailParam.put("pageSize", 100);
- detailParam.put("data", dataObj);
+ detailParam.put("data", billnoParam);
boolean hasNext = true;
while (hasNext) {
String reqJson = detailParam.toJSONString();
@@ -1924,4 +1953,4 @@
}
-}
\ No newline at end of file
+}
--
Gitblit v1.9.1