feat: 消息设置

This commit is contained in:
wenyann 2020-10-23 11:20:51 +08:00
parent 00e7c7bed9
commit 25e9bff303
1 changed files with 9 additions and 9 deletions

View File

@ -178,21 +178,21 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
List<NoticeDetail> noticeList = noticeService.queryNotice(testResult.getTestId());
mailService.sendApiNotification(report, noticeList);
}
if (StringUtils.equals(NoticeConstants.API, report.getTriggerMode())) {
if (StringUtils.equals(NoticeConstants.API, "API")) {
List<String> userIds = new ArrayList<>();
MessageSettingDetail messageSettingDetail = noticeService.searchMessage();
List<MessageDetail> taskList = messageSettingDetail.getJenkinsTask();
String contextSuccess = report.getName() + "执行成功";
String contextFailed = report.getName() + "执行失败";
String contextSuccess = "jenkins任务通知" + report.getName() + "执行成功";
String contextFailed = "jenkins任务通知" + report.getName() + "执行失败";
taskList.forEach(r -> {
switch (r.getType()) {
case NoticeConstants.NAIL_ROBOT:
if (StringUtils.equals(NoticeConstants.EXECUTE_SUCCESSFUL,r.getEvent()) && StringUtils.equals(report.getStatus(), "Success")) {
dingTaskService.sendNailRobot(r, userIds, contextSuccess, NoticeConstants.EXECUTE_SUCCESSFUL);
}
if (StringUtils.equals(NoticeConstants.EXECUTE_FAILED, r.getEvent()) && StringUtils.equals(report.getStatus(), "Error")) {
dingTaskService.sendNailRobot(r, userIds, contextFailed, NoticeConstants.EXECUTE_FAILED);
}
if (StringUtils.equals(NoticeConstants.EXECUTE_SUCCESSFUL, r.getEvent()) && StringUtils.equals(report.getStatus(), "Success")) {
dingTaskService.sendNailRobot(r, userIds, contextSuccess, NoticeConstants.EXECUTE_SUCCESSFUL);
}
if (StringUtils.equals(NoticeConstants.EXECUTE_FAILED, r.getEvent()) && StringUtils.equals(report.getStatus(), "Error")) {
dingTaskService.sendNailRobot(r, userIds, contextFailed, NoticeConstants.EXECUTE_FAILED);
}
break;
case NoticeConstants.WECHAT_ROBOT:
if (StringUtils.equals(NoticeConstants.EXECUTE_SUCCESSFUL, r.getEvent()) && StringUtils.equals(report.getStatus(), "Success")) {