Merge remote-tracking branch 'origin/master'

This commit is contained in:
song.tianyang 2021-03-25 17:01:26 +08:00
commit 100e0e5335
2 changed files with 7 additions and 7 deletions

View File

@ -92,7 +92,7 @@ public class TestPlanController {
@PostMapping("/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public void editTestPlan(@RequestBody TestPlanDTO testPlanDTO) {
testPlanService.editTestPlan(testPlanDTO);
testPlanService.editTestPlan(testPlanDTO, true);
}
@PostMapping("/edit/status/{planId}")

View File

@ -176,7 +176,7 @@ public class TestPlanService {
return Optional.ofNullable(testPlanMapper.selectByPrimaryKey(testPlanId)).orElse(new TestPlan());
}
public int editTestPlan(TestPlanDTO testPlan) {
public int editTestPlan(TestPlanDTO testPlan, Boolean isSendMessage) {
checkTestPlanExist(testPlan);
TestPlan res = testPlanMapper.selectByPrimaryKey(testPlan.getId()); // 先查一次库
testPlan.setUpdateTime(System.currentTimeMillis());
@ -214,7 +214,7 @@ public class TestPlanService {
extScheduleMapper.updateNameByResourceID(testPlan.getId(), testPlan.getName());// 同步更新该测试的定时任务的name
i = testPlanMapper.updateByPrimaryKeyWithBLOBs(testPlan); // 更新
}
if (!StringUtils.isBlank(testPlan.getStatus())) {
if (!StringUtils.isBlank(testPlan.getStatus()) && isSendMessage) {
BeanUtils.copyBean(testPlans, getTestPlan(testPlan.getId()));
String context = getTestPlanContext(testPlans, NoticeConstants.Event.UPDATE);
User user = userMapper.selectByPrimaryKey(testPlans.getCreator());
@ -400,7 +400,7 @@ public class TestPlanService {
testPlanDTO.setId(testPlanId);
if(statusList.size() == 0) { // 原先status不是prepare, 但删除所有关联用例的情况
testPlanDTO.setStatus(TestPlanStatus.Prepare.name());
editTestPlan(testPlanDTO);
editTestPlan(testPlanDTO, false);
return;
}
int passNum = 0, prepareNum = 0, failNum = 0;
@ -417,13 +417,13 @@ public class TestPlanService {
}
if(passNum == statusList.size()) { // 全部通过
testPlanDTO.setStatus(TestPlanStatus.Completed.name());
this.editTestPlan(testPlanDTO);
this.editTestPlan(testPlanDTO, false);
} else if(prepareNum == 0 && passNum + failNum == statusList.size()) { // 已结束
testPlanDTO.setStatus(TestPlanStatus.Finished.name());
editTestPlan(testPlanDTO);
editTestPlan(testPlanDTO, false);
} else if(prepareNum != 0) { // 进行中
testPlanDTO.setStatus(TestPlanStatus.Underway.name());
editTestPlan(testPlanDTO);
editTestPlan(testPlanDTO, false);
}
}