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/lang/en.js b/frontend/src/lang/en.js index 8b64712e90..dc1d42091c 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -2629,6 +2629,7 @@ export default { 'I18N_USER_TEMPLATE_ERROR': 'Template file error', 'i18n_max_user_import_size': 'File size exceeds 10M', app_template: { + execution_time: 'Execution time', app_manager: 'Application management', app_upload: 'Upload app', no_apps: 'No apps', diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index 18cf860b47..c1dfd1b51e 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -2630,6 +2630,7 @@ export default { 'I18N_USER_TEMPLATE_ERROR': '模版錯誤', 'i18n_max_user_import_size': '文件最大不能超過10M', app_template: { + execution_time: '执行时间', app_manager: '應用管理', app_upload: '上傳應用', no_apps: '暫無應用', diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index 6684f597f7..70c824fdfe 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -2630,6 +2630,7 @@ export default { 'I18N_USER_TEMPLATE_ERROR': '模版错误', 'i18n_max_user_import_size': '文件最大不能超过10M', app_template: { + execution_time: '执行时间', app_manager: '应用管理', app_upload: '上传应用', no_apps: '暂无应用', diff --git a/frontend/src/views/panel/appTemplate/AppTemplateContent.vue b/frontend/src/views/panel/appTemplate/AppTemplateContent.vue index 72875f60ce..879fb8747a 100644 --- a/frontend/src/views/panel/appTemplate/AppTemplateContent.vue +++ b/frontend/src/views/panel/appTemplate/AppTemplateContent.vue @@ -65,7 +65,7 @@ append-to-body class="de-dialog-form" width="600px" - destroy-on-close="true" + :destroy-on-close="true" > @@ -82,8 +82,8 @@ -