fix(测试计划): 修复测试计划组移除测试计划时没有自动更新状态的缺陷
This commit is contained in:
parent
255a15a825
commit
c269b2382a
|
@ -320,6 +320,7 @@ public class TestPlanService extends TestPlanBaseUtilsService {
|
|||
public TestPlan update(TestPlanUpdateRequest request, String userId, String requestUrl, String requestMethod) {
|
||||
this.checkTestPlanNotArchived(request.getId());
|
||||
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(request.getId());
|
||||
String testPlanGroup = testPlan.getGroupId();
|
||||
if (!ObjectUtils.allNull(request.getName(), request.getModuleId(), request.getTags(), request.getPlannedEndTime(), request.getPlannedStartTime(), request.getDescription(), request.getGroupId())) {
|
||||
TestPlan updateTestPlan = new TestPlan();
|
||||
updateTestPlan.setId(request.getId());
|
||||
|
@ -364,6 +365,10 @@ public class TestPlanService extends TestPlanBaseUtilsService {
|
|||
testPlanConfig.setPassThreshold(request.getPassThreshold());
|
||||
testPlanConfigMapper.updateByPrimaryKeySelective(testPlanConfig);
|
||||
}
|
||||
|
||||
if (!StringUtils.equalsIgnoreCase(testPlanGroup, TestPlanConstants.TEST_PLAN_DEFAULT_GROUP_ID)) {
|
||||
this.updateTestPlanGroupStatus(testPlanGroup);
|
||||
}
|
||||
testPlanLogService.saveUpdateLog(testPlan, testPlanMapper.selectByPrimaryKey(request.getId()), testPlan.getProjectId(), userId, requestUrl, requestMethod);
|
||||
return testPlan;
|
||||
}
|
||||
|
@ -824,6 +829,17 @@ public class TestPlanService extends TestPlanBaseUtilsService {
|
|||
}
|
||||
|
||||
public void refreshTestPlanStatus(String testPlanId) {
|
||||
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(testPlanId);
|
||||
if (StringUtils.equalsIgnoreCase(testPlan.getType(), TestPlanConstants.TEST_PLAN_TYPE_PLAN)) {
|
||||
this.updateTestPlanStatus(testPlanId);
|
||||
} else {
|
||||
if (!StringUtils.equalsIgnoreCase(testPlan.getGroupId(), TestPlanConstants.TEST_PLAN_DEFAULT_GROUP_ID)) {
|
||||
this.updateTestPlanGroupStatus(testPlan.getGroupId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateTestPlanStatus(String testPlanId) {
|
||||
Map<String, Long> caseExecResultCount = new HashMap<>();
|
||||
Map<String, TestPlanResourceService> beansOfType = applicationContext.getBeansOfType(TestPlanResourceService.class);
|
||||
beansOfType.forEach((k, v) -> {
|
||||
|
|
Loading…
Reference in New Issue