From e69291cd38b86bf638d81c64bd077f8e0ccd8eef Mon Sep 17 00:00:00 2001 From: Saisai Liu <1374434128@qq.com> Date: Fri, 26 Apr 2024 22:27:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E9=87=8D=E6=9E=84=E5=AE=8C=E6=88=90?= =?UTF-8?q?=EF=BC=9B=E9=87=8D=E6=9E=84=E7=82=B9=EF=BC=9A=E8=A1=A8=E7=9A=84?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E8=BE=83=E5=A4=A7=EF=BC=8C=E5=9C=A8=E9=81=8D?= =?UTF-8?q?=E5=8E=86=E8=A1=A8=E7=94=A8=E4=BA=8E=E6=9F=A5=E8=AF=A2=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=E5=AE=89=E6=8E=92=E7=BB=99=E7=BA=BF=E7=A8=8B?= =?UTF-8?q?=E5=BC=82=E6=AD=A5=E6=89=A7=E8=A1=8C=EF=BC=8C=E5=87=8F=E5=B0=91?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E6=97=B6=E9=97=B4=EF=BC=8C=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/BasicConfigInfoServiceImpl.java | 42 +++++++++++++------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/impl/BasicConfigInfoServiceImpl.java b/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/impl/BasicConfigInfoServiceImpl.java index b001272..db6b61e 100644 --- a/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/impl/BasicConfigInfoServiceImpl.java +++ b/muyu-modules/muyv-etl/muyu-etl-service/src/main/java/com/muyu/etl/service/impl/BasicConfigInfoServiceImpl.java @@ -15,6 +15,7 @@ import com.muyu.etl.service.StructureService; import com.muyu.etl.service.TableInfoService; import lombok.SneakyThrows; import lombok.extern.log4j.Log4j2; +import org.apache.commons.lang3.exception.ExceptionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -22,6 +23,10 @@ import javax.servlet.ServletException; import java.sql.*; import java.util.Date; import java.util.*; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; import java.util.stream.Collectors; /** @@ -311,18 +316,30 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl tableInfoStructureRespList = tableInfoService.selectTableInfoList(new TableInfo() {{ setParentId(tableInfo.getId()); }}).stream().map(info -> { - List structureList = structureService.list(new LambdaQueryWrapper().eq(Structure::getTableId,info.getId())); - return TableInfoStructureResp.builder() - .id(info.getId()) - .tableName(info.getTableName()) - .center(info.getCenter()) - .tableRemark(info.getTableRemark()) - .dataNum(info.getDataNum()) - .parentId(info.getParentId()) - .databaseType(basicConfigInfo.getDatabaseType()) - .structureList(structureList) - .basicId(info.getBasicId()) - .build(); + TableInfoStructureResp callable = null; + try { + callable = new Callable<>() { + @Override + public TableInfoStructureResp call() throws Exception { + List structureList = structureService.list(new LambdaQueryWrapper().eq(Structure::getTableId, info.getId())); + return TableInfoStructureResp.builder() + .id(info.getId()) + .tableName(info.getTableName()) + .center(info.getCenter()) + .tableRemark(info.getTableRemark()) + .dataNum(info.getDataNum()) + .parentId(info.getParentId()) + .databaseType(basicConfigInfo.getDatabaseType()) + .structureList(structureList) + .basicId(info.getBasicId()) + .build(); + }; + }.call(); + } catch (Exception e) { + throw new RuntimeException(e); + } +// ExecutorService threadPool = Executors.newCachedThreadPool(); + return callable; }).collect(Collectors.toList()); return TableTreeResp.builder() .tableInfo(tableInfo) @@ -333,4 +350,5 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl