fix(接口测试): 修复删除场景未删除定时任务的缺陷 (#12781)
--bug=1012375 --user=王孝刚 【接口测试】github#12745在接口自动化-场景列表删除已经触发定时任务的场景时,对应的定时触发的场景未被删除 https://www.tapd.cn/55049933/s/1138360 Co-authored-by: wxg0103 <727495428@qq.com>
This commit is contained in:
parent
5b703d1582
commit
c5c5e76fed
|
@ -517,6 +517,7 @@ public class ApiAutomationService {
|
||||||
this.preDelete(s.getId());
|
this.preDelete(s.getId());
|
||||||
testPlanScenarioCaseService.deleteByScenarioId(s.getId());
|
testPlanScenarioCaseService.deleteByScenarioId(s.getId());
|
||||||
apiScenarioMapper.deleteByPrimaryKey(s.getId());
|
apiScenarioMapper.deleteByPrimaryKey(s.getId());
|
||||||
|
scheduleService.deleteByResourceId(s.getId(), ScheduleGroup.API_SCENARIO_TEST.name());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -599,16 +600,16 @@ public class ApiAutomationService {
|
||||||
if (scenario == null) {
|
if (scenario == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ApiScenarioExampleWithOperation example = new ApiScenarioExampleWithOperation();
|
|
||||||
example.createCriteria().andRefIdEqualTo(scenario.getRefId());
|
|
||||||
example.setOperator(SessionUtils.getUserId());
|
|
||||||
example.setOperationTime(System.currentTimeMillis());
|
|
||||||
extApiScenarioMapper.removeToGcByExample(example);
|
|
||||||
ApiScenarioRequest request = new ApiScenarioRequest();
|
ApiScenarioRequest request = new ApiScenarioRequest();
|
||||||
request.setRefId(scenario.getRefId());
|
request.setRefId(scenario.getRefId());
|
||||||
List<String> scenarioIds = extApiScenarioMapper.selectIdsByQuery(request);
|
List<String> scenarioIds = extApiScenarioMapper.selectIdsByQuery(request);
|
||||||
//将这些场景的定时任务删除掉
|
//将这些场景的定时任务删除掉
|
||||||
scenarioIds.forEach(scenarioId -> scheduleService.deleteByResourceId(scenarioId, ScheduleGroup.API_SCENARIO_TEST.name()));
|
scenarioIds.forEach(scenarioId -> scheduleService.deleteByResourceId(scenarioId, ScheduleGroup.API_SCENARIO_TEST.name()));
|
||||||
|
ApiScenarioExampleWithOperation example = new ApiScenarioExampleWithOperation();
|
||||||
|
example.createCriteria().andRefIdEqualTo(scenario.getRefId());
|
||||||
|
example.setOperator(SessionUtils.getUserId());
|
||||||
|
example.setOperationTime(System.currentTimeMillis());
|
||||||
|
extApiScenarioMapper.removeToGcByExample(example);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1897,6 +1898,7 @@ public class ApiAutomationService {
|
||||||
ApiScenarioExample example = new ApiScenarioExample();
|
ApiScenarioExample example = new ApiScenarioExample();
|
||||||
example.createCriteria().andRefIdEqualTo(refId).andVersionIdEqualTo(version);
|
example.createCriteria().andRefIdEqualTo(refId).andVersionIdEqualTo(version);
|
||||||
apiScenarioMapper.deleteByExample(example);
|
apiScenarioMapper.deleteByExample(example);
|
||||||
|
scheduleService.deleteByResourceId(refId, ScheduleGroup.API_SCENARIO_TEST.name());
|
||||||
checkAndSetLatestVersion(refId);
|
checkAndSetLatestVersion(refId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue