fix: 用户组列表操作人显示的ID

--story=1007446 --user=陈建星 统一用户选择下拉框的展示信息 https://www.tapd.cn/55049933/s/1159779
This commit is contained in:
chenjianxing 2022-05-18 13:51:34 +08:00 committed by f2c-ci-robot[bot]
parent 2f1fc4133e
commit f2b1c9ac99
1 changed files with 13 additions and 0 deletions

View File

@ -21,6 +21,7 @@ import io.metersphere.log.utils.ReflexObjectUtil;
import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.log.vo.system.SystemReference;
import io.metersphere.track.dto.TestCaseDTO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
@ -83,6 +84,17 @@ public class GroupService {
return getGroups(groupTypeList, request);
}
public void buildUserInfo(List<GroupDTO> testCases) {
List<String> userIds = new ArrayList();
userIds.addAll(testCases.stream().map(GroupDTO::getCreator).collect(Collectors.toList()));
if (!org.apache.commons.collections.CollectionUtils.isEmpty(userIds)) {
Map<String, String> userMap = ServiceUtils.getUserNameMap(userIds);
testCases.forEach(caseResult -> {
caseResult.setCreator(userMap.get(caseResult.getCreator()));
});
}
}
public Group addGroup(EditGroupRequest request) {
Group group = new Group();
checkGroupExist(request);
@ -313,6 +325,7 @@ public class GroupService {
request.setScopes(scopes);
// request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
List<GroupDTO> groups = extGroupMapper.getGroupList(request);
buildUserInfo(groups);
return PageUtils.setPageInfo(page, groups);
}