Merge pull request #2921 from dataease/pr@dev@fix_user_import_error

fix(系统管理-用户管理): 批量导入没有验证文件表头
This commit is contained in:
fit2cloud-chenyw 2022-08-23 18:09:06 +08:00 committed by GitHub
commit 98d1859149
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 4 deletions

View File

@ -6,6 +6,7 @@ import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.xpack.user.service.UserXpackService; import io.dataease.plugins.xpack.user.service.UserXpackService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.bind.annotation.RequestPart;
@ -37,6 +38,16 @@ public class XUserServer {
DEException.throwException(msg); DEException.throwException(msg);
} }
UserXpackService userXpackService = SpringContextUtil.getBean(UserXpackService.class); 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());
}
}
} }
} }

View File

@ -147,7 +147,7 @@ OPERATE_TYPE_LOGIN=Login
OPERATE_TYPE_PC_VIEW=View with pc OPERATE_TYPE_PC_VIEW=View with pc
OPERATE_TYPE_MB_VIEW=View with mobile device OPERATE_TYPE_MB_VIEW=View with mobile device
OPERATE_TYPE_EXPORT=Export OPERATE_TYPE_EXPORT=Export
I18N_USER_TEMPLATE_ERROR=Template file error
SOURCE_TYPE_DATASOURCE=DATASOURCE SOURCE_TYPE_DATASOURCE=DATASOURCE
SOURCE_TYPE_DATASET=DATASET SOURCE_TYPE_DATASET=DATASET
SOURCE_TYPE_PANEL=PANEL SOURCE_TYPE_PANEL=PANEL

View File

@ -145,7 +145,7 @@ OPERATE_TYPE_LOGIN=\u767B\u5F55
OPERATE_TYPE_PC_VIEW=\u4F7F\u7528PC\u67E5\u770B OPERATE_TYPE_PC_VIEW=\u4F7F\u7528PC\u67E5\u770B
OPERATE_TYPE_MB_VIEW=\u4F7F\u7528\u79FB\u52A8\u7AEF\u67E5\u770B OPERATE_TYPE_MB_VIEW=\u4F7F\u7528\u79FB\u52A8\u7AEF\u67E5\u770B
OPERATE_TYPE_EXPORT=\u5BFC\u51FA OPERATE_TYPE_EXPORT=\u5BFC\u51FA
I18N_USER_TEMPLATE_ERROR=\u7528\u6237\u6A21\u7248\u9519\u8BEF
SOURCE_TYPE_DATASOURCE=\u6570\u636E\u6E90 SOURCE_TYPE_DATASOURCE=\u6570\u636E\u6E90
SOURCE_TYPE_DATASET=\u6570\u636E\u96C6 SOURCE_TYPE_DATASET=\u6570\u636E\u96C6
SOURCE_TYPE_PANEL=\u4EEA\u8868\u677F SOURCE_TYPE_PANEL=\u4EEA\u8868\u677F

View File

@ -146,7 +146,7 @@ OPERATE_TYPE_LOGIN=\u767B\u9304
OPERATE_TYPE_PC_VIEW=\u4F7F\u7528PC\u67E5\u770B OPERATE_TYPE_PC_VIEW=\u4F7F\u7528PC\u67E5\u770B
OPERATE_TYPE_MB_VIEW=\u4F7F\u7528\u79FB\u52D5\u7AEF\u67E5\u770B OPERATE_TYPE_MB_VIEW=\u4F7F\u7528\u79FB\u52D5\u7AEF\u67E5\u770B
OPERATE_TYPE_EXPORT=\u5C0E\u51FA OPERATE_TYPE_EXPORT=\u5C0E\u51FA
I18N_USER_TEMPLATE_ERROR=\u7528\u6236\u6A21\u7248\u932F\u8AA4
SOURCE_TYPE_DATASOURCE=\u6578\u64DA\u6E90 SOURCE_TYPE_DATASOURCE=\u6578\u64DA\u6E90
SOURCE_TYPE_DATASET=\u6578\u64DA\u96C6 SOURCE_TYPE_DATASET=\u6578\u64DA\u96C6
SOURCE_TYPE_PANEL=\u5100\u8868\u677F SOURCE_TYPE_PANEL=\u5100\u8868\u677F