init
This commit is contained in:
26
notice/notice-api/pom.xml
Normal file
26
notice/notice-api/pom.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>notice</artifactId>
|
||||
<groupId>cn.fateverse</groupId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>notice-api</artifactId>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.fateverse</groupId>
|
||||
<artifactId>common-swagger</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,52 @@
|
||||
package cn.fateverse.notice.dto;
|
||||
|
||||
import cn.fateverse.notice.enums.ActionEnums;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Clay
|
||||
* @date 2023-05-04
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("公告发送实体")
|
||||
public class NoticeDto implements Serializable {
|
||||
|
||||
@ApiModelProperty("公告标题")
|
||||
@NotNull(message = "公告标题不能为空")
|
||||
private String noticeTitle;
|
||||
|
||||
@ApiModelProperty("公告类型(1通知 2公告)")
|
||||
@NotNull(message = "公告类型不能为空")
|
||||
private String noticeType;
|
||||
|
||||
@ApiModelProperty("发送类型,用户:user,用户数组:user,角色:role,部门:dept,全发:all")
|
||||
@NotNull(message = "发送类型不能为空")
|
||||
private String sendType;
|
||||
|
||||
private ActionEnums action;
|
||||
|
||||
@ApiModelProperty("发送类型的id")
|
||||
@NotNull(message = "发送对象id不能为空")
|
||||
private List<Long> senderIds;
|
||||
|
||||
@ApiModelProperty("公告内容")
|
||||
private String noticeContent;
|
||||
|
||||
@ApiModelProperty("内容类型: html,text 等")
|
||||
@NotNull(message = "内容类型不能为空")
|
||||
private String contentType;
|
||||
|
||||
@ApiModelProperty("发送群组")
|
||||
@NotNull(message = "消息发送群组不能为空")
|
||||
private String cluster;
|
||||
|
||||
@ApiModelProperty("公告备注")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package cn.fateverse.notice.dubbo;
|
||||
|
||||
import cn.fateverse.notice.dto.NoticeDto;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
|
||||
/**
|
||||
* @author Clay
|
||||
* @date 2023-05-04
|
||||
*/
|
||||
public interface DubboNoticeService {
|
||||
|
||||
/**
|
||||
* 异步发送消息
|
||||
* @param noticeDto 发送消息实体
|
||||
*/
|
||||
@Async
|
||||
void syncSend(NoticeDto noticeDto);
|
||||
|
||||
/**
|
||||
* 发送消息
|
||||
* @param noticeDto 发送消息实体
|
||||
*/
|
||||
void send(NoticeDto noticeDto);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package cn.fateverse.notice.entity;
|
||||
|
||||
import cn.fateverse.notice.enums.ActionEnums;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Clay
|
||||
* @date 2023-05-04
|
||||
*/
|
||||
@Data
|
||||
public class Message implements Serializable {
|
||||
private String id;
|
||||
|
||||
private Object message;
|
||||
|
||||
private ActionEnums type;
|
||||
|
||||
private String group;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package cn.fateverse.notice.enums;
|
||||
|
||||
/**
|
||||
* @author Clay
|
||||
* @date 2023-04-14
|
||||
*/
|
||||
public enum ActionEnums {
|
||||
|
||||
/**
|
||||
* notice 的操作
|
||||
*/
|
||||
SEND("send"),
|
||||
REMOVE("remove"),
|
||||
;
|
||||
|
||||
|
||||
private final String type;
|
||||
|
||||
ActionEnums(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user