feat(测试跟踪): 修复测试计划定时任务通知不能指定具体执行结果通知的问题

修复测试计划定时任务通知不能指定具体执行结果通知的问题
This commit is contained in:
song-tianyang 2022-04-14 16:31:15 +08:00 committed by TIanyang
parent 3c6373a039
commit 890e363e37
4 changed files with 42 additions and 27 deletions

View File

@ -434,22 +434,12 @@ public class ApiExecutionQueueService {
}
public void checkExecutionQueneByLoadTest(LoadTestReport loadTestReport) {
ApiExecutionQueueDetailExample detailExample = new ApiExecutionQueueDetailExample();
detailExample.createCriteria().andReportIdEqualTo(loadTestReport.getId());
List<ApiExecutionQueueDetail> detailList = executionQueueDetailMapper.selectByExample(detailExample);
if (CollectionUtils.isNotEmpty(detailList)) {
List<String> executionQueueIdList = new ArrayList<>();
detailList.forEach(item -> {
executionQueueIdList.add(item.getQueueId());
});
executionQueueDetailMapper.deleteByExample(detailExample);
}
executionQueueDetailMapper.deleteByExample(detailExample);
List<String> testPlanReportIdList = testPlanReportService.getTestPlanReportIdsByLoadTestReportId(loadTestReport.getId());
for (String testPlanReportId : testPlanReportIdList) {
this.testPlanReportTestEnded(testPlanReportId);
}
}
}

View File

@ -126,7 +126,19 @@ public class NoticeSendService {
public void send(Project project, String taskType, NoticeModel noticeModel) {
try {
List<MessageDetail> messageDetails;
// switch (taskType) {
// case NoticeConstants.Mode.API:
// String projectId = (String) noticeModel.getParamMap().get("projectId");
// messageDetails = noticeService.searchMessageByTypeBySend(NoticeConstants.TaskType.JENKINS_TASK, projectId);
// break;
// case NoticeConstants.Mode.SCHEDULE:
// messageDetails = noticeService.searchMessageByTestId(noticeModel.getTestId());
// break;
// default:
// break;
// }
messageDetails = noticeService.searchMessageByTypeAndProjectId(taskType, project.getId());
// 异步发送通知
messageDetails.stream()
.filter(messageDetail -> StringUtils.equals(messageDetail.getEvent(), noticeModel.getEvent()))

View File

@ -355,7 +355,6 @@ export default {
let testPlanReceivers = JSON.parse(JSON.stringify(this.testPlanReceiverOptions));
let i = row.userIds.indexOf('FOLLOW_PEOPLE');
let i2 = row.userIds.indexOf('CREATOR');
let i3 = row.userIds.indexOf('EXECUTOR');
switch (row.event) {
case "CREATE":
testPlanReceivers.unshift({id: 'EXECUTOR', name: this.$t('test_track.plan_view.executor')});
@ -370,27 +369,39 @@ export default {
case "DELETE":
case "COMMENT":
case "COMPLETE":
testPlanReceivers.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
testPlanReceivers.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')});
testPlanReceivers.unshift({id: 'EXECUTOR', name: this.$t('test_track.plan_view.executor')});
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
if (i < 0) {
row.userIds.unshift('FOLLOW_PEOPLE');
}
if (i3 < 0) {
row.userIds.unshift('EXECUTOR');
}
}
this.initExecuteReceivers(testPlanReceivers,row);
break;
case "EXECUTE_SUCCESSFUL":
this.initExecuteReceivers(testPlanReceivers,row);
break;
case "EXECUTE_FAILED":
this.initExecuteReceivers(testPlanReceivers,row);
break;
default:
break;
}
row.testPlanReceiverOptions = testPlanReceivers;
},
initExecuteReceivers(testPlanReceivers,row){
let i = row.userIds.indexOf('FOLLOW_PEOPLE');
let i2 = row.userIds.indexOf('CREATOR');
let i3 = row.userIds.indexOf('EXECUTOR');
testPlanReceivers.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
testPlanReceivers.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')});
testPlanReceivers.unshift({id: 'EXECUTOR', name: this.$t('test_track.plan_view.executor')});
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
if (i < 0) {
row.userIds.unshift('FOLLOW_PEOPLE');
}
if (i3 < 0) {
row.userIds.unshift('EXECUTOR');
}
}
},
handleTemplate(index, row) {
if (hasLicense()) {
let htmlTemplate = "";

View File

@ -173,6 +173,8 @@ export default {
}],
scheduleEventOptions: [
{value: 'COMPLETE', label: this.$t('commons.run_completed')},
{value: 'EXECUTE_SUCCESSFUL', label: this.$t('commons.run_success')},
{value: 'EXECUTE_FAILED', label: this.$t('commons.run_fail')},
],
receiveTypeOptions: [
{value: 'EMAIL', label: this.$t('organization.message.mail')},