refactor(工作台): 首页卡片增加项目全选清空判断逻辑
This commit is contained in:
parent
eeda5334ce
commit
989c29d010
|
@ -41,8 +41,6 @@ public class TestCasePageProviderRequest extends BaseCondition implements Serial
|
||||||
private String apiDefinitionId;
|
private String apiDefinitionId;
|
||||||
|
|
||||||
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotBlank(message = "{api_definition.project_id.not_blank}")
|
|
||||||
@Size(min = 1, max = 50, message = "{api_definition.project_id.length_range}")
|
|
||||||
private String projectId;
|
private String projectId;
|
||||||
|
|
||||||
@Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
|
|
@ -23,6 +23,8 @@ public class LayoutDTO {
|
||||||
private Boolean fullScreen;
|
private Boolean fullScreen;
|
||||||
@Schema(description = "选中的项目ID")
|
@Schema(description = "选中的项目ID")
|
||||||
private List<String> projectIds;
|
private List<String> projectIds;
|
||||||
|
@Schema(description = "是否全选")
|
||||||
|
private boolean selectAll;
|
||||||
@Schema(description = "人员集合")
|
@Schema(description = "人员集合")
|
||||||
private List<String> handleUsers;
|
private List<String> handleUsers;
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,9 @@ import java.util.List;
|
||||||
@Data
|
@Data
|
||||||
public class DashboardFrontPageRequest extends DashboardBaseRequest{
|
public class DashboardFrontPageRequest extends DashboardBaseRequest{
|
||||||
|
|
||||||
|
@Schema(description = "是否全选")
|
||||||
|
private boolean selectAll;
|
||||||
|
|
||||||
@Schema(description = "固定时间天数")
|
@Schema(description = "固定时间天数")
|
||||||
private Integer dayNumber;
|
private Integer dayNumber;
|
||||||
|
|
||||||
|
|
|
@ -142,6 +142,9 @@ public class DashboardService {
|
||||||
|
|
||||||
|
|
||||||
public OverViewCountDTO createByMeCount(DashboardFrontPageRequest request, String userId) {
|
public OverViewCountDTO createByMeCount(DashboardFrontPageRequest request, String userId) {
|
||||||
|
if (!request.isSelectAll() && CollectionUtils.isEmpty(request.getProjectIds())) {
|
||||||
|
return new OverViewCountDTO(new HashMap<>(), new ArrayList<>(), new ArrayList<>());
|
||||||
|
}
|
||||||
List<Project> projects;
|
List<Project> projects;
|
||||||
if (CollectionUtils.isNotEmpty(request.getProjectIds())) {
|
if (CollectionUtils.isNotEmpty(request.getProjectIds())) {
|
||||||
projects = extProjectMapper.getProjectNameModule(null, request.getProjectIds());
|
projects = extProjectMapper.getProjectNameModule(null, request.getProjectIds());
|
||||||
|
@ -295,6 +298,9 @@ public class DashboardService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public OverViewCountDTO projectViewCount(DashboardFrontPageRequest request, String userId) {
|
public OverViewCountDTO projectViewCount(DashboardFrontPageRequest request, String userId) {
|
||||||
|
if (!request.isSelectAll() && CollectionUtils.isEmpty(request.getProjectIds())) {
|
||||||
|
return new OverViewCountDTO(new HashMap<>(), new ArrayList<>(), new ArrayList<>());
|
||||||
|
}
|
||||||
List<Project> collect = getHasPermissionProjects(request, userId);
|
List<Project> collect = getHasPermissionProjects(request, userId);
|
||||||
Map<String, Set<String>> permissionModuleProjectIdMap = dashboardProjectService.getModuleProjectIds(collect);
|
Map<String, Set<String>> permissionModuleProjectIdMap = dashboardProjectService.getModuleProjectIds(collect);
|
||||||
Long toStartTime = request.getToStartTime();
|
Long toStartTime = request.getToStartTime();
|
||||||
|
@ -457,6 +463,7 @@ public class DashboardService {
|
||||||
layoutDTO.setKey(layoutKey.toString());
|
layoutDTO.setKey(layoutKey.toString());
|
||||||
layoutDTO.setLabel(label);
|
layoutDTO.setLabel(label);
|
||||||
layoutDTO.setPos(pos);
|
layoutDTO.setPos(pos);
|
||||||
|
layoutDTO.setSelectAll(true);
|
||||||
layoutDTO.setFullScreen(true);
|
layoutDTO.setFullScreen(true);
|
||||||
layoutDTO.setProjectIds(projectIds);
|
layoutDTO.setProjectIds(projectIds);
|
||||||
layoutDTO.setHandleUsers(new ArrayList<>());
|
layoutDTO.setHandleUsers(new ArrayList<>());
|
||||||
|
@ -1011,7 +1018,7 @@ public class DashboardService {
|
||||||
public Pager<List<CaseReviewDTO>> getFunctionalCasePage(DashboardFrontPageRequest request) {
|
public Pager<List<CaseReviewDTO>> getFunctionalCasePage(DashboardFrontPageRequest request) {
|
||||||
CaseReviewPageRequest reviewRequest = getCaseReviewPageRequest(request);
|
CaseReviewPageRequest reviewRequest = getCaseReviewPageRequest(request);
|
||||||
Page<Object> page = PageHelper.startPage(reviewRequest.getCurrent(), reviewRequest.getPageSize(),
|
Page<Object> page = PageHelper.startPage(reviewRequest.getCurrent(), reviewRequest.getPageSize(),
|
||||||
com.alibaba.excel.util.StringUtils.isNotBlank(reviewRequest.getSortString()) ? reviewRequest.getSortString() : "pos desc");
|
StringUtils.isNotBlank(reviewRequest.getSortString()) ? reviewRequest.getSortString() : "pos desc");
|
||||||
return PageUtils.setPageInfo(page, caseReviewService.getCaseReviewPage(reviewRequest));
|
return PageUtils.setPageInfo(page, caseReviewService.getCaseReviewPage(reviewRequest));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -124,10 +124,20 @@ public class DashboardFrontPageControllerTests extends BaseTest {
|
||||||
MvcResult mvcResultAll = this.requestPostWithOkAndReturn(PROJECT_VIEW, dashboardFrontPageRequest);
|
MvcResult mvcResultAll = this.requestPostWithOkAndReturn(PROJECT_VIEW, dashboardFrontPageRequest);
|
||||||
OverViewCountDTO moduleCountAll = ApiDataUtils.parseObject(JSON.toJSONString(parseResponse(mvcResultAll).get("data")), OverViewCountDTO.class);
|
OverViewCountDTO moduleCountAll = ApiDataUtils.parseObject(JSON.toJSONString(parseResponse(mvcResultAll).get("data")), OverViewCountDTO.class);
|
||||||
Assertions.assertNotNull(moduleCountAll);
|
Assertions.assertNotNull(moduleCountAll);
|
||||||
|
dashboardFrontPageRequest.setProjectIds(new ArrayList<>());
|
||||||
|
dashboardFrontPageRequest.setSelectAll(false);
|
||||||
|
mvcResult = this.requestPostWithOkAndReturn(CREATE_BY_ME, dashboardFrontPageRequest);
|
||||||
|
contentAsString = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||||
|
resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
||||||
|
moduleCount = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), OverViewCountDTO.class);
|
||||||
|
Assertions.assertNotNull(moduleCount);
|
||||||
|
mvcResultAll = this.requestPostWithOkAndReturn(PROJECT_VIEW, dashboardFrontPageRequest);
|
||||||
|
moduleCountAll = ApiDataUtils.parseObject(JSON.toJSONString(parseResponse(mvcResultAll).get("data")), OverViewCountDTO.class);
|
||||||
|
Assertions.assertNotNull(moduleCountAll);
|
||||||
|
|
||||||
dashboardFrontPageRequest.setDayNumber(null);
|
dashboardFrontPageRequest.setDayNumber(null);
|
||||||
dashboardFrontPageRequest.setStartTime(1716185577387L);
|
dashboardFrontPageRequest.setStartTime(1716185577387L);
|
||||||
dashboardFrontPageRequest.setEndTime(1730181702699L);
|
dashboardFrontPageRequest.setEndTime(1730181702699L);
|
||||||
dashboardFrontPageRequest.setProjectIds(new ArrayList<>());
|
|
||||||
mvcResult = this.requestPostWithOkAndReturn(CREATE_BY_ME, dashboardFrontPageRequest);
|
mvcResult = this.requestPostWithOkAndReturn(CREATE_BY_ME, dashboardFrontPageRequest);
|
||||||
moduleCount = JSON.parseObject(JSON.toJSONString(
|
moduleCount = JSON.parseObject(JSON.toJSONString(
|
||||||
JSON.parseObject(mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData()),
|
JSON.parseObject(mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData()),
|
||||||
|
|
Loading…
Reference in New Issue