fix(测试计划): 报告执行状态未及时刷新

This commit is contained in:
song-cc-rock 2024-06-17 15:24:11 +08:00 committed by wxg0103
parent 1b6938e013
commit 8d52c00e9c
4 changed files with 11 additions and 5 deletions

View File

@ -60,5 +60,5 @@ public interface ExtTestPlanReportMapper {
List<ReportDTO> getScenarioReports(@Param("ids") List<String> ids);
void batchUpdateExecuteTime(@Param("startTime") long startTime,@Param("ids")List<String> ids);
void batchUpdateExecuteTimeAndStatus(@Param("startTime") long startTime,@Param("ids")List<String> ids);
}

View File

@ -217,9 +217,9 @@
</foreach>
</select>
<update id="batchUpdateExecuteTime" parameterType="java.lang.String">
<update id="batchUpdateExecuteTimeAndStatus" parameterType="java.lang.String">
update test_plan_report
set start_time = #{startTime}
set start_time = #{startTime}, exec_status = 'RUNNING'
where id in
<foreach collection="ids" item="id" open="(" close=")" separator=",">
#{id}

View File

@ -253,7 +253,7 @@ public class TestPlanExecuteService {
this.setRedisForList(genQueueKey(queueId, queueType), childrenQueue.stream().map(JSON::toJSONString).toList());
// 更新报告的执行时间
extTestPlanReportMapper.batchUpdateExecuteTime(System.currentTimeMillis(), reportMap.values().stream().toList());
extTestPlanReportMapper.batchUpdateExecuteTimeAndStatus(System.currentTimeMillis(), reportMap.values().stream().toList());
if (StringUtils.equalsIgnoreCase(executionQueue.getRunMode(), ApiBatchRunMode.SERIAL.name())) {
//串行
@ -271,7 +271,7 @@ public class TestPlanExecuteService {
} else {
Map<String, String> reportMap = testPlanReportService.genReportByExecution(executionQueue.getPrepareReportId(), genReportRequest, executionQueue.getCreateUser());
executionQueue.setPrepareReportId(reportMap.get(executionQueue.getSourceID()));
extTestPlanReportMapper.batchUpdateExecuteTime(System.currentTimeMillis(), reportMap.values().stream().toList());
extTestPlanReportMapper.batchUpdateExecuteTimeAndStatus(System.currentTimeMillis(), reportMap.values().stream().toList());
this.executeTestPlan(executionQueue);
return executionQueue.getPrepareReportId();
}

View File

@ -480,6 +480,12 @@ public class TestPlanReportService {
testPlanReportMapper.updateByPrimaryKeySelective(planReport);
}
/**
* 获取报告
* @param reportId 报告ID
* @return 报告详情
*/
public TestPlanReport selectById(String reportId) {
return testPlanReportMapper.selectByPrimaryKey(reportId);
}