feat(测试跟踪): 修复测试跟踪执行测试计划时实际开始结束时间的变更方式

--bug=1026052 --user=宋天阳 [测试跟踪]github#24285测试跟踪-测试计划实际开始和实际结束时间显示错误
https://www.tapd.cn/55049933/s/1370506
This commit is contained in:
wxg0103 2023-04-27 19:15:11 +08:00 committed by jianxing
parent 585abe8e56
commit adc84b9372
3 changed files with 16 additions and 18 deletions

View File

@ -35,8 +35,6 @@ public interface ExtTestPlanMapper {
List<TestPlan> listRecent(@Param("userId") String userId, @Param("projectId") String currentProjectId);
int updateActualEndTimeIsNullById(String testPlanID);
@MapKey("id")
Map<String, ParamsDTO> testPlanTestCaseCount(@Param("planIds") List<String> planIds);
@ -55,4 +53,7 @@ public interface ExtTestPlanMapper {
List<TestPlanDTO> planListAll(@Param("request") QueryTestPlanRequest params);
Boolean checkSyncTestCaseExecResultByTestPlanId(String testPlanId);
void updateStatusAndActStartTimeAndSetActEndTimeNullById(@Param("testPlanId") String testPlanId, @Param("actStartTime") long actStartTime, @Param("status") String status);
}

View File

@ -320,7 +320,8 @@
SELECT p.name
FROM test_plan tp
INNER JOIN project p ON p.id = tp.project_id
WHERE tp.id = #{0} limit 1;
WHERE tp.id = #{0}
limit 1;
</select>
<select id="findIdByPerformanceReportId" resultType="java.lang.String">
SELECT report.id
@ -418,13 +419,17 @@
</if>
</where>
</select>
<update id="updateActualEndTimeIsNullById">
<update id="updateStatusAndActStartTimeAndSetActEndTimeNullById">
update test_plan
set actual_end_time = null
where id = #{0}
set actual_start_time = #{actStartTime},
actual_end_time = null,
status = #{status}
where id = #{testPlanId}
</update>
<select id="checkSyncTestCaseExecResultByTestPlanId" resultType="java.lang.Boolean">
SELECT automatic_status_update FROM test_plan WHERE id = #{0}
SELECT automatic_status_update
FROM test_plan
WHERE id = #{0}
</select>
</mapper>

View File

@ -1874,12 +1874,7 @@ public class TestPlanService {
}
private void updateTestPlanExecuteInfo(String testPlanId, String status) {
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(testPlanId);
if (testPlan != null) {
testPlan.setStatus(status);
testPlan.setActualEndTime(null);
testPlanMapper.updateByPrimaryKey(testPlan);
}
extTestPlanMapper.updateStatusAndActStartTimeAndSetActEndTimeNullById(testPlanId, System.currentTimeMillis(), status);
}
public RunModeConfigDTO getRunModeConfigDTO(TestPlanRunRequest testplanRunRequest, String
@ -2128,7 +2123,7 @@ public class TestPlanService {
this.verifyPool(testPlan.getProjectId(), runModeConfigDTO);
}
//测试计划准备执行取消测试计划的实际结束时间
extTestPlanMapper.updateActualEndTimeIsNullById(testPlan.getId());
extTestPlanMapper.updateStatusAndActStartTimeAndSetActEndTimeNullById(testPlan.getId(), System.currentTimeMillis(), TestPlanStatus.Underway.name());
executeQueue.put(testPlan.getId(), planReportId);
}
@ -2301,10 +2296,7 @@ public class TestPlanService {
public String runTestPlanBySchedule(String testPlanId, String projectId, String userId, String triggerMode, String planReportId, String executionWay, String apiRunConfig) {
//定时任务执行重新设置实际开始时间
if (StringUtils.equals(triggerMode, TriggerMode.SCHEDULE.name())) {
TestPlanWithBLOBs testPlanWithBLOBs = new TestPlanWithBLOBs();
testPlanWithBLOBs.setId(testPlanId);
testPlanWithBLOBs.setActualStartTime(System.currentTimeMillis());
testPlanMapper.updateByPrimaryKeySelective(testPlanWithBLOBs);
extTestPlanMapper.updateStatusAndActStartTimeAndSetActEndTimeNullById(testPlanId, System.currentTimeMillis(), TestPlanStatus.Underway.name());
}
return testPlanExecuteService.runTestPlan(testPlanId, projectId, userId, triggerMode, planReportId, executionWay, apiRunConfig);
}