fix(测试计划): 修复定时任务执行测试计划后发送通知后台报服务调用错误的问题
This commit is contained in:
parent
582805e52b
commit
71336dda57
|
@ -57,6 +57,8 @@ public class TestPlanMessageService {
|
||||||
report = testPlanReportService.checkTestPlanReportHasErrorCase(report, testPlanReportContent);
|
report = testPlanReportService.checkTestPlanReportHasErrorCase(report, testPlanReportContent);
|
||||||
}
|
}
|
||||||
if (!report.getIsApiCaseExecuting() && !report.getIsPerformanceExecuting() && !report.getIsScenarioExecuting() && !report.getIsUiScenarioExecuting()) {
|
if (!report.getIsApiCaseExecuting() && !report.getIsPerformanceExecuting() && !report.getIsScenarioExecuting() && !report.getIsUiScenarioExecuting()) {
|
||||||
|
// 异步发送通知需要指定调用其他服务的user
|
||||||
|
HttpHeaderUtils.runAsUser(report.getCreator());
|
||||||
//更新TestPlan状态为完成
|
//更新TestPlan状态为完成
|
||||||
TestPlanWithBLOBs testPlan = testPlanMapper.selectByPrimaryKey(report.getTestPlanId());
|
TestPlanWithBLOBs testPlan = testPlanMapper.selectByPrimaryKey(report.getTestPlanId());
|
||||||
if (testPlan != null
|
if (testPlan != null
|
||||||
|
@ -76,11 +78,13 @@ public class TestPlanMessageService {
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.error(e);
|
LogUtil.error(e);
|
||||||
|
} finally {
|
||||||
|
HttpHeaderUtils.clearUser();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String calcTestPlanStatusWithPassRate(TestPlanWithBLOBs testPlan) {
|
private String calcTestPlanStatusWithPassRate(TestPlanWithBLOBs testPlan) {
|
||||||
try {
|
try {
|
||||||
// 计算通过率
|
// 计算通过率
|
||||||
TestPlanDTOWithMetric testPlanDTOWithMetric = BeanUtils.copyBean(new TestPlanDTOWithMetric(), testPlan);
|
TestPlanDTOWithMetric testPlanDTOWithMetric = BeanUtils.copyBean(new TestPlanDTOWithMetric(), testPlan);
|
||||||
|
@ -114,8 +118,7 @@ public class TestPlanMessageService {
|
||||||
return TestPlanStatus.Underway.name();
|
return TestPlanStatus.Underway.name();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Async
|
private void sendMessage(TestPlan testPlan, TestPlanReport testPlanReport, String projectId) {
|
||||||
public void sendMessage(TestPlan testPlan, TestPlanReport testPlanReport, String projectId) {
|
|
||||||
assert testPlan != null;
|
assert testPlan != null;
|
||||||
SystemParameterService systemParameterService = CommonBeanFactory.getBean(SystemParameterService.class);
|
SystemParameterService systemParameterService = CommonBeanFactory.getBean(SystemParameterService.class);
|
||||||
NoticeSendService noticeSendService = CommonBeanFactory.getBean(NoticeSendService.class);
|
NoticeSendService noticeSendService = CommonBeanFactory.getBean(NoticeSendService.class);
|
||||||
|
|
Loading…
Reference in New Issue