From b55bd2eb9fe29fc7f9c73de161a6573ff62cd1e0 Mon Sep 17 00:00:00 2001 From: AnAngle <1323481023@qq.com> Date: Tue, 6 Sep 2022 16:16:53 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B=E5=AF=BC=E5=85=A5=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E5=A1=AB=E8=B4=A6=E5=8F=B7=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1016463 --user=陈建星 【测试跟踪】github#17570,用例导出excel修改之后在导入会提示[责任人]必须当前项目成员,发现导入需要把责任人改成ID https://www.tapd.cn/55049933/s/1236015 --- .../track/validate/CustomFieldMemberValidator.java | 3 +-- .../track/validate/CustomFieldMultipleMemberValidator.java | 6 +++--- 2 files changed, 4 insertions(+), 5 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 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()));