mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-03-29 16:53:23 +08:00
update 消息推送增加 消息类型 消息来源 前端跳转路径等扩展参数
This commit is contained in:
@@ -4,11 +4,14 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.PageResult;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.enums.PushSourceEnum;
|
||||
import org.dromara.common.core.enums.PushTypeEnum;
|
||||
import org.dromara.common.core.service.DictService;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.redis.annotation.RepeatSubmit;
|
||||
import org.dromara.common.sse.dto.SseMessageDTO;
|
||||
import org.dromara.common.sse.utils.SseMessageUtils;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.system.domain.bo.SysNoticeBo;
|
||||
@@ -17,6 +20,9 @@ import org.dromara.system.service.ISysNoticeService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 公告 信息操作处理
|
||||
*
|
||||
@@ -72,7 +78,17 @@ public class SysNoticeController extends BaseController {
|
||||
return R.fail();
|
||||
}
|
||||
String type = dictService.getDictLabel("sys_notice_type", notice.getNoticeType());
|
||||
SseMessageUtils.publishAll("[" + type + "] " + notice.getNoticeTitle());
|
||||
Map<String, Object> data = new HashMap<>(4);
|
||||
data.put("noticeType", notice.getNoticeType());
|
||||
data.put("noticeTypeLabel", type);
|
||||
data.put("noticeTitle", notice.getNoticeTitle());
|
||||
SseMessageDTO dto = new SseMessageDTO();
|
||||
dto.setMessage("[" + type + "] " + notice.getNoticeTitle());
|
||||
dto.setMessageType(PushTypeEnum.NOTICE.getType());
|
||||
dto.setMessageSource(PushSourceEnum.NOTICE.getSource());
|
||||
dto.setData(data);
|
||||
dto.setPath("/system/notice");
|
||||
SseMessageUtils.publishMessage(dto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.core.domain.dto.UserDTO;
|
||||
import org.dromara.common.core.enums.PushSourceEnum;
|
||||
import org.dromara.common.core.enums.PushTypeEnum;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.SpringUtils;
|
||||
import org.dromara.common.core.utils.StreamUtils;
|
||||
@@ -95,6 +97,8 @@ public class FlwCommonServiceImpl implements IFlwCommonService {
|
||||
SseMessageDTO dto = new SseMessageDTO();
|
||||
dto.setUserIds(userIds);
|
||||
dto.setMessage(message);
|
||||
dto.setMessageType(PushTypeEnum.MESSAGE.getType());
|
||||
dto.setMessageSource(PushSourceEnum.WORKFLOW.getSource());
|
||||
SseMessageUtils.publishMessage(dto);
|
||||
}
|
||||
case EMAIL_MESSAGE -> MailUtils.sendText(emails, subject, message);
|
||||
|
||||
Reference in New Issue
Block a user