fix(系统设置): 组织列表创建人展示有误
This commit is contained in:
parent
e3141a7a95
commit
43572ba9a2
|
@ -10,6 +10,7 @@ import io.metersphere.sdk.exception.MSException;
|
|||
import io.metersphere.sdk.log.constants.OperationLogModule;
|
||||
import io.metersphere.sdk.log.constants.OperationLogType;
|
||||
import io.metersphere.sdk.log.service.OperationLogService;
|
||||
import io.metersphere.sdk.service.BaseUserService;
|
||||
import io.metersphere.sdk.util.BeanUtils;
|
||||
import io.metersphere.sdk.util.JSON;
|
||||
import io.metersphere.sdk.util.Translator;
|
||||
|
@ -62,8 +63,9 @@ public class OrganizationService {
|
|||
@Resource
|
||||
private UserRolePermissionMapper userRolePermissionMapper;
|
||||
@Resource
|
||||
@Lazy
|
||||
private PluginOrganizationService pluginOrganizationService;
|
||||
@Resource
|
||||
private BaseUserService baseUserService;
|
||||
|
||||
private static final String ADD_MEMBER_PATH = "/system/organization/add-member";
|
||||
private static final String REMOVE_MEMBER_PATH = "/system/organization/remove-member";
|
||||
|
@ -76,7 +78,8 @@ public class OrganizationService {
|
|||
*/
|
||||
public List<OrganizationDTO> list(OrganizationRequest organizationRequest) {
|
||||
List<OrganizationDTO> organizationDTOS = extOrganizationMapper.list(organizationRequest);
|
||||
return buildOrgAdminInfo(organizationDTOS);
|
||||
List<OrganizationDTO> organizations = buildUserInfo(organizationDTOS);
|
||||
return buildOrgAdminInfo(organizations);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -781,6 +784,22 @@ public class OrganizationService {
|
|||
return organizationDTOS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置用户信息
|
||||
*
|
||||
* @param organizationDTOS 组织集合
|
||||
* @return 组织集合
|
||||
*/
|
||||
private List<OrganizationDTO> buildUserInfo(List<OrganizationDTO> organizationDTOS) {
|
||||
Map<String, String> userMap = baseUserService.getUserNameMap();
|
||||
organizationDTOS.forEach(organizationDTO -> {
|
||||
organizationDTO.setCreateUser(userMap.get(organizationDTO.getCreateUser()));
|
||||
organizationDTO.setDeleteUser(userMap.get(organizationDTO.getDeleteUser()));
|
||||
organizationDTO.setUpdateUser(userMap.get(organizationDTO.getUpdateUser()));
|
||||
});
|
||||
return organizationDTOS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置操作日志
|
||||
*
|
||||
|
@ -809,13 +828,6 @@ public class OrganizationService {
|
|||
logs.add(dto);
|
||||
}
|
||||
|
||||
public List<OptionDTO> getOptionsByIds(List<String> orgIds) {
|
||||
if (CollectionUtils.isEmpty(orgIds)) {
|
||||
return new ArrayList<>(0);
|
||||
}
|
||||
return extOrganizationMapper.getOptionsByIds(orgIds);
|
||||
}
|
||||
|
||||
public LinkedHashMap<Organization, List<Project>> getOrgProjectMap() {
|
||||
ProjectExample projectExample = new ProjectExample();
|
||||
projectExample.setOrderByClause("name asc");
|
||||
|
|
|
@ -3,6 +3,7 @@ package io.metersphere.system.service;
|
|||
import io.metersphere.sdk.dto.OptionDTO;
|
||||
import io.metersphere.system.domain.PluginOrganization;
|
||||
import io.metersphere.system.domain.PluginOrganizationExample;
|
||||
import io.metersphere.system.mapper.ExtOrganizationMapper;
|
||||
import io.metersphere.system.mapper.PluginOrganizationMapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
|
@ -19,7 +20,7 @@ public class PluginOrganizationService {
|
|||
@Resource
|
||||
private PluginOrganizationMapper pluginOrganizationMapper;
|
||||
@Resource
|
||||
private OrganizationService organizationService;
|
||||
private ExtOrganizationMapper extOrganizationMapper;
|
||||
|
||||
public void add(String pluginId, List<String> orgIds) {
|
||||
if (CollectionUtils.isEmpty(orgIds)) {
|
||||
|
@ -69,7 +70,7 @@ public class PluginOrganizationService {
|
|||
|
||||
// 查询组织信息
|
||||
List<String> orgIds = pluginOrganizations.stream().map(PluginOrganization::getOrganizationId).toList();
|
||||
List<OptionDTO> orgList = organizationService.getOptionsByIds(orgIds);
|
||||
List<OptionDTO> orgList = getOptionsByIds(orgIds);
|
||||
Map<String, OptionDTO> orgInfoMap = orgList.stream().collect(Collectors.toMap(OptionDTO::getId, i -> i));
|
||||
|
||||
// 组装成 map
|
||||
|
@ -86,4 +87,11 @@ public class PluginOrganizationService {
|
|||
}
|
||||
return orgMap;
|
||||
}
|
||||
|
||||
public List<OptionDTO> getOptionsByIds(List<String> orgIds) {
|
||||
if (CollectionUtils.isEmpty(orgIds)) {
|
||||
return new ArrayList<>(0);
|
||||
}
|
||||
return extOrganizationMapper.getOptionsByIds(orgIds);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue