fix(测试跟踪): 功能用例导入有同名用户导入失败
--bug=1020200 --user=陈建星 [测试跟踪] github#20008自定义member字段校验CustomFieldMemberValidator不支持姓名相同的用户 https://www.tapd.cn/55049933/s/1303490
This commit is contained in:
parent
de6749a506
commit
d13692c67f
|
@ -9,6 +9,7 @@ import io.metersphere.i18n.Translator;
|
||||||
import io.metersphere.service.BaseUserService;
|
import io.metersphere.service.BaseUserService;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -22,8 +23,13 @@ public class CustomFieldMemberValidator extends AbstractCustomFieldValidator {
|
||||||
this.isKVOption = true;
|
this.isKVOption = true;
|
||||||
BaseUserService userService = CommonBeanFactory.getBean(BaseUserService.class);
|
BaseUserService userService = CommonBeanFactory.getBean(BaseUserService.class);
|
||||||
List<User> memberOption = userService.getProjectMemberOption(SessionUtils.getCurrentProjectId());
|
List<User> memberOption = userService.getProjectMemberOption(SessionUtils.getCurrentProjectId());
|
||||||
userIdMap = memberOption.stream().collect(Collectors.toMap(user -> user.getId().toLowerCase(), User::getId));
|
userIdMap = memberOption.stream()
|
||||||
userNameMap = memberOption.stream().collect(Collectors.toMap(user -> user.getName().toLowerCase(), User::getId));
|
.collect(
|
||||||
|
Collectors.toMap(user -> user.getId().toLowerCase(), User::getId)
|
||||||
|
);
|
||||||
|
userNameMap = new HashMap<>();
|
||||||
|
memberOption.stream()
|
||||||
|
.forEach(user -> userNameMap.put(user.getName().toLowerCase(), user.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue