feat(工作台): 增加人员概览

This commit is contained in:
guoyuqi 2024-11-11 13:29:36 +08:00 committed by Craftsman
parent e3cdda1048
commit ad272627cb
20 changed files with 361 additions and 21 deletions

View File

@ -12,6 +12,7 @@ import io.metersphere.api.dto.scenario.ScenarioSystemRequest;
import io.metersphere.project.dto.DropNode;
import io.metersphere.project.dto.NodeSortQueryParam;
import io.metersphere.project.dto.ProjectCountDTO;
import io.metersphere.project.dto.ProjectUserCreateCount;
import io.metersphere.system.dto.sdk.OptionDTO;
import io.metersphere.system.dto.table.TableBatchProcessDTO;
import io.metersphere.system.interceptor.BaseConditionFilter;
@ -111,4 +112,7 @@ public interface ExtApiDefinitionMapper {
Long selectNumById(String id);
List<ProjectCountDTO> projectApiCount(@Param("projectIds") Set<String> projectIds, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userId") String userId);
List<ProjectUserCreateCount> userCreateApiCount(@Param("projectId") String projectId, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userIds") Set<String> userIds);
}

View File

@ -787,4 +787,20 @@
</if>
group by api_definition.project_id;
</select>
<select id="userCreateApiCount"
resultType="io.metersphere.project.dto.ProjectUserCreateCount">
SELECT api_definition.create_user as userId, count(api_definition.id) as count
FROM api_definition
WHERE api_definition.deleted = false
AND api_definition.project_id = #{projectId}
AND api_definition.create_time BETWEEN #{startTime} AND #{endTime}
<if test="userIds != null and userIds.size() > 0">
and api_definition.create_user in
<foreach collection="userIds" item="userId" separator="," open="(" close=")">
#{userId}
</foreach>
</if>
group by api_definition.create_user;
</select>
</mapper>

View File

@ -5,10 +5,7 @@ import io.metersphere.api.dto.definition.ExecutePageRequest;
import io.metersphere.api.dto.definition.ExecuteReportDTO;
import io.metersphere.api.dto.scenario.*;
import io.metersphere.dto.TestCaseProviderDTO;
import io.metersphere.project.dto.DropNode;
import io.metersphere.project.dto.ModuleCountDTO;
import io.metersphere.project.dto.NodeSortQueryParam;
import io.metersphere.project.dto.ProjectCountDTO;
import io.metersphere.project.dto.*;
import io.metersphere.request.AssociateOtherCaseRequest;
import io.metersphere.request.TestCasePageProviderRequest;
import io.metersphere.system.dto.sdk.BaseTreeNode;
@ -103,6 +100,8 @@ public interface ExtApiScenarioMapper {
List<ApiScenario> getNameInfo(@Param("ids") List<String> ids);
List<ProjectCountDTO> projectApiScenarioCount(@Param("projectIds") Set<String> projectIds, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userId") String userId);
List<ProjectCountDTO> projectApiScenarioCount(@Param("projectIds") Set<String> projectIds, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userId") String userId);
List<ProjectUserCreateCount> userCreateApiScenarioCount(@Param("projectId") String projectId, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userIds") Set<String> userIds);
}

View File

@ -782,4 +782,20 @@
group by api_scenario.project_id;
</select>
<select id="userCreateApiScenarioCount"
resultType="io.metersphere.project.dto.ProjectUserCreateCount">
SELECT api_scenario.create_user as userId, count(api_scenario.id) as count
FROM api_scenario
WHERE api_scenario.deleted = false
AND api_scenario.project_id = #{projectId}
AND api_scenario.create_time BETWEEN #{startTime} AND #{endTime}
<if test="userIds != null and userIds.size() > 0">
and api_scenario.create_user in
<foreach collection="userIds" item="userId" separator="," open="(" close=")">
#{userId}
</foreach>
</if>
group by api_scenario.create_user;
</select>
</mapper>

View File

@ -5,10 +5,7 @@ import io.metersphere.api.domain.ApiTestCase;
import io.metersphere.api.dto.definition.*;
import io.metersphere.api.dto.scenario.ScenarioSystemRequest;
import io.metersphere.dto.TestCaseProviderDTO;
import io.metersphere.project.dto.DropNode;
import io.metersphere.project.dto.ModuleCountDTO;
import io.metersphere.project.dto.NodeSortQueryParam;
import io.metersphere.project.dto.ProjectCountDTO;
import io.metersphere.project.dto.*;
import io.metersphere.request.AssociateOtherCaseRequest;
import io.metersphere.request.TestCasePageProviderRequest;
import io.metersphere.system.dto.sdk.BaseTreeNode;
@ -115,7 +112,7 @@ public interface ExtApiTestCaseMapper {
List<ApiTestCase> getListBySelectIds(@Param("projectId") String projectId, @Param("ids") List<String> ids, @Param("testPlanId") String testPlanId, @Param("protocols") List<String> protocols);
List<ApiTestCaseAssociateDTO>selectAllApiCaseWithAssociate(@Param("projectId") String projectId, @Param("protocols") List<String> protocols);
List<ApiTestCaseAssociateDTO> selectAllApiCaseWithAssociate(@Param("projectId") String projectId, @Param("protocols") List<String> protocols);
List<ApiTestCaseAssociateDTO> getListBySelectModulesWithAssociate(@Param("projectId") String projectId, @Param("moduleIds") List<String> moduleIds, @Param("protocols") List<String> protocols);
@ -127,7 +124,7 @@ public interface ExtApiTestCaseMapper {
List<ApiTestCase> getRefApiScenarioCreator(@Param("ids") List<String> caseIds);
void clearApiChange(@Param("ids") List<String> ids);
void clearApiChange(@Param("ids") List<String> ids);
List<ApiTestCaseWithBlob> selectAllDetailByApiIds(@Param("apiIds") List<String> apiIds);
@ -135,6 +132,8 @@ public interface ExtApiTestCaseMapper {
List<ApiTestCaseDTO> selectBaseInfoByProjectIdAndApiId(@Param("projectId") String projectId, @Param("apiId") String apiId);
List<ProjectCountDTO> projectApiCaseCount(@Param("projectIds") Set<String> projectIds, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userId") String userId);
List<ProjectCountDTO> projectApiCaseCount(@Param("projectIds") Set<String> projectIds, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userId") String userId);
List<ProjectUserCreateCount> userCreateApiCaseCount(@Param("projectId") String projectId, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userIds") Set<String> userIds);
}

View File

@ -1002,4 +1002,20 @@
group by api_test_case.project_id;
</select>
<select id="userCreateApiCaseCount"
resultType="io.metersphere.project.dto.ProjectUserCreateCount">
SELECT api_test_case.create_user as userId, count(api_test_case.id) as count
FROM api_test_case
WHERE api_test_case.deleted = false
AND api_test_case.project_id = #{projectId}
AND api_test_case.create_time BETWEEN #{startTime} AND #{endTime}
<if test="userIds != null and userIds.size() > 0">
and api_test_case.create_user in
<foreach collection="userIds" item="userId" separator="," open="(" close=")">
#{userId}
</foreach>
</if>
group by api_test_case.create_user;
</select>
</mapper>

View File

@ -6,6 +6,7 @@ import io.metersphere.bug.dto.response.BugDTO;
import io.metersphere.bug.dto.response.BugTagEditDTO;
import io.metersphere.dto.BugProviderDTO;
import io.metersphere.project.dto.ProjectCountDTO;
import io.metersphere.project.dto.ProjectUserCreateCount;
import io.metersphere.request.AssociateBugRequest;
import io.metersphere.request.BugPageProviderRequest;
import io.metersphere.system.interceptor.BaseConditionFilter;
@ -113,5 +114,6 @@ public interface ExtBugMapper {
List<String> getIdsByProvider(@Param("request") AssociateBugRequest request, @Param("deleted") boolean deleted);
List<ProjectCountDTO> projectBugCount(@Param("projectIds") Set<String> projectIds, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userId") String userId);
List<ProjectUserCreateCount> userCreateBugCount(@Param("projectId") String projectId, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userIds") Set<String> userIds);
}

View File

@ -377,5 +377,21 @@
group by bug.project_id;
</select>
<select id="userCreateBugCount"
resultType="io.metersphere.project.dto.ProjectUserCreateCount">
SELECT bug.create_user as userId, count(bug.id) as count
FROM bug
WHERE bug.deleted = false
AND bug.project_id = #{projectId}
AND bug.create_time BETWEEN #{startTime} AND #{endTime}
<if test="userIds != null and userIds.size() > 0">
and bug.create_user in
<foreach collection="userIds" item="userId" separator="," open="(" close=")">
#{userId}
</foreach>
</if>
group by bug.create_user;
</select>
</mapper>

View File

@ -6,6 +6,7 @@ import io.metersphere.functional.request.CaseReviewBatchRequest;
import io.metersphere.functional.request.CaseReviewPageRequest;
import io.metersphere.project.dto.ModuleCountDTO;
import io.metersphere.project.dto.ProjectCountDTO;
import io.metersphere.project.dto.ProjectUserCreateCount;
import io.metersphere.system.interceptor.BaseConditionFilter;
import org.apache.ibatis.annotations.Param;
@ -44,4 +45,7 @@ public interface ExtCaseReviewMapper {
List<ProjectCountDTO> projectReviewCount(@Param("projectIds") Set<String> projectIds, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userId") String userId);
List<ProjectUserCreateCount> userCreateReviewCount(@Param("projectId") String projectId, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userIds") Set<String> userIds);
}

View File

@ -359,4 +359,19 @@
group by case_review.project_id;
</select>
<select id="userCreateReviewCount"
resultType="io.metersphere.project.dto.ProjectUserCreateCount">
SELECT case_review.create_user as userId, count(case_review.id) as count
FROM case_review
WHERE case_review.project_id = #{projectId}
AND case_review.create_time BETWEEN #{startTime} AND #{endTime}
<if test="userIds != null and userIds.size() > 0">
and case_review.create_user in
<foreach collection="userIds" item="userId" separator="," open="(" close=")">
#{userId}
</foreach>
</if>
group by case_review.create_user;
</select>
</mapper>

View File

@ -10,6 +10,7 @@ import io.metersphere.functional.dto.FunctionalCaseVersionDTO;
import io.metersphere.functional.request.*;
import io.metersphere.project.dto.ModuleCountDTO;
import io.metersphere.project.dto.ProjectCountDTO;
import io.metersphere.project.dto.ProjectUserCreateCount;
import io.metersphere.request.AssociateOtherCaseRequest;
import io.metersphere.request.TestCasePageProviderRequest;
import io.metersphere.system.dto.sdk.BaseTreeNode;
@ -121,4 +122,6 @@ public interface ExtFunctionalCaseMapper {
List<ProjectCountDTO> projectCaseCount(@Param("projectIds") Set<String> projectIds, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userId") String userId);
List<ProjectUserCreateCount> userCreateCaseCount(@Param("projectId") String projectId, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userIds") Set<String> userIds);
}

View File

@ -917,4 +917,20 @@
group by functional_case.project_id;
</select>
<select id="userCreateCaseCount"
resultType="io.metersphere.project.dto.ProjectUserCreateCount">
SELECT functional_case.create_user as userId, count(functional_case.id) as count
FROM functional_case
WHERE functional_case.deleted = false
AND functional_case.project_id = #{projectId}
AND functional_case.create_time BETWEEN #{startTime} AND #{endTime}
<if test="userIds != null and userIds.size() > 0">
and functional_case.create_user in
<foreach collection="userIds" item="userId" separator="," open="(" close=")">
#{userId}
</foreach>
</if>
group by functional_case.create_user;
</select>
</mapper>

View File

@ -50,6 +50,13 @@ public class DashboardController {
return dashboardService.projectViewCount(request, SessionUtils.getUserId());
}
@PostMapping("/project_member_view")
@Operation(summary = "人员概览")
@CheckOwner(resourceId = "#request.getOrganizationId()", resourceType = "organization")
public OverViewCountDTO projectMemberViewCount(@Validated @RequestBody DashboardFrontPageRequest request) {
return dashboardService.projectMemberViewCount(request);
}

View File

@ -14,8 +14,10 @@ import io.metersphere.functional.mapper.ExtFunctionalCaseMapper;
import io.metersphere.plan.mapper.ExtTestPlanMapper;
import io.metersphere.project.domain.Project;
import io.metersphere.project.dto.ProjectCountDTO;
import io.metersphere.project.dto.ProjectUserCreateCount;
import io.metersphere.project.mapper.ExtProjectMapper;
import io.metersphere.project.mapper.ExtProjectMemberMapper;
import io.metersphere.project.mapper.ProjectMapper;
import io.metersphere.project.service.ProjectService;
import io.metersphere.sdk.constants.PermissionConstants;
import io.metersphere.sdk.util.JSON;
@ -64,6 +66,8 @@ public class DashboardService {
@Resource
private ProjectService projectService;
@Resource
private ProjectMapper projectMapper;
@Resource
private UserLayoutMapper userLayoutMapper;
@ -75,6 +79,11 @@ public class DashboardService {
public static final String TEST_PLAN = "TEST_PLAN"; // 测试计划
public static final String BUG_COUNT = "BUG_COUNT"; // 缺陷数量
public static final String API_TEST_MODULE = "apiTest";
public static final String TEST_PLAN_MODULE = "testPlan";
public static final String FUNCTIONAL_CASE_MODULE = "caseManagement";
public static final String BUG_MODULE = "bugManagement";
public OverViewCountDTO createByMeCount(DashboardFrontPageRequest request, String userId) {
List<Project> projects;
@ -288,13 +297,16 @@ public class DashboardService {
allProjectIds.addAll(layoutDTO.getProjectIds());
allHandleUsers.addAll(layoutDTO.getHandleUsers());
}
List<String> projectIds = allProjectIds.stream().distinct().toList();
List<Project> getUserProjectIdName = extProjectMapper.getUserProjectIdName(null, projectIds, userId);
List<Project> getUserProjectIdName;
if(CollectionUtils.isEmpty(allProjectIds)) {
getUserProjectIdName =extProjectMapper.getUserProjectIdName(organizationId, null, userId);
} else {
List<String> projectIds = allProjectIds.stream().distinct().toList();
getUserProjectIdName =extProjectMapper.getUserProjectIdName(null, projectIds, userId);
}
Map<String, Project> projectMap = getUserProjectIdName.stream().collect(Collectors.toMap(Project::getId, t -> t));
List<String> handleUsers = allHandleUsers.stream().distinct().toList();
List<ProjectUserMemberDTO> orgProjectMemberList = extProjectMemberMapper.getOrgProjectMemberList(organizationId, handleUsers);
//重新填充填充返回的项目id 用户id
rebuildProjectOrUser(layoutDTOS, getUserProjectIdName, projectMap, orgProjectMemberList);
return layoutDTOS;
@ -361,4 +373,142 @@ public class DashboardService {
}
}
}
public OverViewCountDTO projectMemberViewCount(DashboardFrontPageRequest request) {
String projectId = request.getProjectIds().getFirst();
Project project = projectMapper.selectByPrimaryKey(projectId);
List<String> moduleIds = JSON.parseArray(project.getModuleSetting(), String.class);
Long toStartTime = request.getToStartTime();
Long toEndTime = request.getToEndTime();
List<ProjectUserMemberDTO> projectMemberList = extProjectMemberMapper.getProjectMemberList(projectId, request.getHandleUsers());
Map<String, String> userNameMap = projectMemberList.stream().collect(Collectors.toMap(ProjectUserMemberDTO::getId, ProjectUserMemberDTO::getName));
return getUserCountDTO(userNameMap, moduleIds, projectId, toStartTime, toEndTime);
}
@NotNull
private OverViewCountDTO getUserCountDTO(Map<String, String> userNameMap, List<String> moduleIds, String projectId, Long toStartTime, Long toEndTime) {
List<String> xaxis = new ArrayList<>(userNameMap.values());
Set<String> userIds = userNameMap.keySet();
Map<String, Integer> userCaseCountMap;
Map<String, Integer> userReviewCountMap;
Map<String, Integer> userApiCountMap;
Map<String, Integer> userApiScenarioCountMap;
Map<String, Integer> userApiCaseCountMap;
Map<String, Integer> userPlanCountMap;
Map<String, Integer> userBugCountMap ;
if (moduleIds.contains(FUNCTIONAL_CASE_MODULE)) {
List<ProjectUserCreateCount> userCreateCaseCount = extFunctionalCaseMapper.userCreateCaseCount(projectId, toStartTime, toEndTime, userIds);
userCaseCountMap = userCreateCaseCount.stream().collect(Collectors.toMap(ProjectUserCreateCount::getUserId, ProjectUserCreateCount::getCount));
List<ProjectUserCreateCount> userCreateReviewCount = extCaseReviewMapper.userCreateReviewCount(projectId, toStartTime, toEndTime, userIds);
userReviewCountMap = userCreateReviewCount.stream().collect(Collectors.toMap(ProjectUserCreateCount::getUserId, ProjectUserCreateCount::getCount));
} else {
userReviewCountMap = new HashMap<>();
userCaseCountMap = new HashMap<>();
}
if (moduleIds.contains(API_TEST_MODULE)) {
List<ProjectUserCreateCount> userCreateApiCount = extApiDefinitionMapper.userCreateApiCount(projectId, toStartTime, toEndTime, userIds);
userApiCountMap = userCreateApiCount.stream().collect(Collectors.toMap(ProjectUserCreateCount::getUserId, ProjectUserCreateCount::getCount));
List<ProjectUserCreateCount> userCreateApiScenarioCount = extApiScenarioMapper.userCreateApiScenarioCount(projectId, toStartTime, toEndTime, userIds);
userApiScenarioCountMap = userCreateApiScenarioCount.stream().collect(Collectors.toMap(ProjectUserCreateCount::getUserId, ProjectUserCreateCount::getCount));
List<ProjectUserCreateCount> userCreateApiCaseCount = extApiTestCaseMapper.userCreateApiCaseCount(projectId, toStartTime, toEndTime, userIds);
userApiCaseCountMap = userCreateApiCaseCount.stream().collect(Collectors.toMap(ProjectUserCreateCount::getUserId, ProjectUserCreateCount::getCount));
} else {
userApiCountMap = new HashMap<>();
userApiScenarioCountMap = new HashMap<>();
userApiCaseCountMap = new HashMap<>();
}
if (moduleIds.contains(TEST_PLAN_MODULE)) {
List<ProjectUserCreateCount> userCreatePlanCount = extTestPlanMapper.userCreatePlanCount(projectId, toStartTime, toEndTime, userIds);
userPlanCountMap = userCreatePlanCount.stream().collect(Collectors.toMap(ProjectUserCreateCount::getUserId, ProjectUserCreateCount::getCount));
} else {
userPlanCountMap = new HashMap<>();
}
if (moduleIds.contains(BUG_MODULE)) {
List<ProjectUserCreateCount> userCreateBugCount = extBugMapper.userCreateBugCount(projectId, toStartTime, toEndTime, userIds);
userBugCountMap = userCreateBugCount.stream().collect(Collectors.toMap(ProjectUserCreateCount::getUserId, ProjectUserCreateCount::getCount));
} else {
userBugCountMap = new HashMap<>();
}
List<Integer> userCaseCount = new ArrayList<>();
List<Integer> userReviewCount = new ArrayList<>();
List<Integer> userApiCount = new ArrayList<>();
List<Integer> userApiCaseCount = new ArrayList<>();
List<Integer> userApiScenarioCount = new ArrayList<>();
List<Integer> userPlanCount = new ArrayList<>();
List<Integer> userBugCount = new ArrayList<>();
userNameMap.forEach((id, userName)->{
if (userCaseCountMap.get(id)!=null) {
userCaseCount.add(userCaseCountMap.get(id));
} else {
userCaseCount.add(0);
}
if (userReviewCountMap.get(id)!=null) {
userReviewCount.add(userCaseCountMap.get(id));
} else {
userReviewCount.add(0);
}
if (userApiCountMap.get(id)!=null) {
userApiCount.add(userApiCountMap.get(id));
} else {
userApiCount.add(0);
}
if (userApiCaseCountMap.get(id)!=null) {
userApiCaseCount.add(userApiCaseCountMap.get(id));
} else {
userApiCaseCount.add(0);
}
if (userApiScenarioCountMap.get(id)!=null) {
userApiScenarioCount.add(userApiScenarioCountMap.get(id));
} else {
userApiScenarioCount.add(0);
}
if (userPlanCountMap.get(id)!=null) {
userPlanCount.add(userPlanCountMap.get(id));
} else {
userPlanCount.add(0);
}
if (userBugCountMap.get(id)!=null) {
userBugCount.add(userBugCountMap.get(id));
} else {
userBugCount.add(0);
}
});
List<NameArrayDTO> nameArrayDTOList = new ArrayList<>();
NameArrayDTO userCaseArray = new NameArrayDTO();
userCaseArray.setCount(userCaseCount);
nameArrayDTOList.add(userCaseArray);
NameArrayDTO userReviewArray = new NameArrayDTO();
userReviewArray.setCount(userReviewCount);
nameArrayDTOList.add(userReviewArray);
NameArrayDTO userApiArray = new NameArrayDTO();
userApiArray.setCount(userApiCount);
nameArrayDTOList.add(userApiArray);
NameArrayDTO userApiCaseArray = new NameArrayDTO();
userApiCaseArray.setCount(userApiCaseCount);
nameArrayDTOList.add(userApiCaseArray);
NameArrayDTO userApiScenarioArray = new NameArrayDTO();
userApiScenarioArray.setCount(userApiScenarioCount);
nameArrayDTOList.add(userApiScenarioArray);
NameArrayDTO userPlanArray = new NameArrayDTO();
userPlanArray.setCount(userPlanCount);
nameArrayDTOList.add(userPlanArray);
NameArrayDTO userBugArray = new NameArrayDTO();
userBugArray.setCount(userBugCount);
nameArrayDTOList.add(userBugArray);
OverViewCountDTO overViewCountDTO = new OverViewCountDTO();
overViewCountDTO.setXAxis(xaxis);
overViewCountDTO.setProjectCountList(nameArrayDTOList);
return overViewCountDTO;
}
}

View File

@ -48,6 +48,7 @@ public class DashboardFrontPageControllerTests extends BaseTest {
private static final String CREATE_BY_ME = "/dashboard/create_by_me";
private static final String PROJECT_VIEW = "/dashboard/project_view";
private static final String PROJECT_MEMBER_VIEW = "/dashboard/project_member_view";
@Test
@ -94,12 +95,33 @@ public class DashboardFrontPageControllerTests extends BaseTest {
OverViewCountDTO gyq3 = dashboardService.projectViewCount(dashboardFrontPageRequest, "default-dashboard-member-user-gyq");
Assertions.assertNotNull(gyq3);
dashboardFrontPageRequest.setProjectIds(List.of(DEFAULT_PROJECT_ID));
mvcResultAll = this.requestPostWithOkAndReturn(PROJECT_MEMBER_VIEW, dashboardFrontPageRequest);
moduleCountAll = JSON.parseObject(JSON.toJSONString(
JSON.parseObject(mvcResultAll.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData()),
OverViewCountDTO.class);
Assertions.assertNotNull(moduleCountAll);
Project project = new Project();
project.setModuleSetting("[]");
project.setId(DEFAULT_PROJECT_ID);
projectMapper.updateByPrimaryKeySelective(project);
OverViewCountDTO gyq4 = dashboardService.projectViewCount(dashboardFrontPageRequest, "default-dashboard-member-user-gyq");
Assertions.assertTrue(gyq4.getXAxis().isEmpty());
List<String> moduleIds = new ArrayList<>();
moduleIds.add("apiTest");
moduleIds.add("testPlan");
moduleIds.add("caseManagement");
moduleIds.add("bugManagement");
project.setModuleSetting(moduleIds.toString());
project.setId(DEFAULT_PROJECT_ID);
projectMapper.updateByPrimaryKeySelective(project);
}
@Test
@Order(2)
public void testLayout() throws Exception {
MvcResult mvcResultGrt = this.requestGetWithOkAndReturn(GET_LAYOUT+DEFAULT_ORGANIZATION_ID);
MvcResult mvcResultGrt = this.requestGetWithOkAndReturn(GET_LAYOUT+"DEFAULT_ORGANIZATION_ID");
String contentAsString = mvcResultGrt.getResponse().getContentAsString(StandardCharsets.UTF_8);
ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
List<LayoutDTO> layoutDTOS = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), LayoutDTO.class);
@ -187,4 +209,6 @@ public class DashboardFrontPageControllerTests extends BaseTest {
}
}

View File

@ -0,0 +1,18 @@
package io.metersphere.project.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ProjectUserCreateCount {
@Schema(description = "用户ID")
private String userId;
@Schema(description = "数量")
private int count;
}

View File

@ -45,4 +45,11 @@ public interface ExtProjectMemberMapper {
*/
List<ProjectUserMemberDTO> getOrgProjectMemberList(@Param("organizationId") String organizationId, @Param("userIds") List<String>userIds );
/**
* 获取项目下所有有项目权限的成员
* @param projectId 项目ID
* @param userIds 用户过滤
* @return List<ProjectUserMemberDTO>
*/
List<ProjectUserMemberDTO> getProjectMemberList(@Param("projectId") String projectId, @Param("userIds") List<String>userIds );
}

View File

@ -74,4 +74,17 @@
order by urr.create_time desc
</select>
<select id="getProjectMemberList" resultType="io.metersphere.system.dto.user.ProjectUserMemberDTO">
SELECT distinct u.id, urr.source_id AS projectId, u.name from user_role_relation urr
join `user` u on urr.user_id = u.id where
urr.source_id = #{projectId} and u.deleted = 0 and u.enable = 1
<if test="userIds != null and userIds.size() > 0">
and u.id in
<foreach collection="userIds" item="userId" separator="," open="(" close=")">
#{userId}
</foreach>
</if>
order by urr.create_time desc
</select>
</mapper>

View File

@ -8,10 +8,7 @@ import io.metersphere.plan.dto.request.TestPlanBatchProcessRequest;
import io.metersphere.plan.dto.request.TestPlanExecuteHisPageRequest;
import io.metersphere.plan.dto.request.TestPlanTableRequest;
import io.metersphere.plan.dto.response.TestPlanResponse;
import io.metersphere.project.dto.DropNode;
import io.metersphere.project.dto.ModuleCountDTO;
import io.metersphere.project.dto.NodeSortQueryParam;
import io.metersphere.project.dto.ProjectCountDTO;
import io.metersphere.project.dto.*;
import io.metersphere.system.interceptor.BaseConditionFilter;
import org.apache.ibatis.annotations.Param;
@ -78,6 +75,9 @@ public interface ExtTestPlanMapper {
List<ProjectCountDTO> projectPlanCount(@Param("projectIds") Set<String> projectIds, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userId") String userId);
List<ProjectUserCreateCount> userCreatePlanCount(@Param("projectId") String projectId, @Param("startTime") long startTime, @Param("endTime") long endTime, @Param("userIds") Set<String> userIds);
@BaseConditionFilter
List<TestPlanResponse> selectMyFollowByConditions(@Param("request") TestPlanTableRequest request);

View File

@ -753,6 +753,21 @@
group by test_plan.project_id;
</select>
<select id="userCreatePlanCount"
resultType="io.metersphere.project.dto.ProjectUserCreateCount">
SELECT test_plan.create_user as userId, count(test_plan.id) as count
FROM test_plan
WHERE test_plan.project_id = #{projectId}
AND test_plan.create_time BETWEEN #{startTime} AND #{endTime}
<if test="userIds != null and userIds.size() > 0">
and test_plan.create_user in
<foreach collection="userIds" item="userId" separator="," open="(" close=")">
#{userId}
</foreach>
</if>
group by test_plan.create_user;
</select>
<select id="selectMyFollowByConditions"