fix(项目管理): 修复关闭定时任务,消息通知没有拿到操作人的缺陷

--bug=1039626 --user=王孝刚 【项目管理】消息管理-设置开启和关闭定时任务通知,收到的通知没有获取到操作人信息
https://www.tapd.cn/55049933/s/1500068
This commit is contained in:
wxg0103 2024-04-17 17:59:19 +08:00 committed by 刘瑞斌
parent c366587fc4
commit 9fb041e437

View File

@ -4,6 +4,7 @@ import io.metersphere.sdk.util.JSON;
import io.metersphere.sdk.util.SubListUtils;
import io.metersphere.system.domain.Schedule;
import io.metersphere.system.domain.User;
import io.metersphere.system.mapper.UserMapper;
import io.metersphere.system.notice.NoticeModel;
import io.metersphere.system.notice.constants.NoticeConstants;
import io.metersphere.system.notice.utils.MessageTemplateUtils;
@ -26,6 +27,8 @@ public class ApiScheduleNoticeService {
private NoticeSendService noticeSendService;
@Resource
private CommonNoticeSendService commonNoticeSendService;
@Resource
private UserMapper userMapper;
public void sendScheduleNotice(Schedule schedule, String userId) {
if (ObjectUtils.isNotEmpty(schedule)) {
@ -36,6 +39,8 @@ public class ApiScheduleNoticeService {
}
BeanMap beanMap = new BeanMap(schedule);
Map paramMap = new HashMap<>(beanMap);
User user = userMapper.selectByPrimaryKey(userId);
paramMap.put(NoticeConstants.RelatedUser.OPERATOR, user != null ? user.getName() : "");
String template = defaultTemplateMap.get(NoticeConstants.TaskType.SCHEDULE_TASK + "_" + event);
Map<String, String> defaultSubjectMap = MessageTemplateUtils.getDefaultTemplateSubjectMap();
String subject = defaultSubjectMap.get(NoticeConstants.TaskType.SCHEDULE_TASK + "_" + event);