fix(项目设置): 项目消息设置,任务通知切换事件类型模板未同步更新

--bug=1030939 --user=王旭 【项目设置】消息设置-UI测试任务通知-自动化-编辑通知-切换选择事件类型-模版未同步更新 https://www.tapd.cn/55049933/s/1423091
This commit is contained in:
WangXu10 2023-10-08 11:44:52 +08:00 committed by 刘瑞斌
parent 126b620fc7
commit f460ae66a5
4 changed files with 50 additions and 23 deletions

View File

@ -1,5 +1,6 @@
package io.metersphere.notice.controller;
import io.metersphere.base.domain.MessageTask;
import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.constants.OperLogModule;
import io.metersphere.commons.utils.SessionUtils;
@ -48,5 +49,11 @@ public class NoticeController {
public int deleteMessage(@PathVariable String identification) {
return noticeService.delMessage(identification);
}
@GetMapping("/search/template/{id}/{event}")
public MessageTask searchTemplate(@PathVariable("id") String id, @PathVariable("event") String event) {
return noticeService.searchTemplateById(id, event);
}
}

View File

@ -210,4 +210,15 @@ public class NoticeService {
}
return null;
}
public MessageTask searchTemplateById(String id, String event) {
MessageTask messageTask = new MessageTask();
MessageTaskExample example = new MessageTaskExample();
example.createCriteria().andIdEqualTo(id).andEventEqualTo(event);
List<MessageTask> messageTasks = messageTaskMapper.selectByExampleWithBLOBs(example);
if(CollectionUtils.isNotEmpty(messageTasks)){
messageTask = messageTasks.get(0);
}
return messageTask;
}
}

View File

@ -15,3 +15,7 @@ export function saveNoticeTask(task) {
export function deleteNoticeTask(taskId) {
return get(`/notice/delete/message/${taskId}`);
}
export function searchTemplateById(id, event) {
return get(`/notice/search/template/${id}/${event}`);
}

View File

@ -30,7 +30,7 @@ import {hasLicense} from "metersphere-frontend/src/utils/permission";
import MsCodeEdit from "metersphere-frontend/src/components/MsCodeEdit";
import MsTipButton from "metersphere-frontend/src/components/MsTipButton";
import NotificationTable from "metersphere-frontend/src/components/notification/NotificationTable";
import {searchNoticeByType} from "../../../../api/notification";
import {searchNoticeById, searchNoticeByType, searchTemplateById} from "../../../../api/notification";
import MxNoticeTemplate from "metersphere-frontend/src/components/MxNoticeTemplate";
const TASK_TYPE = 'UI_AUTOMATION_TASK';
@ -187,28 +187,33 @@ export default {
handleTemplate(index, row) {
if (hasLicense()) {
let robotTemplate = "";
switch (row.event) {
case 'CREATE':
robotTemplate = this.robotTitle;
break;
case 'UPDATE':
robotTemplate = this.robotTitle.replace('创建', '更新');
break;
case 'DELETE':
robotTemplate = this.robotTitle.replace('创建', '删除');
break;
case 'EXECUTE_SUCCESSFUL':
robotTemplate = this.robotTitle.replace('创建', '执行')
.replace('UI自动化', 'UI自动化成功');
break;
case 'EXECUTE_FAILED':
robotTemplate = this.robotTitle.replace('创建', '执行')
.replace('UI自动化', 'UI自动化失败');
break;
default:
break;
}
this.$refs.noticeTemplate.open(row, robotTemplate);
searchTemplateById(row.id, row.event).then(response => {
row.template = response.data.template
if (!response.data.template) {
switch (row.event) {
case 'CREATE':
robotTemplate = this.robotTitle;
break;
case 'UPDATE':
robotTemplate = this.robotTitle.replace('创建', '更新');
break;
case 'DELETE':
robotTemplate = this.robotTitle.replace('创建', '删除');
break;
case 'EXECUTE_SUCCESSFUL':
robotTemplate = this.robotTitle.replace('创建', '执行')
.replace('UI自动化', 'UI自动化成功');
break;
case 'EXECUTE_FAILED':
robotTemplate = this.robotTitle.replace('创建', '执行')
.replace('UI自动化', 'UI自动化失败');
break;
default:
break;
}
}
this.$refs.noticeTemplate.open(row, robotTemplate);
});
}
},
handleReceivers(row) {