fix(项目管理): 修复消息模板保存其余模版同步修改问题

--bug=1043072 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001043072
This commit is contained in:
guoyuqi 2024-06-25 13:21:46 +08:00 committed by 刘瑞斌
parent ceea82c233
commit bc045fb26a
1 changed files with 3 additions and 1 deletions

View File

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