From 7e9902b21dce4549c837bec6ac234a576b2efb9b Mon Sep 17 00:00:00 2001
From: lty <876263681@qq.com>
Date: 星期四, 07 五月 2026 09:52:09 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/task/kingdee/handler/InboundOrderHandler.java |   43 ++++++++++++++++++++++++++++++++++++-------
 1 files changed, 36 insertions(+), 7 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..f072781 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());
@@ -1924,4 +1953,4 @@
     }
 
 
-}
\ No newline at end of file
+}

--
Gitblit v1.9.1