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) { public void checkExecutionQueneByLoadTest(LoadTestReport loadTestReport) {
ApiExecutionQueueDetailExample detailExample = new ApiExecutionQueueDetailExample(); ApiExecutionQueueDetailExample detailExample = new ApiExecutionQueueDetailExample();
detailExample.createCriteria().andReportIdEqualTo(loadTestReport.getId()); detailExample.createCriteria().andReportIdEqualTo(loadTestReport.getId());
List<ApiExecutionQueueDetail> detailList = executionQueueDetailMapper.selectByExample(detailExample); executionQueueDetailMapper.deleteByExample(detailExample);
if (CollectionUtils.isNotEmpty(detailList)) {
List<String> executionQueueIdList = new ArrayList<>();
detailList.forEach(item -> {
executionQueueIdList.add(item.getQueueId());
});
executionQueueDetailMapper.deleteByExample(detailExample);
}
List<String> testPlanReportIdList = testPlanReportService.getTestPlanReportIdsByLoadTestReportId(loadTestReport.getId()); List<String> testPlanReportIdList = testPlanReportService.getTestPlanReportIdsByLoadTestReportId(loadTestReport.getId());
for (String testPlanReportId : testPlanReportIdList) { for (String testPlanReportId : testPlanReportIdList) {
this.testPlanReportTestEnded(testPlanReportId); this.testPlanReportTestEnded(testPlanReportId);
} }
} }
} }

View File

@ -126,7 +126,19 @@ public class NoticeSendService {
public void send(Project project, String taskType, NoticeModel noticeModel) { public void send(Project project, String taskType, NoticeModel noticeModel) {
try { try {
List<MessageDetail> messageDetails; 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 = noticeService.searchMessageByTypeAndProjectId(taskType, project.getId());
// 异步发送通知 // 异步发送通知
messageDetails.stream() messageDetails.stream()
.filter(messageDetail -> StringUtils.equals(messageDetail.getEvent(), noticeModel.getEvent())) .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 testPlanReceivers = JSON.parse(JSON.stringify(this.testPlanReceiverOptions));
let i = row.userIds.indexOf('FOLLOW_PEOPLE'); let i = row.userIds.indexOf('FOLLOW_PEOPLE');
let i2 = row.userIds.indexOf('CREATOR'); let i2 = row.userIds.indexOf('CREATOR');
let i3 = row.userIds.indexOf('EXECUTOR');
switch (row.event) { switch (row.event) {
case "CREATE": case "CREATE":
testPlanReceivers.unshift({id: 'EXECUTOR', name: this.$t('test_track.plan_view.executor')}); testPlanReceivers.unshift({id: 'EXECUTOR', name: this.$t('test_track.plan_view.executor')});
@ -370,27 +369,39 @@ export default {
case "DELETE": case "DELETE":
case "COMMENT": case "COMMENT":
case "COMPLETE": case "COMPLETE":
testPlanReceivers.unshift({id: 'CREATOR', name: this.$t('commons.create_user')}); this.initExecuteReceivers(testPlanReceivers,row);
testPlanReceivers.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')}); break;
testPlanReceivers.unshift({id: 'EXECUTOR', name: this.$t('test_track.plan_view.executor')}); case "EXECUTE_SUCCESSFUL":
this.initExecuteReceivers(testPlanReceivers,row);
if (row.isSet) { break;
if (i2 < 0) { case "EXECUTE_FAILED":
row.userIds.unshift('CREATOR'); this.initExecuteReceivers(testPlanReceivers,row);
}
if (i < 0) {
row.userIds.unshift('FOLLOW_PEOPLE');
}
if (i3 < 0) {
row.userIds.unshift('EXECUTOR');
}
}
break; break;
default: default:
break; break;
} }
row.testPlanReceiverOptions = testPlanReceivers; 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) { handleTemplate(index, row) {
if (hasLicense()) { if (hasLicense()) {
let htmlTemplate = ""; let htmlTemplate = "";

View File

@ -173,6 +173,8 @@ export default {
}], }],
scheduleEventOptions: [ scheduleEventOptions: [
{value: 'COMPLETE', label: this.$t('commons.run_completed')}, {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: [ receiveTypeOptions: [
{value: 'EMAIL', label: this.$t('organization.message.mail')}, {value: 'EMAIL', label: this.$t('organization.message.mail')},