diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/service/NoticeMessageTaskService.java b/backend/services/project-management/src/main/java/io/metersphere/project/service/NoticeMessageTaskService.java index 735103c21a..ae5ae5a066 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/service/NoticeMessageTaskService.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/service/NoticeMessageTaskService.java @@ -167,11 +167,13 @@ public class NoticeMessageTaskService { MessageTaskBlobExample messageTaskBlobExample = new MessageTaskBlobExample(); messageTaskBlobExample.createCriteria().andIdIn(messageTaskIds); List messageTaskBlobs = messageTaskBlobMapper.selectByExample(messageTaskBlobExample); + ListmessageTaskEqualsRobotIDs = new ArrayList<>(); for (MessageTask messageTask : messageTasks) { messageTask.setUpdateTime(System.currentTimeMillis()); messageTask.setUpdateUser(userId); //如果有机器人id,则是修改机器人开关和消息配置 if (StringUtils.isNotBlank(messageTaskRequest.getRobotId()) && StringUtils.equalsIgnoreCase(messageTask.getProjectRobotId(), messageTaskRequest.getRobotId())) { + messageTaskEqualsRobotIDs.add(messageTask.getId()); messageTask.setEnable(enable); messageTask.setUseDefaultSubject(useDefaultSubject); messageTask.setUseDefaultTemplate(useDefaultTemplate); @@ -183,7 +185,7 @@ public class NoticeMessageTaskService { mapper.updateByPrimaryKeySelective(messageTask); } for (MessageTaskBlob messageTaskBlob : messageTaskBlobs) { - if (StringUtils.isNotBlank(messageTaskRequest.getRobotId()) && !useDefaultTemplate) { + if (StringUtils.isNotBlank(messageTaskRequest.getRobotId()) && !useDefaultTemplate && messageTaskEqualsRobotIDs.contains(messageTaskBlob.getId())) { messageTaskBlob.setTemplate(messageTaskRequest.getTemplate()); blobMapper.updateByPrimaryKeyWithBLOBs(messageTaskBlob); }