refactor(系统管理): 去掉重复的dto
This commit is contained in:
parent
65b1360b46
commit
9522889ece
|
@ -1,15 +0,0 @@
|
|||
package io.metersphere.sdk.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class OrgIdNameDTO {
|
||||
|
||||
@Schema(description = "关联的组织id")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "关联的组织名称")
|
||||
private String name;
|
||||
|
||||
}
|
|
@ -82,5 +82,5 @@ public class TestResourceReturnDTO {
|
|||
* 关联的组织id集合
|
||||
*/
|
||||
@Schema(description = "关联的组织id和名称的集合")
|
||||
private List<OrgIdNameDTO> orgIdNameMap;
|
||||
private List<OptionDTO> orgIdNameMap;
|
||||
}
|
||||
|
|
|
@ -268,18 +268,18 @@ public class TestResourcePoolService {
|
|||
TestResourceReturnDTO testResourceReturnDTO = new TestResourceReturnDTO();
|
||||
BeanUtils.copyBean(testResourceReturnDTO, testResourceDTO);
|
||||
List<String> orgIds = testResourceDTO.getOrgIds();
|
||||
List<OrgIdNameDTO> orgIdNameMap = new ArrayList<>();
|
||||
List<OptionDTO> orgIdNameMap = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(orgIds)) {
|
||||
for (String orgId : orgIds) {
|
||||
OrgIdNameDTO orgIdNameDTO = new OrgIdNameDTO();
|
||||
OptionDTO optionDTO = new OptionDTO();
|
||||
Organization organization = organizationMapper.selectByPrimaryKey(orgId);
|
||||
orgIdNameDTO.setId(orgId);
|
||||
optionDTO.setId(orgId);
|
||||
if (organization != null) {
|
||||
orgIdNameDTO.setName(organization.getName());
|
||||
optionDTO.setName(organization.getName());
|
||||
} else {
|
||||
orgIdNameDTO.setName(Translator.get("organization_not_exists"));
|
||||
optionDTO.setName(Translator.get("organization_not_exists"));
|
||||
}
|
||||
orgIdNameMap.add(orgIdNameDTO);
|
||||
orgIdNameMap.add(optionDTO);
|
||||
}
|
||||
}
|
||||
testResourceReturnDTO.setOrgIdNameMap(orgIdNameMap);
|
||||
|
|
|
@ -3,13 +3,13 @@ package io.metersphere.system.controller;
|
|||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.metersphere.sdk.constants.PermissionConstants;
|
||||
import io.metersphere.sdk.dto.OptionDTO;
|
||||
import io.metersphere.sdk.log.annotation.Log;
|
||||
import io.metersphere.sdk.log.constants.OperationLogType;
|
||||
import io.metersphere.sdk.util.PageUtils;
|
||||
import io.metersphere.sdk.util.Pager;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.dto.IdNameDisabledDTO;
|
||||
import io.metersphere.system.dto.IdNameStructureDTO;
|
||||
import io.metersphere.system.dto.OptionDisabledDTO;
|
||||
import io.metersphere.system.dto.OrgUserExtend;
|
||||
import io.metersphere.system.request.*;
|
||||
import io.metersphere.system.service.OrganizationService;
|
||||
|
@ -90,21 +90,21 @@ public class OrganizationController {
|
|||
@GetMapping("/project/list/{organizationId}")
|
||||
@Operation(summary = "系统设置-组织-成员-获取当前组织下的所有项目")
|
||||
@RequiresPermissions(PermissionConstants.ORGANIZATION_PROJECT_READ)
|
||||
public List<IdNameStructureDTO> getProjectList(@PathVariable(value = "organizationId") String organizationId, @Schema(description = "查询关键字,根据项目名查询", requiredMode = Schema.RequiredMode.REQUIRED) @RequestParam(value = "keyword", required = false) String keyword) {
|
||||
public List<OptionDTO> getProjectList(@PathVariable(value = "organizationId") String organizationId, @Schema(description = "查询关键字,根据项目名查询", requiredMode = Schema.RequiredMode.REQUIRED) @RequestParam(value = "keyword", required = false) String keyword) {
|
||||
return organizationService.getProjectList(organizationId, keyword);
|
||||
}
|
||||
|
||||
@GetMapping("/user/role/list/{organizationId}")
|
||||
@Operation(summary = "系统设置-组织-成员-获取当前组织下的所有自定义用户组以及组织级别的用户组")
|
||||
@RequiresPermissions(PermissionConstants.ORGANIZATION_MEMBER_READ)
|
||||
public List<IdNameStructureDTO> getUserRoleList(@PathVariable(value = "organizationId") String organizationId) {
|
||||
public List<OptionDTO> getUserRoleList(@PathVariable(value = "organizationId") String organizationId) {
|
||||
return organizationService.getUserRoleList(organizationId);
|
||||
}
|
||||
|
||||
@GetMapping("/not-exist/user/list/{organizationId}")
|
||||
@Operation(summary = "系统设置-组织-成员-获取不在当前组织的所有用户")
|
||||
@RequiresPermissions(PermissionConstants.SYSTEM_USER_ROLE_READ)
|
||||
public List<IdNameDisabledDTO> getUserList(@PathVariable(value = "organizationId") String organizationId, @Schema(description = "查询关键字,根据用户名查询", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
public List<OptionDisabledDTO> getUserList(@PathVariable(value = "organizationId") String organizationId, @Schema(description = "查询关键字,根据用户名查询", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@RequestParam(value = "keyword", required = false) String keyword) {
|
||||
return organizationService.getUserList(organizationId, keyword);
|
||||
}
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
package io.metersphere.system.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class IdNameStructureDTO {
|
||||
@Schema(description = "选项ID")
|
||||
private String id;
|
||||
@Schema(description = "选项名称")
|
||||
private String name;
|
||||
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package io.metersphere.system.dto;
|
||||
|
||||
import io.metersphere.sdk.dto.OptionDTO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
@ -8,7 +9,7 @@ import lombok.NoArgsConstructor;
|
|||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class IdNameDisabledDTO extends IdNameStructureDTO{
|
||||
public class OptionDisabledDTO extends OptionDTO {
|
||||
@Schema(description = "是否已经关联过")
|
||||
private Boolean disabled = false;
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package io.metersphere.system.dto;
|
||||
|
||||
import io.metersphere.sdk.dto.OptionDTO;
|
||||
import io.metersphere.system.domain.User;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
@ -15,8 +16,8 @@ import java.util.List;
|
|||
public class OrgUserExtend extends User {
|
||||
|
||||
@Schema(description = "项目ID名称集合", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<IdNameStructureDTO> projectIdNameMap;;
|
||||
private List<OptionDTO> projectIdNameMap;;
|
||||
|
||||
@Schema(description = "用户组ID名称集合", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<IdNameStructureDTO> userRoleIdNameMap;
|
||||
private List<OptionDTO> userRoleIdNameMap;
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ public interface ExtOrganizationMapper {
|
|||
* @param keyword 组织成员列表请求参数
|
||||
* @return 组织成员列表数据
|
||||
*/
|
||||
List<IdNameDisabledDTO> selectListMemberByOrg(@Param("keyword") String keyword);
|
||||
List<OptionDisabledDTO> selectListMemberByOrg(@Param("keyword") String keyword);
|
||||
|
||||
/**
|
||||
* 获取组织管理员
|
||||
|
|
|
@ -98,7 +98,7 @@
|
|||
group by temp.id
|
||||
</select>
|
||||
|
||||
<select id="selectListMemberByOrg" resultType="io.metersphere.system.dto.IdNameDisabledDTO">
|
||||
<select id="selectListMemberByOrg" resultType="io.metersphere.system.dto.OptionDisabledDTO">
|
||||
select id, name
|
||||
from user
|
||||
where deleted = 0
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.metersphere.system.mapper;
|
||||
|
||||
import io.metersphere.system.dto.IdNameStructureDTO;
|
||||
import io.metersphere.sdk.dto.OptionDTO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -14,5 +14,5 @@ public interface ExtSystemOrgProjectMapper {
|
|||
* @param keyword 组织项目列表请求参数
|
||||
* @return 组织项目列表数据
|
||||
*/
|
||||
List<IdNameStructureDTO> selectListProjectByOrg(@Param("organizationId") String organizationId, @Param("keyword") String keyword);
|
||||
List<OptionDTO> selectListProjectByOrg(@Param("organizationId") String organizationId, @Param("keyword") String keyword);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="io.metersphere.system.mapper.ExtSystemOrgProjectMapper">
|
||||
|
||||
<select id="selectListProjectByOrg" resultType="io.metersphere.system.dto.IdNameStructureDTO">
|
||||
<select id="selectListProjectByOrg" resultType="io.metersphere.sdk.dto.OptionDTO">
|
||||
select id, name
|
||||
from project
|
||||
where deleted = 0
|
||||
|
|
|
@ -297,7 +297,7 @@ public class OrganizationService {
|
|||
Set<String> projectIds = userIdProjectIdMap.get(orgUserExtend.getId());
|
||||
if (CollectionUtils.isNotEmpty(projectIds)) {
|
||||
List<Project> projectFilters = projects.stream().filter(t -> projectIds.contains(t.getId())).toList();
|
||||
List<IdNameStructureDTO> projectList = new ArrayList<>();
|
||||
List<OptionDTO> projectList = new ArrayList<>();
|
||||
setProjectList(projectList, projectFilters);
|
||||
orgUserExtend.setProjectIdNameMap(projectList);
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ public class OrganizationService {
|
|||
|
||||
Set<String> userRoleIds = userIdRoleIdMap.get(orgUserExtend.getId());
|
||||
List<UserRole> userRoleFilters = userRoles.stream().filter(t -> userRoleIds.contains(t.getId())).toList();
|
||||
List<IdNameStructureDTO> userRoleList = new ArrayList<>();
|
||||
List<OptionDTO> userRoleList = new ArrayList<>();
|
||||
setUserRoleList(userRoleList, userRoleFilters);
|
||||
orgUserExtend.setUserRoleIdNameMap(userRoleList);
|
||||
|
||||
|
@ -323,12 +323,12 @@ public class OrganizationService {
|
|||
userIdTargetIdMap.put(userId, targetIds);
|
||||
}
|
||||
|
||||
private void setProjectList(List<IdNameStructureDTO> projectList, List<Project> projectFilters) {
|
||||
private void setProjectList(List<OptionDTO> projectList, List<Project> projectFilters) {
|
||||
for (Project project : projectFilters) {
|
||||
IdNameStructureDTO idNameStructureDTO = new IdNameStructureDTO();
|
||||
idNameStructureDTO.setId(project.getId());
|
||||
idNameStructureDTO.setName(project.getName());
|
||||
projectList.add(idNameStructureDTO);
|
||||
OptionDTO optionDTO = new OptionDTO();
|
||||
optionDTO.setId(project.getId());
|
||||
optionDTO.setName(project.getName());
|
||||
projectList.add(optionDTO);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -652,7 +652,7 @@ public class OrganizationService {
|
|||
* @param organizationId 组织ID
|
||||
* @return 项目列表
|
||||
*/
|
||||
public List<IdNameStructureDTO> getProjectList(String organizationId, String keyword) {
|
||||
public List<OptionDTO> getProjectList(String organizationId, String keyword) {
|
||||
//校验组织是否存在
|
||||
checkOrgExistById(organizationId);
|
||||
return extSystemOrgProjectMapper.selectListProjectByOrg(organizationId, keyword);
|
||||
|
@ -664,11 +664,11 @@ public class OrganizationService {
|
|||
* @param organizationId 组织ID
|
||||
* @return 用户组列表
|
||||
*/
|
||||
public List<IdNameStructureDTO> getUserRoleList(String organizationId) {
|
||||
public List<OptionDTO> getUserRoleList(String organizationId) {
|
||||
//校验组织是否存在
|
||||
checkOrgExistById(organizationId);
|
||||
List<String> scopeIds = Arrays.asList(UserRoleEnum.GLOBAL.toString(), organizationId);
|
||||
List<IdNameStructureDTO> userRoleList = new ArrayList<>();
|
||||
List<OptionDTO> userRoleList = new ArrayList<>();
|
||||
UserRoleExample userRoleExample = new UserRoleExample();
|
||||
userRoleExample.createCriteria().andTypeEqualTo(UserRoleType.ORGANIZATION.toString()).andScopeIdIn(scopeIds);
|
||||
List<UserRole> userRoles = userRoleMapper.selectByExample(userRoleExample);
|
||||
|
@ -676,12 +676,12 @@ public class OrganizationService {
|
|||
return userRoleList;
|
||||
}
|
||||
|
||||
private static void setUserRoleList(List<IdNameStructureDTO> userRoleList, List<UserRole> userRoles) {
|
||||
private static void setUserRoleList(List<OptionDTO> userRoleList, List<UserRole> userRoles) {
|
||||
for (UserRole userRole : userRoles) {
|
||||
IdNameStructureDTO idNameStructureDTO = new IdNameStructureDTO();
|
||||
idNameStructureDTO.setId(userRole.getId());
|
||||
idNameStructureDTO.setName(userRole.getName());
|
||||
userRoleList.add(idNameStructureDTO);
|
||||
OptionDTO optionDTO = new OptionDTO();
|
||||
optionDTO.setId(userRole.getId());
|
||||
optionDTO.setName(userRole.getName());
|
||||
userRoleList.add(optionDTO);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -691,24 +691,24 @@ public class OrganizationService {
|
|||
* @param organizationId 组织ID
|
||||
* @return 用户列表
|
||||
*/
|
||||
public List<IdNameDisabledDTO> getUserList(String organizationId, String keyword) {
|
||||
public List<OptionDisabledDTO> getUserList(String organizationId, String keyword) {
|
||||
//校验组织是否存在
|
||||
checkOrgExistById(organizationId);
|
||||
|
||||
List<IdNameDisabledDTO> idNameDisabledDTOS = extOrganizationMapper.selectListMemberByOrg(keyword);
|
||||
List<OptionDisabledDTO> optionDisabledDTOS = extOrganizationMapper.selectListMemberByOrg(keyword);
|
||||
|
||||
UserRoleRelationExample userRoleRelationExample = new UserRoleRelationExample();
|
||||
userRoleRelationExample.createCriteria().andSourceIdEqualTo(organizationId);
|
||||
List<UserRoleRelation> userRoleRelations = userRoleRelationMapper.selectByExample(userRoleRelationExample);
|
||||
List<String> userIds = userRoleRelations.stream().map(UserRoleRelation::getUserId).distinct().toList();
|
||||
|
||||
for (IdNameDisabledDTO idNameDisabledDTO : idNameDisabledDTOS) {
|
||||
if (CollectionUtils.isNotEmpty(userIds) && userIds.contains(idNameDisabledDTO.getId())) {
|
||||
idNameDisabledDTO.setDisabled(true);
|
||||
for (OptionDisabledDTO optionDisabledDTO : optionDisabledDTOS) {
|
||||
if (CollectionUtils.isNotEmpty(userIds) && userIds.contains(optionDisabledDTO.getId())) {
|
||||
optionDisabledDTO.setDisabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
return idNameDisabledDTOS;
|
||||
return optionDisabledDTOS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,9 +4,9 @@ import io.metersphere.sdk.base.BaseTest;
|
|||
import io.metersphere.sdk.constants.InternalUserRole;
|
||||
import io.metersphere.sdk.constants.SessionConstants;
|
||||
import io.metersphere.sdk.controller.handler.ResultHolder;
|
||||
import io.metersphere.sdk.dto.OptionDTO;
|
||||
import io.metersphere.sdk.util.JSON;
|
||||
import io.metersphere.sdk.util.Pager;
|
||||
import io.metersphere.system.dto.IdNameStructureDTO;
|
||||
import io.metersphere.system.dto.OrgUserExtend;
|
||||
import io.metersphere.system.request.OrgMemberExtendProjectRequest;
|
||||
import io.metersphere.system.request.OrganizationMemberExtendRequest;
|
||||
|
@ -336,11 +336,11 @@ public class OrganizationControllerTests extends BaseTest {
|
|||
.andExpect(content().contentType(MediaType.APPLICATION_JSON)).andReturn();
|
||||
String contentAsString = mvcResult.getResponse().getContentAsString();
|
||||
ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
||||
List<IdNameStructureDTO> projectList = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), IdNameStructureDTO.class);
|
||||
List<OptionDTO> projectList = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), OptionDTO.class);
|
||||
Assertions.assertTrue(CollectionUtils.isNotEmpty(projectList));
|
||||
List<String> ids = projectList.stream().map(IdNameStructureDTO::getId).toList();
|
||||
List<String> ids = projectList.stream().map(OptionDTO::getId).toList();
|
||||
Assertions.assertTrue(ids.contains("sys_org_projectId"));
|
||||
List<String> names = projectList.stream().map(IdNameStructureDTO::getName).toList();
|
||||
List<String> names = projectList.stream().map(OptionDTO::getName).toList();
|
||||
Assertions.assertTrue(names.contains("sys_org_projectId"));
|
||||
}
|
||||
|
||||
|
@ -355,7 +355,7 @@ public class OrganizationControllerTests extends BaseTest {
|
|||
.andExpect(content().contentType(MediaType.APPLICATION_JSON)).andReturn();
|
||||
String contentAsString = mvcResult.getResponse().getContentAsString();
|
||||
ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
||||
List<IdNameStructureDTO> projectList = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), IdNameStructureDTO.class);
|
||||
List<OptionDTO> projectList = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), OptionDTO.class);
|
||||
Assertions.assertTrue(CollectionUtils.isEmpty(projectList));
|
||||
|
||||
}
|
||||
|
@ -383,11 +383,11 @@ public class OrganizationControllerTests extends BaseTest {
|
|||
.andExpect(content().contentType(MediaType.APPLICATION_JSON)).andReturn();
|
||||
String contentAsString = mvcResult.getResponse().getContentAsString();
|
||||
ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
||||
List<IdNameStructureDTO> projectList = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), IdNameStructureDTO.class);
|
||||
List<OptionDTO> projectList = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), OptionDTO.class);
|
||||
Assertions.assertTrue(CollectionUtils.isNotEmpty(projectList));
|
||||
List<String> ids = projectList.stream().map(IdNameStructureDTO::getId).toList();
|
||||
List<String> ids = projectList.stream().map(OptionDTO::getId).toList();
|
||||
Assertions.assertTrue(ids.contains("sys_default_org_role_id_3"));
|
||||
List<String> names = projectList.stream().map(IdNameStructureDTO::getName).toList();
|
||||
List<String> names = projectList.stream().map(OptionDTO::getName).toList();
|
||||
Assertions.assertTrue(names.contains("sys_default_org_role_id_3"));
|
||||
}
|
||||
|
||||
|
@ -402,12 +402,12 @@ public class OrganizationControllerTests extends BaseTest {
|
|||
.andExpect(content().contentType(MediaType.APPLICATION_JSON)).andReturn();
|
||||
String contentAsString = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||
ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
||||
List<IdNameStructureDTO> userRoleList = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), IdNameStructureDTO.class);
|
||||
List<OptionDTO> userRoleList = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), OptionDTO.class);
|
||||
Assertions.assertTrue(CollectionUtils.isNotEmpty(userRoleList));
|
||||
List<String> ids = userRoleList.stream().map(IdNameStructureDTO::getId).toList();
|
||||
List<String> ids = userRoleList.stream().map(OptionDTO::getId).toList();
|
||||
Assertions.assertTrue(ids.contains("org_admin"));
|
||||
Assertions.assertTrue(ids.contains("org_member"));
|
||||
List<String> names = userRoleList.stream().map(IdNameStructureDTO::getName).toList();
|
||||
List<String> names = userRoleList.stream().map(OptionDTO::getName).toList();
|
||||
Assertions.assertTrue(names.contains("组织管理员"));
|
||||
Assertions.assertTrue(names.contains("组织成员"));
|
||||
|
||||
|
@ -437,11 +437,11 @@ public class OrganizationControllerTests extends BaseTest {
|
|||
.andExpect(content().contentType(MediaType.APPLICATION_JSON)).andReturn();
|
||||
String contentAsString = mvcResult.getResponse().getContentAsString();
|
||||
ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
||||
List<IdNameStructureDTO> projectList = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), IdNameStructureDTO.class);
|
||||
List<OptionDTO> projectList = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), OptionDTO.class);
|
||||
Assertions.assertTrue(CollectionUtils.isNotEmpty(projectList));
|
||||
List<String> ids = projectList.stream().map(IdNameStructureDTO::getId).toList();
|
||||
List<String> ids = projectList.stream().map(OptionDTO::getId).toList();
|
||||
Assertions.assertTrue(ids.contains("sys_default_user5"));
|
||||
List<String> names = projectList.stream().map(IdNameStructureDTO::getName).toList();
|
||||
List<String> names = projectList.stream().map(OptionDTO::getName).toList();
|
||||
Assertions.assertTrue(names.contains("testUserFive"));
|
||||
}
|
||||
|
||||
|
@ -456,7 +456,7 @@ public class OrganizationControllerTests extends BaseTest {
|
|||
.andExpect(content().contentType(MediaType.APPLICATION_JSON)).andReturn();
|
||||
String contentAsString = mvcResult.getResponse().getContentAsString();
|
||||
ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
||||
List<IdNameStructureDTO> projectList = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), IdNameStructureDTO.class);
|
||||
List<OptionDTO> projectList = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), OptionDTO.class);
|
||||
Assertions.assertTrue(CollectionUtils.isNotEmpty(projectList));
|
||||
|
||||
}
|
||||
|
@ -502,25 +502,25 @@ public class OrganizationControllerTests extends BaseTest {
|
|||
}
|
||||
if (compare) {
|
||||
Assertions.assertNotNull(orgUserExtend.getUserRoleIdNameMap());
|
||||
List<String> userRoleIds = orgUserExtend.getUserRoleIdNameMap().stream().map(IdNameStructureDTO::getId).toList();
|
||||
List<String> userRoleIds = orgUserExtend.getUserRoleIdNameMap().stream().map(OptionDTO::getId).toList();
|
||||
Assertions.assertTrue(userRoleIds.contains(userRoleId));
|
||||
|
||||
if (StringUtils.isNotBlank(projectId)) {
|
||||
Assertions.assertNotNull(orgUserExtend.getProjectIdNameMap());
|
||||
List<String> projectIds = orgUserExtend.getProjectIdNameMap().stream().map(IdNameStructureDTO::getId).toList();
|
||||
List<String> projectIds = orgUserExtend.getProjectIdNameMap().stream().map(OptionDTO::getId).toList();
|
||||
Assertions.assertTrue(projectIds.contains(projectId));
|
||||
List<String> projectNames = orgUserExtend.getProjectIdNameMap().stream().map(IdNameStructureDTO::getName).toList();
|
||||
List<String> projectNames = orgUserExtend.getProjectIdNameMap().stream().map(OptionDTO::getName).toList();
|
||||
Assertions.assertTrue(projectNames.contains(projectId));
|
||||
}
|
||||
}
|
||||
if (checkPart) {
|
||||
Assertions.assertNotNull(orgUserExtend.getUserRoleIdNameMap());
|
||||
List<String> userRoleIds = orgUserExtend.getUserRoleIdNameMap().stream().map(IdNameStructureDTO::getId).toList();
|
||||
List<String> userRoleIds = orgUserExtend.getUserRoleIdNameMap().stream().map(OptionDTO::getId).toList();
|
||||
Assertions.assertFalse(userRoleIds.contains(noUserRoleId));
|
||||
|
||||
if (StringUtils.isNotBlank(noProjectId)) {
|
||||
Assertions.assertNotNull(orgUserExtend.getProjectIdNameMap());
|
||||
List<String> projectIds = orgUserExtend.getProjectIdNameMap().stream().map(IdNameStructureDTO::getId).toList();
|
||||
List<String> projectIds = orgUserExtend.getProjectIdNameMap().stream().map(OptionDTO::getId).toList();
|
||||
Assertions.assertFalse(projectIds.contains(noProjectId));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue