fix(测试跟踪): 功能用例导出用户名忽略大小写
--bug=1015896 --user=陈建星 【测试跟踪】用户id是小写,导入用例时责任人id填写大写,导入失败 https://www.tapd.cn/55049933/s/1233002
This commit is contained in:
parent
e260fbeb8d
commit
04bcd6bc37
|
@ -22,8 +22,8 @@ public class CustomFieldMemberValidator extends AbstractCustomFieldValidator {
|
|||
this.isKVOption = true;
|
||||
UserService userService = CommonBeanFactory.getBean(UserService.class);
|
||||
List<User> memberOption = userService.getProjectMemberOption(SessionUtils.getCurrentProjectId());
|
||||
userIdMap = memberOption.stream().collect(Collectors.toMap(user -> user.getId().toLowerCase(), user -> user.getName().toLowerCase()));
|
||||
userNameMap = memberOption.stream().collect(Collectors.toMap(user -> user.getName().toLowerCase(), user -> user.getId().toLowerCase()));
|
||||
userIdMap = memberOption.stream().collect(Collectors.toMap(user -> user.getId().toLowerCase(), User::getId));
|
||||
userNameMap = memberOption.stream().collect(Collectors.toMap(user -> user.getName().toLowerCase(), User::getId));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,6 +41,10 @@ public class CustomFieldMemberValidator extends AbstractCustomFieldValidator {
|
|||
|
||||
@Override
|
||||
public Object parse2Key(String keyOrValue, CustomFieldDao customField) {
|
||||
keyOrValue = keyOrValue.toLowerCase();
|
||||
if (userIdMap.containsKey(keyOrValue)) {
|
||||
return userIdMap.get(keyOrValue);
|
||||
}
|
||||
if (userNameMap.containsKey(keyOrValue.toLowerCase())) {
|
||||
return userNameMap.get(keyOrValue.toLowerCase());
|
||||
}
|
||||
|
|
|
@ -34,6 +34,9 @@ public class CustomFieldMultipleMemberValidator extends CustomFieldMemberValidat
|
|||
|
||||
for (int i = 0; i < keyOrValues.size(); i++) {
|
||||
String item = keyOrValues.get(i).toLowerCase();
|
||||
if (userIdMap.containsKey(item)) {
|
||||
keyOrValues.set(i, userIdMap.get(item));
|
||||
}
|
||||
if (userNameMap.containsKey(item)) {
|
||||
keyOrValues.set(i, userNameMap.get(item));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue