fix(项目管理): 修复关闭定时任务,消息通知没有拿到操作人的缺陷
--bug=1039626 --user=王孝刚 【项目管理】消息管理-设置开启和关闭定时任务通知,收到的通知没有获取到操作人信息 https://www.tapd.cn/55049933/s/1500068
This commit is contained in:
parent
c366587fc4
commit
9fb041e437
|
@ -4,6 +4,7 @@ import io.metersphere.sdk.util.JSON;
|
||||||
import io.metersphere.sdk.util.SubListUtils;
|
import io.metersphere.sdk.util.SubListUtils;
|
||||||
import io.metersphere.system.domain.Schedule;
|
import io.metersphere.system.domain.Schedule;
|
||||||
import io.metersphere.system.domain.User;
|
import io.metersphere.system.domain.User;
|
||||||
|
import io.metersphere.system.mapper.UserMapper;
|
||||||
import io.metersphere.system.notice.NoticeModel;
|
import io.metersphere.system.notice.NoticeModel;
|
||||||
import io.metersphere.system.notice.constants.NoticeConstants;
|
import io.metersphere.system.notice.constants.NoticeConstants;
|
||||||
import io.metersphere.system.notice.utils.MessageTemplateUtils;
|
import io.metersphere.system.notice.utils.MessageTemplateUtils;
|
||||||
|
@ -26,6 +27,8 @@ public class ApiScheduleNoticeService {
|
||||||
private NoticeSendService noticeSendService;
|
private NoticeSendService noticeSendService;
|
||||||
@Resource
|
@Resource
|
||||||
private CommonNoticeSendService commonNoticeSendService;
|
private CommonNoticeSendService commonNoticeSendService;
|
||||||
|
@Resource
|
||||||
|
private UserMapper userMapper;
|
||||||
|
|
||||||
public void sendScheduleNotice(Schedule schedule, String userId) {
|
public void sendScheduleNotice(Schedule schedule, String userId) {
|
||||||
if (ObjectUtils.isNotEmpty(schedule)) {
|
if (ObjectUtils.isNotEmpty(schedule)) {
|
||||||
|
@ -36,6 +39,8 @@ public class ApiScheduleNoticeService {
|
||||||
}
|
}
|
||||||
BeanMap beanMap = new BeanMap(schedule);
|
BeanMap beanMap = new BeanMap(schedule);
|
||||||
Map paramMap = new HashMap<>(beanMap);
|
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);
|
String template = defaultTemplateMap.get(NoticeConstants.TaskType.SCHEDULE_TASK + "_" + event);
|
||||||
Map<String, String> defaultSubjectMap = MessageTemplateUtils.getDefaultTemplateSubjectMap();
|
Map<String, String> defaultSubjectMap = MessageTemplateUtils.getDefaultTemplateSubjectMap();
|
||||||
String subject = defaultSubjectMap.get(NoticeConstants.TaskType.SCHEDULE_TASK + "_" + event);
|
String subject = defaultSubjectMap.get(NoticeConstants.TaskType.SCHEDULE_TASK + "_" + event);
|
||||||
|
|
Loading…
Reference in New Issue