fix(测试计划): 导出excel/xmind责任人用户名改为邮箱

--bug=1045347 --user=宋昌昌 【测试用例】用例导出excel/xmind-责任人导出为用户姓名 https://www.tapd.cn/55049933/s/1565894
This commit is contained in:
song-cc-rock 2024-08-20 16:17:17 +08:00 committed by Craftsman
parent bb0942ae74
commit c5c8717878
2 changed files with 7 additions and 7 deletions

View File

@ -21,7 +21,7 @@ public class CustomFieldMemberValidator extends AbstractCustomFieldValidator {
protected Map<String, String> userIdMap; protected Map<String, String> userIdMap;
protected Map<String, String> userEmailMap; protected Map<String, String> userEmailMap;
protected Map<String, String> userNameMap; protected Map<String, String> userIdEmailMap;
public CustomFieldMemberValidator() { public CustomFieldMemberValidator() {
} }
@ -37,9 +37,9 @@ public class CustomFieldMemberValidator extends AbstractCustomFieldValidator {
userEmailMap = new HashMap<>(); userEmailMap = new HashMap<>();
memberOption.stream() memberOption.stream()
.forEach(user -> userEmailMap.put(user.getEmail().toLowerCase(), user.getId())); .forEach(user -> userEmailMap.put(user.getEmail().toLowerCase(), user.getId()));
userNameMap = new HashMap<>(); userIdEmailMap = new HashMap<>();
memberOption.stream() memberOption.stream()
.forEach(user -> userNameMap.put(user.getId(), user.getName().toLowerCase())); .forEach(user -> userIdEmailMap.put(user.getId(), user.getEmail().toLowerCase()));
} }
@Override @Override
@ -70,8 +70,8 @@ public class CustomFieldMemberValidator extends AbstractCustomFieldValidator {
@Override @Override
public Object parse2Value(String keyOrValue, TemplateCustomFieldDTO customField) { public Object parse2Value(String keyOrValue, TemplateCustomFieldDTO customField) {
keyOrValue = keyOrValue.toLowerCase(); keyOrValue = keyOrValue.toLowerCase();
if (userNameMap.containsKey(keyOrValue)) { if (userIdEmailMap.containsKey(keyOrValue)) {
return userNameMap.get(keyOrValue); return userIdEmailMap.get(keyOrValue);
} }
return keyOrValue; return keyOrValue;
} }

View File

@ -58,8 +58,8 @@ public class CustomFieldMultipleMemberValidator extends CustomFieldMemberValidat
for (int i = 0; i < keyOrValues.size(); i++) { for (int i = 0; i < keyOrValues.size(); i++) {
String item = keyOrValues.get(i).toLowerCase(); String item = keyOrValues.get(i).toLowerCase();
if (userNameMap.containsKey(item)) { if (userIdEmailMap.containsKey(item)) {
keyOrValues.set(i, userNameMap.get(item)); keyOrValues.set(i, userIdEmailMap.get(item));
} }
} }
return JSON.toJSONString(keyOrValues); return JSON.toJSONString(keyOrValues);