From 0e79734a55dd4db1f75463d2f4610286ec81ed20 Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 4 Nov 2021 10:35:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/DesignerCloudURLManager.java | 19 +++++- .../LocalWidgetFilterCategory.java | 68 +++++++++---------- 2 files changed, 50 insertions(+), 37 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignerCloudURLManager.java b/designer-base/src/main/java/com/fr/design/DesignerCloudURLManager.java index 5749eeb3b..c6e5e18cf 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerCloudURLManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerCloudURLManager.java @@ -56,15 +56,28 @@ public class DesignerCloudURLManager implements XMLable { } public String acquireUrlByKind(String key) { - String url = CloudCenter.getInstance().acquireConf(key, StringUtils.EMPTY); + String url = urlMap.getOrDefault(key, StringUtils.EMPTY); if (StringUtils.isEmpty(url)) { - return urlMap.getOrDefault(key, StringUtils.EMPTY); + //本地缓存中为空时,直接从云中心获取,获取完成后异步更新本地缓存文件 + String latestUrl = CloudCenter.getInstance().acquireConf(key, StringUtils.EMPTY); + executorService.submit(() -> { + updateURLXMLFile(key, latestUrl); + }); + return url; } + //本地缓存不为空时,直接返回对应 url,同时异步更新 + executorService.submit(() -> { + String latestUrl = CloudCenter.getInstance().acquireConf(key, StringUtils.EMPTY); + updateURLXMLFile(key, latestUrl); + }); + return url; + } + + private synchronized void updateURLXMLFile(String key, String url) { if (!urlMap.containsKey(key) || !url.equals(urlMap.get(key))) { urlMap.put(key, url); saveURLXMLFile(); } - return url; } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/LocalWidgetFilterCategory.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/LocalWidgetFilterCategory.java index b6abbe76c..1d17d3aa7 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/LocalWidgetFilterCategory.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/widgetfilter/LocalWidgetFilterCategory.java @@ -21,54 +21,54 @@ public class LocalWidgetFilterCategory { WidgetFilterTypeInfo source = new WidgetFilterTypeInfo(); source.setTitle(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Source")); source.setKey(ShareFilterConstants.SOURCE_TYPE_FILTER_KEY); - source.addFilterItem(new WidgetFilterInfo("本地", "1", "source")); - source.addFilterItem(new WidgetFilterInfo("商城", "2", "source")); - source.addFilterItem(new WidgetFilterInfo("全部", "0", "source")); + source.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Local"), "1", "source")); + source.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Shop"), "2", "source")); + source.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_All"), "0", "source")); FilterTypeInfo sourceTypeInfo = new FilterTypeInfo(source.getTitle(), source.getKey()); sourceTypeInfo.addFilterType(source); WidgetFilterTypeInfo displayDevice = new WidgetFilterTypeInfo(); displayDevice.setTitle(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Show_Device")); displayDevice.setKey(ShareFilterConstants.SHOW_TERMINAL_FILTER_KEY); - displayDevice.addFilterItem(new WidgetFilterInfo("PC端", "1", "displayDevice")); - displayDevice.addFilterItem(new WidgetFilterInfo("移动端", "2", "displayDevice")); - displayDevice.addFilterItem(new WidgetFilterInfo("全部", "0", "displayDevice")); + displayDevice.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_PC"), "1", "displayDevice")); + displayDevice.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Mobile"), "2", "displayDevice")); + displayDevice.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_All"), "0", "displayDevice")); FilterTypeInfo showDeviceTypeInfo = new FilterTypeInfo(displayDevice.getTitle(), displayDevice.getKey()); showDeviceTypeInfo.addFilterType(displayDevice); WidgetFilterTypeInfo fee = new WidgetFilterTypeInfo(); fee.setTitle(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Price")); fee.setKey(ShareFilterConstants.FEE_FILTER_KEY); - fee.addFilterItem(new WidgetFilterInfo("付费", "2", "fee")); - fee.addFilterItem(new WidgetFilterInfo("免费", "1", "fee")); - fee.addFilterItem(new WidgetFilterInfo("全部", "0", "fee")); + fee.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Pay"), "2", "fee")); + fee.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Free"), "1", "fee")); + fee.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_All"), "0", "fee")); FilterTypeInfo feeTypeInfo = new FilterTypeInfo(fee.getTitle(), fee.getKey()); feeTypeInfo.addFilterType(fee); WidgetFilterTypeInfo chart = new WidgetFilterTypeInfo(); - chart.setTitle("基础元素"); + chart.setTitle(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Basic_Element")); chart.setKey(ShareFilterConstants.CHART_FILTER_KEY); - chart.addFilterItem(new WidgetFilterInfo("柱形图/条形图", "1", "chart")); - chart.addFilterItem(new WidgetFilterInfo("折线图", "3", "chart")); - chart.addFilterItem(new WidgetFilterInfo("组合图", "4", "chart")); - chart.addFilterItem(new WidgetFilterInfo("饼图", "2", "chart")); - chart.addFilterItem(new WidgetFilterInfo("仪表盘", "5", "chart")); - chart.addFilterItem(new WidgetFilterInfo("地图", "6", "chart")); - chart.addFilterItem(new WidgetFilterInfo("其他图表", "7", "chart")); - chart.addFilterItem(new WidgetFilterInfo("明细表", "8", "chart")); - chart.addFilterItem(new WidgetFilterInfo("基础控件", "9", "chart")); - chart.addFilterItem(new WidgetFilterInfo("全部", "0", "chart")); + chart.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Bar_Chart"), "1", "chart")); + chart.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Line_Chart"), "3", "chart")); + chart.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Combination_Chart"), "4", "chart")); + chart.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Pie_Chart"), "2", "chart")); + chart.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Dashboard_Chart"), "5", "chart")); + chart.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Map"), "6", "chart")); + chart.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Other_Chart"), "7", "chart")); + chart.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Detail_List"), "8", "chart")); + chart.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Basic_Widget"), "9", "chart")); + chart.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_All"), "0", "chart")); WidgetFilterTypeInfo report = new WidgetFilterTypeInfo(); - report.setTitle("综合应用"); + report.setTitle(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Comprehensive_Application")); report.setKey(ShareFilterConstants.REPORT_FILTER_KEY); - report.addFilterItem(new WidgetFilterInfo("指标卡", "1", "report")); - report.addFilterItem(new WidgetFilterInfo("标题头", "2", "report")); - report.addFilterItem(new WidgetFilterInfo("特殊功能卡", "4", "report")); - report.addFilterItem(new WidgetFilterInfo("多维度切换", "5", "report")); - report.addFilterItem(new WidgetFilterInfo("移动目录导航", "6", "report")); - report.addFilterItem(new WidgetFilterInfo("填报", "8", "report")); - report.addFilterItem(new WidgetFilterInfo("全部", "0", "report")); + report.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Indicator_Card"), "1", "report")); + report.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Title_Head"), "2", "report")); + report.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Special_Function_Card"), "4", "report")); + report.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Multi_Dimensional_Switch"), "5", "report")); + report.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Move_Directory_Navigation"), "6", "report")); + report.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Write_Report"), "8", "report")); + report.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_All"), "0", "report")); FilterTypeInfo widgetTypeInfo = new FilterTypeInfo(Toolkit.i18nText("Fine-Design_Share_Filter_Widget_Type"), ShareFilterConstants.WIDGET_TYPE_FILTER_KEY); widgetTypeInfo.addFilterType(chart); widgetTypeInfo.addFilterType(report); @@ -76,12 +76,12 @@ public class LocalWidgetFilterCategory { WidgetFilterTypeInfo style = new WidgetFilterTypeInfo(); style.setTitle(Toolkit.i18nText("Fine-Design_Share_Filter_Style")); style.setKey(ShareFilterConstants.STYLE_FILTER_KEY); - style.addFilterItem(new WidgetFilterInfo("简约清新", "1", "style")); - style.addFilterItem(new WidgetFilterInfo("商务稳重", "2", "style")); - style.addFilterItem(new WidgetFilterInfo("活泼绚丽", "3", "style")); - style.addFilterItem(new WidgetFilterInfo("酷炫科技", "4", "style")); - style.addFilterItem(new WidgetFilterInfo("其他风格", "5", "style")); - style.addFilterItem(new WidgetFilterInfo("全部", "0", "style")); + style.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Simple_Fresh"), "1", "style")); + style.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Business_Stable"), "2", "style")); + style.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Lively_And_Bright"), "3", "style")); + style.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Cool_Technology"), "4", "style")); + style.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_Other_Style"), "5", "style")); + style.addFilterItem(new WidgetFilterInfo(Toolkit.i18nText("Fine-Design_Share_Local_Filter_Item_All"), "0", "style")); FilterTypeInfo styleTypeInfo = new FilterTypeInfo(style.getTitle(), style.getKey()); styleTypeInfo.addFilterType(style); category.add(sourceTypeInfo);