Merge pull request #2850 from dataease/pr@dev@fix_import_user_limit

fix(系统管理-用户管理): 导入用户文件最大不能超过10M
This commit is contained in:
fit2cloud-chenyw 2022-08-16 17:49:32 +08:00 committed by GitHub
commit 86c7fb015d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 4 deletions

View File

@ -1,5 +1,7 @@
package io.dataease.plugins.server; package io.dataease.plugins.server;
import io.dataease.commons.exception.DEException;
import io.dataease.i18n.Translator;
import io.dataease.plugins.config.SpringContextUtil; 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;
@ -17,6 +19,7 @@ import javax.servlet.http.HttpServletResponse;
@RestController @RestController
public class XUserServer { public class XUserServer {
private static final Long MAXSIZE = 10485760L;
@ApiOperation("下载模版") @ApiOperation("下载模版")
@PostMapping("/template") @PostMapping("/template")
public void template(HttpServletResponse response) { public void template(HttpServletResponse response) {
@ -27,6 +30,11 @@ public class XUserServer {
@ApiOperation("导入") @ApiOperation("导入")
@PostMapping("/upload") @PostMapping("/upload")
public void upload(@RequestPart(value = "file", required = true) MultipartFile file, HttpServletResponse response) throws Exception{ public void upload(@RequestPart(value = "file", required = true) MultipartFile file, HttpServletResponse response) throws Exception{
if (file.getSize() > MAXSIZE) {
String msgKey = "i18n_max_user_import_size";
String msg = Translator.get(msgKey);
DEException.throwException(msg);
}
UserXpackService userXpackService = SpringContextUtil.getBean(UserXpackService.class); UserXpackService userXpackService = SpringContextUtil.getBean(UserXpackService.class);
userXpackService.upload(file, response); userXpackService.upload(file, response);
} }

View File

@ -206,3 +206,5 @@ i18n_gauge_field_delete=Field type changed,please edit
\u7CFB\u7EDF\u914D\u7F6E=System \u7CFB\u7EDF\u914D\u7F6E=System
\u5916\u89C2\u914D\u7F6E=Appearance \u5916\u89C2\u914D\u7F6E=Appearance
\u6570\u636E\u540C\u6B65\u8868\u5355=Data synchronization form \u6570\u636E\u540C\u6B65\u8868\u5355=Data synchronization form
i18n_max_user_import_size=File size exceeds 10M

View File

@ -205,5 +205,7 @@ i18n_row_permission_id=\u884C\u6743\u9650\u7C7B\u578B\u4E3A\u7EC4\u7EC7/\u89D2\u
\u5916\u89C2\u914D\u7F6E=\u5916\u89C2\u914D\u7F6E \u5916\u89C2\u914D\u7F6E=\u5916\u89C2\u914D\u7F6E
\u6570\u636E\u540C\u6B65\u8868\u5355=\u6570\u636E\u540C\u6B65\u8868\u5355 \u6570\u636E\u540C\u6B65\u8868\u5355=\u6570\u636E\u540C\u6B65\u8868\u5355
i18n_gauge_field_change=\u6240\u7528\u5b57\u6bb5\u53d1\u751f\u53d8\u66f4\uff0c\u8bf7\u91cd\u65b0\u7f16\u8f91 i18n_gauge_field_change=\u6240\u7528\u5B57\u6BB5\u53D1\u751F\u53D8\u66F4\uFF0C\u8BF7\u91CD\u65B0\u7F16\u8F91
i18n_gauge_field_delete=\u6240\u7528\u5b57\u6bb5\u5df2\u5220\u9664\uff0c\u8bf7\u91cd\u65b0\u7f16\u8f91 i18n_gauge_field_delete=\u6240\u7528\u5B57\u6BB5\u5DF2\u5220\u9664\uFF0C\u8BF7\u91CD\u65B0\u7F16\u8F91
i18n_max_user_import_size=\u6587\u4EF6\u5927\u5C0F\u8D85\u8FC710M

View File

@ -201,5 +201,8 @@ i18n_row_permission_id=\u884C\u6B0A\u9650\u985E\u578B\u70BA\u7D44\u7E54/\u89D2\u
\u5916\u89C2\u914D\u7F6E=\u5916\u89C0\u914D\u7F6E \u5916\u89C2\u914D\u7F6E=\u5916\u89C0\u914D\u7F6E
\u6570\u636E\u540C\u6B65\u8868\u5355=\u6578\u64DA\u540C\u6B65\u8868\u55AE \u6570\u636E\u540C\u6B65\u8868\u5355=\u6578\u64DA\u540C\u6B65\u8868\u55AE
i18n_gauge_field_change=\u6240\u7528\u5b57\u6bb5\u767c\u751f\u8b8a\u66f4\uff0c\u8acb\u91cd\u65b0\u7de8\u8f2f i18n_gauge_field_change=\u6240\u7528\u5B57\u6BB5\u767C\u751F\u8B8A\u66F4\uFF0C\u8ACB\u91CD\u65B0\u7DE8\u8F2F
i18n_gauge_field_delete=\u6240\u7528\u5b57\u6bb5\u5df2\u522a\u9664\uff0c\u8acb\u91cd\u65b0\u7de8\u8f2f i18n_gauge_field_delete=\u6240\u7528\u5B57\u6BB5\u5DF2\u522A\u9664\uFF0C\u8ACB\u91CD\u65B0\u7DE8\u8F2F
i18n_max_user_import_size=\u6587\u4EF6\u5927\u5C0F\u8D85\u904E10M