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 633acaf268..e16cb37c4d 100644 --- a/backend/src/main/resources/i18n/messages_en_US.properties +++ b/backend/src/main/resources/i18n/messages_en_US.properties @@ -147,7 +147,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 6cdae05932..53e3ba69ff 100644 --- a/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -145,7 +145,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 300deecca8..f8208f88f6 100644 --- a/backend/src/main/resources/i18n/messages_zh_TW.properties +++ b/backend/src/main/resources/i18n/messages_zh_TW.properties @@ -146,7 +146,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