diff --git a/backend/src/main/java/io/metersphere/track/validate/CustomFieldMemberValidator.java b/backend/src/main/java/io/metersphere/track/validate/CustomFieldMemberValidator.java index 28a61d79e9..ee2d01fa23 100644 --- a/backend/src/main/java/io/metersphere/track/validate/CustomFieldMemberValidator.java +++ b/backend/src/main/java/io/metersphere/track/validate/CustomFieldMemberValidator.java @@ -22,8 +22,8 @@ public class CustomFieldMemberValidator extends AbstractCustomFieldValidator { this.isKVOption = true; UserService userService = CommonBeanFactory.getBean(UserService.class); List 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()); } diff --git a/backend/src/main/java/io/metersphere/track/validate/CustomFieldMultipleMemberValidator.java b/backend/src/main/java/io/metersphere/track/validate/CustomFieldMultipleMemberValidator.java index 2e48a00568..0471d0bc2b 100644 --- a/backend/src/main/java/io/metersphere/track/validate/CustomFieldMultipleMemberValidator.java +++ b/backend/src/main/java/io/metersphere/track/validate/CustomFieldMultipleMemberValidator.java @@ -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)); }