From 291d16943cfb3b4ceddb342f64803d058a35e327 Mon Sep 17 00:00:00 2001 From: zhangyong Date: Tue, 23 Aug 2022 10:29:27 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E5=A4=9A=E9=80=89=E5=AF=BC=E5=85=A5=E7=94=A8=E4=BE=8B=E6=97=B6?= =?UTF-8?q?=E8=B4=A3=E4=BB=BB=E4=BA=BAid=E5=BF=BD=E7=95=A5=E5=A4=A7?= =?UTF-8?q?=E5=B0=8F=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1015896 --user=张勇 【测试跟踪】用户id是小写,导入用例时责任人id填写大写,导入失败 https://www.tapd.cn/55049933/s/1229922 --- .../track/validate/CustomFieldMemberValidator.java | 3 ++- .../track/validate/CustomFieldMultipleMemberValidator.java | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) 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 5df1a9ec79..d1e91201b6 100644 --- a/backend/src/main/java/io/metersphere/track/validate/CustomFieldMemberValidator.java +++ b/backend/src/main/java/io/metersphere/track/validate/CustomFieldMemberValidator.java @@ -32,7 +32,8 @@ public class CustomFieldMemberValidator extends AbstractCustomFieldValidator { if (StringUtils.isBlank(value)) { return; } - if (userIdMap.containsKey(value) || userNameMap.containsKey(value)) { + long count = userIdMap.entrySet().stream().filter(e -> StringUtils.equalsAnyIgnoreCase(value,e.getKey(),e.getValue())).count(); + if(count > 0){ 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 1ef0de145b..9b06e34240 100644 --- a/backend/src/main/java/io/metersphere/track/validate/CustomFieldMultipleMemberValidator.java +++ b/backend/src/main/java/io/metersphere/track/validate/CustomFieldMultipleMemberValidator.java @@ -18,10 +18,12 @@ public class CustomFieldMultipleMemberValidator extends CustomFieldMemberValidat } for (String item : parse2Array(customField.getName(), value)) { - if (!userIdMap.containsKey(item) && !userNameMap.containsKey(item)) { - CustomFieldValidateException.throwException(String.format(Translator.get("custom_field_member_tip"), customField.getName())); + long count = userIdMap.entrySet().stream().filter(e -> StringUtils.equalsAnyIgnoreCase(item,e.getKey(),e.getValue())).count(); + if(count > 0){ + return; } } + CustomFieldValidateException.throwException(String.format(Translator.get("custom_field_member_tip"), customField.getName())); } @Override