From ce833626cedaeb1a3a9727a43a5f7a85a0a4d646 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Mon, 31 May 2021 14:44:23 +0800 Subject: [PATCH 1/6] =?UTF-8?q?feat:=20=E6=9F=A5=E8=AF=A2=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E8=8F=9C=E5=8D=95=E8=BF=87=E6=BB=A4=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/dataease/auth/service/impl/AuthUserServiceImpl.java | 4 ---- .../io/dataease/auth/service/impl/DynamicMenuServiceImpl.java | 1 + 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/backend/src/main/java/io/dataease/auth/service/impl/AuthUserServiceImpl.java b/backend/src/main/java/io/dataease/auth/service/impl/AuthUserServiceImpl.java index c234f58b2e..fd9dada411 100644 --- a/backend/src/main/java/io/dataease/auth/service/impl/AuthUserServiceImpl.java +++ b/backend/src/main/java/io/dataease/auth/service/impl/AuthUserServiceImpl.java @@ -6,8 +6,6 @@ import io.dataease.base.mapper.ext.AuthMapper; import io.dataease.auth.service.AuthUserService; import io.dataease.commons.constants.AuthConstants; import io.dataease.plugins.common.dto.PluginSysMenu; -import io.dataease.plugins.common.service.PluginMenuService; -import io.dataease.plugins.config.SpringContextUtil; import io.dataease.plugins.util.PluginUtils; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -15,10 +13,8 @@ import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Caching; import org.springframework.stereotype.Service; - import javax.annotation.Resource; import java.util.List; -import java.util.Map; import java.util.stream.Collectors; @Service diff --git a/backend/src/main/java/io/dataease/auth/service/impl/DynamicMenuServiceImpl.java b/backend/src/main/java/io/dataease/auth/service/impl/DynamicMenuServiceImpl.java index 60f5e4114a..bb045872bd 100644 --- a/backend/src/main/java/io/dataease/auth/service/impl/DynamicMenuServiceImpl.java +++ b/backend/src/main/java/io/dataease/auth/service/impl/DynamicMenuServiceImpl.java @@ -31,6 +31,7 @@ public class DynamicMenuServiceImpl implements DynamicMenuService { //增加插件中的菜单 List pluginSysMenus = PluginUtils.pluginMenus(); if (CollectionUtils.isNotEmpty(pluginSysMenus) ) { + pluginSysMenus = pluginSysMenus.stream().filter(menu -> menu.getType() <= 1).collect(Collectors.toList()); List pluginDtos = pluginSysMenus.stream().map(this::convert).collect(Collectors.toList()); dynamicMenuDtos.addAll(pluginDtos); } From 7fc6296bc13c2725dd5c493ab4da11c787f4e97c Mon Sep 17 00:00:00 2001 From: taojinlong Date: Mon, 31 May 2021 16:01:51 +0800 Subject: [PATCH 2/6] =?UTF-8?q?feat:=20=E6=A3=80=E6=B5=8B=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/dataease/base/mapper/ext/UtilMapper.java | 7 +++++++ .../main/java/io/dataease/base/mapper/ext/UtilMapper.xml | 9 +++++++++ .../io/dataease/service/dataset/DataSetTableService.java | 7 +++++-- 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 backend/src/main/java/io/dataease/base/mapper/ext/UtilMapper.java create mode 100644 backend/src/main/java/io/dataease/base/mapper/ext/UtilMapper.xml diff --git a/backend/src/main/java/io/dataease/base/mapper/ext/UtilMapper.java b/backend/src/main/java/io/dataease/base/mapper/ext/UtilMapper.java new file mode 100644 index 0000000000..e8842d8d9e --- /dev/null +++ b/backend/src/main/java/io/dataease/base/mapper/ext/UtilMapper.java @@ -0,0 +1,7 @@ +package io.dataease.base.mapper.ext; + + +public interface UtilMapper { + + Long currentTimestamp(); +} diff --git a/backend/src/main/java/io/dataease/base/mapper/ext/UtilMapper.xml b/backend/src/main/java/io/dataease/base/mapper/ext/UtilMapper.xml new file mode 100644 index 0000000000..a35e7f619e --- /dev/null +++ b/backend/src/main/java/io/dataease/base/mapper/ext/UtilMapper.xml @@ -0,0 +1,9 @@ + + + + + + + diff --git a/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java b/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java index 14005e8ba9..a9c61f76f7 100644 --- a/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java +++ b/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java @@ -6,6 +6,7 @@ import com.google.gson.Gson; import io.dataease.base.domain.*; import io.dataease.base.mapper.*; import io.dataease.base.mapper.ext.ExtDataSetTableMapper; +import io.dataease.base.mapper.ext.UtilMapper; import io.dataease.commons.constants.JobStatus; import io.dataease.commons.utils.*; import io.dataease.controller.request.dataset.DataSetTableRequest; @@ -880,12 +881,14 @@ public class DataSetTableService { return CollectionUtils.isNotEmpty(data); } + @Resource + private UtilMapper utilMapper; + @QuartzScheduled(cron = "0 0/3 * * * ?") public void updateDatasetTableStatus(){ List qrtzSchedulerStates = qrtzSchedulerStateMapper.selectByExample(null); - List activeQrtzInstances = qrtzSchedulerStates.stream().filter(qrtzSchedulerState -> qrtzSchedulerState.getLastCheckinTime() + qrtzSchedulerState.getCheckinInterval() + 1000 > System.currentTimeMillis()).map(QrtzSchedulerStateKey::getInstanceName).collect(Collectors.toList()); + List activeQrtzInstances = qrtzSchedulerStates.stream().filter(qrtzSchedulerState -> qrtzSchedulerState.getLastCheckinTime() + qrtzSchedulerState.getCheckinInterval() + 1000 > utilMapper.currentTimestamp()).map(QrtzSchedulerStateKey::getInstanceName).collect(Collectors.toList()); List jobStoppeddDatasetTables = new ArrayList<>(); - DatasetTableExample example = new DatasetTableExample(); example.createCriteria().andSyncStatusEqualTo(JobStatus.Underway.name()); From 7838dface216d62905d3cea4269b48990c245df3 Mon Sep 17 00:00:00 2001 From: junjie Date: Mon, 31 May 2021 16:20:28 +0800 Subject: [PATCH 3/6] =?UTF-8?q?feat(=E8=A7=86=E5=9B=BE):=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E3=80=81=E6=A0=B7=E5=BC=8F=E4=B8=AD=EF=BC=8C=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=94=BE=E5=88=B0=E5=A4=96=E9=9D=A2=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=EF=BC=8C=E4=B8=8D=E6=98=BE=E7=A4=BA=E5=88=99=E7=A6=81?= =?UTF-8?q?=E7=94=A8=E5=B1=9E=E6=80=A7=E7=BC=96=E8=BE=91=EF=BC=9B=E5=A4=96?= =?UTF-8?q?=E4=BE=A7=E6=A0=87=E9=A2=98=E7=A7=BB=E5=85=A5=E5=88=B0=E6=A0=87?= =?UTF-8?q?=E9=A2=98=E7=9A=84=E6=A0=B7=E5=BC=8F=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component-style/LegendSelector.vue | 29 +++++++++++--- .../component-style/TitleSelector.vue | 40 +++++++++++++++---- .../component-style/XAxisSelector.vue | 31 +++++++++++--- .../component-style/YAxisSelector.vue | 31 +++++++++++--- .../components/shape-attr/LabelSelector.vue | 29 +++++++++++--- .../components/shape-attr/TooltipSelector.vue | 29 +++++++++++--- frontend/src/views/chart/view/ChartEdit.vue | 35 ++++++++-------- 7 files changed, 173 insertions(+), 51 deletions(-) diff --git a/frontend/src/views/chart/components/component-style/LegendSelector.vue b/frontend/src/views/chart/components/component-style/LegendSelector.vue index c5efed7e8d..476c4b5590 100644 --- a/frontend/src/views/chart/components/component-style/LegendSelector.vue +++ b/frontend/src/views/chart/components/component-style/LegendSelector.vue @@ -2,15 +2,16 @@
- - {{ $t('chart.show') }} - + + + - {{ $t('chart.legend') }} + + {{ $t('chart.legend') }} + +
@@ -80,7 +89,8 @@ export default { { name: this.$t('chart.line_symbol_roundRect'), value: 'roundRect' }, { name: this.$t('chart.line_symbol_triangle'), value: 'triangle' }, { name: this.$t('chart.line_symbol_diamond'), value: 'diamond' } - ] + ], + isSetting: false } }, watch: { @@ -116,6 +126,9 @@ export default { this.fontSize = arr }, changeLegendStyle() { + if (!this.legendForm.show) { + this.isSetting = false + } this.$emit('onLegendChange', this.legendForm) } } @@ -147,4 +160,10 @@ export default { .el-form-item{ margin-bottom: 6px; } + +.switch-style{ + position: absolute; + right: 10px; + margin-top: -4px; +} diff --git a/frontend/src/views/chart/components/component-style/TitleSelector.vue b/frontend/src/views/chart/components/component-style/TitleSelector.vue index 2b4424daf4..67938b87ea 100644 --- a/frontend/src/views/chart/components/component-style/TitleSelector.vue +++ b/frontend/src/views/chart/components/component-style/TitleSelector.vue @@ -2,14 +2,24 @@
- - {{ $t('chart.show') }} + + + + + @@ -39,7 +49,15 @@ - {{ $t('chart.title') }} + + {{ $t('chart.title') }} + +
@@ -59,7 +77,8 @@ export default { data() { return { titleForm: JSON.parse(JSON.stringify(DEFAULT_TITLE_STYLE)), - fontSize: [] + fontSize: [], + isSetting: false } }, watch: { @@ -76,13 +95,11 @@ export default { if (customStyle.text) { this.titleForm = customStyle.text } + this.titleForm.title = this.chart.title } } } }, - created() { - console.log(JSON.stringify(this.chart)) - }, mounted() { this.init() }, @@ -98,6 +115,9 @@ export default { this.fontSize = arr }, changeTitleStyle() { + if (!this.titleForm.show) { + this.isSetting = false + } this.$emit('onTextChange', this.titleForm) } } @@ -129,4 +149,10 @@ export default { .el-form-item{ margin-bottom: 6px; } + +.switch-style{ + position: absolute; + right: 10px; + margin-top: -4px; +} diff --git a/frontend/src/views/chart/components/component-style/XAxisSelector.vue b/frontend/src/views/chart/components/component-style/XAxisSelector.vue index c967201f7d..637f2355c6 100644 --- a/frontend/src/views/chart/components/component-style/XAxisSelector.vue +++ b/frontend/src/views/chart/components/component-style/XAxisSelector.vue @@ -2,15 +2,16 @@
- - {{ $t('chart.show') }} - + + + {{ $t('chart.text_pos_top') }} @@ -24,12 +25,20 @@ - + - {{ $t('chart.xAxis') }} + + {{ $t('chart.xAxis') }} + +
@@ -48,7 +57,8 @@ export default { }, data() { return { - axisForm: JSON.parse(JSON.stringify(DEFAULT_XAXIS_STYLE)) + axisForm: JSON.parse(JSON.stringify(DEFAULT_XAXIS_STYLE)), + isSetting: false } }, watch: { @@ -73,6 +83,9 @@ export default { }, methods: { changeXAxisStyle() { + if (!this.axisForm.show) { + this.isSetting = false + } this.$emit('onChangeXAxisForm', this.axisForm) } } @@ -104,4 +117,10 @@ export default { .el-form-item{ margin-bottom: 6px; } + +.switch-style{ + position: absolute; + right: 10px; + margin-top: -4px; +} diff --git a/frontend/src/views/chart/components/component-style/YAxisSelector.vue b/frontend/src/views/chart/components/component-style/YAxisSelector.vue index 8bfed38fa1..a986e78d86 100644 --- a/frontend/src/views/chart/components/component-style/YAxisSelector.vue +++ b/frontend/src/views/chart/components/component-style/YAxisSelector.vue @@ -2,15 +2,16 @@
- - {{ $t('chart.show') }} - + + + {{ $t('chart.text_pos_left') }} @@ -24,12 +25,20 @@ - + - {{ $t('chart.yAxis') }} + + {{ $t('chart.yAxis') }} + +
@@ -48,7 +57,8 @@ export default { }, data() { return { - axisForm: JSON.parse(JSON.stringify(DEFAULT_YAXIS_STYLE)) + axisForm: JSON.parse(JSON.stringify(DEFAULT_YAXIS_STYLE)), + isSetting: false } }, watch: { @@ -73,6 +83,9 @@ export default { }, methods: { changeYAxisStyle() { + if (!this.axisForm.show) { + this.isSetting = false + } this.$emit('onChangeYAxisForm', this.axisForm) } } @@ -104,4 +117,10 @@ export default { .el-form-item{ margin-bottom: 6px; } + +.switch-style{ + position: absolute; + right: 10px; + margin-top: -4px; +} diff --git a/frontend/src/views/chart/components/shape-attr/LabelSelector.vue b/frontend/src/views/chart/components/shape-attr/LabelSelector.vue index e9289037dc..b72b29c882 100644 --- a/frontend/src/views/chart/components/shape-attr/LabelSelector.vue +++ b/frontend/src/views/chart/components/shape-attr/LabelSelector.vue @@ -2,15 +2,16 @@
- - {{ $t('chart.show') }} - + + + @@ -67,7 +68,15 @@ - {{ $t('chart.label') }} + + {{ $t('chart.label') }} + +
@@ -87,7 +96,8 @@ export default { data() { return { labelForm: JSON.parse(JSON.stringify(DEFAULT_LABEL)), - fontSize: [] + fontSize: [], + isSetting: false } }, watch: { @@ -123,6 +133,9 @@ export default { this.fontSize = arr }, changeLabelAttr() { + if (!this.labelForm.show) { + this.isSetting = false + } this.$emit('onLabelChange', this.labelForm) } } @@ -154,4 +167,10 @@ export default { .el-form-item{ margin-bottom: 6px; } + + .switch-style{ + position: absolute; + right: 10px; + margin-top: -4px; + } diff --git a/frontend/src/views/chart/components/shape-attr/TooltipSelector.vue b/frontend/src/views/chart/components/shape-attr/TooltipSelector.vue index 148a28aeb4..b509b7012f 100644 --- a/frontend/src/views/chart/components/shape-attr/TooltipSelector.vue +++ b/frontend/src/views/chart/components/shape-attr/TooltipSelector.vue @@ -2,15 +2,16 @@
- - {{ $t('chart.show') }} - + + + {{ $t('chart.tooltip_item') }} @@ -54,7 +55,15 @@ - {{ $t('chart.tooltip') }} + + {{ $t('chart.tooltip') }} + +
@@ -74,7 +83,8 @@ export default { data() { return { tooltipForm: JSON.parse(JSON.stringify(DEFAULT_TOOLTIP)), - fontSize: [] + fontSize: [], + isSetting: false } }, watch: { @@ -110,6 +120,9 @@ export default { this.fontSize = arr }, changeTooltipAttr() { + if (!this.tooltipForm.show) { + this.isSetting = false + } this.$emit('onTooltipChange', this.tooltipForm) } } @@ -141,4 +154,10 @@ export default { .el-form-item{ margin-bottom: 6px; } + +.switch-style{ + position: absolute; + right: 10px; + margin-top: -4px; +} diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index 4f48f557c8..5ae3dced7d 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -73,23 +73,23 @@ -
- - {{ $t('chart.title') }} - {{ $t('chart.confirm') }} - - - - - - -
+ + + + + + + + + + + + + + + + +
{{ $t('chart.chart_type') }} @@ -736,6 +736,7 @@ export default { onTextChange(val) { this.view.customStyle.text = val + this.view.title = val.title this.save() }, From 001f6b46fdc019ea49d8e13055515581276a5684 Mon Sep 17 00:00:00 2001 From: taojinlong Date: Mon, 31 May 2021 16:35:52 +0800 Subject: [PATCH 4/6] =?UTF-8?q?feat:=20=E9=93=BE=E6=8E=A5=E5=88=B0?= =?UTF-8?q?=E5=B8=AE=E5=8A=A9=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/layout/components/Topbar.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/layout/components/Topbar.vue b/frontend/src/layout/components/Topbar.vue index 4f5bccaedb..03c016a265 100644 --- a/frontend/src/layout/components/Topbar.vue +++ b/frontend/src/layout/components/Topbar.vue @@ -49,7 +49,7 @@ {{ $t('user.change_password') }} - + {{ $t('commons.help_documentation') }} From 10b0e87f62b1d4449c88ed3db3c068473d315004 Mon Sep 17 00:00:00 2001 From: junjie Date: Mon, 31 May 2021 16:46:23 +0800 Subject: [PATCH 5/6] =?UTF-8?q?feat(=E8=A7=86=E5=9B=BE):=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E9=BC=A0=E6=A0=87=E6=94=BE=E4=B8=8A=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E6=98=BE=E7=A4=BA=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/lang/en.js | 15 +++++- frontend/src/lang/tw.js | 15 +++++- frontend/src/lang/zh.js | 15 +++++- frontend/src/views/chart/view/ChartEdit.vue | 53 +++++++++++++++------ 4 files changed, 81 insertions(+), 17 deletions(-) diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index a370514f5a..3aab9b858e 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -679,7 +679,20 @@ export default { title_limit: 'Title cannot be greater than 50 characters', filter_condition: 'Filter Condition', filter_field_can_null: 'Filter field must choose', - preview_100_data: 'Preview 100 rows' + preview_100_data: 'Preview 100 rows', + chart_table_normal: 'Detail Table', + chart_card: 'KPI Card', + chart_bar: 'Base Bar', + chart_bar_stack: 'Stack Bar', + chart_bar_horizontal: 'Horizontal Bar', + chart_bar_stack_horizontal: 'Stack Horizontal Bar', + chart_line: 'Base Line', + chart_line_stack: 'Stack Line', + chart_pie: 'Pie', + chart_pie_rose: 'Rose Pie', + chart_funnel: 'Funnel', + chart_radar: 'Radar', + chart_gauge: 'Gauge' }, dataset: { sheet_warn: 'There are multiple sheet pages, and the first one is extracted by default', diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index 2211e4a45a..38de7d1eeb 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -679,7 +679,20 @@ export default { title_limit: '標題不能大於50個字符', filter_condition: '過濾條件', filter_field_can_null: '過濾字段必填', - preview_100_data: '預覽前100條記錄' + preview_100_data: '預覽前100條記錄', + chart_table_normal: '明細表', + chart_card: '指標卡', + chart_bar: '基礎柱狀圖', + chart_bar_stack: '堆疊柱狀圖', + chart_bar_horizontal: '橫向柱狀圖', + chart_bar_stack_horizontal: '橫向堆疊柱狀圖', + chart_line: '基礎折線圖', + chart_line_stack: '堆疊折線圖', + chart_pie: '餅圖', + chart_pie_rose: '南丁格爾玫瑰圖', + chart_funnel: '漏鬥圖', + chart_radar: '雷達圖', + chart_gauge: '儀表盤' }, dataset: { sheet_warn: '有多個sheet頁面,默認抽取第一個', diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index 348bf41e5e..f62c8a8e35 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -679,7 +679,20 @@ export default { title_limit: '标题不能大于50个字符', filter_condition: '过滤条件', filter_field_can_null: '过滤字段必填', - preview_100_data: '预览前100条记录' + preview_100_data: '预览前100条记录', + chart_table_normal: '明细表', + chart_card: '指标卡', + chart_bar: '基础柱状图', + chart_bar_stack: '堆叠柱状图', + chart_bar_horizontal: '横向柱状图', + chart_bar_stack_horizontal: '横向堆叠柱状图', + chart_line: '基础折线图', + chart_line_stack: '堆叠折线图', + chart_pie: '饼图', + chart_pie_rose: '南丁格尔玫瑰图', + chart_funnel: '漏斗图', + chart_radar: '雷达图', + chart_gauge: '仪表盘' }, dataset: { sheet_warn: '有多个Sheet页,默认抽取第一个', diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index 5ae3dced7d..200c90dae6 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -101,24 +101,49 @@ @change="save(true,'chart')" >
- - - - - + + + + + + + + + + + + + + +
- - - - - + + + + + + + + + + + + + + +
- - - - + + + + + + + + +
From b4376a079e5aa7aae1f7ac2cc1d74fcb8d84ab83 Mon Sep 17 00:00:00 2001 From: taojinlong Date: Mon, 31 May 2021 17:12:27 +0800 Subject: [PATCH 6/6] =?UTF-8?q?feat:=20license=20=E6=8F=90=E9=86=92:=20?= =?UTF-8?q?=E6=97=A0license=EF=BC=8C=E4=B8=8D=E6=8F=90=E9=86=92=EF=BC=9B?= =?UTF-8?q?=E8=BF=87=E6=9C=9F=E4=BB=A5=E5=8F=8A=E6=97=A0=E6=95=88=EF=BC=8C?= =?UTF-8?q?=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../license/DefaultLicenseService.java | 24 +------------------ .../commons/license/F2CLicenseResponse.java | 9 +++++++ .../controller/LicenseController.java | 15 ++++++------ frontend/src/store/modules/lic.js | 1 - 4 files changed, 17 insertions(+), 32 deletions(-) diff --git a/backend/src/main/java/io/dataease/commons/license/DefaultLicenseService.java b/backend/src/main/java/io/dataease/commons/license/DefaultLicenseService.java index 8f96a8463b..07a651d3b3 100644 --- a/backend/src/main/java/io/dataease/commons/license/DefaultLicenseService.java +++ b/backend/src/main/java/io/dataease/commons/license/DefaultLicenseService.java @@ -41,18 +41,6 @@ public class DefaultLicenseService { f2CLicenseResponse.setMessage("The license is unavailable for this product."); return f2CLicenseResponse; } - -// 检查每个模块的PLU限制 -// if(!Arrays.asList(NO_PLU_LIMIT_MODULES).contains(moduleId)){ -// AuthorizationUnit authorizationUnit= CommonBeanFactory.getBean(AuthorizationUnit.class); -// try{ -// authorizationUnit.calculateAssets(f2CLicenseResponse.getLicense().getCount()); -// return f2CLicenseResponse; -// }catch (Exception e){ -// f2CLicenseResponse.setStatus(F2CLicenseResponse.Status.invalid); -// f2CLicenseResponse.setMessage(e.getMessage()); -// } -// } return f2CLicenseResponse; }catch (Exception e){ return F2CLicenseResponse.invalid(e.getMessage()); @@ -79,16 +67,10 @@ public class DefaultLicenseService { License license = readLicense(); return validateLicense(product, license.getLicense()); } catch (Exception e) { - return F2CLicenseResponse.invalid(e.getMessage()); + return F2CLicenseResponse.noRecord(); } } - public void validateF2cLicense(){ - License license = readLicense(); - F2CLicenseResponse f2CLicenseResponse = validateLicense(product, license.getLicense()); - writeLicense(license.getLicense(), f2CLicenseResponse); - } - public F2CLicenseResponse updateLicense(String product, String licenseKey) { // 验证license F2CLicenseResponse response = validateLicense(product, licenseKey); @@ -104,12 +86,10 @@ public class DefaultLicenseService { public License readLicense() { License license = innerLicenseService.getLicense(LICENSE_ID); if (license == null) { - /*DEException.throwException(Translator.get("i18n_no_license_record"));*/ DEException.throwException("i18n_no_license_record"); } if (StringUtils.isBlank(license.getLicense())) { DEException.throwException("i18n_license_is_empty"); - //F2CException.throwException(Translator.get("i18n_license_is_empty")); } return license; } @@ -117,9 +97,7 @@ public class DefaultLicenseService { // 创建或更新License private void writeLicense(String licenseKey, F2CLicenseResponse response) { if (StringUtils.isBlank(licenseKey)) { - DEException.throwException("i18n_license_is_empty"); - } License license = new License(); license.setId(LICENSE_ID); diff --git a/backend/src/main/java/io/dataease/commons/license/F2CLicenseResponse.java b/backend/src/main/java/io/dataease/commons/license/F2CLicenseResponse.java index 529c97d609..632a9bfcc3 100644 --- a/backend/src/main/java/io/dataease/commons/license/F2CLicenseResponse.java +++ b/backend/src/main/java/io/dataease/commons/license/F2CLicenseResponse.java @@ -31,6 +31,7 @@ public class F2CLicenseResponse { } public static enum Status { + no_record, valid, invalid, expired; @@ -43,4 +44,12 @@ public class F2CLicenseResponse { f2CLicenseResponse.setMessage(a); return f2CLicenseResponse; } + + public static F2CLicenseResponse noRecord() { + F2CLicenseResponse f2CLicenseResponse = new F2CLicenseResponse(); + f2CLicenseResponse.setStatus(Status.no_record); + f2CLicenseResponse.setLicense(null); + f2CLicenseResponse.setMessage("No license record"); + return f2CLicenseResponse; + } } diff --git a/backend/src/main/java/io/dataease/controller/LicenseController.java b/backend/src/main/java/io/dataease/controller/LicenseController.java index f56e19d51c..4071f6b811 100644 --- a/backend/src/main/java/io/dataease/controller/LicenseController.java +++ b/backend/src/main/java/io/dataease/controller/LicenseController.java @@ -2,6 +2,7 @@ package io.dataease.controller; +import com.google.gson.Gson; import io.dataease.commons.license.DefaultLicenseService; import io.dataease.commons.license.F2CLicenseResponse; import org.springframework.beans.factory.annotation.Value; @@ -22,16 +23,14 @@ public class LicenseController { @GetMapping(value = "anonymous/license/validate") public ResultHolder validateLicense() throws Exception { - if (!need_validate_lic) { - return ResultHolder.success(null); - } - /* License license = defaultLicenseService.readLicense(); - if(StringUtils.isEmpty(license.getF2cLicense())){ - throw new Exception("Invalid License."); - } - F2CLicenseResponse f2CLicenseResponse = new Gson().fromJson(license.getF2cLicense(), F2CLicenseResponse.class);*/ +// if (!need_validate_lic) { +// return ResultHolder.success(null); +// } F2CLicenseResponse f2CLicenseResponse = defaultLicenseService.validateLicense(); + System.out.println(new Gson().toJson(f2CLicenseResponse)); switch (f2CLicenseResponse.getStatus()) { + case no_record: + return ResultHolder.success(f2CLicenseResponse); case valid: return ResultHolder.success(null); case expired: diff --git a/frontend/src/store/modules/lic.js b/frontend/src/store/modules/lic.js index 64f5ee8254..e3380eb4ba 100644 --- a/frontend/src/store/modules/lic.js +++ b/frontend/src/store/modules/lic.js @@ -32,7 +32,6 @@ const actions = { }) }) } - } export default {