From 670b5781988cf113f1e43ab1ab19b223cc24fa6e Mon Sep 17 00:00:00 2001 From: admin Date: Sun, 2 Apr 2023 10:14:50 +0800 Subject: [PATCH 1/9] body --- src/main/java/com/glxp/api/idc/controller/IdcController.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/glxp/api/idc/controller/IdcController.java b/src/main/java/com/glxp/api/idc/controller/IdcController.java index e3ce5dbf..1d9eb78d 100644 --- a/src/main/java/com/glxp/api/idc/controller/IdcController.java +++ b/src/main/java/com/glxp/api/idc/controller/IdcController.java @@ -64,6 +64,7 @@ public class IdcController { //@Log("数据同步任务列表拉取") @RequestMapping(value = "/spssync/common/list") + @ResponseBody public BaseResponse list(HttpServletRequest request, @RequestBody(required = false) Map params) { return idcService.taskList(request, params); } From 664c053e5b8444dbd6594bf55299ad1c7d5cccbe Mon Sep 17 00:00:00 2001 From: admin Date: Sun, 2 Apr 2023 10:30:21 +0800 Subject: [PATCH 2/9] body().string --- .../java/com/glxp/api/idc/service/impl/IdcServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java b/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java index 191d713f..48ceb8c9 100644 --- a/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java +++ b/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java @@ -248,7 +248,7 @@ public class IdcServiceImpl implements IdcService { try { boolean success=true; Response response = client.newCall(request).execute(); - result = response.body().toString(); + result = response.body().string(); JSONObject json = JSONObject.parseObject(result); if(isLastLevel()) { success = analyToDB(json,files); @@ -282,7 +282,7 @@ public class IdcServiceImpl implements IdcService { String result = ""; try { Response response = client.newCall(request).execute(); - result = response.body().toString(); + result = response.body().string(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); From b93687944355ad99fd48539a15fab558070a9295 Mon Sep 17 00:00:00 2001 From: admin Date: Sun, 2 Apr 2023 10:47:47 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E6=8B=89=E5=8F=96=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=8B=86=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/glxp/api/idc/service/IdcService.java | 2 +- .../api/idc/service/impl/IdcServiceImpl.java | 37 ++++++++++--- .../glxp/api/idc/thread/AsyncFetchTask.java | 55 ------------------- 3 files changed, 31 insertions(+), 63 deletions(-) delete mode 100644 src/main/java/com/glxp/api/idc/thread/AsyncFetchTask.java diff --git a/src/main/java/com/glxp/api/idc/service/IdcService.java b/src/main/java/com/glxp/api/idc/service/IdcService.java index f079c9b0..c8e65099 100644 --- a/src/main/java/com/glxp/api/idc/service/IdcService.java +++ b/src/main/java/com/glxp/api/idc/service/IdcService.java @@ -25,7 +25,7 @@ public interface IdcService { BaseResponse download(HttpServletRequest request,Map params); public void asyncFetchTask(); - + public void asyncFetchUdiTask(); BaseResponse downlaodSuccess(HttpServletRequest request,Map params); public void asyncIdcTask(); diff --git a/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java b/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java index 48ceb8c9..5f22d97d 100644 --- a/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java +++ b/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java @@ -130,12 +130,29 @@ public class IdcServiceImpl implements IdcService { /*拉取前一级中继服务数据*/ @Async @Override + public void asyncFetchUdiTask() { + fetchTask(false); + } + @Async + @Override public void asyncFetchTask() { - - Map query = new HashMap(); + fetchTask(true); + + + } + + + private void fetchTask(boolean isIdc) { String host = getNextHost(); + if(!isIdc) { + Map map = dbDao.get("select * from sync_data_set limit 1"); + if(map!=null&&map.get("syncIp")!=null) + host = map.get("syncIp").toString(); + } + logger.info("fetch from ip:"+host); if(!StringUtils.isEmpty(host)) { - String result = post(host+"/spssync/common/list",query); + String result = post(host+"/spssync/common/list",null); + logger.info("fetchTask--->"+result); if(IDCUtils.isJson(result)) { JSONObject json = JSON.parseObject(result); if(json!=null&&json.getInteger("code")==20000&&json.getString("data")!=null) { @@ -144,15 +161,14 @@ public class IdcServiceImpl implements IdcService { for(Map map:list) { Map params = new HashMap(); params.put("taskId", map.get("taskId")); - fetchData(host+"/spssync/common/list",params); + fetchData(host+"/spssync/common/download",params); } } } } } - } - + @Async @Override public void asyncIdcTask() { @@ -249,6 +265,7 @@ public class IdcServiceImpl implements IdcService { boolean success=true; Response response = client.newCall(request).execute(); result = response.body().string(); + logger.info("fetchData-->"+result); JSONObject json = JSONObject.parseObject(result); if(isLastLevel()) { success = analyToDB(json,files); @@ -265,6 +282,7 @@ public class IdcServiceImpl implements IdcService { } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); + logger.error("fetchData-->"+e.getMessage()); } return result; } @@ -273,7 +291,9 @@ public class IdcServiceImpl implements IdcService { OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); - RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(params)); + RequestBody body = RequestBody.create(mediaType, ""); + if(params!=null) + body = RequestBody.create(mediaType,JSON.toJSONString(params)); Request request = new Request.Builder() .url(url) .method("POST", body) @@ -283,6 +303,7 @@ public class IdcServiceImpl implements IdcService { try { Response response = client.newCall(request).execute(); result = response.body().string(); + logger.info("post-result-->"+result); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -567,7 +588,9 @@ public class IdcServiceImpl implements IdcService { map.put("taskId", json.get("messageId")); map.put("cacheFilePath", fileName); map.put("status", success ? "1" : "0"); + saveExportStatus(map); + } diff --git a/src/main/java/com/glxp/api/idc/thread/AsyncFetchTask.java b/src/main/java/com/glxp/api/idc/thread/AsyncFetchTask.java deleted file mode 100644 index 9312f3c8..00000000 --- a/src/main/java/com/glxp/api/idc/thread/AsyncFetchTask.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.glxp.api.idc.thread; - -import javax.annotation.Resource; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.scheduling.annotation.EnableScheduling; -import org.springframework.scheduling.annotation.SchedulingConfigurer; -import org.springframework.scheduling.config.ScheduledTaskRegistrar; -import org.springframework.scheduling.support.CronTrigger; -import org.springframework.stereotype.Component; - -import com.glxp.api.dao.schedule.ScheduledDao; -import com.glxp.api.entity.system.ScheduledEntity; -import com.glxp.api.idc.service.IdcService; -import com.glxp.api.req.system.ScheduledRequest; - - -@Component -@EnableScheduling -public class AsyncFetchTask implements SchedulingConfigurer { - - final Logger logger = LoggerFactory.getLogger(AsyncFetchTask.class); - - @Resource - private ScheduledDao scheduledDao; - - @Resource - private IdcService idcService; - - @Override - public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) { - scheduledTaskRegistrar.addTriggerTask(() -> process(), - triggerContext -> { - ScheduledRequest scheduledRequest = new ScheduledRequest(); - scheduledRequest.setCronName("syncFetch"); - logger.info("syncFetch----------------"); - ScheduledEntity scheduledEntity = scheduledDao.findScheduled(scheduledRequest); - String cron = scheduledEntity!=null ? scheduledEntity.getCron() : "* 0/5 * * * ?"; - - if (cron.isEmpty()) { - logger.error("cron is null"); - } - logger.info("syncFetch----------------"); - return new CronTrigger(cron).nextExecutionTime(triggerContext); - }); - } - - private void process() { - logger.info("syncFetch----process------------"); - - idcService.asyncFetchTask(); - } - -} From f3474232d186df679ec6431c79f97651ce984a9d Mon Sep 17 00:00:00 2001 From: admin Date: Sun, 2 Apr 2023 12:45:01 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/idc/service/impl/IdcServiceImpl.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java b/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java index 5f22d97d..dc86c14e 100644 --- a/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java +++ b/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java @@ -78,8 +78,7 @@ public class IdcServiceImpl implements IdcService { "basicThirdProducts//thr_products/id///updateTime///第三方产品信息","//sup_cert/id///updateTime/filePath//资质证书信息", "//sup_cert_set/id///updateTime///供应商资质证书设置","companyCert//sup_company/customerId///updateTime///配送企业", "manufacturerCert//sup_manufacturer/id///updateTime///生产企业","productCert//sup_product/id///updateTime///产品资质信息", - "//udicompany/id///updateTime///国际库医疗器械注册人信息"}; - //"dbDiProducts//productinfo/id///updateTime///DI产品信息", + "dbDiProducts//productinfo/id///updateTime///DI产品信息","//udicompany/id///updateTime///国际库医疗器械注册人信息"}; private int orderNum=0; @@ -109,7 +108,13 @@ public class IdcServiceImpl implements IdcService { if(map==null) ResultVOUtils.error(9000, "下载任务不存在"); String json = FileUtils.readFileAll(map.get("cacheFilePath").toString()); + logger.info("download-->"+json); JSONObject object = JSON.parseObject(json); + if(object!=null&&object.getInteger("code")==20000) { + BaseResponse response = JSON.parseObject(json,BaseResponse.class); + return response; + } + return ResultVOUtils.success(object); } @@ -598,7 +603,15 @@ public class IdcServiceImpl implements IdcService { /*解析到数据库*/ private boolean analyToDB(JSONObject jsonObject,MultipartFile[] files) { if(!StringUtils.isEmpty(jsonObject.getString("tableName"))) { - List> list = jsonObject.getObject("data", List.class); + JSONObject object = jsonObject.getJSONObject("data"); + List> list = new ArrayList<>(); + + if(object instanceof List) { + list = jsonObject.getObject("data", List.class); + } else { + if(object.get("data")!=null) + list = object.getObject("data", List.class); + } return analyData(jsonObject.getString("tableName"),jsonObject.getString("uniqueColumn"),list); //图片处理 } From 5db7e35b6afb781f535522a979fd765c6fd7495a Mon Sep 17 00:00:00 2001 From: admin Date: Sun, 2 Apr 2023 13:06:16 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/glxp/api/idc/service/impl/IdcServiceImpl.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java b/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java index dc86c14e..3bef4ddc 100644 --- a/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java +++ b/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java @@ -602,17 +602,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; From 96ac962e0c2be004da8b3876c89df314fd767d0d Mon Sep 17 00:00:00 2001 From: admin Date: Sun, 2 Apr 2023 15:35:21 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E6=8B=89=E5=8F=96=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/idc/service/impl/IdcServiceImpl.java | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java b/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java index 3bef4ddc..e1ce90e0 100644 --- a/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java +++ b/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java @@ -108,9 +108,9 @@ public class IdcServiceImpl implements IdcService { if(map==null) ResultVOUtils.error(9000, "下载任务不存在"); 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) { BaseResponse response = JSON.parseObject(json,BaseResponse.class); return response; } @@ -157,7 +157,7 @@ public class IdcServiceImpl implements IdcService { logger.info("fetch from ip:"+host); if(!StringUtils.isEmpty(host)) { String result = post(host+"/spssync/common/list",null); - logger.info("fetchTask--->"+result); + if(IDCUtils.isJson(result)) { JSONObject json = JSON.parseObject(result); if(json!=null&&json.getInteger("code")==20000&&json.getString("data")!=null) { @@ -166,7 +166,7 @@ public class IdcServiceImpl implements IdcService { for(Map map:list) { Map params = new HashMap(); params.put("taskId", map.get("taskId")); - fetchData(host+"/spssync/common/download",params); + fetchData(host,params); } } } @@ -254,13 +254,13 @@ public class IdcServiceImpl implements IdcService { - private String fetchData(String url,Map params) { + private String fetchData(String host,Map params) { OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(params)); Request request = new Request.Builder() - .url(url) + .url(host+"/spssync/common/download") .method("POST", body) .addHeader("Content-Type", "application/json") .build(); @@ -270,15 +270,15 @@ public class IdcServiceImpl implements IdcService { boolean success=true; Response response = client.newCall(request).execute(); result = response.body().string(); - logger.info("fetchData-->"+result); JSONObject json = JSONObject.parseObject(result); if(isLastLevel()) { success = analyToDB(json,files); + if(!success) + logger.info("fetchData-->解析失败"); } else { syncAddTaskStatus(json,false,success); } - String host = getNextHost(); if(success) { String ret = post(host+"/spssync/common/success",params); @@ -308,7 +308,6 @@ public class IdcServiceImpl implements IdcService { try { Response response = client.newCall(request).execute(); result = response.body().string(); - logger.info("post-result-->"+result); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -605,16 +604,17 @@ public class IdcServiceImpl implements IdcService { 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); + list = object.getObject("data", List.class); + + } + if(!StringUtils.isEmpty(object.getString("tableName"))) { + return analyData(object.getString("tableName"),object.getString("uniqueColumn"),list); + } else { + logger.error("数据格式错误:无数据标记"); } - if(!StringUtils.isEmpty(object.getString("tableName"))) - return analyData(object.getString("tableName"),jsonObject.getString("uniqueColumn"),list); //图片处理 } return false; @@ -736,6 +736,8 @@ public class IdcServiceImpl implements IdcService { } if(n>0) { result = (dbDao.save(sql)>0); + if(!result) + logger.error(tableName+"-->fetchSave Fail"); } } From 062def2485d189678a888487943764ba14adce66 Mon Sep 17 00:00:00 2001 From: admin Date: Sun, 2 Apr 2023 16:00:50 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../glxp/api/idc/service/impl/IdcServiceImpl.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java b/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java index e1ce90e0..9b33b5e0 100644 --- a/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java +++ b/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java @@ -552,7 +552,7 @@ public class IdcServiceImpl implements IdcService { } } else { success = false; - saveIdcLog(messageType,"",tableName +">fail:上传地址未连通",i *limit,total); + saveIdcLog(messageType,"",syncIp+":"+tableName +">fail:上传地址未连通",i *limit,total); } } else { if(!StringUtils.isEmpty(recordSql)) { @@ -602,16 +602,22 @@ public class IdcServiceImpl implements IdcService { /*解析到数据库*/ private boolean analyToDB(JSONObject jsonObject,MultipartFile[] files) { if(jsonObject.getJSONObject("data")!=null) { + String tableName = ""; + String uniqueColumn = ""; JSONObject object = jsonObject.getJSONObject("data"); List> list = new ArrayList<>(); if(object instanceof List) { list = jsonObject.getObject("data", List.class); + tableName = jsonObject.getString("tableName"); + uniqueColumn = jsonObject.getString("uniqueColumn"); } else { list = object.getObject("data", List.class); - + tableName = object.getString("tableName"); + uniqueColumn = object.getString("uniqueColumn"); } - if(!StringUtils.isEmpty(object.getString("tableName"))) { - return analyData(object.getString("tableName"),object.getString("uniqueColumn"),list); + + if(!StringUtils.isEmpty(tableName)) { + return analyData(tableName,uniqueColumn,list); } else { logger.error("数据格式错误:无数据标记"); } From 1b2a6d7c8b3f5aa6ef4b4d092a6425a72eaec2d5 Mon Sep 17 00:00:00 2001 From: admin Date: Sun, 2 Apr 2023 17:05:45 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/idc/service/impl/IdcServiceImpl.java | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java b/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java index 9b33b5e0..7e38f2e2 100644 --- a/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java +++ b/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java @@ -78,8 +78,8 @@ public class IdcServiceImpl implements IdcService { "basicThirdProducts//thr_products/id///updateTime///第三方产品信息","//sup_cert/id///updateTime/filePath//资质证书信息", "//sup_cert_set/id///updateTime///供应商资质证书设置","companyCert//sup_company/customerId///updateTime///配送企业", "manufacturerCert//sup_manufacturer/id///updateTime///生产企业","productCert//sup_product/id///updateTime///产品资质信息", - "dbDiProducts//productinfo/id///updateTime///DI产品信息","//udicompany/id///updateTime///国际库医疗器械注册人信息"}; - + "//udicompany/id///updateTime///国际库医疗器械注册人信息"}; + //"dbDiProducts//productinfo/id///updateTime///DI产品信息", private int orderNum=0; @Resource @@ -601,21 +601,24 @@ public class IdcServiceImpl implements IdcService { /*解析到数据库*/ private boolean analyToDB(JSONObject jsonObject,MultipartFile[] files) { - if(jsonObject.getJSONObject("data")!=null) { + + if(jsonObject.get("data")!=null) { + logger.error("json>>>>>>>>>"); String tableName = ""; String uniqueColumn = ""; - JSONObject object = jsonObject.getJSONObject("data"); + Object object = jsonObject.get("data"); List> list = new ArrayList<>(); if(object instanceof List) { list = jsonObject.getObject("data", List.class); tableName = jsonObject.getString("tableName"); uniqueColumn = jsonObject.getString("uniqueColumn"); } else { - list = object.getObject("data", List.class); - tableName = object.getString("tableName"); - uniqueColumn = object.getString("uniqueColumn"); + JSONObject obj = jsonObject.getJSONObject("data"); + list = obj.getObject("data", List.class); + tableName = obj.getString("tableName"); + uniqueColumn = obj.getString("uniqueColumn"); } - + logger.error("table-->"+tableName); if(!StringUtils.isEmpty(tableName)) { return analyData(tableName,uniqueColumn,list); } else { @@ -628,7 +631,7 @@ public class IdcServiceImpl implements IdcService { /*按表名解析数据到数据库,子表暂未处理*/ private boolean analyData(String tableName,String uniqueColumn,List> list) { - + logger.error("ana-->"+tableName+"--list-->"+JSON.toJSONString(list)); String tName = DBAUtils.tableRealName(tableName); String sql="replace "+tName +"("; String del="delete from "+tName+" where "; From 8c25c5d7c2b853ca2e9a18dad34e58fa5fb1dccb Mon Sep 17 00:00:00 2001 From: admin Date: Sun, 2 Apr 2023 17:16:51 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../glxp/api/idc/service/impl/IdcServiceImpl.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java b/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java index 7e38f2e2..b76fc6fc 100644 --- a/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java +++ b/src/main/java/com/glxp/api/idc/service/impl/IdcServiceImpl.java @@ -271,12 +271,21 @@ public class IdcServiceImpl implements IdcService { Response response = client.newCall(request).execute(); result = response.body().string(); JSONObject json = JSONObject.parseObject(result); + if(isLastLevel()) { - success = analyToDB(json,files); + if(json.get("code")!=null) { + success = analyToDB(json.getJSONObject("data"),files); + } else { + success = analyToDB(json,files); + } if(!success) logger.info("fetchData-->解析失败"); } else { - syncAddTaskStatus(json,false,success); + if(json.get("code")!=null) { + syncAddTaskStatus(json.getJSONObject("data"),false,success); + } else { + syncAddTaskStatus(json,false,success); + } } if(success) {