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 ee2d01fa23..ddaca94398 100644 --- a/backend/src/main/java/io/metersphere/track/validate/CustomFieldMemberValidator.java +++ b/backend/src/main/java/io/metersphere/track/validate/CustomFieldMemberValidator.java @@ -32,8 +32,7 @@ public class CustomFieldMemberValidator extends AbstractCustomFieldValidator { if (StringUtils.isBlank(value)) { return; } - long count = userIdMap.entrySet().stream().filter(e -> StringUtils.equalsAnyIgnoreCase(value,e.getKey(),e.getValue())).count(); - if(count > 0){ + if (userIdMap.containsKey(value) || userNameMap.containsKey(value)) { return; } throw new CustomFieldValidateException(String.format(Translator.get("custom_field_member_tip"), customField.getName())); 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 0471d0bc2b..5ca705671a 100644 --- a/backend/src/main/java/io/metersphere/track/validate/CustomFieldMultipleMemberValidator.java +++ b/backend/src/main/java/io/metersphere/track/validate/CustomFieldMultipleMemberValidator.java @@ -17,9 +17,9 @@ public class CustomFieldMultipleMemberValidator extends CustomFieldMemberValidat } for (String item : parse2Array(customField.getName(), value)) { - long count = userIdMap.entrySet().stream().filter(e -> StringUtils.equalsAnyIgnoreCase(item,e.getKey(),e.getValue())).count(); - if(count > 0){ - return; + item = item.toLowerCase(); + if (!userIdMap.containsKey(item) && !userNameMap.containsKey(item)) { + CustomFieldValidateException.throwException(String.format(Translator.get("custom_field_member_tip"), customField.getName())); } } CustomFieldValidateException.throwException(String.format(Translator.get("custom_field_member_tip"), customField.getName()));