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