From 08b90af58c90cdaea7f7d395eefebdf1e7990204 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Wed, 2 Nov 2022 15:27:22 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E5=BA=94=E7=94=A8):=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=BA=94=E7=94=A8=E7=9A=84=E9=9D=99=E6=80=81=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=AD=98=E5=82=A8=E6=96=B9=E5=BC=8F=EF=BC=8C=E9=9D=99?= =?UTF-8?q?=E6=80=81=E6=96=87=E4=BB=B6=E7=9B=B4=E6=8E=A5=E5=AD=98=E6=94=BE?= =?UTF-8?q?=E5=9C=A8=E6=9C=8D=E5=8A=A1=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ext/ExtPanelAppTemplateMapper.java | 14 +++++++++++ .../ext/ExtPanelAppTemplateMapper.xml | 15 +++++++++++ .../panel/PanelAppTemplateService.java | 25 +++++++++++++------ .../resources/i18n/messages_en_US.properties | 2 +- .../resources/i18n/messages_zh_CN.properties | 2 +- .../resources/i18n/messages_zh_TW.properties | 2 +- .../src/components/widget/DeWidget/DeTabs.vue | 8 +++--- frontend/src/lang/en.js | 1 + frontend/src/lang/tw.js | 1 + frontend/src/lang/zh.js | 1 + .../views/panel/ViewSelect/multiplexing.vue | 2 +- .../panel/appTemplate/AppTemplateContent.vue | 2 +- .../appTemplate/component/TemplateItem.vue | 7 ++++-- .../views/panel/appTemplateMarket/index.vue | 4 +-- .../panel/appTemplateMarket/log/index.vue | 2 +- 15 files changed, 67 insertions(+), 21 deletions(-) create mode 100644 backend/src/main/java/io/dataease/ext/ExtPanelAppTemplateMapper.java create mode 100644 backend/src/main/java/io/dataease/ext/ExtPanelAppTemplateMapper.xml diff --git a/backend/src/main/java/io/dataease/ext/ExtPanelAppTemplateMapper.java b/backend/src/main/java/io/dataease/ext/ExtPanelAppTemplateMapper.java new file mode 100644 index 0000000000..b771622afc --- /dev/null +++ b/backend/src/main/java/io/dataease/ext/ExtPanelAppTemplateMapper.java @@ -0,0 +1,14 @@ +package io.dataease.ext; + +import io.dataease.plugins.common.base.domain.PanelAppTemplateWithBLOBs; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Update; + +import java.util.List; + +@Mapper +public interface ExtPanelAppTemplateMapper { + + List queryBaseInfo(@Param("nodeType") String nodeType , @Param("pid") String pid); +} diff --git a/backend/src/main/java/io/dataease/ext/ExtPanelAppTemplateMapper.xml b/backend/src/main/java/io/dataease/ext/ExtPanelAppTemplateMapper.xml new file mode 100644 index 0000000000..dcb28bc95f --- /dev/null +++ b/backend/src/main/java/io/dataease/ext/ExtPanelAppTemplateMapper.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/backend/src/main/java/io/dataease/service/panel/PanelAppTemplateService.java b/backend/src/main/java/io/dataease/service/panel/PanelAppTemplateService.java index 8b97b489f6..b520a95af4 100644 --- a/backend/src/main/java/io/dataease/service/panel/PanelAppTemplateService.java +++ b/backend/src/main/java/io/dataease/service/panel/PanelAppTemplateService.java @@ -10,6 +10,7 @@ import io.dataease.controller.request.dataset.DataSetTableRequest; import io.dataease.controller.request.panel.PanelAppTemplateApplyRequest; import io.dataease.controller.request.panel.PanelAppTemplateRequest; import io.dataease.controller.request.panel.PanelGroupRequest; +import io.dataease.ext.ExtPanelAppTemplateMapper; import io.dataease.plugins.common.base.domain.*; import io.dataease.plugins.common.base.mapper.PanelAppTemplateMapper; import io.dataease.plugins.common.constants.DatasetType; @@ -19,6 +20,7 @@ import io.dataease.service.dataset.DataSetGroupService; import io.dataease.service.dataset.DataSetTableFieldsService; import io.dataease.service.dataset.DataSetTableService; import io.dataease.service.datasource.DatasourceService; +import io.dataease.service.staticResource.StaticResourceService; import org.apache.commons.lang3.StringUtils; import org.pentaho.di.core.util.UUIDUtil; import org.springframework.context.annotation.Lazy; @@ -31,6 +33,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import static io.dataease.commons.constants.StaticResourceConstants.UPLOAD_URL_PREFIX; + /** * Author: wangjiahao * Date: 2022/9/8 @@ -40,6 +44,8 @@ import java.util.Map; public class PanelAppTemplateService { private static Gson gson = new Gson(); + @Resource + private ExtPanelAppTemplateMapper extPanelAppTemplateMapper; @Resource private PanelAppTemplateMapper panelAppTemplateMapper; @Resource @@ -59,16 +65,11 @@ public class PanelAppTemplateService { private PanelViewService panelViewService; @Resource private DataSetGroupService dataSetGroupService; + @Resource + private StaticResourceService staticResourceService; public List list(PanelAppTemplateRequest request) { - PanelAppTemplateExample example = new PanelAppTemplateExample(); - if (StringUtils.isNotEmpty(request.getPid())) { - example.createCriteria().andPidEqualTo(request.getPid()); - } - if (StringUtils.isNotEmpty(request.getNodeType())) { - example.createCriteria().andNodeTypeEqualTo(request.getNodeType()); - } - return panelAppTemplateMapper.selectByExampleWithBLOBs(example); + return extPanelAppTemplateMapper.queryBaseInfo(request.getNodeType(),request.getPid()); } public void save(PanelAppTemplateRequest request) { @@ -80,6 +81,10 @@ public class PanelAppTemplateService { if (StringUtils.isEmpty(requestTemplate.getNodeType())) { requestTemplate.setNodeType("template"); } + //Store static resource into the server + String snapshotName = "app-template-" + request.getId() + ".jpeg"; + staticResourceService.saveSingleFileToServe(snapshotName, request.getSnapshot().replace("data:image/jpeg;base64,", "")); + requestTemplate.setSnapshot("/" + UPLOAD_URL_PREFIX + '/' + snapshotName); panelAppTemplateMapper.insertSelective(requestTemplate); } @@ -90,6 +95,10 @@ public class PanelAppTemplateService { request.setUpdateTime(System.currentTimeMillis()); PanelAppTemplateWithBLOBs requestTemplate = new PanelAppTemplateWithBLOBs(); BeanUtils.copyBean(requestTemplate, request); + //Store static resource into the server + String snapshotName = "app-template-" + request.getId() + ".jpeg"; + staticResourceService.saveSingleFileToServe(snapshotName, request.getSnapshot().replace("data:image/jpeg;base64,", "")); + requestTemplate.setSnapshot("/" + UPLOAD_URL_PREFIX + '/' + snapshotName); panelAppTemplateMapper.updateByPrimaryKeySelective(requestTemplate); } diff --git a/backend/src/main/resources/i18n/messages_en_US.properties b/backend/src/main/resources/i18n/messages_en_US.properties index dfe388f61f..cb0ee034c1 100644 --- a/backend/src/main/resources/i18n/messages_en_US.properties +++ b/backend/src/main/resources/i18n/messages_en_US.properties @@ -1,7 +1,7 @@ \u4E2A\u4EBA\u4FE1\u606F=Personal Information \u4EEA\u8868\u677F=Dashboard \u6A21\u677F\u5E02\u573A=Template Market -\u5E94\u7528\u5E02\u573A=App Market +\u5E94\u7528=Application \u5E94\u7528\u7BA1\u7406=Applications \u4FEE\u6539\u5BC6\u7801=Change Password \u521B\u5EFA\u7528\u6237=Create User diff --git a/backend/src/main/resources/i18n/messages_zh_CN.properties b/backend/src/main/resources/i18n/messages_zh_CN.properties index c3724a160f..e37471cbfc 100644 --- a/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -1,7 +1,7 @@ \u4E2A\u4EBA\u4FE1\u606F=\u4E2A\u4EBA\u4FE1\u606F \u4EEA\u8868\u677F=\u4EEA\u8868\u677F \u6A21\u677F\u5E02\u573A=\u6A21\u677F\u5E02\u573A -\u5E94\u7528\u5E02\u573A=\u5E94\u7528\u5E02\u573A +\u5E94\u7528=\u5E94\u7528 \u5E94\u7528\u7BA1\u7406=\u5E94\u7528\u7BA1\u7406 \u4FEE\u6539\u5BC6\u7801=\u4FEE\u6539\u5BC6\u7801 \u521B\u5EFA\u7528\u6237=\u521B\u5EFA\u7528\u6237 diff --git a/backend/src/main/resources/i18n/messages_zh_TW.properties b/backend/src/main/resources/i18n/messages_zh_TW.properties index 93400397eb..d95e37be11 100644 --- a/backend/src/main/resources/i18n/messages_zh_TW.properties +++ b/backend/src/main/resources/i18n/messages_zh_TW.properties @@ -1,7 +1,7 @@ \u4E2A\u4EBA\u4FE1\u606F=\u500B\u4EBA\u4FE1\u606F \u4EEA\u8868\u677F=\u5100\u8868\u677F \u6A21\u677F\u5E02\u573A=\u6A21\u677F\u5E02\u5834 -\u5E94\u7528\u5E02\u573A=\u5E94\u7528\u5E02\u5834 +\u5E94\u7528=\u5E94\u7528 \u5E94\u7528\u7BA1\u7406=\u5E94\u7528\u7BA1\u7406 \u4FEE\u6539\u5BC6\u7801=\u4FEE\u6539\u5BC6\u78BC \u521B\u5EFA\u7528\u6237=\u5275\u5EFA\u7528\u6236 diff --git a/frontend/src/components/widget/DeWidget/DeTabs.vue b/frontend/src/components/widget/DeWidget/DeTabs.vue index b4f635e8ae..42e7f607c6 100644 --- a/frontend/src/components/widget/DeWidget/DeTabs.vue +++ b/frontend/src/components/widget/DeWidget/DeTabs.vue @@ -3,8 +3,10 @@ class="de-tabs-div" :class="headClass" > -
-
+
@@ -82,8 +82,8 @@ -