From 2aa749d06379c5c52eb65cf17a5883d7c655ad52 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Tue, 23 Aug 2022 18:07:59 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=B3=BB=E7=BB=9F=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=AE=A1=E7=90=86):=20=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E6=B2=A1=E6=9C=89=E9=AA=8C=E8=AF=81=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E8=A1=A8=E5=A4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/dataease/plugins/server/XUserServer.java | 13 ++++++++++++- .../main/resources/i18n/messages_en_US.properties | 2 +- .../main/resources/i18n/messages_zh_CN.properties | 2 +- .../main/resources/i18n/messages_zh_TW.properties | 2 +- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/io/dataease/plugins/server/XUserServer.java b/backend/src/main/java/io/dataease/plugins/server/XUserServer.java index 38692b88a6..1a66947faf 100644 --- a/backend/src/main/java/io/dataease/plugins/server/XUserServer.java +++ b/backend/src/main/java/io/dataease/plugins/server/XUserServer.java @@ -6,6 +6,7 @@ import io.dataease.plugins.config.SpringContextUtil; import io.dataease.plugins.xpack.user.service.UserXpackService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestPart; @@ -37,6 +38,16 @@ public class XUserServer { DEException.throwException(msg); } UserXpackService userXpackService = SpringContextUtil.getBean(UserXpackService.class); - userXpackService.upload(file, response); + try{ + userXpackService.upload(file, response); + }catch (Exception e) { + if (StringUtils.contains(e.getMessage(), "template file error")) { + + DEException.throwException(Translator.get("I18N_USER_TEMPLATE_ERROR")); + }else { + DEException.throwException(e.getMessage()); + } + + } } } diff --git a/backend/src/main/resources/i18n/messages_en_US.properties b/backend/src/main/resources/i18n/messages_en_US.properties index 2f5afb2967..644646b772 100644 --- a/backend/src/main/resources/i18n/messages_en_US.properties +++ b/backend/src/main/resources/i18n/messages_en_US.properties @@ -146,7 +146,7 @@ OPERATE_TYPE_LOGIN=Login OPERATE_TYPE_PC_VIEW=View with pc OPERATE_TYPE_MB_VIEW=View with mobile device OPERATE_TYPE_EXPORT=Export - +I18N_USER_TEMPLATE_ERROR=Template file error SOURCE_TYPE_DATASOURCE=DATASOURCE SOURCE_TYPE_DATASET=DATASET SOURCE_TYPE_PANEL=PANEL diff --git a/backend/src/main/resources/i18n/messages_zh_CN.properties b/backend/src/main/resources/i18n/messages_zh_CN.properties index 00a0f7d2fd..bde1835387 100644 --- a/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -144,7 +144,7 @@ OPERATE_TYPE_LOGIN=\u767B\u5F55 OPERATE_TYPE_PC_VIEW=\u4F7F\u7528PC\u67E5\u770B OPERATE_TYPE_MB_VIEW=\u4F7F\u7528\u79FB\u52A8\u7AEF\u67E5\u770B OPERATE_TYPE_EXPORT=\u5BFC\u51FA - +I18N_USER_TEMPLATE_ERROR=\u7528\u6237\u6A21\u7248\u9519\u8BEF SOURCE_TYPE_DATASOURCE=\u6570\u636E\u6E90 SOURCE_TYPE_DATASET=\u6570\u636E\u96C6 SOURCE_TYPE_PANEL=\u4EEA\u8868\u677F diff --git a/backend/src/main/resources/i18n/messages_zh_TW.properties b/backend/src/main/resources/i18n/messages_zh_TW.properties index 41b412d5e8..1282210399 100644 --- a/backend/src/main/resources/i18n/messages_zh_TW.properties +++ b/backend/src/main/resources/i18n/messages_zh_TW.properties @@ -145,7 +145,7 @@ OPERATE_TYPE_LOGIN=\u767B\u9304 OPERATE_TYPE_PC_VIEW=\u4F7F\u7528PC\u67E5\u770B OPERATE_TYPE_MB_VIEW=\u4F7F\u7528\u79FB\u52D5\u7AEF\u67E5\u770B OPERATE_TYPE_EXPORT=\u5C0E\u51FA - +I18N_USER_TEMPLATE_ERROR=\u7528\u6236\u6A21\u7248\u932F\u8AA4 SOURCE_TYPE_DATASOURCE=\u6578\u64DA\u6E90 SOURCE_TYPE_DATASET=\u6578\u64DA\u96C6 SOURCE_TYPE_PANEL=\u5100\u8868\u677F