From e305c028880ca5134e8cbf7f309675c3af3573d5 Mon Sep 17 00:00:00 2001 From: admin Date: Sun, 2 Apr 2023 13:06:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sale/admin/idc/service/impl/IdcServiceImpl.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/api-admin/src/main/java/com/glxp/sale/admin/idc/service/impl/IdcServiceImpl.java b/api-admin/src/main/java/com/glxp/sale/admin/idc/service/impl/IdcServiceImpl.java index 8115645..b6dfe84 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/idc/service/impl/IdcServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/idc/service/impl/IdcServiceImpl.java @@ -110,7 +110,7 @@ public class IdcServiceImpl implements IdcService { String json = FileUtils.readFileAll(map.get("cacheFilePath").toString()); logger.info("download-->"+json); JSONObject object = JSON.parseObject(json); - if(object!=null&&object.getInteger("code")==20000) { + if(object!=null&&object.getInteger("code")!=null&&object.getInteger("code")==20000) { BaseResponse response = JSON.parseObject(json,BaseResponse.class); return response; } @@ -274,6 +274,8 @@ public class IdcServiceImpl implements IdcService { JSONObject json = JSONObject.parseObject(result); if(isLastLevel()) { success = analyToDB(json,files); + if(!success) + logger.info("fetchData-->解析失败"); } else { syncAddTaskStatus(json,false,success); } @@ -602,17 +604,19 @@ public class IdcServiceImpl implements IdcService { /*解析到数据库*/ private boolean analyToDB(JSONObject jsonObject,MultipartFile[] files) { - if(!StringUtils.isEmpty(jsonObject.getString("tableName"))) { + if(jsonObject.getJSONObject("data")!=null) { JSONObject object = jsonObject.getJSONObject("data"); List> list = new ArrayList<>(); if(object instanceof List) { list = jsonObject.getObject("data", List.class); } else { + object = jsonObject; if(object.get("data")!=null) list = object.getObject("data", List.class); } - return analyData(jsonObject.getString("tableName"),jsonObject.getString("uniqueColumn"),list); + if(!StringUtils.isEmpty(object.getString("tableName"))) + return analyData(object.getString("tableName"),jsonObject.getString("uniqueColumn"),list); //图片处理 } return false;