fix(工作台): 工作台待办计划筛选问题
--bug=1050264 --user=宋昌昌 【工作台】我的待办-选择项目下无测试计划数据-页面报错 https://www.tapd.cn/55049933/s/1629779
This commit is contained in:
parent
1e0da292a9
commit
92200c4ed1
|
@ -93,7 +93,7 @@ public class BugController {
|
|||
@CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project")
|
||||
public Pager<List<BugDTO>> page(@Validated @RequestBody BugPageRequest request) {
|
||||
request.setUseTrash(false);
|
||||
if (request.getRelatedToPlan() || request.getCreateByMe() || request.getAssignedToMe() || request.getUnresolved()) {
|
||||
if (request.getBoardCount() || request.getRelatedToPlan() || request.getCreateByMe() || request.getAssignedToMe() || request.getUnresolved()) {
|
||||
request.setTodoParam(bugService.buildBugToDoParam(request, SessionUtils.getUserId(), SessionUtils.getCurrentOrganizationId()));
|
||||
}
|
||||
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
|
||||
|
|
|
@ -32,6 +32,9 @@ public class BugPageRequest extends BasePageRequest {
|
|||
@Schema(description = "工作台参数: 是否待我处理的")
|
||||
private Boolean assignedToMe = false;
|
||||
|
||||
@Schema(description = "工作台参数: 缺陷数")
|
||||
private Boolean boardCount = false;
|
||||
|
||||
@Schema(description = "工作台参数: 是否遗留的")
|
||||
private Boolean unresolved = false;
|
||||
}
|
||||
|
|
|
@ -202,8 +202,11 @@
|
|||
</if>
|
||||
<if test="request.relatedToPlan">
|
||||
and b.id in (
|
||||
select distinct b.id from bug b inner join bug_relation_case brc on b.id = brc.bug_id
|
||||
where brc.test_plan_id is not null and b.project_id = #{request.projectId}
|
||||
select distinct bug.id
|
||||
from test_plan
|
||||
left join bug_relation_case on test_plan.id = bug_relation_case.test_plan_id
|
||||
left join bug on bug_relation_case.bug_id = bug.id
|
||||
where test_plan.status = 'NOT_ARCHIVED' and bug.deleted = false and test_plan.project_id = #{request.projectId}
|
||||
)
|
||||
</if>
|
||||
<include refid="filter"/>
|
||||
|
|
|
@ -122,31 +122,8 @@
|
|||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="(request.innerIds != null and request.innerIds.size() > 0) or (request.extraIncludeChildIds != null and request.extraIncludeChildIds.size() > 0)">
|
||||
and (
|
||||
false
|
||||
<if test="request.innerIds != null and request.innerIds.size() > 0">
|
||||
or t.id in
|
||||
<foreach collection="request.innerIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
or t.group_id in
|
||||
<foreach collection="request.innerIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.extraIncludeChildIds != null and request.extraIncludeChildIds.size() > 0">
|
||||
or t.id in
|
||||
<foreach collection="request.extraIncludeChildIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
)
|
||||
</if>
|
||||
</if>
|
||||
<if test="!request.myTodo">
|
||||
<include refid="baseConditionQuery"/>
|
||||
</if>
|
||||
<include refid="baseConditionQuery"/>
|
||||
|
||||
<if test="request.keyword != null and request.keyword != ''">
|
||||
and (
|
||||
|
@ -161,7 +138,7 @@
|
|||
</if>
|
||||
)
|
||||
</if>
|
||||
<if test="request.innerIds != null and request.innerIds.size() > 0 and !request.myTodo">
|
||||
<if test="request.innerIds != null and request.innerIds.size() > 0">
|
||||
and t.id in
|
||||
<foreach collection="request.innerIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
|
|
|
@ -503,7 +503,6 @@ public class TestPlanManagementService {
|
|||
*/
|
||||
private void setTodoParam(TestPlanTableRequest request) {
|
||||
List<String> doneIds = new ArrayList<>();
|
||||
List<String> extraChildIds = new ArrayList<>();
|
||||
// 筛选出已完成/进行中的计划或计划组
|
||||
List<String> statusList = new ArrayList<>();
|
||||
statusList.add(TestPlanConstants.TEST_PLAN_SHOW_STATUS_COMPLETED);
|
||||
|
@ -545,49 +544,15 @@ public class TestPlanManagementService {
|
|||
}
|
||||
calculateIds.addAll(childPlans.stream().map(TestPlan::getId).toList());
|
||||
if (CollectionUtils.isNotEmpty(calculateIds)) {
|
||||
boolean onlyPrepared = isOnlyFilterPreparedWithTodoParam(request.getFilter());
|
||||
boolean onlyUnderway = isOnlyFilterUnderwayWithTodoParam(request.getFilter());
|
||||
List<TestPlanStatisticsResponse> calcPlans = testPlanStatisticsService.calculateRate(calculateIds);
|
||||
calcPlans.forEach(plan -> {
|
||||
// 筛选出已完成 && 且通过率达到阈值的子计划
|
||||
if (plan.getPassRate() >= plan.getPassThreshold() && StringUtils.equals(plan.getStatus(), TestPlanConstants.TEST_PLAN_SHOW_STATUS_COMPLETED)) {
|
||||
doneIds.add(plan.getId());
|
||||
}
|
||||
// 筛选出未执行的子计划
|
||||
if (StringUtils.equals(plan.getStatus(), TestPlanConstants.TEST_PLAN_SHOW_STATUS_PREPARED)) {
|
||||
if (onlyPrepared) {
|
||||
extraChildIds.add(plan.getId());
|
||||
}
|
||||
if (onlyUnderway) {
|
||||
doneIds.add(plan.getId());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
request.setDoneExcludeIds(doneIds);
|
||||
request.setExtraIncludeChildIds(extraChildIds);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否仅筛选待办列表中的未开始计划
|
||||
* @param filterStatusMap 筛选条件
|
||||
* @return boolean
|
||||
*/
|
||||
private boolean isOnlyFilterPreparedWithTodoParam(Map<String, List<String>> filterStatusMap) {
|
||||
return filterStatusMap != null && filterStatusMap.containsKey("status")
|
||||
&& filterStatusMap.get("status").contains(TestPlanConstants.TEST_PLAN_SHOW_STATUS_PREPARED)
|
||||
&& !filterStatusMap.get("status").contains(TestPlanConstants.TEST_PLAN_SHOW_STATUS_UNDERWAY);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否仅筛选待办列表中的执行中计划
|
||||
* @param filterStatusMap 筛选条件
|
||||
* @return boolean
|
||||
*/
|
||||
private boolean isOnlyFilterUnderwayWithTodoParam(Map<String, List<String>> filterStatusMap) {
|
||||
return filterStatusMap != null && filterStatusMap.containsKey("status")
|
||||
&& filterStatusMap.get("status").contains(TestPlanConstants.TEST_PLAN_SHOW_STATUS_UNDERWAY)
|
||||
&& !filterStatusMap.get("status").contains(TestPlanConstants.TEST_PLAN_SHOW_STATUS_PREPARED);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue