fix(工作台): 仪表盘接口Api及Case数量统计问题

--bug=1025728 --user=宋昌昌 【工作台】我的仪表盘-我的待办-接口和接口用例统计和进入我的待办-各项目接口和接口用例总和不一致 https://www.tapd.cn/55049933/s/1369713
This commit is contained in:
song-cc-rock 2023-05-08 16:26:11 +08:00 committed by 建国
parent 6337d932ce
commit bb85fa2c7b
3 changed files with 4 additions and 18 deletions

View File

@ -552,7 +552,6 @@
</foreach> </foreach>
and ad.status in ('Prepare', 'Underway') and ad.status in ('Prepare', 'Underway')
and ad.user_id = #{userId,jdbcType=VARCHAR} and ad.user_id = #{userId,jdbcType=VARCHAR}
and ad.latest = 1
</select> </select>

View File

@ -314,14 +314,14 @@
</if> </if>
</select> </select>
<select id="getCountUpcoming" resultType="java.lang.Integer"> <select id="getCountUpcoming" resultType="java.lang.Integer">
select count(*) from api_test_case ac where select count(*) from api_test_case ac inner join api_definition ad on ac.api_definition_id = ad.id where
ac.project_id in ac.project_id in
<foreach collection="projectIds" item="projectId" separator="," open="(" close=")"> <foreach collection="projectIds" item="projectId" separator="," open="(" close=")">
#{projectId} #{projectId}
</foreach> </foreach>
and ac.create_user_id = #{userId,jdbcType=VARCHAR} and ac.create_user_id = #{userId,jdbcType=VARCHAR}
and case_status in ('Prepare', 'Underway') and ac.case_status in ('Prepare', 'Underway')
and (ac.status is null or ac.status != 'Trash'); and (ac.status is null or ac.status != 'Trash')
</select> </select>
<sql id="queryWhereCondition"> <sql id="queryWhereCondition">

View File

@ -173,8 +173,6 @@ public class WorkstationService {
int issueUpcomingCount = extIssuesMapper.getCountUpcoming(projectIds, userId); int issueUpcomingCount = extIssuesMapper.getCountUpcoming(projectIds, userId);
int apiUpcomingCount = extApiDefinitionMapper.getCountUpcoming(projectIds, userId); int apiUpcomingCount = extApiDefinitionMapper.getCountUpcoming(projectIds, userId);
int apiCaseUpcomingCount = extApiTestCaseMapper.getCountUpcoming(projectIds, userId); int apiCaseUpcomingCount = extApiTestCaseMapper.getCountUpcoming(projectIds, userId);
int updateApiCaseCount = getUpdateApiCaseCount(projectIds, userId);
int apiCaseCount = apiCaseUpcomingCount + updateApiCaseCount;
int scenarioUpcomingCount = extApiScenarioMapper.getCountUpcoming(projectIds, userId); int scenarioUpcomingCount = extApiScenarioMapper.getCountUpcoming(projectIds, userId);
int loadUpcomingCount = extLoadTestMapper.getCountUpcoming(projectIds, userId); int loadUpcomingCount = extLoadTestMapper.getCountUpcoming(projectIds, userId);
Map<String, Integer> map = new HashMap<>(8); Map<String, Integer> map = new HashMap<>(8);
@ -183,23 +181,12 @@ public class WorkstationService {
map.put("track_review", reviewUpcomingCount); map.put("track_review", reviewUpcomingCount);
map.put("track_issue", issueUpcomingCount); map.put("track_issue", issueUpcomingCount);
map.put("api_definition", apiUpcomingCount); map.put("api_definition", apiUpcomingCount);
map.put("api_case",apiCaseCount); map.put("api_case",apiCaseUpcomingCount);
map.put("api_automation", scenarioUpcomingCount); map.put("api_automation", scenarioUpcomingCount);
map.put("performance", loadUpcomingCount); map.put("performance", loadUpcomingCount);
return map; return map;
} }
public int getUpdateApiCaseCount(List<String> projectIds,String userId){
int totalUpdateCount = 0;
for (String projectId : projectIds) {
List<String> syncRuleCaseStatus = getSyncRuleCaseStatus(projectId);
Long toBeUpdatedTime = getToBeUpdatedTime(projectId);
int updateCount = extApiTestCaseMapper.getUpdateCount(userId, projectId, syncRuleCaseStatus, toBeUpdatedTime);
totalUpdateCount = totalUpdateCount+updateCount;
}
return totalUpdateCount;
}
public List<String> getSyncRuleCaseStatus(String projectId) { public List<String> getSyncRuleCaseStatus(String projectId) {
List<String> statusList = new ArrayList<>(); List<String> statusList = new ArrayList<>();
List<ProjectApplication> projectApplicationConfigs = extProjectApplicationMapper.selectByProjectIdAndType(projectId,"TRIGGER_UPDATE"); List<ProjectApplication> projectApplicationConfigs = extProjectApplicationMapper.selectByProjectIdAndType(projectId,"TRIGGER_UPDATE");