From 128d031932631d07643a711d016b0e82658b6c53 Mon Sep 17 00:00:00 2001 From: Cui YongXing <2835316714@qq.com> Date: Sun, 8 Sep 2024 01:06:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BB=E6=89=BE=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/TaskInfoServiceImpl.java | 36 ++++++++++++------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/cloud-task-server/src/main/java/com/muyu/task/server/service/impl/TaskInfoServiceImpl.java b/cloud-task-server/src/main/java/com/muyu/task/server/service/impl/TaskInfoServiceImpl.java index 1ff82fd..d67b9eb 100644 --- a/cloud-task-server/src/main/java/com/muyu/task/server/service/impl/TaskInfoServiceImpl.java +++ b/cloud-task-server/src/main/java/com/muyu/task/server/service/impl/TaskInfoServiceImpl.java @@ -344,16 +344,16 @@ public class TaskInfoServiceImpl extends ServiceImpl i DataValue[][] data = tableValueResult.getData(); log.info("执行{}查询的方法结束", sqlSelect); - for (DataValue[] datum : data) { - for (DataValue dataValue : datum) { - String key = dataValue.getKey(); - String newKey = map.get(key); - dataValue.setKey(newKey); - } - } - Result result = datasourceFeign.addProduct(newBasicId, tableId, data); - log.info("{}添加结束", result); - //executeTheRule(data,map,newBasicId,tableId); +// for (DataValue[] datum : data) { +// for (DataValue dataValue : datum) { +// String key = dataValue.getKey(); +// String newKey = map.get(key); +// dataValue.setKey(newKey); +// } +// } +// Result result = datasourceFeign.addProduct(newBasicId, tableId, data); +// log.info("{}添加结束", result); + executeTheRule(data,map,newBasicId,tableId); } @@ -368,13 +368,15 @@ public class TaskInfoServiceImpl extends ServiceImpl i // 初始化第一个任务 tasks.add(() -> { + log.info(dataValues); return dataValues; }); - // 创建任务链 - Future currentFuture = null; + // 提交第一个任务 + Future currentFuture = executor.submit(tasks.poll()); for (int i = 1; i <= 4; i++) { final Future finalCurrentFuture = currentFuture; + log.info(finalCurrentFuture); Callable task = () -> { DataValue[][] prevResult = finalCurrentFuture.get(); @@ -397,7 +399,15 @@ public class TaskInfoServiceImpl extends ServiceImpl i } try { DataValue[][] afterFilteringDataValue = currentFuture.get(); - + for (DataValue[] datum : afterFilteringDataValue) { + for (DataValue dataValue : datum) { + String key = dataValue.getKey(); + String newKey = map.get(key); + dataValue.setKey(newKey); + } + } + Result result = datasourceFeign.addProduct(newBasicId, tableId, afterFilteringDataValue); + log.info("{}添加结束", result); } catch (InterruptedException e) { throw new RuntimeException(e);