Browse Source

KERNEL-11853 抽数缓存最小更新间隔限制1分钟,不允许小数

newui
Maximus 3 years ago
parent
commit
833b53133d
  1. 20
      designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java

20
designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java

@ -188,7 +188,14 @@ public class ESDStrategyConfigPane extends BasicBeanPane<StrategyConfig> {
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<StrategyConfig> {
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");

Loading…
Cancel
Save