From cb91ff9c60a0a16febe8d27950d0f050d435e183 Mon Sep 17 00:00:00 2001 From: Yann Date: Thu, 7 Jul 2022 14:57:18 +0800 Subject: [PATCH 1/6] =?UTF-8?q?REPORT-74775=20=E3=80=90=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E3=80=91=E5=86=85=E7=BD=AE=E6=95=B0=E6=8D=AE=E9=9B=86?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E6=95=B0=E6=8D=AE=EF=BC=8C=E5=A4=9A=E5=88=97?= =?UTF-8?q?=E6=83=85=E5=86=B5=EF=BC=8C=E6=98=BE=E7=A4=BA=E6=9C=89=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/tabledata/tabledatapane/EmbeddedTableDataPane.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/EmbeddedTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/EmbeddedTableDataPane.java index 8b47b222d6..731816243e 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/EmbeddedTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/EmbeddedTableDataPane.java @@ -65,6 +65,9 @@ public class EmbeddedTableDataPane extends AbstractTableDataPane Date: Thu, 7 Jul 2022 16:24:18 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=8A=BD=E6=95=B0=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E6=9C=80=E5=B0=8F=E6=9B=B4=E6=96=B0=E9=97=B4=E9=9A=94=E9=99=90?= =?UTF-8?q?=E5=88=B61=E5=88=86=E9=92=9F=EF=BC=8C=E4=B8=8D=E5=85=81?= =?UTF-8?q?=E8=AE=B8=E5=B0=8F=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/ESDStrategyConfigPane.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java index 1fd840ac78..091e18231e 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java @@ -15,6 +15,7 @@ import com.fr.esd.util.ESDUtils; import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; +import com.fr.third.org.quartz.CronExpression; import javax.swing.AbstractAction; import javax.swing.JPanel; @@ -25,9 +26,11 @@ import java.awt.Desktop; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.net.URI; +import java.text.ParseException; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Date; /** * @author rinoux @@ -36,7 +39,6 @@ import java.util.List; */ public class ESDStrategyConfigPane extends BasicBeanPane { private static final String CRON_HELP_URL = "http://help.fanruan.com/finereport/doc-view-693.html"; - private UIRadioButton selectAutoUpdate; private UIRadioButton selectBySchema; private UICheckBox shouldEvolve; @@ -131,8 +133,7 @@ public class ESDStrategyConfigPane extends BasicBeanPane { ob = StrategyConfigHelper.createStrategyConfig(true, false, true); } this.strategyConfig = ob; - - this.updateInterval.setText(ob.getUpdateInterval() <= 0 ? "0" : String.valueOf(ob.getUpdateInterval() / (double) CacheConstants.MILLIS_OF_MINUTE)); + this.updateInterval.setText(ob.getUpdateInterval() <= 0 ? "0" : String.format("%.0f", ob.getUpdateInterval() / (double) CacheConstants.MILLIS_OF_MINUTE)); this.schemaTime.setText(StringUtils.join(",", ob.getUpdateSchema().toArray(new String[0]))); this.shouldEvolve.setSelected(ob.shouldEvolve()); this.selectBySchema.setSelected(ob.isScheduleBySchema()); @@ -177,11 +178,22 @@ public class ESDStrategyConfigPane extends BasicBeanPane { if (ESDUtils.checkUpdateTimeSchema(text)) { if (ESDUtils.isCronExpression(text)) { + // 判断后两次更新时间间隔,如果小于1分钟就显示错误 + CronExpression cron = new CronExpression(text); + Date next1 = cron.getNextValidTimeAfter(new Date()); + Date next2 = cron.getNextValidTimeAfter(next1); + if (next2.getTime() - next1.getTime() < CacheConstants.MILLIS_OF_MINUTE) { + this.schemaTimeCheckTips.setText(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Error_Time_Interval_Too_Short")); + this.schemaTimeCheckTips.setVisible(true); + throw new IllegalArgumentException("[ESD]Update schema time interval is to short."); + } + schemaTimes.add(text); } else { Collections.addAll(schemaTimes, text.split(",")); } } else { + this.schemaTimeCheckTips.setText(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Error_Time_Format")); this.schemaTimeCheckTips.setVisible(true); throw new IllegalArgumentException("[ESD]Update schema time format error."); } @@ -202,6 +214,8 @@ public class ESDStrategyConfigPane extends BasicBeanPane { } } catch (CloneNotSupportedException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); + } catch (ParseException e) { + throw new RuntimeException(e); } } @@ -211,7 +225,7 @@ public class ESDStrategyConfigPane extends BasicBeanPane { private boolean checkUpdateInterval(String intervalValue) { try { - return !StringUtils.isEmpty(intervalValue) && !(Double.parseDouble(intervalValue) <= 0); + return !StringUtils.isEmpty(intervalValue) && !(Integer.parseInt(intervalValue) <= 0); } catch (NumberFormatException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } From 247e752bc81e643e64f4a699c224fd3651a82f29 Mon Sep 17 00:00:00 2001 From: Num73 <2788852163@qq.com> Date: Thu, 7 Jul 2022 16:54:50 +0800 Subject: [PATCH 3/6] =?UTF-8?q?KERNEL-11853=20=E6=8A=BD=E6=95=B0=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E6=9C=80=E5=B0=8F=E6=9B=B4=E6=96=B0=E9=97=B4=E9=9A=94?= =?UTF-8?q?=E9=99=90=E5=88=B61=E5=88=86=E9=92=9F=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E5=85=81=E8=AE=B8=E5=B0=8F=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/ESDStrategyConfigPane.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java index 1fd840ac78..091e18231e 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java @@ -15,6 +15,7 @@ import com.fr.esd.util.ESDUtils; import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; +import com.fr.third.org.quartz.CronExpression; import javax.swing.AbstractAction; import javax.swing.JPanel; @@ -25,9 +26,11 @@ import java.awt.Desktop; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.net.URI; +import java.text.ParseException; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Date; /** * @author rinoux @@ -36,7 +39,6 @@ import java.util.List; */ public class ESDStrategyConfigPane extends BasicBeanPane { private static final String CRON_HELP_URL = "http://help.fanruan.com/finereport/doc-view-693.html"; - private UIRadioButton selectAutoUpdate; private UIRadioButton selectBySchema; private UICheckBox shouldEvolve; @@ -131,8 +133,7 @@ public class ESDStrategyConfigPane extends BasicBeanPane { ob = StrategyConfigHelper.createStrategyConfig(true, false, true); } this.strategyConfig = ob; - - this.updateInterval.setText(ob.getUpdateInterval() <= 0 ? "0" : String.valueOf(ob.getUpdateInterval() / (double) CacheConstants.MILLIS_OF_MINUTE)); + this.updateInterval.setText(ob.getUpdateInterval() <= 0 ? "0" : String.format("%.0f", ob.getUpdateInterval() / (double) CacheConstants.MILLIS_OF_MINUTE)); this.schemaTime.setText(StringUtils.join(",", ob.getUpdateSchema().toArray(new String[0]))); this.shouldEvolve.setSelected(ob.shouldEvolve()); this.selectBySchema.setSelected(ob.isScheduleBySchema()); @@ -177,11 +178,22 @@ public class ESDStrategyConfigPane extends BasicBeanPane { if (ESDUtils.checkUpdateTimeSchema(text)) { if (ESDUtils.isCronExpression(text)) { + // 判断后两次更新时间间隔,如果小于1分钟就显示错误 + CronExpression cron = new CronExpression(text); + Date next1 = cron.getNextValidTimeAfter(new Date()); + Date next2 = cron.getNextValidTimeAfter(next1); + if (next2.getTime() - next1.getTime() < CacheConstants.MILLIS_OF_MINUTE) { + this.schemaTimeCheckTips.setText(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Error_Time_Interval_Too_Short")); + this.schemaTimeCheckTips.setVisible(true); + throw new IllegalArgumentException("[ESD]Update schema time interval is to short."); + } + schemaTimes.add(text); } else { Collections.addAll(schemaTimes, text.split(",")); } } else { + this.schemaTimeCheckTips.setText(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Error_Time_Format")); this.schemaTimeCheckTips.setVisible(true); throw new IllegalArgumentException("[ESD]Update schema time format error."); } @@ -202,6 +214,8 @@ public class ESDStrategyConfigPane extends BasicBeanPane { } } catch (CloneNotSupportedException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); + } catch (ParseException e) { + throw new RuntimeException(e); } } @@ -211,7 +225,7 @@ public class ESDStrategyConfigPane extends BasicBeanPane { private boolean checkUpdateInterval(String intervalValue) { try { - return !StringUtils.isEmpty(intervalValue) && !(Double.parseDouble(intervalValue) <= 0); + return !StringUtils.isEmpty(intervalValue) && !(Integer.parseInt(intervalValue) <= 0); } catch (NumberFormatException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } From 833b53133d697b5d4f9138bae5fa163810617981 Mon Sep 17 00:00:00 2001 From: Maximus <2788852163@qq.com> Date: Thu, 7 Jul 2022 19:44:07 +0800 Subject: [PATCH 4/6] =?UTF-8?q?KERNEL-11853=20=E6=8A=BD=E6=95=B0=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E6=9C=80=E5=B0=8F=E6=9B=B4=E6=96=B0=E9=97=B4=E9=9A=94?= =?UTF-8?q?=E9=99=90=E5=88=B61=E5=88=86=E9=92=9F=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E5=85=81=E8=AE=B8=E5=B0=8F=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/ESDStrategyConfigPane.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java index 091e18231e..a94db304b3 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java @@ -188,7 +188,14 @@ public class ESDStrategyConfigPane extends BasicBeanPane { throw new IllegalArgumentException("[ESD]Update schema time interval is to short."); } - schemaTimes.add(text); + if (checkCornTimeInterval(text)) { + schemaTimes.add(text); + } else { + this.schemaTimeCheckTips.setText(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Error_Time_Interval_Too_Short")); + this.schemaTimeCheckTips.setVisible(true); + throw new IllegalArgumentException("[ESD]Update schema time interval is to short."); + } + } else { Collections.addAll(schemaTimes, text.split(",")); } @@ -233,6 +240,17 @@ public class ESDStrategyConfigPane extends BasicBeanPane { return false; } + private boolean checkCornTimeInterval (String cronText) { + // 判断后两次更新时间间隔,如果小于1分钟就返回false + try { + CronExpression cron = new CronExpression(cronText); + Date next1 = cron.getNextValidTimeAfter(new Date()); + Date next2 = cron.getNextValidTimeAfter(next1); + return next2.getTime() - next1.getTime() >= CacheConstants.MILLIS_OF_MINUTE; + } catch (ParseException e) { + throw new RuntimeException(e); + } + } protected String title4PopupWindow() { return InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Cache_Strategy_Config_Title"); From b012cbac5796b5f6e6040e04977a9776783dfb5e Mon Sep 17 00:00:00 2001 From: Maximus <2788852163@qq.com> Date: Thu, 7 Jul 2022 19:55:25 +0800 Subject: [PATCH 5/6] =?UTF-8?q?KERNEL-11853=20=E6=8A=BD=E6=95=B0=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E6=9C=80=E5=B0=8F=E6=9B=B4=E6=96=B0=E9=97=B4=E9=9A=94?= =?UTF-8?q?=E9=99=90=E5=88=B61=E5=88=86=E9=92=9F=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E5=85=81=E8=AE=B8=E5=B0=8F=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/data/datapane/ESDStrategyConfigPane.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java index a94db304b3..e4fd53cec7 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java @@ -247,9 +247,10 @@ public class ESDStrategyConfigPane extends BasicBeanPane { Date next1 = cron.getNextValidTimeAfter(new Date()); Date next2 = cron.getNextValidTimeAfter(next1); return next2.getTime() - next1.getTime() >= CacheConstants.MILLIS_OF_MINUTE; - } catch (ParseException e) { - throw new RuntimeException(e); + } catch (ParseException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); } + return false; } protected String title4PopupWindow() { From 4aec6e5b8d2187dd7b24026c77fa050feb69df3a Mon Sep 17 00:00:00 2001 From: Maximus <2788852163@qq.com> Date: Fri, 8 Jul 2022 09:51:35 +0800 Subject: [PATCH 6/6] =?UTF-8?q?KERNEL-11853=20=E6=8A=BD=E6=95=B0=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E6=9C=80=E5=B0=8F=E6=9B=B4=E6=96=B0=E9=97=B4=E9=9A=94?= =?UTF-8?q?=E9=99=90=E5=88=B61=E5=88=86=E9=92=9F=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E5=85=81=E8=AE=B8=E5=B0=8F=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/data/datapane/ESDStrategyConfigPane.java | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java index e4fd53cec7..39b4ecb00f 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java @@ -178,16 +178,6 @@ public class ESDStrategyConfigPane extends BasicBeanPane { if (ESDUtils.checkUpdateTimeSchema(text)) { if (ESDUtils.isCronExpression(text)) { - // 判断后两次更新时间间隔,如果小于1分钟就显示错误 - CronExpression cron = new CronExpression(text); - Date next1 = cron.getNextValidTimeAfter(new Date()); - Date next2 = cron.getNextValidTimeAfter(next1); - if (next2.getTime() - next1.getTime() < CacheConstants.MILLIS_OF_MINUTE) { - this.schemaTimeCheckTips.setText(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Error_Time_Interval_Too_Short")); - this.schemaTimeCheckTips.setVisible(true); - throw new IllegalArgumentException("[ESD]Update schema time interval is to short."); - } - if (checkCornTimeInterval(text)) { schemaTimes.add(text); } else { @@ -221,8 +211,6 @@ public class ESDStrategyConfigPane extends BasicBeanPane { } } catch (CloneNotSupportedException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); - } catch (ParseException e) { - throw new RuntimeException(e); } }