feat(系统管理): 用户导入模板增加中文模板
This commit is contained in:
parent
9951b73c7c
commit
567a626998
|
@ -70,7 +70,8 @@ public class FilterChainUtils {
|
||||||
|
|
||||||
// 获取插件中的图片
|
// 获取插件中的图片
|
||||||
filterChainDefinitionMap.put("/plugin/image/**", "anon");
|
filterChainDefinitionMap.put("/plugin/image/**", "anon");
|
||||||
filterChainDefinitionMap.put("/templates/user_import.xlsx", "anon");
|
filterChainDefinitionMap.put("/templates/user_import_en.xlsx", "anon");
|
||||||
|
filterChainDefinitionMap.put("/templates/user_import_cn.xlsx", "anon");
|
||||||
|
|
||||||
return filterChainDefinitionMap;
|
return filterChainDefinitionMap;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,16 +10,16 @@ import lombok.Data;
|
||||||
public class UserExcel {
|
public class UserExcel {
|
||||||
@NotBlank(message = "{user.name.not_blank}")
|
@NotBlank(message = "{user.name.not_blank}")
|
||||||
@Size(min = 1, max = 255, message = "{user.name.length_range}")
|
@Size(min = 1, max = 255, message = "{user.name.length_range}")
|
||||||
@ExcelProperty("name*")
|
@ExcelProperty(index = 0)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@NotBlank(message = "{cannot_be_null}")
|
@NotBlank(message = "{cannot_be_null}")
|
||||||
@Size(min = 1, max = 64, message = "{user.email.length_range}")
|
@Size(min = 1, max = 64, message = "{user.email.length_range}")
|
||||||
@Email(message = "{user.email.invalid}")
|
@Email(message = "{user.email.invalid}")
|
||||||
@ExcelProperty("email*")
|
@ExcelProperty(index = 1)
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
@ExcelProperty("phone")
|
@ExcelProperty(index = 2)
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
@ExcelProperty("workspace")
|
@ExcelProperty("workspace")
|
||||||
|
|
|
@ -560,7 +560,24 @@ public class UserControllerTests extends BaseTest {
|
||||||
errorDataIndex = new int[]{};
|
errorDataIndex = new int[]{};
|
||||||
UserParamUtils.checkImportResponse(response, importSuccessData, errorDataIndex);
|
UserParamUtils.checkImportResponse(response, importSuccessData, errorDataIndex);
|
||||||
|
|
||||||
|
|
||||||
|
//导入中文文件
|
||||||
|
importSuccessData = 19;
|
||||||
|
filePath = Objects.requireNonNull(this.getClass().getClassLoader().getResource("file/user_import_cn_success.xls")).getPath();
|
||||||
|
file = new MockMultipartFile("file", "userImportCn.xls", MediaType.APPLICATION_OCTET_STREAM_VALUE, UserParamUtils.getFileBytes(filePath));
|
||||||
|
userImportReportDTOByFile = userService.getUserExcelParseDTO(file);
|
||||||
|
response = userRequestUtils.parseObjectFromMvcResult(userRequestUtils.responseFile(UserRequestUtils.URL_USER_IMPORT, file), UserImportResponse.class);
|
||||||
|
UserParamUtils.checkImportResponse(response, importSuccessData, errorDataIndex);//检查返回值
|
||||||
|
userDTOList = this.checkImportUserInDb(userImportReportDTOByFile);//检查数据已入库
|
||||||
|
for (UserDTO item : userDTOList) {
|
||||||
|
LOG_CHECK_LIST.add(
|
||||||
|
new CheckLogModel(item.getId(), OperationLogType.ADD, UserRequestUtils.URL_USER_IMPORT)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//文件内没有一条合格数据 应当导入成功的数据为0
|
//文件内没有一条合格数据 应当导入成功的数据为0
|
||||||
|
importSuccessData = 0;
|
||||||
filePath = Objects.requireNonNull(this.getClass().getClassLoader().getResource("file/user_import_error_all.xlsx")).getPath();
|
filePath = Objects.requireNonNull(this.getClass().getClassLoader().getResource("file/user_import_error_all.xlsx")).getPath();
|
||||||
file = new MockMultipartFile("file", "userImport.xlsx", MediaType.APPLICATION_OCTET_STREAM_VALUE, UserParamUtils.getFileBytes(filePath));
|
file = new MockMultipartFile("file", "userImport.xlsx", MediaType.APPLICATION_OCTET_STREAM_VALUE, UserParamUtils.getFileBytes(filePath));
|
||||||
response = userRequestUtils.parseObjectFromMvcResult(userRequestUtils.responseFile(UserRequestUtils.URL_USER_IMPORT, file), UserImportResponse.class);
|
response = userRequestUtils.parseObjectFromMvcResult(userRequestUtils.responseFile(UserRequestUtils.URL_USER_IMPORT, file), UserImportResponse.class);
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue