fix(测试跟踪): 首页测试计划遗留缺陷统计本周新增

--bug=1025744 --user=宋昌昌 【测试跟踪】首页-测试计划遗留缺陷统计-本周新增-统计时间不是从周一开始 https://www.tapd.cn/55049933/s/1366006
This commit is contained in:
song-cc-rock 2023-04-24 15:01:13 +08:00 committed by 刘瑞斌
parent 70e6ccc1e9
commit 0967768aff
6 changed files with 12 additions and 6 deletions

View File

@ -47,7 +47,7 @@ public interface ExtIssuesMapper {
Long getThisWeekIssueCount(@Param("ids") List<String> ids, @Param("projectId") String projectId); Long getThisWeekIssueCount(@Param("ids") List<String> ids, @Param("projectId") String projectId);
List<String> getTestPlanThisWeekIssue(String projectId); List<String> getTestPlanThisWeekIssue(@Param("projectId") String projectId, @Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp);
List<String> getTestPlanIssue(String projectId); List<String> getTestPlanIssue(String projectId);
} }

View File

@ -173,7 +173,7 @@
from test_plan_test_case tptc from test_plan_test_case tptc
join test_plan tp on tp.id = tptc.plan_id join test_plan tp on tp.id = tptc.plan_id
join test_case_issues tci on tptc.id = tci.resource_id join test_case_issues tci on tptc.id = tci.resource_id
where tptc.is_del != 1 and date_sub(curdate(), interval 7 day) &lt;= from_unixtime(round(tci.relate_time / 1000, 0)) where tptc.is_del != 1 and tci.relate_time between #{firstDayTimestamp} and #{lastDayTimestamp}
and tp.project_id = #{projectId} and tp.project_id = #{projectId}
</select> </select>

View File

@ -92,7 +92,7 @@ public interface ExtTestCaseMapper {
List<String> getTestPlanBug(@Param("planId") String planId); List<String> getTestPlanBug(@Param("planId") String planId);
Long getTestPlanThisWeekBugCount(@Param("projectId") String projectId, @Param("ids") List<String> ids); Long getTestPlanThisWeekBugCount(@Param("projectId") String projectId, @Param("ids") List<String> ids, @Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp);
int getTestPlanCase(@Param("planId") String planId); int getTestPlanCase(@Param("planId") String planId);

View File

@ -968,7 +968,7 @@
from test_plan_test_case tptc from test_plan_test_case tptc
join test_plan tp on tp.id = tptc.plan_id join test_plan tp on tp.id = tptc.plan_id
join test_case_issues tci on tptc.id = tci.resource_id join test_case_issues tci on tptc.id = tci.resource_id
where tp.project_id = #{projectId} and tptc.is_del != 1 and date_sub(curdate(), interval 7 day) &lt;= from_unixtime(round(tci.relate_time / 1000, 0)) where tp.project_id = #{projectId} and tptc.is_del != 1 and tci.relate_time between #{firstDayTimestamp} and #{lastDayTimestamp}
and tci.issues_id in and tci.issues_id in
<foreach collection="ids" item="id" separator="," open="(" close=")"> <foreach collection="ids" item="id" separator="," open="(" close=")">
#{id} #{id}

View File

@ -1888,7 +1888,10 @@ public class IssuesService {
public void setFilterIds(IssuesRequest request) { public void setFilterIds(IssuesRequest request) {
List<String> issueIds; List<String> issueIds;
if (request.getThisWeekUnClosedTestPlanIssue()) { if (request.getThisWeekUnClosedTestPlanIssue()) {
issueIds = extIssuesMapper.getTestPlanThisWeekIssue(request.getProjectId()); Map<String, Date> weedFirstTimeAndLastTime = io.metersphere.commons.utils.DateUtils.getWeedFirstTimeAndLastTime(new Date());
Date firstDay = weedFirstTimeAndLastTime.get("firstTime");
Date lastDay = weedFirstTimeAndLastTime.get("lastTime");
issueIds = extIssuesMapper.getTestPlanThisWeekIssue(request.getProjectId(), firstDay.getTime(), lastDay.getTime());
} else if (request.getAllTestPlanIssue() || request.getUnClosedTestPlanIssue()) { } else if (request.getAllTestPlanIssue() || request.getUnClosedTestPlanIssue()) {
issueIds = extIssuesMapper.getTestPlanIssue(request.getProjectId()); issueIds = extIssuesMapper.getTestPlanIssue(request.getProjectId());
} else { } else {

View File

@ -182,7 +182,10 @@ public class TrackService {
int thisWeekCount = 0; int thisWeekCount = 0;
if (CollectionUtils.isNotEmpty(issueIds)) { if (CollectionUtils.isNotEmpty(issueIds)) {
thisWeekCount = extTestCaseMapper.getTestPlanThisWeekBugCount(projectId, issueIds).intValue(); Map<String, Date> weedFirstTimeAndLastTime = DateUtils.getWeedFirstTimeAndLastTime(new Date());
Date firstDay = weedFirstTimeAndLastTime.get("firstTime");
Date lastDay = weedFirstTimeAndLastTime.get("lastTime");
thisWeekCount = extTestCaseMapper.getTestPlanThisWeekBugCount(projectId, issueIds, firstDay.getTime(), lastDay.getTime()).intValue();
} }
bugSizeMap.put("thisWeekCount", thisWeekCount); bugSizeMap.put("thisWeekCount", thisWeekCount);
return bugSizeMap; return bugSizeMap;