mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-04-08 19:43:16 +08:00
update 完成消息盒子功能前后端联动(已读未读在前端浏览器存储)
This commit is contained in:
@@ -14,11 +14,16 @@ import java.io.Serializable;
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Data
|
||||
public class PushPayload implements Serializable {
|
||||
public class PushPayloadDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 消息记录ID
|
||||
*/
|
||||
private Long messageId;
|
||||
|
||||
/**
|
||||
* 消息类型
|
||||
*/
|
||||
@@ -49,8 +54,8 @@ public class PushPayload implements Serializable {
|
||||
*/
|
||||
private Long timestamp;
|
||||
|
||||
public static PushPayload of(String type, String source, String message, Object data) {
|
||||
PushPayload payload = new PushPayload();
|
||||
public static PushPayloadDTO of(String type, String source, String message, Object data) {
|
||||
PushPayloadDTO payload = new PushPayloadDTO();
|
||||
payload.setType(StringUtils.defaultIfBlank(type, PushTypeEnum.MESSAGE.getType()));
|
||||
payload.setSource(StringUtils.defaultIfBlank(source, PushSourceEnum.BACKEND.getSource()));
|
||||
payload.setMessage(message);
|
||||
@@ -59,7 +64,7 @@ public class PushPayload implements Serializable {
|
||||
return payload;
|
||||
}
|
||||
|
||||
public static PushPayload of(PushTypeEnum type, PushSourceEnum source, String message, Object data) {
|
||||
public static PushPayloadDTO of(PushTypeEnum type, PushSourceEnum source, String message, Object data) {
|
||||
return of(
|
||||
type == null ? null : type.getType(),
|
||||
source == null ? null : source.getSource(),
|
||||
@@ -68,8 +73,8 @@ public class PushPayload implements Serializable {
|
||||
);
|
||||
}
|
||||
|
||||
public static PushPayload of(PushTypeEnum type, PushSourceEnum source, String message, Object data, String path) {
|
||||
PushPayload payload = of(type, source, message, data);
|
||||
public static PushPayloadDTO of(PushTypeEnum type, PushSourceEnum source, String message, Object data, String path) {
|
||||
PushPayloadDTO payload = of(type, source, message, data);
|
||||
payload.setPath(path);
|
||||
return payload;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.dromara.common.core.service;
|
||||
|
||||
import org.dromara.common.core.domain.dto.PushPayloadDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 通用 消息服务
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
public interface MessageService {
|
||||
|
||||
void sendMessage(Long userId, String message);
|
||||
|
||||
void sendMessage(String message);
|
||||
|
||||
void sendMessage(Long userId, PushPayloadDTO payload);
|
||||
|
||||
void sendMessage(PushPayloadDTO payload);
|
||||
|
||||
void publishMessage(List<Long> userIds, PushPayloadDTO payload);
|
||||
|
||||
void publishAll(String message);
|
||||
|
||||
void publishAll(PushPayloadDTO payload);
|
||||
}
|
||||
Reference in New Issue
Block a user