From 4a5da6eaf50be732b7611b209f8cb0b7a00b9b92 Mon Sep 17 00:00:00 2001
From: liuhanqing <447067298@qq.com>
Date: Fri, 1 Jan 2021 22:35:57 +0800
Subject: [PATCH 01/10] =?UTF-8?q?=E3=80=90message=E3=80=91=E7=B3=BB?=
=?UTF-8?q?=E7=BB=9F=E6=B6=88=E6=81=AF=E6=A8=A1=E5=9D=97=E5=88=9D=E6=AD=A5?=
=?UTF-8?q?=E5=88=92=E5=88=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
kernel-d-message/README.md | 3 +
kernel-d-message/message-api/README.md | 1 +
kernel-d-message/message-api/pom.xml | 57 ++++++++++++
.../roses/kernel/message/api/MessageApi.java | 14 +++
.../api/constants/MessageConstants.java | 36 ++++++++
.../message/api/context/MessageContext.java | 24 +++++
.../api/exception/MessageException.java | 19 ++++
.../exception/enums/MessageExceptionEnum.java | 37 ++++++++
.../kernel/message/api/pojo/MessageParam.java | 71 +++++++++++++++
.../message/api/pojo/MessageSendParam.java | 53 +++++++++++
kernel-d-message/message-business/README.md | 1 +
kernel-d-message/message-business/pom.xml | 59 +++++++++++++
.../controller/SysMessageController.java | 25 ++++++
kernel-d-message/message-sdk-db/README.md | 1 +
kernel-d-message/message-sdk-db/pom.xml | 36 ++++++++
.../kernel/message/db/entity/SysMessage.java | 87 +++++++++++++++++++
.../message/db/mapper/SysMessageMapper.java | 14 +++
.../db/mapper/mapping/SysMessageMapper.xml | 4 +
.../message/db/service/SysMessageService.java | 14 +++
.../service/impl/SysMessageServiceImpl.java | 18 ++++
.../message-spring-boot-starter/README.md | 1 +
.../message-spring-boot-starter/pom.xml | 38 ++++++++
.../starter/GunsMessageAutoConfiguration.java | 16 ++++
.../main/resources/META-INF/spring.factories | 2 +
kernel-d-message/pom.xml | 36 ++++++++
pom.xml | 3 +
26 files changed, 670 insertions(+)
create mode 100644 kernel-d-message/README.md
create mode 100644 kernel-d-message/message-api/README.md
create mode 100644 kernel-d-message/message-api/pom.xml
create mode 100644 kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/MessageApi.java
create mode 100644 kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/constants/MessageConstants.java
create mode 100644 kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/context/MessageContext.java
create mode 100644 kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/exception/MessageException.java
create mode 100644 kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/exception/enums/MessageExceptionEnum.java
create mode 100644 kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageParam.java
create mode 100644 kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageSendParam.java
create mode 100644 kernel-d-message/message-business/README.md
create mode 100644 kernel-d-message/message-business/pom.xml
create mode 100644 kernel-d-message/message-business/src/main/java/cn/stylefeng/roses/kernel/message/modular/manage/controller/SysMessageController.java
create mode 100644 kernel-d-message/message-sdk-db/README.md
create mode 100644 kernel-d-message/message-sdk-db/pom.xml
create mode 100644 kernel-d-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/entity/SysMessage.java
create mode 100644 kernel-d-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/mapper/SysMessageMapper.java
create mode 100644 kernel-d-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/mapper/mapping/SysMessageMapper.xml
create mode 100644 kernel-d-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/service/SysMessageService.java
create mode 100644 kernel-d-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/service/impl/SysMessageServiceImpl.java
create mode 100644 kernel-d-message/message-spring-boot-starter/README.md
create mode 100644 kernel-d-message/message-spring-boot-starter/pom.xml
create mode 100644 kernel-d-message/message-spring-boot-starter/src/main/java/cn/stylefeng/roses/kernel/message/starter/GunsMessageAutoConfiguration.java
create mode 100644 kernel-d-message/message-spring-boot-starter/src/main/resources/META-INF/spring.factories
create mode 100644 kernel-d-message/pom.xml
diff --git a/kernel-d-message/README.md b/kernel-d-message/README.md
new file mode 100644
index 000000000..2c1c3db8c
--- /dev/null
+++ b/kernel-d-message/README.md
@@ -0,0 +1,3 @@
+系统消息模块
+
+系统消息模块可以发送消息记录,已读未读状态
diff --git a/kernel-d-message/message-api/README.md b/kernel-d-message/message-api/README.md
new file mode 100644
index 000000000..1368f2aa3
--- /dev/null
+++ b/kernel-d-message/message-api/README.md
@@ -0,0 +1 @@
+系统消息模块的api
\ No newline at end of file
diff --git a/kernel-d-message/message-api/pom.xml b/kernel-d-message/message-api/pom.xml
new file mode 100644
index 000000000..17ac09d84
--- /dev/null
+++ b/kernel-d-message/message-api/pom.xml
@@ -0,0 +1,57 @@
+
+
+ 4.0.0
+
+
+ cn.stylefeng.roses
+ kernel-d-message
+ 1.0.0
+ ../pom.xml
+
+
+ message-api
+
+ jar
+
+
+
+
+
+
+
+ cn.stylefeng.roses
+ auth-api
+ 1.0.0
+ true
+
+
+
+
+
+ cn.stylefeng.roses
+ validator-api
+ 1.0.0
+
+
+
+
+
+ cn.stylefeng.roses
+ db-api
+ 1.0.0
+
+
+
+
+
+
+ javax.servlet
+ javax.servlet-api
+ true
+
+
+
+
+
diff --git a/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/MessageApi.java b/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/MessageApi.java
new file mode 100644
index 000000000..96109ddd5
--- /dev/null
+++ b/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/MessageApi.java
@@ -0,0 +1,14 @@
+package cn.stylefeng.roses.kernel.message.api;
+
+/**
+ * 系统消息相关接口
+ *
+ * 接口可以有多种实现,目前只实现数据库存储方式
+ *
+ * @author liuhanqing
+ * @date 2021/1/1 20:21
+ */
+public interface MessageApi {
+
+
+}
\ No newline at end of file
diff --git a/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/constants/MessageConstants.java b/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/constants/MessageConstants.java
new file mode 100644
index 000000000..c61294c5e
--- /dev/null
+++ b/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/constants/MessageConstants.java
@@ -0,0 +1,36 @@
+package cn.stylefeng.roses.kernel.message.api.constants;
+
+/**
+ * message模块的常量
+ *
+ * @author liuhanqing
+ * @date 2021/1/1 20:58
+ */
+public interface MessageConstants {
+
+ /**
+ * 消息模块的名称
+ */
+ String MESSAGE_MODULE_NAME = "kernel-d-message";
+
+ /**
+ * 异常枚举的步进值
+ */
+ String MESSAGE_EXCEPTION_STEP_CODE = "23";
+
+ /**
+ * 发送所有用户标识
+ */
+ String RECEIVE_ALL_USER_FLAG = "all";
+
+ /**
+ * 默认查询日志分页
+ */
+ Integer DEFAULT_BEGIN_PAGE_NO = 1;
+
+ /**
+ * 默认查询日志分页大小
+ */
+ Integer DEFAULT_PAGE_SIZE = 10;
+
+}
diff --git a/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/context/MessageContext.java b/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/context/MessageContext.java
new file mode 100644
index 000000000..07a3df1ff
--- /dev/null
+++ b/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/context/MessageContext.java
@@ -0,0 +1,24 @@
+package cn.stylefeng.roses.kernel.message.api.context;
+
+import cn.hutool.extra.spring.SpringUtil;
+import cn.stylefeng.roses.kernel.message.api.MessageApi;
+
+/**
+ * 消息操作api的获取
+ *
+ * @author liuhanqing
+ * @date 2021/1/1 21:13
+ */
+public class MessageContext {
+
+ /**
+ * 获取消息操作api
+ *
+ * @author liuhanqing
+ * @date 2021/1/1 21:13
+ */
+ public static MessageApi me() {
+ return SpringUtil.getBean(MessageApi.class);
+ }
+
+}
diff --git a/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/exception/MessageException.java b/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/exception/MessageException.java
new file mode 100644
index 000000000..a98e76b81
--- /dev/null
+++ b/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/exception/MessageException.java
@@ -0,0 +1,19 @@
+package cn.stylefeng.roses.kernel.message.api.exception;
+
+import cn.stylefeng.roses.kernel.message.api.constants.MessageConstants;
+import cn.stylefeng.roses.kernel.rule.abstracts.AbstractExceptionEnum;
+import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
+
+/**
+ * 消息异常枚举
+ *
+ * @author liuhanqing
+ * @date 2021/1/1 20:55
+ */
+public class MessageException extends ServiceException {
+
+ public MessageException(AbstractExceptionEnum exception) {
+ super(MessageConstants.MESSAGE_MODULE_NAME, exception);
+ }
+
+}
diff --git a/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/exception/enums/MessageExceptionEnum.java b/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/exception/enums/MessageExceptionEnum.java
new file mode 100644
index 000000000..8498988cb
--- /dev/null
+++ b/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/exception/enums/MessageExceptionEnum.java
@@ -0,0 +1,37 @@
+package cn.stylefeng.roses.kernel.message.api.exception.enums;
+
+import cn.stylefeng.roses.kernel.message.api.constants.MessageConstants;
+import cn.stylefeng.roses.kernel.rule.abstracts.AbstractExceptionEnum;
+import cn.stylefeng.roses.kernel.rule.constants.RuleConstants;
+import lombok.Getter;
+
+/**
+ * 消息异常枚举
+ *
+ * @author liuhanqing
+ * @date 2021/1/1 21:14
+ */
+@Getter
+public enum MessageExceptionEnum implements AbstractExceptionEnum {
+
+ /**
+ * 发送系统消息时,传入的参数中receiveUserIds不合法
+ */
+ ERROR_RECEIVE_USER_IDS(RuleConstants.BUSINESS_ERROR_TYPE_CODE + MessageConstants.MESSAGE_EXCEPTION_STEP_CODE + "01", "接收用户id字符串不合法!");
+
+ /**
+ * 错误编码
+ */
+ private final String errorCode;
+
+ /**
+ * 提示用户信息
+ */
+ private final String userTip;
+
+ MessageExceptionEnum(String errorCode, String userTip) {
+ this.errorCode = errorCode;
+ this.userTip = userTip;
+ }
+
+}
diff --git a/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageParam.java b/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageParam.java
new file mode 100644
index 000000000..8d28ea806
--- /dev/null
+++ b/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageParam.java
@@ -0,0 +1,71 @@
+package cn.stylefeng.roses.kernel.message.api.pojo.manage;
+
+import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import javax.validation.constraints.NotNull;
+import java.util.Date;
+
+/**
+ * 系统消息的查询参数
+ *
+ * @author liuhanqing
+ * @date 2021/1/1 20:23
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class MessageParam extends BaseRequest {
+
+ /**
+ * 消息id
+ */
+ @NotNull(message = "messageId不能为空", groups = {edit.class, delete.class, detail.class})
+ private Long messageId;
+
+ /**
+ * 接收用户id
+ */
+ private Long receiveUserId;
+
+ /**
+ * 发送用户id
+ */
+ private Long sendUserId;
+
+ /**
+ * 消息标题
+ */
+ private String messageTitle;
+
+ /**
+ * 消息的内容
+ */
+ private String messageContent;
+
+ /**
+ * 消息类型
+ */
+ private String messageType;
+
+ /**
+ * 消息发送时间
+ */
+ private Date messageSendTime;
+
+ /**
+ * 业务id
+ */
+ private Long businessId;
+
+ /**
+ * 业务类型
+ */
+ private String businessType;
+
+ /**
+ * 阅读状态:0-未读,1-已读
+ */
+ private Integer readFlag;
+
+}
diff --git a/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageSendParam.java b/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageSendParam.java
new file mode 100644
index 000000000..6a9b334bf
--- /dev/null
+++ b/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageSendParam.java
@@ -0,0 +1,53 @@
+package cn.stylefeng.roses.kernel.message.api.pojo.manage;
+
+import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * 发送系统消息的参数
+ *
+ * @author liuhanqing
+ * @date 2021/1/1 20:23
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class MessageSendParam extends BaseRequest {
+
+ /**
+ * 接收用户id字符串,多个以,分割
+ */
+ @NotBlank(message = "接收用户ID字符串不能为空", groups = {add.class, edit.class})
+ private String receiveUserIds;
+
+ /**
+ * 消息标题
+ */
+ @NotBlank(message = "消息标题不能为空", groups = {add.class, edit.class})
+ private String messageTitle;
+
+ /**
+ * 消息的内容
+ */
+ private String messageContent;
+
+ /**
+ * 消息类型
+ */
+ private String messageType;
+
+ /**
+ * 业务id
+ */
+ @NotBlank(message = "业务id不能为空", groups = {add.class, edit.class})
+ private Long businessId;
+
+ /**
+ * 业务类型
+ */
+ @NotBlank(message = "业务类型不能为空", groups = {add.class, edit.class})
+ private String businessType;
+
+}
diff --git a/kernel-d-message/message-business/README.md b/kernel-d-message/message-business/README.md
new file mode 100644
index 000000000..46ec04adf
--- /dev/null
+++ b/kernel-d-message/message-business/README.md
@@ -0,0 +1 @@
+系统消息业务模块,包含发送消息,查看消息,消息列表,已读消息,未读消息的业务
\ No newline at end of file
diff --git a/kernel-d-message/message-business/pom.xml b/kernel-d-message/message-business/pom.xml
new file mode 100644
index 000000000..83979a693
--- /dev/null
+++ b/kernel-d-message/message-business/pom.xml
@@ -0,0 +1,59 @@
+
+
+ 4.0.0
+
+
+ cn.stylefeng.roses
+ kernel-d-log
+ 1.0.0
+ ../pom.xml
+
+
+ message-business
+
+ jar
+
+
+
+
+
+ cn.stylefeng.roses
+ message-api
+ 1.0.0
+
+
+
+
+
+ cn.stylefeng.roses
+ scanner-api
+ 1.0.0
+
+
+
+
+
+ cn.stylefeng.roses
+ validator-api
+ 1.0.0
+
+
+
+
+
+ cn.stylefeng.roses
+ db-sdk-mp
+ 1.0.0
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+
+
diff --git a/kernel-d-message/message-business/src/main/java/cn/stylefeng/roses/kernel/message/modular/manage/controller/SysMessageController.java b/kernel-d-message/message-business/src/main/java/cn/stylefeng/roses/kernel/message/modular/manage/controller/SysMessageController.java
new file mode 100644
index 000000000..5e7a511ee
--- /dev/null
+++ b/kernel-d-message/message-business/src/main/java/cn/stylefeng/roses/kernel/message/modular/manage/controller/SysMessageController.java
@@ -0,0 +1,25 @@
+package cn.stylefeng.roses.kernel.message.modular.manage.controller;
+
+import cn.stylefeng.roses.kernel.message.api.MessageApi;
+import cn.stylefeng.roses.kernel.resource.api.annotation.ApiResource;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 系统消息控制器
+ *
+ * @author liuhanqing
+ * @date 2021/1/1 22:30
+ */
+@RestController
+@ApiResource(name = "系统消息控制器")
+public class SysMessageController {
+
+ /**
+ * 系统消息api
+ */
+ @Autowired
+ private MessageApi messageApi;
+
+
+}
diff --git a/kernel-d-message/message-sdk-db/README.md b/kernel-d-message/message-sdk-db/README.md
new file mode 100644
index 000000000..4766a8ca2
--- /dev/null
+++ b/kernel-d-message/message-sdk-db/README.md
@@ -0,0 +1 @@
+系统消息记录的sdk,用于将消息记录到数据库中,提供相关消息管理接口
\ No newline at end of file
diff --git a/kernel-d-message/message-sdk-db/pom.xml b/kernel-d-message/message-sdk-db/pom.xml
new file mode 100644
index 000000000..b12b29801
--- /dev/null
+++ b/kernel-d-message/message-sdk-db/pom.xml
@@ -0,0 +1,36 @@
+
+
+ 4.0.0
+
+
+ cn.stylefeng.roses
+ kernel-d-message
+ 1.0.0
+ ../pom.xml
+
+
+ message-sdk-db
+
+ jar
+
+
+
+
+
+ cn.stylefeng.roses
+ message-api
+ 1.0.0
+
+
+
+
+ cn.stylefeng.roses
+ db-sdk-mp
+ 1.0.0
+
+
+
+
+
diff --git a/kernel-d-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/entity/SysMessage.java b/kernel-d-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/entity/SysMessage.java
new file mode 100644
index 000000000..0f39b4a9b
--- /dev/null
+++ b/kernel-d-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/entity/SysMessage.java
@@ -0,0 +1,87 @@
+package cn.stylefeng.roses.kernel.message.db.entity;
+
+import cn.stylefeng.roses.kernel.db.api.pojo.entity.BaseEntity;
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * 系统消息
+ *
+ * @author liuhanqing
+ * @date 2020/12/31 20:09
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+@TableName("sys_message")
+public class SysMessage extends BaseEntity {
+
+ /**
+ * 主键
+ */
+ @TableId(value = "message_id", type = IdType.ASSIGN_ID)
+ private Long messageId;
+
+ /**
+ * 接收用户id
+ */
+ @TableId(value = "receive_user_id")
+ private Long receiveUserId;
+
+ /**
+ * 发送用户id
+ */
+ @TableId(value = "send_user_id")
+ private Long sendUserId;
+
+ /**
+ * 消息标题
+ */
+ @TableField(value = "message_title")
+ private String messageTitle;
+
+ /**
+ * 消息的内容
+ */
+ @TableField(value = "message_content")
+ private String messageContent;
+
+ /**
+ * 消息类型
+ */
+ @TableField(value = "message_type")
+ private String messageType;
+
+ /**
+ * 消息发送时间
+ */
+ @TableField(value = "message_send_time")
+ private Date messageSendTime;
+
+ /**
+ * 业务id
+ */
+ @TableField(value = "business_id")
+ private Long businessId;
+
+ /**
+ * 业务类型
+ */
+ @TableField(value = "business_type")
+ private String businessType;
+
+ /**
+ * 阅读状态:0-未读,1-已读
+ */
+ @TableField(value = "read_flag")
+ private Integer readFlag;
+
+ /**
+ * 是否删除:Y-已删除,N-未删除
+ */
+ @TableField(value = "del_flag", fill = FieldFill.INSERT)
+ private String delFlag;
+
+}
\ No newline at end of file
diff --git a/kernel-d-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/mapper/SysMessageMapper.java b/kernel-d-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/mapper/SysMessageMapper.java
new file mode 100644
index 000000000..bdc62af3e
--- /dev/null
+++ b/kernel-d-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/mapper/SysMessageMapper.java
@@ -0,0 +1,14 @@
+package cn.stylefeng.roses.kernel.message.db.mapper;
+
+import cn.stylefeng.roses.kernel.message.db.entity.SysMessage;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 系统消息 Mapper 接口
+ *
+ * @author liuhanqing
+ * @date 2020/12/31 20:09
+ */
+public interface SysMessageMapper extends BaseMapper {
+
+}
diff --git a/kernel-d-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/mapper/mapping/SysMessageMapper.xml b/kernel-d-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/mapper/mapping/SysMessageMapper.xml
new file mode 100644
index 000000000..2767ad7df
--- /dev/null
+++ b/kernel-d-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/mapper/mapping/SysMessageMapper.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/kernel-d-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/service/SysMessageService.java b/kernel-d-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/service/SysMessageService.java
new file mode 100644
index 000000000..77ffa6f8f
--- /dev/null
+++ b/kernel-d-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/service/SysMessageService.java
@@ -0,0 +1,14 @@
+package cn.stylefeng.roses.kernel.message.db.service;
+
+import cn.stylefeng.roses.kernel.message.db.entity.SysMessage;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 系统消息 service接口
+ *
+ * @author liuhanqing
+ * @date 2020/12/31 20:09
+ */
+public interface SysMessageService extends IService {
+
+}
diff --git a/kernel-d-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/service/impl/SysMessageServiceImpl.java b/kernel-d-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/service/impl/SysMessageServiceImpl.java
new file mode 100644
index 000000000..6b4520cd4
--- /dev/null
+++ b/kernel-d-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/service/impl/SysMessageServiceImpl.java
@@ -0,0 +1,18 @@
+package cn.stylefeng.roses.kernel.message.db.service.impl;
+
+import cn.stylefeng.roses.kernel.message.db.entity.SysMessage;
+import cn.stylefeng.roses.kernel.message.db.mapper.SysMessageMapper;
+import cn.stylefeng.roses.kernel.message.db.service.SysMessageService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 系统消息 service接口实现类
+ *
+ * @author liuhanqing
+ * @date 2020/12/31 20:09
+ */
+@Service
+public class SysMessageServiceImpl extends ServiceImpl implements SysMessageService {
+
+}
diff --git a/kernel-d-message/message-spring-boot-starter/README.md b/kernel-d-message/message-spring-boot-starter/README.md
new file mode 100644
index 000000000..c3a12177f
--- /dev/null
+++ b/kernel-d-message/message-spring-boot-starter/README.md
@@ -0,0 +1 @@
+系统消息的spring boot自动加载模块
\ No newline at end of file
diff --git a/kernel-d-message/message-spring-boot-starter/pom.xml b/kernel-d-message/message-spring-boot-starter/pom.xml
new file mode 100644
index 000000000..cf61944ed
--- /dev/null
+++ b/kernel-d-message/message-spring-boot-starter/pom.xml
@@ -0,0 +1,38 @@
+
+
+ 4.0.0
+
+
+ cn.stylefeng.roses
+ kernel-d-message
+ 1.0.0
+ ../pom.xml
+
+
+ message-spring-boot-starter
+
+ jar
+
+
+
+
+
+
+
+
+
+ cn.stylefeng.roses
+ message-sdk-db
+ 1.0.0
+
+
+
+
+
+
diff --git a/kernel-d-message/message-spring-boot-starter/src/main/java/cn/stylefeng/roses/kernel/message/starter/GunsMessageAutoConfiguration.java b/kernel-d-message/message-spring-boot-starter/src/main/java/cn/stylefeng/roses/kernel/message/starter/GunsMessageAutoConfiguration.java
new file mode 100644
index 000000000..a2c26e978
--- /dev/null
+++ b/kernel-d-message/message-spring-boot-starter/src/main/java/cn/stylefeng/roses/kernel/message/starter/GunsMessageAutoConfiguration.java
@@ -0,0 +1,16 @@
+package cn.stylefeng.roses.kernel.message.starter;
+
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * 系统消息的自动配置
+ *
+ * @author liuhanqing
+ * @date 2020/12/31 18:50
+ */
+@Configuration
+public class GunsMessageAutoConfiguration {
+
+
+
+}
\ No newline at end of file
diff --git a/kernel-d-message/message-spring-boot-starter/src/main/resources/META-INF/spring.factories b/kernel-d-message/message-spring-boot-starter/src/main/resources/META-INF/spring.factories
new file mode 100644
index 000000000..e86c6ccc0
--- /dev/null
+++ b/kernel-d-message/message-spring-boot-starter/src/main/resources/META-INF/spring.factories
@@ -0,0 +1,2 @@
+org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
+ cn.stylefeng.roses.kernel.message.starter.GunsMessageAutoConfiguration
\ No newline at end of file
diff --git a/kernel-d-message/pom.xml b/kernel-d-message/pom.xml
new file mode 100644
index 000000000..9429be1b9
--- /dev/null
+++ b/kernel-d-message/pom.xml
@@ -0,0 +1,36 @@
+
+
+ 4.0.0
+
+
+ cn.stylefeng.roses
+ roses-kernel
+ 1.0.0
+ ../pom.xml
+
+
+ kernel-d-message
+
+ pom
+
+
+ message-api
+ message-business
+ message-sdk-db
+ message-spring-boot-starter
+
+
+
+
+
+
+ cn.stylefeng.roses
+ kernel-a-rule
+ 1.0.0
+
+
+
+
+
diff --git a/pom.xml b/pom.xml
index fdec697bf..a9d5a5486 100644
--- a/pom.xml
+++ b/pom.xml
@@ -73,6 +73,9 @@
kernel-s-dict
+
+ kernel-d-message
+
kernel-s-system
From 77a0779bf9c7de5540c45531d525b0cd287befa9 Mon Sep 17 00:00:00 2001
From: liuhanqing <447067298@qq.com>
Date: Sat, 2 Jan 2021 23:02:03 +0800
Subject: [PATCH 02/10] =?UTF-8?q?=E3=80=90message=E3=80=91=E6=8E=A5?=
=?UTF-8?q?=E5=8F=A3=E5=BC=80=E5=8F=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../roses/kernel/message/api/MessageApi.java | 14 ---
.../README.md | 0
.../message-api/README.md | 0
.../message-api/pom.xml | 0
.../roses/kernel/message/api/MessageApi.java | 87 +++++++++++++++++++
.../api/constants/MessageConstants.java | 0
.../message/api/context/MessageContext.java | 0
.../api/exception/MessageException.java | 0
.../exception/enums/MessageExceptionEnum.java | 0
.../kernel/message/api/pojo/MessageParam.java | 2 +-
.../message/api/pojo/MessageResponse.java | 67 ++++++++++++++
.../message/api/pojo/MessageSendParam.java | 2 +-
.../message-business/README.md | 0
.../message-business/pom.xml | 0
.../controller/SysMessageController.java | 0
.../message-sdk-db/README.md | 0
.../message-sdk-db/pom.xml | 0
.../message/db/MessageDbServiceImpl.java | 63 ++++++++++++++
.../kernel/message/db/entity/SysMessage.java | 0
.../message/db/mapper/SysMessageMapper.java | 0
.../db/mapper/mapping/SysMessageMapper.xml | 0
.../message/db/service/SysMessageService.java | 0
.../service/impl/SysMessageServiceImpl.java | 0
.../message-spring-boot-starter/README.md | 0
.../message-spring-boot-starter/pom.xml | 0
.../starter/GunsMessageAutoConfiguration.java | 0
.../main/resources/META-INF/spring.factories | 0
.../pom.xml | 2 +-
pom.xml | 2 +-
29 files changed, 221 insertions(+), 18 deletions(-)
delete mode 100644 kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/MessageApi.java
rename {kernel-d-message => kernel-s-message}/README.md (100%)
rename {kernel-d-message => kernel-s-message}/message-api/README.md (100%)
rename {kernel-d-message => kernel-s-message}/message-api/pom.xml (100%)
create mode 100644 kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/MessageApi.java
rename {kernel-d-message => kernel-s-message}/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/constants/MessageConstants.java (100%)
rename {kernel-d-message => kernel-s-message}/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/context/MessageContext.java (100%)
rename {kernel-d-message => kernel-s-message}/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/exception/MessageException.java (100%)
rename {kernel-d-message => kernel-s-message}/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/exception/enums/MessageExceptionEnum.java (100%)
rename {kernel-d-message => kernel-s-message}/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageParam.java (95%)
create mode 100644 kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageResponse.java
rename {kernel-d-message => kernel-s-message}/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageSendParam.java (95%)
rename {kernel-d-message => kernel-s-message}/message-business/README.md (100%)
rename {kernel-d-message => kernel-s-message}/message-business/pom.xml (100%)
rename {kernel-d-message => kernel-s-message}/message-business/src/main/java/cn/stylefeng/roses/kernel/message/modular/manage/controller/SysMessageController.java (100%)
rename {kernel-d-message => kernel-s-message}/message-sdk-db/README.md (100%)
rename {kernel-d-message => kernel-s-message}/message-sdk-db/pom.xml (100%)
create mode 100644 kernel-s-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/MessageDbServiceImpl.java
rename {kernel-d-message => kernel-s-message}/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/entity/SysMessage.java (100%)
rename {kernel-d-message => kernel-s-message}/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/mapper/SysMessageMapper.java (100%)
rename {kernel-d-message => kernel-s-message}/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/mapper/mapping/SysMessageMapper.xml (100%)
rename {kernel-d-message => kernel-s-message}/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/service/SysMessageService.java (100%)
rename {kernel-d-message => kernel-s-message}/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/service/impl/SysMessageServiceImpl.java (100%)
rename {kernel-d-message => kernel-s-message}/message-spring-boot-starter/README.md (100%)
rename {kernel-d-message => kernel-s-message}/message-spring-boot-starter/pom.xml (100%)
rename {kernel-d-message => kernel-s-message}/message-spring-boot-starter/src/main/java/cn/stylefeng/roses/kernel/message/starter/GunsMessageAutoConfiguration.java (100%)
rename {kernel-d-message => kernel-s-message}/message-spring-boot-starter/src/main/resources/META-INF/spring.factories (100%)
rename {kernel-d-message => kernel-s-message}/pom.xml (95%)
diff --git a/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/MessageApi.java b/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/MessageApi.java
deleted file mode 100644
index 96109ddd5..000000000
--- a/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/MessageApi.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package cn.stylefeng.roses.kernel.message.api;
-
-/**
- * 系统消息相关接口
- *
- * 接口可以有多种实现,目前只实现数据库存储方式
- *
- * @author liuhanqing
- * @date 2021/1/1 20:21
- */
-public interface MessageApi {
-
-
-}
\ No newline at end of file
diff --git a/kernel-d-message/README.md b/kernel-s-message/README.md
similarity index 100%
rename from kernel-d-message/README.md
rename to kernel-s-message/README.md
diff --git a/kernel-d-message/message-api/README.md b/kernel-s-message/message-api/README.md
similarity index 100%
rename from kernel-d-message/message-api/README.md
rename to kernel-s-message/message-api/README.md
diff --git a/kernel-d-message/message-api/pom.xml b/kernel-s-message/message-api/pom.xml
similarity index 100%
rename from kernel-d-message/message-api/pom.xml
rename to kernel-s-message/message-api/pom.xml
diff --git a/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/MessageApi.java b/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/MessageApi.java
new file mode 100644
index 000000000..3687e057f
--- /dev/null
+++ b/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/MessageApi.java
@@ -0,0 +1,87 @@
+package cn.stylefeng.roses.kernel.message.api;
+
+import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
+import cn.stylefeng.roses.kernel.message.api.pojo.MessageResponse;
+import cn.stylefeng.roses.kernel.message.api.pojo.MessageSendParam;
+import cn.stylefeng.roses.kernel.message.api.pojo.MessageParam;
+
+
+import java.util.List;
+
+/**
+ * 系统消息相关接口
+ *
+ * 接口可以有多种实现,目前只实现数据库存储方式
+ *
+ * @author liuhanqing
+ * @date 2021/1/2 21:21
+ */
+public interface MessageApi {
+
+ /**
+ * 发送系统消息
+ *
+ * @param messageSendParam 系统消息参数
+ * @author liuhanqing
+ * @date 2021/1/2 21:21
+ */
+ void sendMessage(MessageSendParam messageSendParam);
+
+ /**
+ * 更新阅读状态
+ *
+ * @param messageParam 系统消息参数
+ * @author liuhanqing
+ * @date 2021/1/2 22:15
+ */
+ void updateReadFlag(MessageParam messageParam);
+
+ /**
+ * 删除系统消息
+ *
+ * @param messageId 消息id
+ * @author liuhanqing
+ * @date 2021/1/2 21:21
+ */
+ void deleteByMessageId(Long messageId);
+
+ /**
+ * 批量删除系统消息
+ *
+ * @param messageIds 消息id字符串,多个用逗号分隔
+ * @author liuhanqing
+ * @date 2021/1/2 21:21
+ */
+ void batchDeleteByMessageId(String messageIds);
+
+ /**
+ * 查看系统消息
+ *
+ * @param messageParam 查看参数
+ * @return 系统消息
+ * @author liuhanqing
+ * @date 2021/1/2 21:21
+ */
+ MessageResponse messageDetail(MessageParam messageParam);
+
+ /**
+ * 查询系统消息
+ *
+ * @param messageParam 查询参数
+ * @return 查询分页结果
+ * @author liuhanqing
+ * @date 2021/1/2 21:21
+ */
+ PageResult queryMessagePage(MessageParam messageParam);
+
+ /**
+ * 查询系统消息
+ *
+ * @param messageParam 查询参数
+ * @return 系统消息列表
+ * @author liuhanqing
+ * @date 2021/1/2 21:21
+ */
+ List queryMessageList(MessageParam messageParam);
+
+}
\ No newline at end of file
diff --git a/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/constants/MessageConstants.java b/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/constants/MessageConstants.java
similarity index 100%
rename from kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/constants/MessageConstants.java
rename to kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/constants/MessageConstants.java
diff --git a/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/context/MessageContext.java b/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/context/MessageContext.java
similarity index 100%
rename from kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/context/MessageContext.java
rename to kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/context/MessageContext.java
diff --git a/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/exception/MessageException.java b/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/exception/MessageException.java
similarity index 100%
rename from kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/exception/MessageException.java
rename to kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/exception/MessageException.java
diff --git a/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/exception/enums/MessageExceptionEnum.java b/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/exception/enums/MessageExceptionEnum.java
similarity index 100%
rename from kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/exception/enums/MessageExceptionEnum.java
rename to kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/exception/enums/MessageExceptionEnum.java
diff --git a/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageParam.java b/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageParam.java
similarity index 95%
rename from kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageParam.java
rename to kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageParam.java
index 8d28ea806..60d62f4d1 100644
--- a/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageParam.java
+++ b/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageParam.java
@@ -1,4 +1,4 @@
-package cn.stylefeng.roses.kernel.message.api.pojo.manage;
+package cn.stylefeng.roses.kernel.message.api.pojo;
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
import lombok.Data;
diff --git a/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageResponse.java b/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageResponse.java
new file mode 100644
index 000000000..2d6c01f2d
--- /dev/null
+++ b/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageResponse.java
@@ -0,0 +1,67 @@
+package cn.stylefeng.roses.kernel.message.api.pojo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 系统消息的查询参数
+ *
+ * @author liuhanqing
+ * @date 2021/1/2 21:23
+ */
+@Data
+public class MessageResponse implements Serializable {
+
+ /**
+ * 消息id
+ */
+ private Long messageId;
+
+ /**
+ * 接收用户id
+ */
+ private Long receiveUserId;
+
+ /**
+ * 发送用户id
+ */
+ private Long sendUserId;
+
+ /**
+ * 消息标题
+ */
+ private String messageTitle;
+
+ /**
+ * 消息的内容
+ */
+ private String messageContent;
+
+ /**
+ * 消息类型
+ */
+ private String messageType;
+
+ /**
+ * 消息发送时间
+ */
+ private Date messageSendTime;
+
+ /**
+ * 业务id
+ */
+ private Long businessId;
+
+ /**
+ * 业务类型
+ */
+ private String businessType;
+
+ /**
+ * 阅读状态:0-未读,1-已读
+ */
+ private Integer readFlag;
+
+}
diff --git a/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageSendParam.java b/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageSendParam.java
similarity index 95%
rename from kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageSendParam.java
rename to kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageSendParam.java
index 6a9b334bf..a044b4320 100644
--- a/kernel-d-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageSendParam.java
+++ b/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageSendParam.java
@@ -1,4 +1,4 @@
-package cn.stylefeng.roses.kernel.message.api.pojo.manage;
+package cn.stylefeng.roses.kernel.message.api.pojo;
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
import lombok.Data;
diff --git a/kernel-d-message/message-business/README.md b/kernel-s-message/message-business/README.md
similarity index 100%
rename from kernel-d-message/message-business/README.md
rename to kernel-s-message/message-business/README.md
diff --git a/kernel-d-message/message-business/pom.xml b/kernel-s-message/message-business/pom.xml
similarity index 100%
rename from kernel-d-message/message-business/pom.xml
rename to kernel-s-message/message-business/pom.xml
diff --git a/kernel-d-message/message-business/src/main/java/cn/stylefeng/roses/kernel/message/modular/manage/controller/SysMessageController.java b/kernel-s-message/message-business/src/main/java/cn/stylefeng/roses/kernel/message/modular/manage/controller/SysMessageController.java
similarity index 100%
rename from kernel-d-message/message-business/src/main/java/cn/stylefeng/roses/kernel/message/modular/manage/controller/SysMessageController.java
rename to kernel-s-message/message-business/src/main/java/cn/stylefeng/roses/kernel/message/modular/manage/controller/SysMessageController.java
diff --git a/kernel-d-message/message-sdk-db/README.md b/kernel-s-message/message-sdk-db/README.md
similarity index 100%
rename from kernel-d-message/message-sdk-db/README.md
rename to kernel-s-message/message-sdk-db/README.md
diff --git a/kernel-d-message/message-sdk-db/pom.xml b/kernel-s-message/message-sdk-db/pom.xml
similarity index 100%
rename from kernel-d-message/message-sdk-db/pom.xml
rename to kernel-s-message/message-sdk-db/pom.xml
diff --git a/kernel-s-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/MessageDbServiceImpl.java b/kernel-s-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/MessageDbServiceImpl.java
new file mode 100644
index 000000000..380e501fc
--- /dev/null
+++ b/kernel-s-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/MessageDbServiceImpl.java
@@ -0,0 +1,63 @@
+package cn.stylefeng.roses.kernel.message.db;
+
+import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
+import cn.stylefeng.roses.kernel.message.api.MessageApi;
+import cn.stylefeng.roses.kernel.message.api.constants.MessageConstants;
+import cn.stylefeng.roses.kernel.message.api.pojo.MessageParam;
+import cn.stylefeng.roses.kernel.message.api.pojo.MessageResponse;
+import cn.stylefeng.roses.kernel.message.api.pojo.MessageSendParam;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 系统消息,数据库实现
+ *
+ * @author liuhanqing
+ * @date 2021/1/2 22:00
+ */
+@Slf4j
+@Service
+public class MessageDbServiceImpl implements MessageApi {
+
+ @Override
+ public void sendMessage(MessageSendParam messageSendParam) {
+ String receiveUserIds = messageSendParam.getReceiveUserIds();
+ // 发送所有人判断
+ if (MessageConstants.RECEIVE_ALL_USER_FLAG.equals(receiveUserIds)) {
+
+ }
+
+ }
+
+ @Override
+ public void updateReadFlag(MessageParam messageParam) {
+
+ }
+
+ @Override
+ public void deleteByMessageId(Long messageId) {
+
+ }
+
+ @Override
+ public void batchDeleteByMessageId(String messageIds) {
+
+ }
+
+ @Override
+ public MessageResponse messageDetail(MessageParam messageParam) {
+ return null;
+ }
+
+ @Override
+ public PageResult queryMessagePage(MessageParam messageParam) {
+ return null;
+ }
+
+ @Override
+ public List queryMessageList(MessageParam messageParam) {
+ return null;
+ }
+}
diff --git a/kernel-d-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/entity/SysMessage.java b/kernel-s-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/entity/SysMessage.java
similarity index 100%
rename from kernel-d-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/entity/SysMessage.java
rename to kernel-s-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/entity/SysMessage.java
diff --git a/kernel-d-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/mapper/SysMessageMapper.java b/kernel-s-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/mapper/SysMessageMapper.java
similarity index 100%
rename from kernel-d-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/mapper/SysMessageMapper.java
rename to kernel-s-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/mapper/SysMessageMapper.java
diff --git a/kernel-d-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/mapper/mapping/SysMessageMapper.xml b/kernel-s-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/mapper/mapping/SysMessageMapper.xml
similarity index 100%
rename from kernel-d-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/mapper/mapping/SysMessageMapper.xml
rename to kernel-s-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/mapper/mapping/SysMessageMapper.xml
diff --git a/kernel-d-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/service/SysMessageService.java b/kernel-s-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/service/SysMessageService.java
similarity index 100%
rename from kernel-d-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/service/SysMessageService.java
rename to kernel-s-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/service/SysMessageService.java
diff --git a/kernel-d-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/service/impl/SysMessageServiceImpl.java b/kernel-s-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/service/impl/SysMessageServiceImpl.java
similarity index 100%
rename from kernel-d-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/service/impl/SysMessageServiceImpl.java
rename to kernel-s-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/service/impl/SysMessageServiceImpl.java
diff --git a/kernel-d-message/message-spring-boot-starter/README.md b/kernel-s-message/message-spring-boot-starter/README.md
similarity index 100%
rename from kernel-d-message/message-spring-boot-starter/README.md
rename to kernel-s-message/message-spring-boot-starter/README.md
diff --git a/kernel-d-message/message-spring-boot-starter/pom.xml b/kernel-s-message/message-spring-boot-starter/pom.xml
similarity index 100%
rename from kernel-d-message/message-spring-boot-starter/pom.xml
rename to kernel-s-message/message-spring-boot-starter/pom.xml
diff --git a/kernel-d-message/message-spring-boot-starter/src/main/java/cn/stylefeng/roses/kernel/message/starter/GunsMessageAutoConfiguration.java b/kernel-s-message/message-spring-boot-starter/src/main/java/cn/stylefeng/roses/kernel/message/starter/GunsMessageAutoConfiguration.java
similarity index 100%
rename from kernel-d-message/message-spring-boot-starter/src/main/java/cn/stylefeng/roses/kernel/message/starter/GunsMessageAutoConfiguration.java
rename to kernel-s-message/message-spring-boot-starter/src/main/java/cn/stylefeng/roses/kernel/message/starter/GunsMessageAutoConfiguration.java
diff --git a/kernel-d-message/message-spring-boot-starter/src/main/resources/META-INF/spring.factories b/kernel-s-message/message-spring-boot-starter/src/main/resources/META-INF/spring.factories
similarity index 100%
rename from kernel-d-message/message-spring-boot-starter/src/main/resources/META-INF/spring.factories
rename to kernel-s-message/message-spring-boot-starter/src/main/resources/META-INF/spring.factories
diff --git a/kernel-d-message/pom.xml b/kernel-s-message/pom.xml
similarity index 95%
rename from kernel-d-message/pom.xml
rename to kernel-s-message/pom.xml
index 9429be1b9..728ea6b52 100644
--- a/kernel-d-message/pom.xml
+++ b/kernel-s-message/pom.xml
@@ -11,7 +11,7 @@
../pom.xml
- kernel-d-message
+ kernel-s-message
pom
diff --git a/pom.xml b/pom.xml
index a9d5a5486..1c04eed85 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,7 +74,7 @@
kernel-s-dict
- kernel-d-message
+ kernel-s-message
kernel-s-system
From 6a9c28487fdc1f710d0d90bc8e496903805131c1 Mon Sep 17 00:00:00 2001
From: liuhanqing <447067298@qq.com>
Date: Mon, 4 Jan 2021 23:24:39 +0800
Subject: [PATCH 03/10] =?UTF-8?q?=E3=80=90message=E3=80=91=E7=B3=BB?=
=?UTF-8?q?=E7=BB=9F=E6=B6=88=E6=81=AF=E6=A8=A1=E5=9D=97=E5=BC=80=E5=8F=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
kernel-s-message/message-api/pom.xml | 2 +-
.../roses/kernel/message/api/MessageApi.java | 11 ++-
.../api/constants/MessageConstants.java | 2 +-
.../api/enums/MessageReadFlagEnum.java | 33 ++++++++
.../kernel/message/api/pojo/MessageParam.java | 5 ++
.../message/api/pojo/MessageResponse.java | 5 ++
.../message/api/pojo/MessageSendParam.java | 5 ++
kernel-s-message/message-sdk-db/pom.xml | 8 +-
.../message/db/MessageDbServiceImpl.java | 56 ++++++++++++-
.../kernel/message/db/entity/SysMessage.java | 6 ++
.../message-spring-boot-starter/pom.xml | 2 +-
.../roses/kernel/system/UserServiceApi.java | 35 ++++++++
.../kernel/system/pojo/user/SysUserDTO.java | 81 +++++++++++++++++++
.../pojo/user}/request/SysUserRequest.java | 2 +-
.../user/controller/SysUserController.java | 2 +-
.../user/factory/SysUserCreateFactory.java | 2 +-
.../modular/user/mapper/SysUserMapper.java | 2 +-
.../user/service/SysUserDataScopeService.java | 2 +-
.../user/service/SysUserRoleService.java | 2 +-
.../modular/user/service/SysUserService.java | 2 +-
.../impl/SysUserDataScopeServiceImpl.java | 2 +-
.../service/impl/SysUserRoleServiceImpl.java | 2 +-
.../user/service/impl/SysUserServiceImpl.java | 56 ++++++++++++-
23 files changed, 308 insertions(+), 17 deletions(-)
create mode 100644 kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/enums/MessageReadFlagEnum.java
create mode 100644 kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/system/pojo/user/SysUserDTO.java
rename kernel-s-system/{system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/pojo => system-api/src/main/java/cn/stylefeng/roses/kernel/system/pojo/user}/request/SysUserRequest.java (98%)
diff --git a/kernel-s-message/message-api/pom.xml b/kernel-s-message/message-api/pom.xml
index 17ac09d84..33e993129 100644
--- a/kernel-s-message/message-api/pom.xml
+++ b/kernel-s-message/message-api/pom.xml
@@ -6,7 +6,7 @@
cn.stylefeng.roses
- kernel-d-message
+ kernel-s-message
1.0.0
../pom.xml
diff --git a/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/MessageApi.java b/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/MessageApi.java
index 3687e057f..449792c94 100644
--- a/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/MessageApi.java
+++ b/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/MessageApi.java
@@ -1,6 +1,7 @@
package cn.stylefeng.roses.kernel.message.api;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
+import cn.stylefeng.roses.kernel.message.api.enums.MessageReadFlagEnum;
import cn.stylefeng.roses.kernel.message.api.pojo.MessageResponse;
import cn.stylefeng.roses.kernel.message.api.pojo.MessageSendParam;
import cn.stylefeng.roses.kernel.message.api.pojo.MessageParam;
@@ -36,6 +37,14 @@ public interface MessageApi {
*/
void updateReadFlag(MessageParam messageParam);
+ /**
+ * 批量更新阅读状态
+ *
+ * @param messageIds 消息id字符串,多个用逗号分隔
+ * @author liuhanqing
+ * @date 2021/1/4 21:21
+ */
+ void batchReadFlagByMessageIds(String messageIds, MessageReadFlagEnum flagEnum);
/**
* 删除系统消息
*
@@ -52,7 +61,7 @@ public interface MessageApi {
* @author liuhanqing
* @date 2021/1/2 21:21
*/
- void batchDeleteByMessageId(String messageIds);
+ void batchDeleteByMessageIds(String messageIds);
/**
* 查看系统消息
diff --git a/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/constants/MessageConstants.java b/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/constants/MessageConstants.java
index c61294c5e..4957afc24 100644
--- a/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/constants/MessageConstants.java
+++ b/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/constants/MessageConstants.java
@@ -11,7 +11,7 @@ public interface MessageConstants {
/**
* 消息模块的名称
*/
- String MESSAGE_MODULE_NAME = "kernel-d-message";
+ String MESSAGE_MODULE_NAME = "kernel-s-message";
/**
* 异常枚举的步进值
diff --git a/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/enums/MessageReadFlagEnum.java b/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/enums/MessageReadFlagEnum.java
new file mode 100644
index 000000000..ef2d7c12a
--- /dev/null
+++ b/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/enums/MessageReadFlagEnum.java
@@ -0,0 +1,33 @@
+package cn.stylefeng.roses.kernel.message.api.enums;
+
+import lombok.Getter;
+
+/**
+ * 消息阅读状态
+ *
+ * @author liuhanqing
+ * @date 2021/1/4 22:26
+ */
+@Getter
+public enum MessageReadFlagEnum {
+
+ /**
+ * 未读
+ */
+ UNREAD(0, "未读"),
+
+ /**
+ * 已读
+ */
+ READ(1, "已读");
+
+ private final Integer code;
+
+ private final String name;
+
+ MessageReadFlagEnum(Integer code, String name) {
+ this.code = code;
+ this.name = name;
+ }
+
+}
diff --git a/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageParam.java b/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageParam.java
index 60d62f4d1..11c0d93f9 100644
--- a/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageParam.java
+++ b/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageParam.java
@@ -48,6 +48,11 @@ public class MessageParam extends BaseRequest {
*/
private String messageType;
+ /**
+ * 消息优先级
+ */
+ private String priorityLevel;
+
/**
* 消息发送时间
*/
diff --git a/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageResponse.java b/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageResponse.java
index 2d6c01f2d..795470203 100644
--- a/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageResponse.java
+++ b/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageResponse.java
@@ -39,6 +39,11 @@ public class MessageResponse implements Serializable {
*/
private String messageContent;
+ /**
+ * 消息优先级
+ */
+ private String priorityLevel;
+
/**
* 消息类型
*/
diff --git a/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageSendParam.java b/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageSendParam.java
index a044b4320..36e5dd642 100644
--- a/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageSendParam.java
+++ b/kernel-s-message/message-api/src/main/java/cn/stylefeng/roses/kernel/message/api/pojo/MessageSendParam.java
@@ -38,6 +38,11 @@ public class MessageSendParam extends BaseRequest {
*/
private String messageType;
+ /**
+ * 消息优先级
+ */
+ private String priorityLevel;
+
/**
* 业务id
*/
diff --git a/kernel-s-message/message-sdk-db/pom.xml b/kernel-s-message/message-sdk-db/pom.xml
index b12b29801..0b8c4ebf3 100644
--- a/kernel-s-message/message-sdk-db/pom.xml
+++ b/kernel-s-message/message-sdk-db/pom.xml
@@ -6,7 +6,7 @@
cn.stylefeng.roses
- kernel-d-message
+ kernel-s-message
1.0.0
../pom.xml
@@ -30,6 +30,12 @@
db-sdk-mp
1.0.0
+
+
+ cn.stylefeng.roses
+ system-api
+ 1.0.0
+
diff --git a/kernel-s-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/MessageDbServiceImpl.java b/kernel-s-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/MessageDbServiceImpl.java
index 380e501fc..fd3dbbdd3 100644
--- a/kernel-s-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/MessageDbServiceImpl.java
+++ b/kernel-s-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/MessageDbServiceImpl.java
@@ -1,15 +1,27 @@
package cn.stylefeng.roses.kernel.message.db;
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.convert.Convert;
+import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
+import cn.stylefeng.roses.kernel.auth.api.pojo.login.LoginUser;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.message.api.MessageApi;
import cn.stylefeng.roses.kernel.message.api.constants.MessageConstants;
+import cn.stylefeng.roses.kernel.message.api.enums.MessageReadFlagEnum;
+import cn.stylefeng.roses.kernel.message.api.exception.enums.MessageExceptionEnum;
import cn.stylefeng.roses.kernel.message.api.pojo.MessageParam;
import cn.stylefeng.roses.kernel.message.api.pojo.MessageResponse;
import cn.stylefeng.roses.kernel.message.api.pojo.MessageSendParam;
+import cn.stylefeng.roses.kernel.message.db.entity.SysMessage;
+import cn.stylefeng.roses.kernel.message.db.service.SysMessageService;
+import cn.stylefeng.roses.kernel.system.UserServiceApi;
+import cn.stylefeng.roses.kernel.system.exception.SystemModularException;
+import cn.stylefeng.roses.kernel.system.pojo.user.request.SysUserRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
-import java.util.List;
+import javax.annotation.Resource;
+import java.util.*;
/**
* 系统消息,数据库实现
@@ -21,13 +33,48 @@ import java.util.List;
@Service
public class MessageDbServiceImpl implements MessageApi {
+
+ @Resource
+ private UserServiceApi userServiceApi;
+
+ @Resource
+ private SysMessageService sysMessageService;
+
@Override
public void sendMessage(MessageSendParam messageSendParam) {
String receiveUserIds = messageSendParam.getReceiveUserIds();
+ // 获取当前登录人
+ LoginUser loginUser = LoginContext.me().getLoginUser();
+ List sendMsgList = new ArrayList<>();
+ List userIds = new ArrayList<>();
// 发送所有人判断
if (MessageConstants.RECEIVE_ALL_USER_FLAG.equals(receiveUserIds)) {
+ // 查询所有用户
+ userIds = userServiceApi.queryAllUserIdList(new SysUserRequest());
+ } else {
+ String[] userIdArr = receiveUserIds.split(",");
+ userIds = Convert.toList(Long.class, userIdArr);
}
+ if (userIds == null || userIds.isEmpty()) {
+ throw new SystemModularException(MessageExceptionEnum.ERROR_RECEIVE_USER_IDS, receiveUserIds);
+ }
+
+ Set userIdSet = new HashSet<>(userIds);
+ SysMessage sysMessage = new SysMessage();
+ BeanUtil.copyProperties(messageSendParam, sysMessage);
+ // 初始化默认值
+ sysMessage.setReadFlag(MessageReadFlagEnum.UNREAD.getCode());
+ sysMessage.setSendUserId(loginUser.getUserId());
+ sysMessage.setMessageSendTime(new Date());
+ userIdSet.forEach(userId -> {
+ // 判断用户是否存在
+ if(userServiceApi.userExist(userId)){
+ sysMessage.setReceiveUserId(userId);
+ sendMsgList.add(sysMessage);
+ }
+ });
+ sysMessageService.saveBatch(sendMsgList);
}
@@ -36,13 +83,18 @@ public class MessageDbServiceImpl implements MessageApi {
}
+ @Override
+ public void batchReadFlagByMessageIds(String messageIds, MessageReadFlagEnum flagEnum) {
+
+ }
+
@Override
public void deleteByMessageId(Long messageId) {
}
@Override
- public void batchDeleteByMessageId(String messageIds) {
+ public void batchDeleteByMessageIds(String messageIds) {
}
diff --git a/kernel-s-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/entity/SysMessage.java b/kernel-s-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/entity/SysMessage.java
index 0f39b4a9b..a4da591ae 100644
--- a/kernel-s-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/entity/SysMessage.java
+++ b/kernel-s-message/message-sdk-db/src/main/java/cn/stylefeng/roses/kernel/message/db/entity/SysMessage.java
@@ -54,6 +54,12 @@ public class SysMessage extends BaseEntity {
@TableField(value = "message_type")
private String messageType;
+ /**
+ * 消息优先级
+ */
+ @TableField(value = "priority_level")
+ private String priorityLevel;
+
/**
* 消息发送时间
*/
diff --git a/kernel-s-message/message-spring-boot-starter/pom.xml b/kernel-s-message/message-spring-boot-starter/pom.xml
index cf61944ed..8ac9a1d90 100644
--- a/kernel-s-message/message-spring-boot-starter/pom.xml
+++ b/kernel-s-message/message-spring-boot-starter/pom.xml
@@ -6,7 +6,7 @@
cn.stylefeng.roses
- kernel-d-message
+ kernel-s-message
1.0.0
../pom.xml
diff --git a/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/system/UserServiceApi.java b/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/system/UserServiceApi.java
index ea878834b..1ffdc89e8 100644
--- a/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/system/UserServiceApi.java
+++ b/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/system/UserServiceApi.java
@@ -1,6 +1,8 @@
package cn.stylefeng.roses.kernel.system;
+import cn.stylefeng.roses.kernel.system.pojo.user.SysUserDTO;
import cn.stylefeng.roses.kernel.system.pojo.user.UserLoginInfoDTO;
+import cn.stylefeng.roses.kernel.system.pojo.user.request.SysUserRequest;
import java.util.Date;
import java.util.List;
@@ -73,4 +75,37 @@ public interface UserServiceApi {
*/
List getUserBindDataScope(Long userId);
+ /**
+ * 查询全部用户ID(剔除管理员,和不允许登录)
+ *
+ * @param sysUserRequest 查询参数
+ * @return List 用户id 集合
+ * @author liuhanqing
+ * @date 2021/1/4 22:09
+ */
+ List queryAllUserIdList(SysUserRequest sysUserRequest);
+
+
+
+ /**
+ * 获取用户信息
+ *
+ * @param userId 用户id
+ * @return 用户信息
+ * @author liuhanqing
+ * @date 2021/1/4 22:09
+ */
+ SysUserDTO getUserInfo(Long userId);
+
+
+ /**
+ * 根据用户id 判断用户是否存在
+ *
+ * @param userId 用户id
+ * @return 用户信息
+ * @author liuhanqing
+ * @date 2021/1/4 22:55
+ */
+ Boolean userExist(Long userId);
+
}
diff --git a/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/system/pojo/user/SysUserDTO.java b/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/system/pojo/user/SysUserDTO.java
new file mode 100644
index 000000000..33e04cc77
--- /dev/null
+++ b/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/system/pojo/user/SysUserDTO.java
@@ -0,0 +1,81 @@
+package cn.stylefeng.roses.kernel.system.pojo.user;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 系统用户结果
+ *
+ * @author fengshuonan
+ * @date 2020/4/2 9:19
+ */
+@Data
+public class SysUserDTO {
+
+ /**
+ * 主键
+ */
+ private Long userId;
+
+ /**
+ * 账号
+ */
+ private String account;
+
+ /**
+ * 昵称
+ */
+ private String nickName;
+
+ /**
+ * 姓名
+ */
+ private String realName;
+
+ /**
+ * 头像
+ */
+ private Long avatar;
+
+ /**
+ * 生日
+ */
+ private Date birthday;
+
+ /**
+ * 性别(M-男,F-女)
+ */
+ private String sex;
+
+ /**
+ * 邮箱
+ */
+ private String email;
+
+ /**
+ * 手机
+ */
+ private String phone;
+
+ /**
+ * 电话
+ */
+ private String tel;
+
+ /**
+ * 用户所属机构
+ */
+ private Long orgId;
+
+ /**
+ * 用户所属机构的职务
+ */
+ private Long positionId;
+
+ /**
+ * 状态
+ */
+ private Integer statusFlag;
+
+}
diff --git a/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/pojo/request/SysUserRequest.java b/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/system/pojo/user/request/SysUserRequest.java
similarity index 98%
rename from kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/pojo/request/SysUserRequest.java
rename to kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/system/pojo/user/request/SysUserRequest.java
index c347ed54e..a2a5e885d 100644
--- a/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/pojo/request/SysUserRequest.java
+++ b/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/system/pojo/user/request/SysUserRequest.java
@@ -1,4 +1,4 @@
-package cn.stylefeng.roses.kernel.system.modular.user.pojo.request;
+package cn.stylefeng.roses.kernel.system.pojo.user.request;
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
import cn.stylefeng.roses.kernel.validator.validators.date.DateValue;
diff --git a/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/controller/SysUserController.java b/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/controller/SysUserController.java
index e6c55e5c5..763c34fa4 100644
--- a/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/controller/SysUserController.java
+++ b/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/controller/SysUserController.java
@@ -8,7 +8,7 @@ import cn.stylefeng.roses.kernel.resource.api.annotation.PostResource;
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
-import cn.stylefeng.roses.kernel.system.modular.user.pojo.request.SysUserRequest;
+import cn.stylefeng.roses.kernel.system.pojo.user.request.SysUserRequest;
import cn.stylefeng.roses.kernel.system.modular.user.service.SysUserRoleService;
import cn.stylefeng.roses.kernel.system.modular.user.service.SysUserService;
import org.springframework.validation.annotation.Validated;
diff --git a/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/factory/SysUserCreateFactory.java b/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/factory/SysUserCreateFactory.java
index 068a5e12f..998782767 100644
--- a/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/factory/SysUserCreateFactory.java
+++ b/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/factory/SysUserCreateFactory.java
@@ -9,7 +9,7 @@ import cn.stylefeng.roses.kernel.rule.enums.SexEnum;
import cn.stylefeng.roses.kernel.rule.enums.YesOrNotEnum;
import cn.stylefeng.roses.kernel.system.enums.UserStatusEnum;
import cn.stylefeng.roses.kernel.system.modular.user.entity.SysUser;
-import cn.stylefeng.roses.kernel.system.modular.user.pojo.request.SysUserRequest;
+import cn.stylefeng.roses.kernel.system.pojo.user.request.SysUserRequest;
/**
* 用户信息填充,用于创建和修改用户时,添加一些基础信息
diff --git a/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/mapper/SysUserMapper.java b/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/mapper/SysUserMapper.java
index b963fb854..af9e93af2 100644
--- a/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/mapper/SysUserMapper.java
+++ b/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/mapper/SysUserMapper.java
@@ -3,7 +3,7 @@ package cn.stylefeng.roses.kernel.system.modular.user.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import cn.stylefeng.roses.kernel.system.modular.user.entity.SysUser;
-import cn.stylefeng.roses.kernel.system.modular.user.pojo.request.SysUserRequest;
+import cn.stylefeng.roses.kernel.system.pojo.user.request.SysUserRequest;
import cn.stylefeng.roses.kernel.system.modular.user.pojo.response.SysUserResponse;
import org.apache.ibatis.annotations.Param;
diff --git a/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/SysUserDataScopeService.java b/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/SysUserDataScopeService.java
index 9080566f2..d8d94ce20 100644
--- a/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/SysUserDataScopeService.java
+++ b/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/SysUserDataScopeService.java
@@ -1,7 +1,7 @@
package cn.stylefeng.roses.kernel.system.modular.user.service;
import cn.stylefeng.roses.kernel.system.modular.user.entity.SysUserDataScope;
-import cn.stylefeng.roses.kernel.system.modular.user.pojo.request.SysUserRequest;
+import cn.stylefeng.roses.kernel.system.pojo.user.request.SysUserRequest;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
diff --git a/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/SysUserRoleService.java b/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/SysUserRoleService.java
index 3a6635dde..c0f2552cc 100644
--- a/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/SysUserRoleService.java
+++ b/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/SysUserRoleService.java
@@ -1,7 +1,7 @@
package cn.stylefeng.roses.kernel.system.modular.user.service;
import cn.stylefeng.roses.kernel.system.modular.user.entity.SysUserRole;
-import cn.stylefeng.roses.kernel.system.modular.user.pojo.request.SysUserRequest;
+import cn.stylefeng.roses.kernel.system.pojo.user.request.SysUserRequest;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
diff --git a/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/SysUserService.java b/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/SysUserService.java
index f3495d7d3..d4fd6c569 100644
--- a/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/SysUserService.java
+++ b/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/SysUserService.java
@@ -4,7 +4,7 @@ import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.rule.pojo.dict.SimpleDict;
import cn.stylefeng.roses.kernel.system.UserServiceApi;
import cn.stylefeng.roses.kernel.system.modular.user.entity.SysUser;
-import cn.stylefeng.roses.kernel.system.modular.user.pojo.request.SysUserRequest;
+import cn.stylefeng.roses.kernel.system.pojo.user.request.SysUserRequest;
import cn.stylefeng.roses.kernel.system.modular.user.pojo.response.SysUserResponse;
import com.baomidou.mybatisplus.extension.service.IService;
diff --git a/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/impl/SysUserDataScopeServiceImpl.java b/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/impl/SysUserDataScopeServiceImpl.java
index 5c544c363..f62493b0d 100644
--- a/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/impl/SysUserDataScopeServiceImpl.java
+++ b/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/impl/SysUserDataScopeServiceImpl.java
@@ -2,7 +2,7 @@ package cn.stylefeng.roses.kernel.system.modular.user.service.impl;
import cn.stylefeng.roses.kernel.system.modular.user.entity.SysUserDataScope;
import cn.stylefeng.roses.kernel.system.modular.user.mapper.SysUserDataScopeMapper;
-import cn.stylefeng.roses.kernel.system.modular.user.pojo.request.SysUserRequest;
+import cn.stylefeng.roses.kernel.system.pojo.user.request.SysUserRequest;
import cn.stylefeng.roses.kernel.system.modular.user.service.SysUserDataScopeService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
diff --git a/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/impl/SysUserRoleServiceImpl.java b/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/impl/SysUserRoleServiceImpl.java
index e4c025cdf..25e8bbc00 100644
--- a/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/impl/SysUserRoleServiceImpl.java
+++ b/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/impl/SysUserRoleServiceImpl.java
@@ -4,7 +4,7 @@ import cn.stylefeng.roses.kernel.system.exception.SystemModularException;
import cn.stylefeng.roses.kernel.system.exception.enums.SysUserExceptionEnum;
import cn.stylefeng.roses.kernel.system.modular.user.entity.SysUserRole;
import cn.stylefeng.roses.kernel.system.modular.user.mapper.SysUserRoleMapper;
-import cn.stylefeng.roses.kernel.system.modular.user.pojo.request.SysUserRequest;
+import cn.stylefeng.roses.kernel.system.pojo.user.request.SysUserRequest;
import cn.stylefeng.roses.kernel.system.modular.user.service.SysUserRoleService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
diff --git a/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/impl/SysUserServiceImpl.java b/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/impl/SysUserServiceImpl.java
index 4947dbb39..f471bf8fe 100644
--- a/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/impl/SysUserServiceImpl.java
+++ b/kernel-s-system/system-business-user/src/main/java/cn/stylefeng/roses/kernel/system/modular/user/service/impl/SysUserServiceImpl.java
@@ -26,7 +26,8 @@ import cn.stylefeng.roses.kernel.system.modular.user.entity.SysUserRole;
import cn.stylefeng.roses.kernel.system.modular.user.factory.SysUserCreateFactory;
import cn.stylefeng.roses.kernel.system.modular.user.factory.UserLoginInfoFactory;
import cn.stylefeng.roses.kernel.system.modular.user.mapper.SysUserMapper;
-import cn.stylefeng.roses.kernel.system.modular.user.pojo.request.SysUserRequest;
+import cn.stylefeng.roses.kernel.system.pojo.user.SysUserDTO;
+import cn.stylefeng.roses.kernel.system.pojo.user.request.SysUserRequest;
import cn.stylefeng.roses.kernel.system.modular.user.pojo.response.SysUserResponse;
import cn.stylefeng.roses.kernel.system.modular.user.service.SysUserDataScopeService;
import cn.stylefeng.roses.kernel.system.modular.user.service.SysUserOrgService;
@@ -52,6 +53,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Set;
+import java.util.function.Function;
import java.util.stream.Collectors;
/**
@@ -451,6 +453,58 @@ public class SysUserServiceImpl extends ServiceImpl impl
return sysUserDataScopeService.getUserDataScopeIdList(userId);
}
+
+ @Override
+ public List queryAllUserIdList(SysUserRequest sysUserRequest) {
+
+ LambdaQueryWrapper wrapper = createWrapper(sysUserRequest);
+
+ // 排除超级管理员
+ wrapper.ne(SysUser::getSuperAdminFlag, YesOrNotEnum.Y.getCode());
+
+ // 只查询id
+ wrapper.select(SysUser::getUserId);
+ // 查询全部用户ID
+ Function