From 2c50587faf4d0e111003d6870be5c1d1a1597f6a Mon Sep 17 00:00:00 2001 From: admin Date: Sun, 2 Apr 2023 10:43:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=89=E5=8F=96=E4=BB=BB=E5=8A=A1=E6=8B=86?= =?UTF-8?q?=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sale/admin/idc/service/IdcService.java | 3 ++- .../idc/service/impl/IdcServiceImpl.java | 21 ++++++++++++++++--- .../{idc => }/thread/AsyncFetchTask.java | 2 +- 3 files changed, 21 insertions(+), 5 deletions(-) rename api-admin/src/main/java/com/glxp/sale/admin/{idc => }/thread/AsyncFetchTask.java (97%) diff --git a/api-admin/src/main/java/com/glxp/sale/admin/idc/service/IdcService.java b/api-admin/src/main/java/com/glxp/sale/admin/idc/service/IdcService.java index 9f15813..a244750 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/idc/service/IdcService.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/idc/service/IdcService.java @@ -24,7 +24,8 @@ 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/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 249e18c..d1d1c44 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 @@ -130,9 +130,25 @@ public class IdcServiceImpl implements IdcService { /*拉取前一级中继服务数据*/ @Async @Override + public void asyncFetchUdiTask() { + fetchTask(false); + } + @Async + @Override public void asyncFetchTask() { - + 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",null); @@ -151,9 +167,8 @@ public class IdcServiceImpl implements IdcService { } } } - } - + @Async @Override public void asyncIdcTask() { diff --git a/api-admin/src/main/java/com/glxp/sale/admin/idc/thread/AsyncFetchTask.java b/api-admin/src/main/java/com/glxp/sale/admin/thread/AsyncFetchTask.java similarity index 97% rename from api-admin/src/main/java/com/glxp/sale/admin/idc/thread/AsyncFetchTask.java rename to api-admin/src/main/java/com/glxp/sale/admin/thread/AsyncFetchTask.java index 08772c2..1865da9 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/idc/thread/AsyncFetchTask.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/thread/AsyncFetchTask.java @@ -1,4 +1,4 @@ -package com.glxp.sale.admin.idc.thread; +package com.glxp.sale.admin.thread; import javax.annotation.Resource;