From 7a61b9b28d575f739fadd2fa75f792576ae86ce4 Mon Sep 17 00:00:00 2001 From: Yvan Date: Fri, 1 Apr 2022 18:26:00 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-68727=20=E3=80=90=E8=BF=AD=E4=BB=A3?= =?UTF-8?q?=E3=80=91=E3=80=90=E6=95=B0=E6=8D=AE=E9=9B=86=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E3=80=91=E6=90=9C=E7=B4=A2=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=88=97=E6=9C=AA=E5=8A=A0=E8=BD=BD=E7=9A=84=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=EF=BC=8C=E8=AF=A5=E6=95=B0=E6=8D=AE=E9=9B=86=E6=9C=AA?= =?UTF-8?q?=E8=A2=AB=E6=90=9C=E7=B4=A2=20=E3=80=90=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E5=8E=9F=E5=9B=A0=E3=80=91=E6=B5=8B=E8=AF=95=E7=94=A8sleep?= =?UTF-8?q?=E6=9D=A5=E6=A8=A1=E6=8B=9F=E5=8F=96=E6=95=B0=E6=85=A2=EF=BC=8C?= =?UTF-8?q?=E5=9C=A8=E5=8F=96=E5=88=97=E5=90=8D=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=E4=BC=9A=E9=80=A0=E6=88=90=E4=B8=80=E4=BA=9B=E5=A5=87=E6=80=AA?= =?UTF-8?q?=E7=9A=84=E9=94=99=E8=AF=AF=20=E3=80=90=E6=94=B9=E5=8A=A8?= =?UTF-8?q?=E6=80=9D=E8=B7=AF=E3=80=911.=E5=9B=A0=E4=B8=BA=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E5=88=97=E5=90=8D=E9=87=8C=E5=81=9A=E4=BA=86=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E5=A4=84=E7=90=86=EF=BC=8C=E6=89=80=E4=BB=A5=E8=B7=9F?= =?UTF-8?q?=E4=BA=A7=E5=93=81=E6=B2=9F=E9=80=9A=E5=90=8E=E7=A1=AE=E5=AE=9A?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=B8=BA=E5=88=97=E5=90=8D=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=B0=B1=E4=B8=8D=E5=B1=95=E7=A4=BA=E6=95=B4?= =?UTF-8?q?=E4=B8=AA=E6=95=B0=E6=8D=AE=E9=9B=86=E8=8A=82=E7=82=B9=E4=BA=86?= =?UTF-8?q?=EF=BC=9B2.=E4=BA=A7=E5=93=81=E8=AE=A9=E6=8A=8A=E6=9C=80?= =?UTF-8?q?=E5=A4=A7=E6=90=9C=E7=B4=A2=E6=97=B6=E9=97=B4=E7=9A=84=E9=99=90?= =?UTF-8?q?=E5=88=B6=E5=8E=BB=E6=8E=89=20=E3=80=90review=E5=BB=BA=E8=AE=AE?= =?UTF-8?q?=E3=80=91=E6=97=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../search/TableDataTreeSearchManager.java | 11 ---- .../control/common/TableDataSearchTask.java | 6 +- .../search/time/TableDataSearchTimer.java | 64 ------------------- .../search/time/TableDataSearchTimerTask.java | 22 ------- 4 files changed, 4 insertions(+), 99 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/data/datapane/management/search/time/TableDataSearchTimer.java delete mode 100644 designer-base/src/main/java/com/fr/design/data/datapane/management/search/time/TableDataSearchTimerTask.java diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/management/search/TableDataTreeSearchManager.java b/designer-base/src/main/java/com/fr/design/data/datapane/management/search/TableDataTreeSearchManager.java index 1a6a62747..6fe79189c 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/management/search/TableDataTreeSearchManager.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/management/search/TableDataTreeSearchManager.java @@ -1,7 +1,6 @@ package com.fr.design.data.datapane.management.search; import com.fr.data.TableDataSource; -import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.design.DesignModelAdapter; import com.fr.design.data.datapane.TableDataTree; import com.fr.design.data.datapane.TableDataTreePane; @@ -10,11 +9,7 @@ import com.fr.design.data.datapane.management.search.event.TreeSearchStatusChang import com.fr.design.data.datapane.management.search.searcher.TableDataSearchMode; import com.fr.design.data.datapane.management.search.searcher.TableDataTreeSearcher; import com.fr.design.data.datapane.management.search.searcher.TreeSearchStatus; -import com.fr.design.data.datapane.management.search.time.TableDataSearchTimer; import com.fr.design.data.datapane.management.search.view.TreeSearchRendererHelper; -import com.fr.design.data.tabledata.wrapper.TableDataWrapper; -import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; -import com.fr.general.NameObject; import com.fr.stable.StringUtils; import javax.swing.SwingUtilities; @@ -137,8 +132,6 @@ public class TableDataTreeSearchManager { setTreeSearchStatus(TreeSearchStatus.SEARCHING); rendererHelper.replaceTreeRenderer(getCurrentTableDataTree(), searchText); count = new AtomicInteger(treeSearcher.getAllWrappersSize()); - // 计时开始 - TableDataSearchTimer.getInstance().startClock(); treeSearcher.startSearch(searchText); } @@ -176,7 +169,6 @@ public class TableDataTreeSearchManager { */ public void stopSearch() { setTreeSearchStatus(TreeSearchStatus.SEARCH_STOPPED); - TableDataSearchTimer.getInstance().stopClock(); count = null; treeSearcher.stopSearch(); } @@ -186,7 +178,6 @@ public class TableDataTreeSearchManager { */ public void completeSearch() { setTreeSearchStatus(TreeSearchStatus.SEARCH_COMPLETED); - TableDataSearchTimer.getInstance().stopClock(); count = null; treeSearcher.completeSearch(); } @@ -196,7 +187,6 @@ public class TableDataTreeSearchManager { */ public void restoreToolBarAndTreePane() { setTreeSearchStatus(TreeSearchStatus.NOT_IN_SEARCH_MODE); - TableDataSearchTimer.getInstance().stopClock(); if (treeSearcher != null) { treeSearcher.afterSearch(); } @@ -211,7 +201,6 @@ public class TableDataTreeSearchManager { */ public void restoreTreePane() { setTreeSearchStatus(TreeSearchStatus.SEARCH_NOT_BEGIN); - TableDataSearchTimer.getInstance().stopClock(); lastSearchText = null; if (rendererHelper != null) { rendererHelper.restore(getCurrentTableDataTree()); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/management/search/control/common/TableDataSearchTask.java b/designer-base/src/main/java/com/fr/design/data/datapane/management/search/control/common/TableDataSearchTask.java index ded7b27fd..2ab51f6a2 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/management/search/control/common/TableDataSearchTask.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/management/search/control/common/TableDataSearchTask.java @@ -1,10 +1,8 @@ package com.fr.design.data.datapane.management.search.control.common; -import com.fr.design.data.datapane.management.search.TableDataTreeSearchManager; import com.fr.design.data.datapane.management.search.control.TreeSearchCallback; import com.fr.design.data.datapane.management.search.control.TreeSearchResult; import com.fr.design.data.datapane.management.search.control.TreeSearchTask; -import com.fr.design.data.datapane.management.search.searcher.TreeSearchStatus; import com.fr.design.data.tabledata.wrapper.StoreProcedureDataWrapper; import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.log.FineLoggerFactory; @@ -70,6 +68,10 @@ public class TableDataSearchTask implements TreeSearchTask { String tableDataName = tableDataWrapper.getTableDataName(); boolean isTableDataNameMatch = isMatchSearch(tableDataName, searchText); List columnNameList = tableDataWrapper.calculateColumnNameList(); + // 没取到列名的话,代表取数那边出错了,就不添加数据集了 + if (columnNameList.size() == 0) { + return new TableDataSearchResult.Builder().buildSuccess(false).build(); + } boolean isColumnMatch = columnNameList.stream().anyMatch(columnName -> isMatchSearch(columnName, searchText)); return new TableDataSearchResult.Builder() .buildSuccess(true) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/management/search/time/TableDataSearchTimer.java b/designer-base/src/main/java/com/fr/design/data/datapane/management/search/time/TableDataSearchTimer.java deleted file mode 100644 index 63f041359..000000000 --- a/designer-base/src/main/java/com/fr/design/data/datapane/management/search/time/TableDataSearchTimer.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.fr.design.data.datapane.management.search.time; - -import com.fr.concurrent.NamedThreadFactory; -import com.fr.general.ComparatorUtils; - -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; - -/** - * 搜索任务定时器 - * - * @author Yvan - */ -public class TableDataSearchTimer { - - /** - * 定时器 - */ - private static ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory(TableDataSearchTimer.class)); - - /** - * 定时任务 - */ - private TableDataSearchTimerTask timeTask; - - /** - * 最大单次startSearch的时间 - */ - public static final long MAX_SEARCH_TIME = 5000; - - private TableDataSearchTimer() { - } - - private static class Holder { - private static final TableDataSearchTimer INSTANCE = new TableDataSearchTimer(); - } - - public static TableDataSearchTimer getInstance() { - return Holder.INSTANCE; - } - - public void startClock() { - this.timeTask = new TableDataSearchTimerTask(); - scheduler.schedule(timeTask, MAX_SEARCH_TIME, TimeUnit.MILLISECONDS); - } - - public void stopClock() { - this.timeTask = null; - } - - public void shutdown() { - scheduler.shutdown(); - } - - /** - * 判断是不是当前的Timer中的task,为了避免shutdownNow()之后原task仍在执行,可能会 - * @param task - * @return - */ - public boolean isCurrentTask(TableDataSearchTimerTask task) { - return ComparatorUtils.equals(this.timeTask, task); - } -} diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/management/search/time/TableDataSearchTimerTask.java b/designer-base/src/main/java/com/fr/design/data/datapane/management/search/time/TableDataSearchTimerTask.java deleted file mode 100644 index 27b074f7e..000000000 --- a/designer-base/src/main/java/com/fr/design/data/datapane/management/search/time/TableDataSearchTimerTask.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.fr.design.data.datapane.management.search.time; - -import com.fr.design.data.datapane.management.search.TableDataTreeSearchManager; -import com.fr.design.data.datapane.management.search.searcher.TreeSearchStatus; - -/** - * @author Yvan - */ -public class TableDataSearchTimerTask implements Runnable { - - public TableDataSearchTimerTask() { - } - - @Override - public void run() { - // 最大单次搜索时间过后,将结束搜索 - if (TableDataTreeSearchManager.getInstance().getTreeSearchStatus() == TreeSearchStatus.SEARCHING && - TableDataSearchTimer.getInstance().isCurrentTask(this)) { - TableDataTreeSearchManager.getInstance().completeSearch(); - } - } -}