diff --git a/ruoyi-models/pom.xml b/ruoyi-models/pom.xml
index b3e8690bf2026d737bbc7df6c7b60ca27f782d48..b5f59cec6c0303582c86c2c9d53c841b1dda8417 100644
--- a/ruoyi-models/pom.xml
+++ b/ruoyi-models/pom.xml
@@ -44,6 +44,27 @@
${ruoyi.version}
+
+
+ com.ruoyi
+ ruoyi-message
+ ${ruoyi.version}
+
+
+
+
+ com.ruoyi
+ ruoyi-tfa-phone
+ ${ruoyi.version}
+
+
+
+
+ com.ruoyi
+ ruoyi-tfa-email
+ ${ruoyi.version}
+
+
@@ -54,6 +75,7 @@
ruoyi-generator
ruoyi-quartz
ruoyi-online
+ ruoyi-message
pom
\ No newline at end of file
diff --git a/ruoyi-models/ruoyi-message/pom.xml b/ruoyi-models/ruoyi-message/pom.xml
new file mode 100644
index 0000000000000000000000000000000000000000..9e9b65e1199291c88079c5c78fe402c5a39842e5
--- /dev/null
+++ b/ruoyi-models/ruoyi-message/pom.xml
@@ -0,0 +1,45 @@
+
+
+
+ ruoyi-models
+ com.ruoyi
+ 3.8.8.3.1
+
+ 4.0.0
+
+ ruoyi-message
+
+
+ message消息模块
+
+
+
+
+
+
+ com.ruoyi
+ ruoyi-framework
+
+
+
+
+ com.ruoyi
+ ruoyi-common
+
+
+
+
+ com.ruoyi
+ ruoyi-tfa-phone
+
+
+
+
+ com.ruoyi
+ ruoyi-tfa-email
+
+
+
+
\ No newline at end of file
diff --git a/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/annotation/MessageLog.java b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/annotation/MessageLog.java
new file mode 100644
index 0000000000000000000000000000000000000000..71620f186564237cfbadf4781614da4e91aaaa61
--- /dev/null
+++ b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/annotation/MessageLog.java
@@ -0,0 +1,36 @@
+package com.ruoyi.modelMessage.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import com.ruoyi.modelMessage.enums.MessageType;
+
+
+//自定义消息系统注解
+@Target({ ElementType.PARAMETER, ElementType.METHOD })
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface MessageLog {
+ /**
+ * 消息操作的描述
+ */
+ String description() default "";
+
+ /**
+ * 消息标题
+ */
+ String title() default "";
+
+ /**
+ * 是否立即记录消息,默认为 true
+ */
+ boolean immediateLog() default true;
+
+ /**
+ * 操作类型
+ */
+ MessageType messageType() default MessageType.INFO;
+}
diff --git a/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/controller/MessageSystemController.java b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/controller/MessageSystemController.java
new file mode 100644
index 0000000000000000000000000000000000000000..63f281945f408694eddf90c2b67ee564eca19228
--- /dev/null
+++ b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/controller/MessageSystemController.java
@@ -0,0 +1,227 @@
+package com.ruoyi.modelMessage.controller;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.modelMessage.domain.MessageSystem;
+import com.ruoyi.modelMessage.domain.MessageTemplate;
+import com.ruoyi.modelMessage.domain.vo.SysUserVo;
+import com.ruoyi.modelMessage.service.IMessageSystemService;
+
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.servlet.http.HttpServletResponse;
+
+/**
+ * 消息管理Controller
+ *
+ * @author ruoyi
+ * @date 2024-12-21
+ */
+@RestController
+@RequestMapping("/modelMessage/messageSystem")
+@Tag(name = "【消息管理】管理")
+public class MessageSystemController extends BaseController
+{
+ @Autowired
+ private IMessageSystemService messageSystemService;
+
+ /**
+ * 查询消息管理列表
+ */
+ @Operation(summary = "查询消息管理列表")
+ //@PreAuthorize("@ss.hasPermi('modelMessage:messageSystem:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(MessageSystem messageSystem)
+ {
+ startPage();
+ messageSystem.setCreateBy(getUsername());
+ messageSystem.setMessageRecipient(getUsername());
+ List list = messageSystemService.selectMessageSystemList(messageSystem);
+ return getDataTable(list);
+ }
+
+ /**
+ * 导出消息管理列表
+ */
+ @Operation(summary = "导出消息管理列表")
+ @PreAuthorize("@ss.hasPermi('modelMessage:messageSystem:export')")
+ @Log(title = "消息管理", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, MessageSystem messageSystem)
+ {
+ List list = messageSystemService.selectMessageSystemList(messageSystem);
+ ExcelUtil util = new ExcelUtil(MessageSystem.class);
+ util.exportExcel(response, list, "消息管理数据");
+ }
+
+ /**
+ * 获取消息管理详细信息
+ */
+ @Operation(summary = "获取消息管理详细信息")
+ //@PreAuthorize("@ss.hasPermi('modelMessage:messageSystem:query')")
+ @GetMapping(value = "/{messageId}")
+ public AjaxResult getInfo(@PathVariable("messageId") Long messageId)
+ {
+ return success(messageSystemService.selectMessageSystemByMessageId(messageId));
+ }
+
+ /**
+ * 修改消息管理
+ */
+ @Operation(summary = "修改消息管理")
+ //@PreAuthorize("@ss.hasPermi('modelMessage:messageSystem:edit')")
+ @Log(title = "消息管理", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody MessageSystem messageSystem)
+ {
+ messageSystem.setUpdateBy(getUsername());
+ return toAjax(messageSystemService.updateMessageSystem(messageSystem));
+ }
+
+ /**
+ * 删除消息管理
+ */
+ @Operation(summary = "删除消息管理")
+ //@PreAuthorize("@ss.hasPermi('modelMessage:messageSystem:remove')")
+ @Log(title = "消息管理", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{messageIds}")
+ public AjaxResult remove(@PathVariable( name = "messageIds" ) Long[] messageIds)
+ {
+ return toAjax(messageSystemService.deleteMessageSystemByMessageIds(messageIds));
+ }
+
+ /**
+ * 批量发送消息
+ */
+ @Operation(summary = "发送消息")
+ @Log(title = "发送消息", businessType = BusinessType.INSERT)
+ @PostMapping
+ @Transactional
+ public AjaxResult batchAdd(@RequestBody List messageSystemList) {
+ try {
+ for (MessageSystem message : messageSystemList) {
+ messageSystemService.processMessageSystem(message);
+ }
+ if (messageSystemService.batchInsertMessageSystem(messageSystemList) <= 0) {
+ throw new ServiceException("消息发送失败!");
+ }
+ return AjaxResult.success("消息发送成功!");
+ } catch (Exception e) {
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+ return AjaxResult.error("消息发送失败!", e);
+ }
+ }
+
+ /**
+ * 用户点击标题之后已读信息
+ */
+ @Operation(summary = "用户点击标题调整信息状态")
+ @PostMapping("/{messageId}")
+ public AjaxResult update(@PathVariable Long messageId){
+ try{
+ int state= messageSystemService.updateState(messageId);
+ return success(state);
+ }catch(Exception e){
+ e.printStackTrace();
+ return error();
+ }
+ }
+
+ /**
+ * 查询平台用户 sendMode 进行过滤。
+ */
+ @Operation(summary = "查询平台用户")
+ @GetMapping("/selectUser")
+ public AjaxResult selectUser(@RequestParam(required = false) String sendMode) {
+ try {
+ List list;
+ if ("1".equals(sendMode)) { // 手机号
+ list = messageSystemService.getUsersFilteredBySendMode("phone");
+ } else if ("2".equals(sendMode)) { // 邮箱
+ list = messageSystemService.getUsersFilteredBySendMode("email");
+ } else {
+ list = messageSystemService.selectUser();
+ }
+ return AjaxResult.success(list);
+ } catch (ServiceException e) {
+ return AjaxResult.error(e.getMessage());
+ }
+ }
+
+ /**
+ * 查询角色信息
+ */
+ @Operation(summary = "查询角色")
+ @GetMapping("/selectRole")
+ public AjaxResult selectRole() {
+ return success(messageSystemService.selectRole());
+ }
+
+ /**
+ * 查询所有部门信息
+ */
+ @Operation(summary = "查询部门")
+ @GetMapping("/selectDept")
+ public AjaxResult selectDept() {
+ return success(messageSystemService.selectDept());
+ }
+
+ /**
+ * 根据角色ID获取所有符合条件的用户信息。
+ *
+ * @param roleId 角色ID
+ * @return 用户信息列表
+ */
+ @Operation(summary = "根据角色ID获取所有符合条件的用户信息")
+ @GetMapping("/getUsersByRole/{roleId}")
+ public R> selectUsersByRoleId(@PathVariable Long roleId) {
+ List users = messageSystemService.selectUsersByRoleId(roleId);
+ return R.ok(users);
+ }
+
+ /**
+ * 根据部门ID获取所有符合条件的用户信息。
+ *
+ * @param deptId 部门ID
+ * @return 用户信息列表
+ */
+ @Operation(summary = "根据部门ID获取所有符合条件的用户信息")
+ @GetMapping("/getUserNameByDeptId/{deptId}")
+ public R> getUserNameByDeptId(@PathVariable Long deptId) {
+ List depts= messageSystemService.getUserNameByDeptId(deptId);
+ return R.ok(depts);
+ }
+
+ /**
+ * 查询模版签名
+ * @return 模版信息列表
+ */
+ @Operation(summary = "查询模版签名")
+ @GetMapping("/selecTemplates")
+ public R selecTemplates() {
+ List templates= messageSystemService.selecTemplates();
+ return R.ok(templates);
+ }
+}
diff --git a/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/controller/MessageTemplateController.java b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/controller/MessageTemplateController.java
new file mode 100644
index 0000000000000000000000000000000000000000..5888d2b542ed2a1a5e46b28ecd896f50d579d78b
--- /dev/null
+++ b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/controller/MessageTemplateController.java
@@ -0,0 +1,116 @@
+package com.ruoyi.modelMessage.controller;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.modelMessage.domain.MessageTemplate;
+import com.ruoyi.modelMessage.service.IMessageTemplateService;
+
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.servlet.http.HttpServletResponse;
+
+/**
+ * 模版管理Controller
+ *
+ * @author ruoyi
+ * @date 2024-12-31
+ */
+@RestController
+@RequestMapping("/modelMessage/template")
+@Tag(name = "【模版管理】管理")
+public class MessageTemplateController extends BaseController
+{
+ @Autowired
+ private IMessageTemplateService messageTemplateService;
+
+ /**
+ * 查询模版管理列表
+ */
+ @Operation(summary = "查询模版管理列表")
+ //@PreAuthorize("@ss.hasPermi('modelMessage:template:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(MessageTemplate messageTemplate)
+ {
+ startPage();
+ List list = messageTemplateService.selectMessageTemplateList(messageTemplate);
+ return getDataTable(list);
+ }
+
+ /**
+ * 导出模版管理列表
+ */
+ @Operation(summary = "导出模版管理列表")
+ @PreAuthorize("@ss.hasPermi('modelMessage:template:export')")
+ @Log(title = "模版管理", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, MessageTemplate messageTemplate)
+ {
+ List list = messageTemplateService.selectMessageTemplateList(messageTemplate);
+ ExcelUtil util = new ExcelUtil(MessageTemplate.class);
+ util.exportExcel(response, list, "模版管理数据");
+ }
+
+ /**
+ * 获取模版管理详细信息
+ */
+ @Operation(summary = "获取模版管理详细信息")
+ //@PreAuthorize("@ss.hasPermi('modelMessage:template:query')")
+ @GetMapping(value = "/{templateId}")
+ public AjaxResult getInfo(@PathVariable("templateId") Long templateId)
+ {
+ return success(messageTemplateService.selectMessageTemplateByTemplateId(templateId));
+ }
+
+ /**
+ * 新增模版管理
+ */
+ @Operation(summary = "新增模版管理")
+ //@PreAuthorize("@ss.hasPermi('modelMessage:template:add')")
+ @Log(title = "模版管理", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody MessageTemplate messageTemplate)
+ {
+ return toAjax(messageTemplateService.insertMessageTemplate(messageTemplate));
+ }
+
+ /**
+ * 修改模版管理
+ */
+ @Operation(summary = "修改模版管理")
+ //@PreAuthorize("@ss.hasPermi('modelMessage:template:edit')")
+ @Log(title = "模版管理", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody MessageTemplate messageTemplate)
+ {
+ return toAjax(messageTemplateService.updateMessageTemplate(messageTemplate));
+ }
+
+ /**
+ * 删除模版管理
+ */
+ @Operation(summary = "删除模版管理")
+ //@PreAuthorize("@ss.hasPermi('modelMessage:template:remove')")
+ @Log(title = "模版管理", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{templateIds}")
+ public AjaxResult remove(@PathVariable( name = "templateIds" ) Long[] templateIds)
+ {
+ return toAjax(messageTemplateService.deleteMessageTemplateByTemplateIds(templateIds));
+ }
+}
diff --git a/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/controller/MessageVariableController.java b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/controller/MessageVariableController.java
new file mode 100644
index 0000000000000000000000000000000000000000..e240fa6db7315549ee2b89882143ef612d374626
--- /dev/null
+++ b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/controller/MessageVariableController.java
@@ -0,0 +1,154 @@
+package com.ruoyi.modelMessage.controller;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.ruoyi.common.annotation.Anonymous;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.modelMessage.domain.MessageVariable;
+import com.ruoyi.modelMessage.service.IMessageVariableService;
+
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.servlet.http.HttpServletResponse;
+
+/**
+ * 变量管理Controller
+ *
+ * @author ruoyi
+ * @date 2024-12-31
+ */
+@RestController
+@RequestMapping("/modelMessage/variable")
+@Tag(name = "【变量管理】管理")
+public class MessageVariableController extends BaseController
+{
+ @Autowired
+ private IMessageVariableService messageVariableService;
+
+ /**
+ * 查询变量管理列表
+ */
+ @Operation(summary = "查询变量管理列表")
+ //@PreAuthorize("@ss.hasPermi('modelMessage:variable:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(MessageVariable messageVariable)
+ {
+ startPage();
+ List list = messageVariableService.selectMessageVariableList(messageVariable);
+ return getDataTable(list);
+ }
+
+ /**
+ * 导出变量管理列表
+ */
+ @Operation(summary = "导出变量管理列表")
+ @PreAuthorize("@ss.hasPermi('modelMessage:variable:export')")
+ @Log(title = "变量管理", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, MessageVariable messageVariable)
+ {
+ List list = messageVariableService.selectMessageVariableList(messageVariable);
+ ExcelUtil util = new ExcelUtil(MessageVariable.class);
+ util.exportExcel(response, list, "变量管理数据");
+ }
+
+ /**
+ * 获取变量管理详细信息
+ */
+ @Operation(summary = "获取变量管理详细信息")
+ //@PreAuthorize("@ss.hasPermi('modelMessage:variable:query')")
+ @GetMapping(value = "/{variableId}")
+ public AjaxResult getInfo(@PathVariable("variableId") Long variableId)
+ {
+ return success(messageVariableService.selectMessageVariableByVariableId(variableId));
+ }
+
+ /**
+ * 新增变量管理
+ */
+ @Operation(summary = "新增变量管理")
+ //@PreAuthorize("@ss.hasPermi('modelMessage:variable:add')")
+ @Log(title = "变量管理", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody MessageVariable messageVariable)
+ {
+ return toAjax(messageVariableService.insertMessageVariable(messageVariable));
+ }
+
+ /**
+ * 修改变量管理
+ */
+ @Operation(summary = "修改变量管理")
+ //@PreAuthorize("@ss.hasPermi('modelMessage:variable:edit')")
+ @Log(title = "变量管理", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody MessageVariable messageVariable)
+ {
+ return toAjax(messageVariableService.updateMessageVariable(messageVariable));
+ }
+
+ /**
+ * 删除变量管理
+ */
+ @Operation(summary = "删除变量管理")
+ //@PreAuthorize("@ss.hasPermi('modelMessage:variable:remove')")
+ @Log(title = "变量管理", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{variableIds}")
+ public AjaxResult remove(@PathVariable( name = "variableIds" ) Long[] variableIds)
+ {
+ for (Long variableId : variableIds) {
+ // 获取变量信息
+ MessageVariable variable = messageVariableService.selectMessageVariableByVariableId(variableId);
+ if (variable == null) {
+ throw new ServiceException("变量不存在!");
+ }
+ // 检查变量是否被模板使用
+ if (messageVariableService.selectTemplateByVariableId(variable.getVariableName())) {
+ throw new ServiceException("该变量已被模版使用,不能删除!");
+ }
+ }
+ return toAjax(messageVariableService.deleteMessageVariableByVariableIds(variableIds));
+ }
+
+ /**
+ * 查询角色信息
+ */
+ @Operation(summary = "查询变量")
+ @GetMapping("/selectMessageVariable")
+ @Anonymous
+ public AjaxResult selectMessageVariable() {
+ return success(messageVariableService.selectMessageVariable());
+ }
+
+ /**
+ * 根据变量类型生成不同的变量内容
+ */
+ @Operation(summary = "根据变量类型生成不同变量内容")
+ @GetMapping("/generate")
+ public AjaxResult generateVariableContent(@RequestParam String variableType) {
+ try {
+ Object content = messageVariableService.generateVariableContent(variableType);
+ return AjaxResult.success(content);
+ } catch (Exception e) {
+ return AjaxResult.error("生成变量内容失败!");
+ }
+ }
+}
diff --git a/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/domain/MessageSystem.java b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/domain/MessageSystem.java
new file mode 100644
index 0000000000000000000000000000000000000000..7dc177afddd3934ec2773ed2fafc25cb6ca4ef68
--- /dev/null
+++ b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/domain/MessageSystem.java
@@ -0,0 +1,159 @@
+package com.ruoyi.modelMessage.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+
+/**
+ * 消息管理对象 message_system
+ *
+ * @author ruoyi
+ * @date 2024-12-21
+ */
+@Schema(description = "消息管理对象")
+public class MessageSystem extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 主键 */
+ @Schema(title = "主键")
+ private Long messageId;
+
+ /** 标题 */
+ @Schema(title = "标题")
+ @Excel(name = "标题")
+ private String messageTitle;
+
+ /** 消息内容 */
+ @Schema(title = "消息内容")
+ @Excel(name = "消息内容")
+ private String messageContent;
+
+ /** 消息状态(0未读 1已读) */
+ @Schema(title = "消息状态(0未读 1已读)")
+ @Excel(name = "消息状态(0未读 1已读)")
+ private String messageStatus;
+
+ /** 消息类型 */
+ @Schema(title = "消息类型")
+ @Excel(name = "消息类型")
+ private String messageType;
+
+ /** 消息类型 */
+ @Schema(title = "接收人")
+ @Excel(name = "接收人")
+ private String messageRecipient;
+
+ /** 发送方式(0平台 1手机号 2 邮箱) */
+ @Schema(title = "发送方式(0平台 1手机号 2 邮箱)")
+ @Excel(name = "发送方式(0平台 1手机号 2 邮箱)")
+ private String sendMode;
+
+ /** 号码 */
+ @Schema(title = "号码")
+ @Excel(name = "号码")
+ private String code;
+
+ public String getSendMode() {
+ return sendMode;
+ }
+
+ public void setSendMode(String sendMode) {
+ this.sendMode = sendMode;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ public void setMessageId(Long messageId)
+ {
+ this.messageId = messageId;
+ }
+
+ public Long getMessageId()
+ {
+ return messageId;
+ }
+
+
+ public void setMessageTitle(String messageTitle)
+ {
+ this.messageTitle = messageTitle;
+ }
+
+ public String getMessageTitle()
+ {
+ return messageTitle;
+ }
+
+
+ public void setMessageContent(String messageContent)
+ {
+ this.messageContent = messageContent;
+ }
+
+ public String getMessageContent()
+ {
+ return messageContent;
+ }
+
+
+ public void setMessageStatus(String messageStatus)
+ {
+ this.messageStatus = messageStatus;
+ }
+
+ public String getMessageStatus()
+ {
+ return messageStatus;
+ }
+
+
+ public void setMessageType(String messageType)
+ {
+ this.messageType = messageType;
+ }
+
+ public String getMessageType()
+ {
+ return messageType;
+ }
+
+ public String getMessageRecipient() {
+ return messageRecipient;
+ }
+
+ public void setMessageRecipient(String messageRecipient) {
+ this.messageRecipient = messageRecipient;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("messageId", getMessageId())
+ .append("messageTitle", getMessageTitle())
+ .append("messageContent", getMessageContent())
+ .append("messageStatus", getMessageStatus())
+ .append("messageType", getMessageType())
+ .append("messageRecipient", getMessageRecipient())
+ .append("sendMode", getSendMode())
+ .append("code", getCode())
+ .append("createBy", getCreateBy())
+ .append("createTime", getCreateTime())
+ .append("updateBy", getUpdateBy())
+ .append("updateTime", getUpdateTime())
+ .append("remark", getRemark())
+ .toString();
+ }
+
+
+}
diff --git a/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/domain/MessageTemplate.java b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/domain/MessageTemplate.java
new file mode 100644
index 0000000000000000000000000000000000000000..f8067cfd4aa767ab3dd079d119038fc86e8fa0da
--- /dev/null
+++ b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/domain/MessageTemplate.java
@@ -0,0 +1,134 @@
+package com.ruoyi.modelMessage.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+
+/**
+ * 模版管理对象 message_template
+ *
+ * @author ruoyi
+ * @date 2024-12-31
+ */
+@Schema(description = "模版管理对象")
+public class MessageTemplate extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+
+ /** 主键 */
+ @Schema(title = "主键")
+ private Long templateId;
+
+ /** 模版名称 */
+ @Schema(title = "模版名称")
+ @Excel(name = "模版名称")
+ private String templateName;
+
+ /** 模版CODE */
+ @Schema(title = "模版CODE")
+ @Excel(name = "模版CODE")
+ private String templateCode;
+
+ /** 模版类型 */
+ @Schema(title = "模版类型")
+ @Excel(name = "模版类型")
+ private String templateType;
+
+ /** 模版内容 */
+ @Schema(title = "模版内容")
+ @Excel(name = "模版内容")
+ private String templateContent;
+
+ /** 变量属性 */
+ @Schema(title = "变量属性")
+ @Excel(name = "变量属性")
+ private String templateVariable;
+ public void setTemplateId(Long templateId)
+ {
+ this.templateId = templateId;
+ }
+
+ public Long getTemplateId()
+ {
+ return templateId;
+ }
+
+
+ public void setTemplateName(String templateName)
+ {
+ this.templateName = templateName;
+ }
+
+ public String getTemplateName()
+ {
+ return templateName;
+ }
+
+
+ public void setTemplateCode(String templateCode)
+ {
+ this.templateCode = templateCode;
+ }
+
+ public String getTemplateCode()
+ {
+ return templateCode;
+ }
+
+
+ public void setTemplateType(String templateType)
+ {
+ this.templateType = templateType;
+ }
+
+ public String getTemplateType()
+ {
+ return templateType;
+ }
+
+
+ public void setTemplateContent(String templateContent)
+ {
+ this.templateContent = templateContent;
+ }
+
+ public String getTemplateContent()
+ {
+ return templateContent;
+ }
+
+
+ public void setTemplateVariable(String templateVariable)
+ {
+ this.templateVariable = templateVariable;
+ }
+
+ public String getTemplateVariable()
+ {
+ return templateVariable;
+ }
+
+
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("templateId", getTemplateId())
+ .append("templateName", getTemplateName())
+ .append("templateCode", getTemplateCode())
+ .append("templateType", getTemplateType())
+ .append("templateContent", getTemplateContent())
+ .append("templateVariable", getTemplateVariable())
+ .append("createBy", getCreateBy())
+ .append("createTime", getCreateTime())
+ .append("updateBy", getUpdateBy())
+ .append("updateTime", getUpdateTime())
+ .append("remark", getRemark())
+ .toString();
+ }
+}
diff --git a/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/domain/MessageVariable.java b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/domain/MessageVariable.java
new file mode 100644
index 0000000000000000000000000000000000000000..155cd38b333cf37663fd324cc9f221cab653890f
--- /dev/null
+++ b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/domain/MessageVariable.java
@@ -0,0 +1,107 @@
+package com.ruoyi.modelMessage.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+
+/**
+ * 变量管理对象 message_variable
+ *
+ * @author ruoyi
+ * @date 2024-12-31
+ */
+@Schema(description = "变量管理对象")
+public class MessageVariable extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+
+ /** 主键 */
+ @Schema(title = "主键")
+ private Long variableId;
+
+ /** 变量名称 */
+ @Schema(title = "变量名称")
+ @Excel(name = "变量名称")
+ private String variableName;
+
+ /** 变量类型 */
+ @Schema(title = "变量类型")
+ @Excel(name = "变量类型")
+ private String variableType;
+
+ /** 变量内容 */
+ @Schema(title = "变量内容")
+ @Excel(name = "变量内容")
+ private String variableContent;
+ public void setVariableId(Long variableId)
+ {
+ this.variableId = variableId;
+ }
+
+ public MessageVariable(Long variableId, String variableName, String variableType, String variableContent) {
+ this.variableId = variableId;
+ this.variableName = variableName;
+ this.variableType = variableType;
+ this.variableContent = variableContent;
+ }
+
+ public Long getVariableId()
+ {
+ return variableId;
+ }
+
+
+ public void setVariableName(String variableName)
+ {
+ this.variableName = variableName;
+ }
+
+ public String getVariableName()
+ {
+ return variableName;
+ }
+
+
+ public void setVariableType(String variableLength)
+ {
+ this.variableType = variableLength;
+ }
+
+ public String getVariableType()
+ {
+ return variableType;
+ }
+
+
+ public void setVariableContent(String variableContent)
+ {
+ this.variableContent = variableContent;
+ }
+
+ public String getVariableContent()
+ {
+ return variableContent;
+ }
+
+
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("variableId", getVariableId())
+ .append("variableName", getVariableName())
+ .append("variableType", getVariableType())
+ .append("variableContent", getVariableContent())
+ .append("createBy", getCreateBy())
+ .append("createTime", getCreateTime())
+ .append("updateBy", getUpdateBy())
+ .append("updateTime", getUpdateTime())
+ .append("remark", getRemark())
+ .toString();
+ }
+}
diff --git a/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/domain/vo/SysDeptVo.java b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/domain/vo/SysDeptVo.java
new file mode 100644
index 0000000000000000000000000000000000000000..d583bee5d8c2dec87956236ee209a4020693a5c5
--- /dev/null
+++ b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/domain/vo/SysDeptVo.java
@@ -0,0 +1,220 @@
+package com.ruoyi.modelMessage.domain.vo;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import com.ruoyi.common.core.domain.BaseEntity;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.Email;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Size;
+
+/**
+ * 部门表 sys_dept
+ *
+ * @author ruoyi
+ */
+@Schema(title = "部门")
+public class SysDeptVo extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 部门ID */
+ @Schema(title = "部门ID")
+ private Long deptId;
+
+ /** 父部门ID */
+ @Schema(title = "父部门ID")
+ private Long parentId;
+
+ /** 祖级列表 */
+ @Schema(title = "祖级列表")
+ private String ancestors;
+
+ /** 部门名称 */
+ @Schema(title = "部门名称")
+ private String deptName;
+
+ /** 显示顺序 */
+ @Schema(title = "显示顺序")
+ private Integer orderNum;
+
+ /** 负责人 */
+ @Schema(title = "负责人")
+ private String leader;
+
+ /** 联系电话 */
+ @Schema(title = "联系电话")
+ private String phone;
+
+ /** 邮箱 */
+ @Schema(title = "邮箱")
+ private String email;
+
+ /** 部门状态:0正常,1停用 */
+ @Schema(title = "部门表",description = "0正常,1停用")
+ private String status;
+
+ /** 删除标志(0代表存在 2代表删除) */
+ @Schema(title = "删除标志",description = "0代表存在 2代表删除")
+ private String delFlag;
+
+ /** 父部门名称 */
+ @Schema(title = "父部门名称")
+ private String parentName;
+
+ /** 子部门 */
+ @Schema(title = "子部门")
+ private List children = new ArrayList();
+
+ public Long getDeptId()
+ {
+ return deptId;
+ }
+
+ public void setDeptId(Long deptId)
+ {
+ this.deptId = deptId;
+ }
+
+ public Long getParentId()
+ {
+ return parentId;
+ }
+
+ public void setParentId(Long parentId)
+ {
+ this.parentId = parentId;
+ }
+
+ public String getAncestors()
+ {
+ return ancestors;
+ }
+
+ public void setAncestors(String ancestors)
+ {
+ this.ancestors = ancestors;
+ }
+
+ @NotBlank(message = "部门名称不能为空")
+ @Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符")
+ public String getDeptName()
+ {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName)
+ {
+ this.deptName = deptName;
+ }
+
+ @NotNull(message = "显示顺序不能为空")
+ public Integer getOrderNum()
+ {
+ return orderNum;
+ }
+
+ public void setOrderNum(Integer orderNum)
+ {
+ this.orderNum = orderNum;
+ }
+
+ public String getLeader()
+ {
+ return leader;
+ }
+
+ public void setLeader(String leader)
+ {
+ this.leader = leader;
+ }
+
+ @Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符")
+ public String getPhone()
+ {
+ return phone;
+ }
+
+ public void setPhone(String phone)
+ {
+ this.phone = phone;
+ }
+
+ @Email(message = "邮箱格式不正确")
+ @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
+ public String getEmail()
+ {
+ return email;
+ }
+
+ public void setEmail(String email)
+ {
+ this.email = email;
+ }
+
+ public String getStatus()
+ {
+ return status;
+ }
+
+ public void setStatus(String status)
+ {
+ this.status = status;
+ }
+
+ public String getDelFlag()
+ {
+ return delFlag;
+ }
+
+ public void setDelFlag(String delFlag)
+ {
+ this.delFlag = delFlag;
+ }
+
+ public String getParentName()
+ {
+ return parentName;
+ }
+
+ public void setParentName(String parentName)
+ {
+ this.parentName = parentName;
+ }
+
+ public List getChildren()
+ {
+ return children;
+ }
+
+ public void setChildren(List children)
+ {
+ this.children = children;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("deptId", getDeptId())
+ .append("parentId", getParentId())
+ .append("ancestors", getAncestors())
+ .append("deptName", getDeptName())
+ .append("orderNum", getOrderNum())
+ .append("leader", getLeader())
+ .append("phone", getPhone())
+ .append("email", getEmail())
+ .append("status", getStatus())
+ .append("delFlag", getDelFlag())
+ .append("createBy", getCreateBy())
+ .append("createTime", getCreateTime())
+ .append("updateBy", getUpdateBy())
+ .append("updateTime", getUpdateTime())
+ .toString();
+ }
+}
diff --git a/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/domain/vo/SysRoleVo.java b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/domain/vo/SysRoleVo.java
new file mode 100644
index 0000000000000000000000000000000000000000..2d0112ccf5434d77fd0435787e0adc11ac4f430d
--- /dev/null
+++ b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/domain/vo/SysRoleVo.java
@@ -0,0 +1,55 @@
+package com.ruoyi.modelMessage.domain.vo;
+
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.annotation.Excel.ColumnType;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+
+
+/**
+ * 角色表 sys_role
+ *
+ * @author ruoyi
+ */
+@Schema(title = "角色表")
+public class SysRoleVo
+{
+
+ /** 角色ID */
+ @Schema(title = "角色ID")
+ @Excel(name = "角色序号", cellType = ColumnType.NUMERIC)
+ private Long roleId;
+
+ /** 角色名称 */
+ @Schema(title = "角色名称")
+ @Excel(name = "角色名称")
+ private String roleName;
+
+ public Long getRoleId() {
+ return roleId;
+ }
+
+ public void setRoleId(Long roleId) {
+ this.roleId = roleId;
+ }
+
+ public String getRoleName() {
+ return roleName;
+ }
+
+ public void setRoleName(String roleName) {
+ this.roleName = roleName;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("roleId", getRoleId())
+ .append("roleName", getRoleName())
+ .toString();
+ }
+}
diff --git a/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/domain/vo/SysUserVo.java b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/domain/vo/SysUserVo.java
new file mode 100644
index 0000000000000000000000000000000000000000..377abe159024c22c898f973f013fa932bae5a54f
--- /dev/null
+++ b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/domain/vo/SysUserVo.java
@@ -0,0 +1,96 @@
+package com.ruoyi.modelMessage.domain.vo;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.annotation.Excel.Type;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+
+/**
+ * 用户对象 sys_user
+ *
+ * @author ruoyi
+ */
+@Schema(title = "用户")
+public class SysUserVo
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 用户ID */
+ @Schema(title = "用户编号")
+ @Excel(name = "用户编号")
+ private Long userId;
+
+ /** 部门ID */
+ @Schema(title = "部门编号")
+ @Excel(name = "部门编号", type = Type.IMPORT)
+ private Long deptId;
+
+ /** 用户账号 */
+ @Schema(title = "登录名称")
+ @Excel(name = "登录名称")
+ private String userName;
+
+ /** 用户邮箱 */
+ @Schema(title = "用户邮箱")
+ @Excel(name = "用户邮箱")
+ private String email;
+
+ /** 手机号码 */
+ @Schema(title = "手机号码")
+ @Excel(name = "手机号码")
+ private String phonenumber;
+
+ public Long getUserId() {
+ return userId;
+ }
+
+ public void setUserId(Long userId) {
+ this.userId = userId;
+ }
+
+ public Long getDeptId() {
+ return deptId;
+ }
+
+ public void setDeptId(Long deptId) {
+ this.deptId = deptId;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public String getPhonenumber() {
+ return phonenumber;
+ }
+
+ public void setPhonenumber(String phonenumber) {
+ this.phonenumber = phonenumber;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("userId", getUserId())
+ .append("deptId", getDeptId())
+ .append("userName", getUserName())
+ .append("email", getEmail())
+ .append("phonenumber", getPhonenumber())
+ .toString();
+ }
+}
diff --git a/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/enums/MessageType.java b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/enums/MessageType.java
new file mode 100644
index 0000000000000000000000000000000000000000..36a1dbbb7edc8a1cc6a435981f2adf76733d1ea4
--- /dev/null
+++ b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/enums/MessageType.java
@@ -0,0 +1,25 @@
+package com.ruoyi.modelMessage.enums;
+
+public enum MessageType {
+ INFO("信息", "普通信息记录"),
+ WARN("警告", "非致命问题警告"),
+ ERROR("错误", "严重错误信息"),
+ DEBUG("调试", "调试信息,仅用于开发环境"),
+ SUCCESS("成功", "操作成功的提示信息");
+
+ private final String code;
+ private final String description;
+
+ MessageType(String code, String description) {
+ this.code = code;
+ this.description = description;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+}
diff --git a/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/enums/SendMode.java b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/enums/SendMode.java
new file mode 100644
index 0000000000000000000000000000000000000000..6693572ac86f3d04a6bd8653e120d965e8dc01e6
--- /dev/null
+++ b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/enums/SendMode.java
@@ -0,0 +1,32 @@
+package com.ruoyi.modelMessage.enums;
+
+public enum SendMode {
+ PLATFORM("0", "平台"),
+ PHONE("1", "手机号"),
+ EMAIL("2", "邮箱");
+
+ private final String code;
+ private final String description;
+
+ SendMode(String code, String description) {
+ this.code = code;
+ this.description = description;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public static SendMode fromCode(String code) {
+ for (SendMode mode : SendMode.values()) {
+ if (mode.getCode().equals(code)) {
+ return mode;
+ }
+ }
+ throw new IllegalArgumentException("未知的发送方式: " + code);
+ }
+}
diff --git a/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/mapper/MessageSystemMapper.java b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/mapper/MessageSystemMapper.java
new file mode 100644
index 0000000000000000000000000000000000000000..0b8a1964215eec3f1795f232cb99fbf25b354191
--- /dev/null
+++ b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/mapper/MessageSystemMapper.java
@@ -0,0 +1,121 @@
+package com.ruoyi.modelMessage.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+
+import com.ruoyi.modelMessage.domain.MessageSystem;
+import com.ruoyi.modelMessage.domain.MessageTemplate;
+import com.ruoyi.modelMessage.domain.vo.SysDeptVo;
+import com.ruoyi.modelMessage.domain.vo.SysRoleVo;
+import com.ruoyi.modelMessage.domain.vo.SysUserVo;
+
+/**
+ * 消息管理Mapper接口
+ *
+ * @author ruoyi
+ * @date 2024-12-21
+ */
+public interface MessageSystemMapper
+{
+ /**
+ * 查询消息管理
+ *
+ * @param messageId 消息管理主键
+ * @return 消息管理
+ */
+ public MessageSystem selectMessageSystemByMessageId(Long messageId);
+
+ /**
+ * 查询消息管理列表
+ *
+ * @param messageSystem 消息管理
+ * @return 消息管理集合
+ */
+ public List selectMessageSystemList(MessageSystem messageSystem);
+
+ /**
+ * 新增消息管理
+ *
+ * @param messageSystem 消息管理
+ * @return 结果
+ */
+ public int insertMessageSystem(MessageSystem messageSystem);
+
+ /**
+ * 修改消息管理
+ *
+ * @param messageSystem 消息管理
+ * @return 结果
+ */
+ public int updateMessageSystem(MessageSystem messageSystem);
+
+ /**
+ * 删除消息管理
+ *
+ * @param messageId 消息管理主键
+ * @return 结果
+ */
+ public int deleteMessageSystemByMessageId(Long messageId);
+
+ /**
+ * 批量删除消息管理
+ *
+ * @param messageIds 需要删除的数据主键集合
+ * @return 结果
+ */
+ public int deleteMessageSystemByMessageIds(Long[] messageIds);
+
+ //查询平台系统资源收件人用户信息
+ @Select("SELECT * FROM `sys_user`")
+ public List selectUser();
+
+ //查询角色信息 然后根据角色把消息发给某角色
+ @Select("SELECT * FROM `sys_role`")
+ public List selectRole();
+
+ //查询部门信息 然后根据部门把消息发给某部门
+ @Select("SELECT * FROM `sys_dept`")
+ public List selectDept();
+
+ // 根据发送方式过滤用户 (短信或邮箱)
+ @Select("")
+ List selectUserBySendMode(String filterType);
+
+ //将信息状态未读信息变为已读
+ @Update("update message_system set message_status = 1 where message_id = #{messageId} and message_recipient = #{userName}")
+ public int updateState(Long messageId, String userName);
+
+
+ /**
+ * 根据部门ID获取所有符合条件的用户信息。
+ *
+ * @param deptId 部门ID
+ * @return 用户信息列表
+ */
+ @Select("SELECT u.* FROM sys_user u JOIN sys_dept d ON u.dept_id = d.dept_id WHERE d.dept_id = #{deptId}")
+ public List getUserNameByDeptId(Long roleId);
+
+ /**
+ * 根据角色ID查询用户列表。
+ *
+ * @param roleId 角色ID
+ * @return 用户列表
+ */
+ @Select("SELECT u.* FROM sys_user u JOIN sys_user_role ur ON u.user_id = ur.user_id WHERE ur.role_id = #{roleId}")
+ public List selectUsersByRoleId(Long roleId);
+
+ //查询模版签名
+ @Select("SELECT template_id,template_code,template_variable FROM `message_template`")
+ public List selecTemplates();
+
+ //批量发送信息
+ public int batchInsertMessageSystem(List messageSystemList);
+}
diff --git a/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/mapper/MessageTemplateMapper.java b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/mapper/MessageTemplateMapper.java
new file mode 100644
index 0000000000000000000000000000000000000000..d1a25f4380801a5c2dbc5e883b40555d9a9936ad
--- /dev/null
+++ b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/mapper/MessageTemplateMapper.java
@@ -0,0 +1,73 @@
+package com.ruoyi.modelMessage.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Select;
+
+import com.ruoyi.modelMessage.domain.MessageTemplate;
+
+/**
+ * 模版管理Mapper接口
+ *
+ * @author ruoyi
+ * @date 2024-12-31
+ */
+public interface MessageTemplateMapper
+{
+ /**
+ * 查询模版管理
+ *
+ * @param templateId 模版管理主键
+ * @return 模版管理
+ */
+ public MessageTemplate selectMessageTemplateByTemplateId(Long templateId);
+
+ /**
+ * 查询模版管理列表
+ *
+ * @param messageTemplate 模版管理
+ * @return 模版管理集合
+ */
+ public List selectMessageTemplateList(MessageTemplate messageTemplate);
+
+ /**
+ * 新增模版管理
+ *
+ * @param messageTemplate 模版管理
+ * @return 结果
+ */
+ public int insertMessageTemplate(MessageTemplate messageTemplate);
+
+ /**
+ * 修改模版管理
+ *
+ * @param messageTemplate 模版管理
+ * @return 结果
+ */
+ public int updateMessageTemplate(MessageTemplate messageTemplate);
+
+ /**
+ * 删除模版管理
+ *
+ * @param templateId 模版管理主键
+ * @return 结果
+ */
+ public int deleteMessageTemplateByTemplateId(Long templateId);
+
+ /**
+ * 批量删除模版管理
+ *
+ * @param templateIds 需要删除的数据主键集合
+ * @return 结果
+ */
+ public int deleteMessageTemplateByTemplateIds(Long[] templateIds);
+
+ /**
+ * 根据模板templateCode查询模板信息
+ *
+ * @param templateCode 模版编码
+ * @return 模版对象
+ */
+ @Select("SELECT * FROM message_template WHERE template_code = #{templateCode}")
+ public MessageTemplate selectMessageTemplateByTemplateCode(String templateCode);
+}
diff --git a/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/mapper/MessageVariableMapper.java b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/mapper/MessageVariableMapper.java
new file mode 100644
index 0000000000000000000000000000000000000000..30fe3584efafe465edf0284545a001a79f1096db
--- /dev/null
+++ b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/mapper/MessageVariableMapper.java
@@ -0,0 +1,75 @@
+package com.ruoyi.modelMessage.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Select;
+
+import com.ruoyi.modelMessage.domain.MessageVariable;
+
+/**
+ * 变量管理Mapper接口
+ *
+ * @author ruoyi
+ * @date 2024-12-31
+ */
+public interface MessageVariableMapper
+{
+ /**
+ * 查询变量管理
+ *
+ * @param variableId 变量管理主键
+ * @return 变量管理
+ */
+ public MessageVariable selectMessageVariableByVariableId(Long variableId);
+
+ /**
+ * 查询变量管理列表
+ *
+ * @param messageVariable 变量管理
+ * @return 变量管理集合
+ */
+ public List selectMessageVariableList(MessageVariable messageVariable);
+
+ /**
+ * 新增变量管理
+ *
+ * @param messageVariable 变量管理
+ * @return 结果
+ */
+ public int insertMessageVariable(MessageVariable messageVariable);
+
+ /**
+ * 修改变量管理
+ *
+ * @param messageVariable 变量管理
+ * @return 结果
+ */
+ public int updateMessageVariable(MessageVariable messageVariable);
+
+ /**
+ * 删除变量管理
+ *
+ * @param variableId 变量管理主键
+ * @return 结果
+ */
+ public int deleteMessageVariableByVariableId(Long variableId);
+
+ /**
+ * 批量删除变量管理
+ *
+ * @param variableIds 需要删除的数据主键集合
+ * @return 结果
+ */
+ public int deleteMessageVariableByVariableIds(Long[] variableIds);
+
+ //删除变量之前检查一下有没有模版使用
+ @Select("SELECT COUNT(*) > 0 FROM message_template WHERE template_variable = #{templateVariable}")
+ public boolean selectTemplateByVariableId(String templateVariable);
+
+ //查询变量
+ @Select("SELECT * FROM message_variable")
+ public List selectMessageVariable();
+
+ //查询在使用模版签名时用到了那些变量一一赋值
+ public List selectMessageVariables(List variableNames);
+}
diff --git a/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/service/IMessageSystemService.java b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/service/IMessageSystemService.java
new file mode 100644
index 0000000000000000000000000000000000000000..5b0a6942559c7a5e803163636ea5ecc7a056a8f2
--- /dev/null
+++ b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/service/IMessageSystemService.java
@@ -0,0 +1,108 @@
+package com.ruoyi.modelMessage.service;
+
+import java.util.List;
+
+import com.ruoyi.modelMessage.domain.MessageSystem;
+import com.ruoyi.modelMessage.domain.MessageTemplate;
+import com.ruoyi.modelMessage.domain.vo.SysDeptVo;
+import com.ruoyi.modelMessage.domain.vo.SysRoleVo;
+import com.ruoyi.modelMessage.domain.vo.SysUserVo;
+
+/**
+ * 消息管理Service接口
+ *
+ * @author ruoyi
+ * @date 2024-12-21
+ */
+public interface IMessageSystemService
+{
+ /**
+ * 查询消息管理
+ *
+ * @param messageId 消息管理主键
+ * @return 消息管理
+ */
+ public MessageSystem selectMessageSystemByMessageId(Long messageId);
+
+ /**
+ * 查询消息管理列表
+ *
+ * @param messageSystem 消息管理
+ * @return 消息管理集合
+ */
+ public List selectMessageSystemList(MessageSystem messageSystem);
+
+ /**
+ * 新增消息管理
+ *
+ * @param messageSystem 消息管理
+ * @return 结果
+ */
+ public int insertMessageSystem(MessageSystem messageSystem);
+
+ /**
+ * 修改消息管理
+ *
+ * @param messageSystem 消息管理
+ * @return 结果
+ */
+ public int updateMessageSystem(MessageSystem messageSystem);
+
+ /**
+ * 批量删除消息管理
+ *
+ * @param messageIds 需要删除的消息管理主键集合
+ * @return 结果
+ */
+ public int deleteMessageSystemByMessageIds(Long[] messageIds);
+
+ /**
+ * 删除消息管理信息
+ *
+ * @param messageId 消息管理主键
+ * @return 结果
+ */
+ public int deleteMessageSystemByMessageId(Long messageId);
+
+ //查询系统资源用户信息
+ public List selectUser();
+
+ //将信息状态未读信息变为已读
+ public int updateState(Long messageId);
+
+ //根据发送方式 执行不同操作
+ public void processMessageSystem(MessageSystem messageSystem);
+
+ // 根据发送方式过滤用户 (短信或邮箱)
+ public List getUsersFilteredBySendMode(String filterType);
+
+ //查询角色信息 然后根据角色把消息发给某角色
+ public List selectRole();
+
+ //查询部门信息 然后根据部门把消息发给某部门
+ public List selectDept();
+
+ /**
+ * 根据角色ID获取用户列表。
+ *
+ * @param roleId 角色ID
+ * @return
+ *
+ * */
+ public List selectUsersByRoleId(Long roleId);
+
+ /**
+ * 根据部门ID获取用户列表。
+ *
+ * @param deptId 部门ID
+ * @return
+ *
+ * */
+ public List getUserNameByDeptId(Long deptId);
+
+ // 查询模版签名
+ public List selecTemplates();
+
+ // 批量发送信息
+ public int batchInsertMessageSystem(List messageSystemList);
+}
diff --git a/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/service/IMessageTemplateService.java b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/service/IMessageTemplateService.java
new file mode 100644
index 0000000000000000000000000000000000000000..c6df315d5a3014fb3d287e3f6cc7e69e6e2aacc4
--- /dev/null
+++ b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/service/IMessageTemplateService.java
@@ -0,0 +1,62 @@
+package com.ruoyi.modelMessage.service;
+
+import java.util.List;
+
+import com.ruoyi.modelMessage.domain.MessageTemplate;
+
+/**
+ * 模版管理Service接口
+ *
+ * @author ruoyi
+ * @date 2024-12-31
+ */
+public interface IMessageTemplateService
+{
+ /**
+ * 查询模版管理
+ *
+ * @param templateId 模版管理主键
+ * @return 模版管理
+ */
+ public MessageTemplate selectMessageTemplateByTemplateId(Long templateId);
+
+ /**
+ * 查询模版管理列表
+ *
+ * @param messageTemplate 模版管理
+ * @return 模版管理集合
+ */
+ public List selectMessageTemplateList(MessageTemplate messageTemplate);
+
+ /**
+ * 新增模版管理
+ *
+ * @param messageTemplate 模版管理
+ * @return 结果
+ */
+ public int insertMessageTemplate(MessageTemplate messageTemplate);
+
+ /**
+ * 修改模版管理
+ *
+ * @param messageTemplate 模版管理
+ * @return 结果
+ */
+ public int updateMessageTemplate(MessageTemplate messageTemplate);
+
+ /**
+ * 批量删除模版管理
+ *
+ * @param templateIds 需要删除的模版管理主键集合
+ * @return 结果
+ */
+ public int deleteMessageTemplateByTemplateIds(Long[] templateIds);
+
+ /**
+ * 删除模版管理信息
+ *
+ * @param templateId 模版管理主键
+ * @return 结果
+ */
+ public int deleteMessageTemplateByTemplateId(Long templateId);
+}
diff --git a/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/service/IMessageVariableService.java b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/service/IMessageVariableService.java
new file mode 100644
index 0000000000000000000000000000000000000000..201aa913a8e41dc287e9e21218013aa84aaa75c7
--- /dev/null
+++ b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/service/IMessageVariableService.java
@@ -0,0 +1,71 @@
+package com.ruoyi.modelMessage.service;
+
+import java.util.List;
+
+import com.ruoyi.modelMessage.domain.MessageVariable;
+
+/**
+ * 变量管理Service接口
+ *
+ * @author ruoyi
+ * @date 2024-12-31
+ */
+public interface IMessageVariableService
+{
+ /**
+ * 查询变量管理
+ *
+ * @param variableId 变量管理主键
+ * @return 变量管理
+ */
+ public MessageVariable selectMessageVariableByVariableId(Long variableId);
+
+ /**
+ * 查询变量管理列表
+ *
+ * @param messageVariable 变量管理
+ * @return 变量管理集合
+ */
+ public List selectMessageVariableList(MessageVariable messageVariable);
+
+ /**
+ * 新增变量管理
+ *
+ * @param messageVariable 变量管理
+ * @return 结果
+ */
+ public int insertMessageVariable(MessageVariable messageVariable);
+
+ /**
+ * 修改变量管理
+ *
+ * @param messageVariable 变量管理
+ * @return 结果
+ */
+ public int updateMessageVariable(MessageVariable messageVariable);
+
+ /**
+ * 批量删除变量管理
+ *
+ * @param variableIds 需要删除的变量管理主键集合
+ * @return 结果
+ */
+ public int deleteMessageVariableByVariableIds(Long[] variableIds);
+
+ /**
+ * 删除变量管理信息
+ *
+ * @param variableId 变量管理主键
+ * @return 结果
+ */
+ public int deleteMessageVariableByVariableId(Long variableId);
+
+ // 查询全部变量
+ public List selectMessageVariable();
+
+ // 删除变量之前检查一下有没有模版使用
+ public boolean selectTemplateByVariableId(String templateVariable);
+
+ // 根据类型生成不同的变量内容
+ public String generateVariableContent(String variableType);
+}
diff --git a/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/service/impl/MessageSystemServiceImpl.java b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/service/impl/MessageSystemServiceImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..5bb0f7923f2209de148f176da67b8cb02ed222bb
--- /dev/null
+++ b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/service/impl/MessageSystemServiceImpl.java
@@ -0,0 +1,291 @@
+package com.ruoyi.modelMessage.service.impl;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.alibaba.fastjson2.JSONObject;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.modelMessage.domain.MessageSystem;
+import com.ruoyi.modelMessage.domain.MessageTemplate;
+import com.ruoyi.modelMessage.domain.vo.SysDeptVo;
+import com.ruoyi.modelMessage.domain.vo.SysRoleVo;
+import com.ruoyi.modelMessage.domain.vo.SysUserVo;
+import com.ruoyi.modelMessage.enums.SendMode;
+import com.ruoyi.modelMessage.mapper.MessageSystemMapper;
+import com.ruoyi.modelMessage.service.IMessageSystemService;
+import com.ruoyi.modelMessage.utils.MessageSystemUtils;
+import com.ruoyi.tfa.email.utils.EmailUtil;
+import com.ruoyi.tfa.phone.enums.DySmsTemplate;
+import com.ruoyi.tfa.phone.utils.DySmsUtil;
+
+/**
+ * 消息管理Service业务层处理
+ *
+ */
+@Service
+public class MessageSystemServiceImpl implements IMessageSystemService {
+
+ private static final Logger log = LoggerFactory.getLogger(MessageSystemServiceImpl.class);
+
+ @Autowired
+ private MessageSystemMapper messageSystemMapper;
+
+ @Autowired
+ private MessageSystemUtils messageSystemUtils;
+
+ /**
+ * 查询消息管理
+ *
+ * @param messageId 消息管理主键
+ * @return 消息管理
+ */
+ @Override
+ public MessageSystem selectMessageSystemByMessageId(Long messageId) {
+ return messageSystemMapper.selectMessageSystemByMessageId(messageId);
+ }
+
+ /**
+ * 查询消息管理列表
+ *
+ * @param messageSystem 消息管理
+ * @return 消息管理列表
+ */
+ @Override
+ public List selectMessageSystemList(MessageSystem messageSystem) {
+ return messageSystemMapper.selectMessageSystemList(messageSystem);
+ }
+
+ /**
+ * 新增消息管理
+ *
+ * @param messageSystem 消息管理
+ * @return 结果
+ */
+ @Override
+ public int insertMessageSystem(MessageSystem messageSystem) {
+ messageSystem.setMessageStatus("0"); // 默认发送信息为未读状态
+ messageSystem.setCreateBy(SecurityUtils.getUsername());
+ messageSystem.setUpdateBy(SecurityUtils.getUsername());
+ messageSystem.setCreateTime(DateUtils.getNowDate());
+ messageSystem.setUpdateTime(DateUtils.getNowDate());
+ return messageSystemMapper.insertMessageSystem(messageSystem);
+ }
+
+ /**
+ * 修改消息管理
+ *
+ * @param messageSystem 消息管理
+ * @return 结果
+ */
+ @Override
+ public int updateMessageSystem(MessageSystem messageSystem) {
+ messageSystem.setUpdateTime(DateUtils.getNowDate());
+ return messageSystemMapper.updateMessageSystem(messageSystem);
+ }
+
+ /**
+ * 批量删除消息管理
+ *
+ * @param messageIds 需要删除的消息管理主键
+ * @return 结果
+ */
+ @Override
+ public int deleteMessageSystemByMessageIds(Long[] messageIds) {
+ return messageSystemMapper.deleteMessageSystemByMessageIds(messageIds);
+ }
+
+ /**
+ * 删除消息管理信息
+ *
+ * @param messageId 消息管理主键
+ * @return 结果
+ */
+ @Override
+ public int deleteMessageSystemByMessageId(Long messageId) {
+ return messageSystemMapper.deleteMessageSystemByMessageId(messageId);
+ }
+
+ // 查询系统资源用户信息
+ @Override
+ public List selectUser() {
+ return messageSystemMapper.selectUser();
+ }
+
+ // 收件人为本人的话点击信息详情的时候然后把状态未读信息修改为已读
+ @Override
+ public int updateState(Long messageId) {
+ return messageSystemMapper.updateState(messageId, SecurityUtils.getUsername());
+ }
+
+ // 根据发送方式过滤用户 (短信或邮箱)
+ @Override
+ public List getUsersFilteredBySendMode(String filterType) {
+ return messageSystemMapper.selectUserBySendMode(filterType);
+ }
+
+ // 查询角色信息 然后根据角色把消息发给某角色
+ @Override
+ public List selectRole() {
+ return messageSystemMapper.selectRole();
+ }
+
+ // 查询部门信息 然后根据部门把消息发给某部门
+ @Override
+ public List selectDept() {
+ return messageSystemMapper.selectDept();
+ }
+
+ /**
+ * 根据角色ID获取对应用户信息。
+ *
+ * @param roleId 角色ID
+ * @return 符合条件的用户列表
+ */
+ @Override
+ public List selectUsersByRoleId(Long roleId) {
+ return messageSystemMapper.selectUsersByRoleId(roleId);
+ }
+
+ /**
+ * 根据角色ID获取用户ID列表。
+ *
+ * @param roleId 角色ID
+ * @return 用户ID列表
+ */
+ @Override
+ public List getUserNameByDeptId(Long deptId) {
+ return messageSystemMapper.getUserNameByDeptId(deptId);
+ }
+
+ // 查询模版签名
+ @Override
+ public List selecTemplates() {
+ return messageSystemMapper.selecTemplates();
+ }
+
+ /**
+ * 批量发送信息
+ */
+ @Override
+ public int batchInsertMessageSystem(List messageSystemList) {
+ String username = SecurityUtils.getUsername();
+ Date nowDate = DateUtils.getNowDate();
+ for (MessageSystem messageSystem : messageSystemList) {
+ messageSystem.setMessageStatus("0"); // 默认发送信息为未读状态
+ messageSystem.setCreateBy(username);
+ messageSystem.setUpdateBy(username);
+ messageSystem.setCreateTime(nowDate);
+ messageSystem.setUpdateTime(nowDate);
+ }
+ return messageSystemMapper.batchInsertMessageSystem(messageSystemList);
+ }
+
+ /**
+ * 根据 MessageSystem 对象的 sendMode 属性处理消息的发送方式
+ */
+ @Override
+ public void processMessageSystem(MessageSystem messageSystem) {
+ if (messageSystem == null || messageSystem.getSendMode() == null) {
+ throw new ServiceException("无效的消息系统对象或发送方式!");
+ }
+ String sendModeStr = messageSystem.getSendMode();
+ SendMode sendMode;
+ try {
+ sendMode = SendMode.fromCode(sendModeStr);
+ } catch (IllegalArgumentException e) {
+ throw new ServiceException("类型转换失败: " + sendModeStr);
+ }
+ switch (sendMode) {
+ case PHONE:
+ sendNotificationMessage(messageSystem);
+ break;
+ case EMAIL:
+ handleEmailNotification(messageSystem);
+ break;
+ case PLATFORM:
+ sendPlatformMessage(messageSystem);
+ break;
+ default:
+ throw new ServiceException("未知的发送方式!");
+ }
+ }
+
+ /**
+ * 发送平台消息
+ */
+ public void sendPlatformMessage(MessageSystem messageSystem) {
+ String notificationContent = messageSystem.getMessageContent();
+ try {
+ String filledMessage = notificationContent.startsWith("SMS_") ?
+ messageSystemUtils.processTemplateMessage(messageSystem, notificationContent) :
+ notificationContent; // 如果是自定义输入,使用用户输入的内容
+ log.info("平台内容: {}", filledMessage);
+ messageSystem.setMessageContent(filledMessage);
+ } catch (Exception e) {
+ log.error("发送平台消息时发生异常: ", e);
+ throw new ServiceException("发送平台消息异常:" + e.getMessage());
+ }
+ }
+
+ /**
+ * 发送邮件通知
+ */
+ public void handleEmailNotification(MessageSystem messageSystem) {
+ String email = messageSystem.getCode();
+ if (StringUtils.isEmpty(email)) {
+ throw new ServiceException("邮箱地址不能为空!");
+ }
+ try {
+ String filledMessage = messageSystem.getMessageContent().startsWith("SMS_") ?
+ messageSystemUtils.processTemplateMessage(messageSystem, messageSystem.getMessageContent()) :
+ messageSystem.getMessageContent(); // 如果是自定义输入,则直接使用用户提供的内容
+ log.info("邮件内容: {}", filledMessage);
+ messageSystem.setMessageContent(filledMessage);
+ EmailUtil.sendMessage(email, "通知", filledMessage);
+ } catch (Exception e) {
+ log.error("发送邮件时发生异常: ", e);
+ throw new ServiceException("发送通知信息异常:" + e.getMessage());
+ }
+ }
+
+ /**
+ * 发送短信通知
+ */
+ public void sendNotificationMessage(MessageSystem messageSystem) {
+ String phone = messageSystem.getCode();
+ if (StringUtils.isEmpty(phone)) {
+ throw new ServiceException("手机号码为空!");
+ }
+ try {
+ // 解析并处理模板消息
+ Map parsedParams = messageSystemUtils.parseInput(messageSystem.getMessageContent());
+ String templateCode = (String) parsedParams.get("templateCode");
+ DySmsTemplate dySmsTemplate = null;
+
+ if (templateCode != null) {
+ dySmsTemplate = DySmsTemplate.toEnum(templateCode);
+ @SuppressWarnings("unchecked")
+ Map params = (Map) parsedParams.get("params");
+ String filledMessage = messageSystemUtils.fillTemplate((String) parsedParams.get("templateContent"), params);
+ messageSystem.setMessageContent(filledMessage);
+ JSONObject templateParamJson = new JSONObject(params);
+ DySmsUtil.sendSms(dySmsTemplate, templateParamJson, phone);
+ } else {
+ DySmsUtil.sendSms(null, null, phone);
+ }
+ } catch (Exception e) {
+ log.error("发送短信时发生异常: ", e);
+ throw new ServiceException("发送短信异常:" + e.getMessage());
+ }
+ }
+
+}
diff --git a/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/service/impl/MessageTemplateServiceImpl.java b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/service/impl/MessageTemplateServiceImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..2933003f7c977e7613ac115accd46a13f49f252b
--- /dev/null
+++ b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/service/impl/MessageTemplateServiceImpl.java
@@ -0,0 +1,104 @@
+package com.ruoyi.modelMessage.service.impl;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.modelMessage.domain.MessageTemplate;
+import com.ruoyi.modelMessage.mapper.MessageTemplateMapper;
+import com.ruoyi.modelMessage.service.IMessageTemplateService;
+
+
+/**
+ * 模版管理Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2024-12-31
+ */
+@Service
+public class MessageTemplateServiceImpl implements IMessageTemplateService
+{
+ @Autowired
+ private MessageTemplateMapper messageTemplateMapper;
+
+ /**
+ * 查询模版管理
+ *
+ * @param templateId 模版管理主键
+ * @return 模版管理
+ */
+ @Override
+ public MessageTemplate selectMessageTemplateByTemplateId(Long templateId)
+ {
+ return messageTemplateMapper.selectMessageTemplateByTemplateId(templateId);
+ }
+
+ /**
+ * 查询模版管理列表
+ *
+ * @param messageTemplate 模版管理
+ * @return 模版管理
+ */
+ @Override
+ public List selectMessageTemplateList(MessageTemplate messageTemplate)
+ {
+ return messageTemplateMapper.selectMessageTemplateList(messageTemplate);
+ }
+
+ /**
+ * 新增模版管理
+ *
+ * @param messageTemplate 模版管理
+ * @return 结果
+ */
+ @Override
+ public int insertMessageTemplate(MessageTemplate messageTemplate)
+ {
+ messageTemplate.setCreateBy(SecurityUtils.getUsername());
+ messageTemplate.setCreateTime(DateUtils.getNowDate());
+ messageTemplate.setUpdateBy(SecurityUtils.getUsername());
+ messageTemplate.setUpdateTime(DateUtils.getNowDate());
+ return messageTemplateMapper.insertMessageTemplate(messageTemplate);
+ }
+
+ /**
+ * 修改模版管理
+ *
+ * @param messageTemplate 模版管理
+ * @return 结果
+ */
+ @Override
+ public int updateMessageTemplate(MessageTemplate messageTemplate)
+ {
+ messageTemplate.setUpdateBy(SecurityUtils.getUsername());
+ messageTemplate.setUpdateTime(DateUtils.getNowDate());
+ return messageTemplateMapper.updateMessageTemplate(messageTemplate);
+ }
+
+ /**
+ * 批量删除模版管理
+ *
+ * @param templateIds 需要删除的模版管理主键
+ * @return 结果
+ */
+ @Override
+ public int deleteMessageTemplateByTemplateIds(Long[] templateIds)
+ {
+ return messageTemplateMapper.deleteMessageTemplateByTemplateIds(templateIds);
+ }
+
+ /**
+ * 删除模版管理信息
+ *
+ * @param templateId 模版管理主键
+ * @return 结果
+ */
+ @Override
+ public int deleteMessageTemplateByTemplateId(Long templateId)
+ {
+ return messageTemplateMapper.deleteMessageTemplateByTemplateId(templateId);
+ }
+}
diff --git a/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/service/impl/MessageVariableServiceImpl.java b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/service/impl/MessageVariableServiceImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..dc64b3153c7785d21e0a6a5a7c80c0813b937baa
--- /dev/null
+++ b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/service/impl/MessageVariableServiceImpl.java
@@ -0,0 +1,144 @@
+package com.ruoyi.modelMessage.service.impl;
+
+import java.util.List;
+
+import org.apache.commons.lang3.RandomStringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.aliyun.oss.ServiceException;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.modelMessage.domain.MessageVariable;
+import com.ruoyi.modelMessage.mapper.MessageVariableMapper;
+import com.ruoyi.modelMessage.service.IMessageVariableService;
+
+/**
+ * 变量管理Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2024-12-31
+ */
+@Service
+public class MessageVariableServiceImpl implements IMessageVariableService
+{
+ private static final int CODE_LENGTH = 6;
+
+ @Autowired
+ private MessageVariableMapper messageVariableMapper;
+
+ /**
+ * 查询变量管理
+ *
+ * @param variableId 变量管理主键
+ * @return 变量管理
+ */
+ @Override
+ public MessageVariable selectMessageVariableByVariableId(Long variableId)
+ {
+ return messageVariableMapper.selectMessageVariableByVariableId(variableId);
+ }
+
+ /**
+ * 查询变量管理列表
+ *
+ * @param messageVariable 变量管理
+ * @return 变量管理
+ */
+ @Override
+ public List selectMessageVariableList(MessageVariable messageVariable)
+ {
+ return messageVariableMapper.selectMessageVariableList(messageVariable);
+ }
+
+ /**
+ * 新增变量管理
+ *
+ * @param messageVariable 变量管理
+ * @return 结果
+ */
+ @Override
+ public int insertMessageVariable(MessageVariable messageVariable)
+ {
+ messageVariable.setCreateBy(SecurityUtils.getUsername());
+ messageVariable.setCreateTime(DateUtils.getNowDate());
+ messageVariable.setUpdateBy(SecurityUtils.getUsername());
+ messageVariable.setUpdateTime(DateUtils.getNowDate());
+ return messageVariableMapper.insertMessageVariable(messageVariable);
+ }
+
+ /**
+ * 修改变量管理
+ *
+ * @param messageVariable 变量管理
+ * @return 结果
+ */
+ @Override
+ public int updateMessageVariable(MessageVariable messageVariable)
+ {
+ messageVariable.setUpdateBy(SecurityUtils.getUsername());
+ messageVariable.setUpdateTime(DateUtils.getNowDate());
+ return messageVariableMapper.updateMessageVariable(messageVariable);
+ }
+
+ /**
+ * 批量删除变量管理
+ *
+ * @param variableIds 需要删除的变量管理主键
+ * @return 结果
+ */
+ @Override
+ public int deleteMessageVariableByVariableIds(Long[] variableIds)
+ {
+ return messageVariableMapper.deleteMessageVariableByVariableIds(variableIds);
+ }
+
+ /**
+ * 删除变量管理信息
+ *
+ * @param variableId 变量管理主键
+ * @return 结果
+ */
+ @Override
+ public int deleteMessageVariableByVariableId(Long variableId)
+ {
+ return messageVariableMapper.deleteMessageVariableByVariableId(variableId);
+ }
+
+ //查询变量
+ @Override
+ public List selectMessageVariable() {
+ return messageVariableMapper.selectMessageVariable();
+ }
+
+ //删除变量之前检查一下有没有模版使用
+ @Override
+ public boolean selectTemplateByVariableId(String templateVariable) {
+ return messageVariableMapper.selectTemplateByVariableId(templateVariable);
+ }
+
+ //根据类型生成不同的变量内容
+ @Override
+ public String generateVariableContent(String variableType) {
+ switch (variableType) {
+ case "time":
+ return DateUtils.dateTimeNow("HH:mm:ss");
+ case "date":
+ return DateUtils.dateTimeNow("yyyy-MM-dd");
+ case "datetime":
+ return DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:ss");
+ case "addresser":
+ return SecurityUtils.getUsername();
+ case "recipients":
+ return SecurityUtils.getUsername();
+ case "RandomnDigits":
+ return RandomStringUtils.randomNumeric(CODE_LENGTH);
+ case "RandomnCharacters":
+ return RandomStringUtils.randomAlphabetic(CODE_LENGTH);
+ case "RandomN-digitLetters":
+ return RandomStringUtils.randomAlphanumeric(CODE_LENGTH);
+ default:
+ throw new ServiceException("不明确的类型 " + variableType);
+ }
+ }
+}
diff --git a/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/utils/MessageLogAspect.java b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/utils/MessageLogAspect.java
new file mode 100644
index 0000000000000000000000000000000000000000..7a5bfcfc17096d9ed6d91eb5cdf9731af829889f
--- /dev/null
+++ b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/utils/MessageLogAspect.java
@@ -0,0 +1,68 @@
+package com.ruoyi.modelMessage.utils;
+
+import java.lang.reflect.Method;
+
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.annotation.Order;
+import org.springframework.stereotype.Component;
+
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.modelMessage.annotation.MessageLog;
+import com.ruoyi.modelMessage.domain.MessageSystem;
+import com.ruoyi.modelMessage.enums.MessageType;
+import com.ruoyi.modelMessage.service.IMessageSystemService;
+
+@Aspect
+@Component
+@Order(1) //Aspect 的优先级
+public class MessageLogAspect {
+
+ private static final Logger logger = LoggerFactory.getLogger(MessageLogAspect.class);
+
+ @Autowired
+ private IMessageSystemService messageSystemService;
+
+ @Around("@annotation(messageLog)")
+ public Object handleMessageLog(ProceedingJoinPoint joinPoint, MessageLog messageLog) throws Throwable {
+ MethodSignature signature = (MethodSignature) joinPoint.getSignature();
+ Method method = signature.getMethod();
+ // 获取注解信息
+ String description = messageLog.description();
+ String title = messageLog.title();
+ MessageType messageType = messageLog.messageType();
+ boolean immediateLog = messageLog.immediateLog();
+ try {
+ Object result = joinPoint.proceed();
+ // 如果设置了true立即执行
+ if (immediateLog) {
+ logMessage(title, description, messageType);
+ }
+ return result;
+ } catch (Exception e) {
+ logger.error("消息记录失败,方法: {}, 描述: {}", method.getName(), description, e);
+ throw e;
+ }
+ }
+
+ private void logMessage(String title, String description, MessageType messageType) {
+ MessageSystem messageSystem = new MessageSystem();
+ messageSystem.setMessageTitle(title); // 标题
+ messageSystem.setCreateBy(SecurityUtils.getUsername()); // 发送人
+ messageSystem.setCreateTime(DateUtils.getNowDate()); // 发送时间
+ messageSystem.setMessageContent(description); // 信息内容
+ messageSystem.setMessageStatus("0"); // 默认为未读 0未读 1 已读
+ messageSystem.setMessageType(messageType.getCode());
+ messageSystem.setUpdateBy(SecurityUtils.getUsername()); // 修改人
+ messageSystem.setUpdateTime(DateUtils.getNowDate()); // 修改时间
+ messageSystem.setSendMode("0"); // 默认发送方式为平台
+ messageSystemService.insertMessageSystem(messageSystem);
+ logger.info("消息记录成功,标题: {}, 描述: {}, 类型: {}", title, description, messageType);
+ }
+}
diff --git a/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/utils/MessageSystemUtils.java b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/utils/MessageSystemUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..00cde678c0c634f5504bd2e477c798d032cff63d
--- /dev/null
+++ b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/utils/MessageSystemUtils.java
@@ -0,0 +1,229 @@
+package com.ruoyi.modelMessage.utils;
+
+import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.commons.lang3.RandomStringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.modelMessage.domain.MessageSystem;
+import com.ruoyi.modelMessage.domain.MessageTemplate;
+import com.ruoyi.modelMessage.domain.MessageVariable;
+import com.ruoyi.modelMessage.mapper.MessageTemplateMapper;
+import com.ruoyi.modelMessage.mapper.MessageVariableMapper;
+
+@Component
+public class MessageSystemUtils {
+
+ private static final String NUMERIC_CHARACTERS = "0123456789";
+ private static final int CODE_LENGTH = 6;
+
+ @Autowired
+ private MessageTemplateMapper messageTemplateMapper;
+
+ @Autowired
+ private MessageVariableMapper messageVariableMapper;
+
+ /**
+ * 解析输入字符串,提取模板代码和参数
+ *
+ * @param input 输入字符串
+ * @return 解析结果
+ */
+ public Map parseInput(String input) {
+ if (input == null) {
+ throw new ServiceException("输入内容不能为空!");
+ }
+ String templateCode = null;
+ String queryParams = "";
+ if (input.startsWith("SMS_")) {
+ int templateCodeEndIndex = input.indexOf('?');
+ if (templateCodeEndIndex != -1) {
+ templateCode = input.substring(0, templateCodeEndIndex);
+ queryParams = input.substring(templateCodeEndIndex + 1);
+ } else {
+ templateCode = input;
+ }
+ }
+ MessageTemplate templateContent = null;
+ List variableNames = new ArrayList<>();
+ if (templateCode != null) {
+ templateContent = messageTemplateMapper.selectMessageTemplateByTemplateCode(templateCode);
+ if (templateContent == null) {
+ throw new ServiceException("未找到该模版签名! " + templateCode);
+ }
+ variableNames = extractVariableNamesFromTemplate(templateContent);
+ }
+
+ Map params = new HashMap<>();
+ if (!queryParams.isEmpty()) {
+ for (String param : queryParams.split("&")) {
+ String[] keyValue = param.split("=", 2);
+ if (keyValue.length != 2) {
+ throw new ServiceException("无效的参数格式:" + param);
+ }
+ params.put(keyValue[0], URLDecoder.decode(keyValue[1], StandardCharsets.UTF_8));
+ }
+ }
+ if (templateContent != null) {
+ for (String varName : variableNames) {
+ if (!params.containsKey(varName)) {
+ params.put(varName, generateRandomCode(CODE_LENGTH));
+ }
+ }
+ }
+ return Map.of("templateCode", templateCode, "params", params,
+ "templateContent", templateContent != null ? templateContent.getTemplateContent() : input,
+ "variableNames", variableNames);
+ }
+
+ /**
+ * 生成指定长度的随机数字字符串
+ *
+ * @param length 长度
+ * @return 随机数字字符串
+ */
+ public String generateRandomCode(int length) {
+ Random random = new Random();
+ StringBuilder codeBuilder = new StringBuilder(length);
+ for (int i = 0; i < length; i++) {
+ int index = random.nextInt(NUMERIC_CHARACTERS.length());
+ char randomChar = NUMERIC_CHARACTERS.charAt(index);
+ codeBuilder.append(randomChar);
+ }
+ return codeBuilder.toString();
+ }
+
+ /**
+ * 提取模板中的变量名
+ *
+ * @param templateContent 模板内容
+ * @return 变量名列表
+ */
+ public List extractVariableNamesFromTemplate(MessageTemplate templateContent) {
+ List variableNames = new ArrayList<>();
+ Pattern pattern = Pattern.compile("\\$\\{(.*?)\\}");
+ Matcher matcher = pattern.matcher(templateContent.getTemplateContent());
+ while (matcher.find()) {
+ variableNames.add(matcher.group(1));
+ }
+ return variableNames;
+ }
+
+ /**
+ * 填充模板
+ *
+ * @param template 模板
+ * @param params 参数
+ * @return 填充后的模板
+ */
+ public String fillTemplate(String template, Map params) {
+ String filledTemplate = template;
+ for (Map.Entry entry : params.entrySet()) {
+ filledTemplate = filledTemplate.replace("${" + entry.getKey() + "}", entry.getValue());
+ }
+ return filledTemplate;
+ }
+
+ /**
+ * 清除内置变量的随机数字
+ *
+ * @param params 参数
+ */
+ public void clearBuiltInVariables(Map params) {
+ List builtInVariables = messageVariableMapper.selectMessageVariable();
+ for (MessageVariable variable : builtInVariables) {
+ String variableContent = variable.getVariableContent();
+ params.remove(variableContent);
+ }
+ }
+
+ /**
+ * 处理模板消息并填充内置变量
+ */
+ public String processTemplateMessage(MessageSystem messageSystem, String notificationContent) throws Exception {
+ Map parsedParams = parseInput(notificationContent);
+ String templateCode = (String) parsedParams.get("templateCode");
+ MessageTemplate templateContent = null;
+
+ if (templateCode != null) {
+ templateContent = messageTemplateMapper.selectMessageTemplateByTemplateCode(templateCode); //查询获取模版内容
+ }
+
+ @SuppressWarnings("unchecked")
+ Map params = (Map) parsedParams.get("params");
+
+ // 检查参数
+ List variableNames = new ArrayList<>();
+ if (templateContent != null) {
+ variableNames = extractVariableNamesFromTemplate(templateContent);
+ for (String varName : variableNames) {
+ if (!params.containsKey(varName)) {
+ throw new ServiceException("缺少参数: " + varName);
+ }
+ }
+ }
+ clearBuiltInVariables(params); // 清除内置变量
+ fillBuiltInVariables(params, messageSystem, variableNames);
+ // 如果未找到模板,使用原始内容作为模板
+ String templateContentStr = templateContent != null ? templateContent.getTemplateContent() : notificationContent;
+ return fillTemplate(templateContentStr, params);
+ }
+
+ /**
+ * 填充内置变量
+ *
+ * @param params 参数
+ * @param message 消息
+ * @param variableNames 变量名列表
+ */
+ public void fillBuiltInVariables(Map params, MessageSystem message, List variableNames) {
+ List builtInVariables = messageVariableMapper.selectMessageVariables(variableNames);
+ for (MessageVariable variable : builtInVariables) {
+ String variableContent = variable.getVariableContent();
+ String variableValue = "recipients".equals(variableContent) ? message.getMessageRecipient() : generateVariableContent(variableContent);
+ params.putIfAbsent(variableContent, variableValue);
+ }
+ }
+
+ /**
+ * 生成变量内容
+ *
+ * @param variableContent 变量内容
+ * @return 生成的变量内容
+ */
+ public String generateVariableContent(String variableContent) {
+ switch (variableContent) {
+ case "time":
+ return DateUtils.dateTimeNow("HH:mm:ss");
+ case "date":
+ return DateUtils.dateTimeNow("yyyy-MM-dd");
+ case "datetime":
+ return DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:ss");
+ case "addresser":
+ case "recipients":
+ return SecurityUtils.getUsername();
+ case "code":
+ return generateRandomCode(CODE_LENGTH); // 确保这里生成随机验证码
+ case "RandomnDigits":
+ return RandomStringUtils.randomNumeric(CODE_LENGTH);
+ case "RandomnCharacters":
+ return RandomStringUtils.randomAlphabetic(CODE_LENGTH);
+ case "RandomN-digitLetters":
+ return RandomStringUtils.randomAlphanumeric(CODE_LENGTH);
+ default:
+ throw new ServiceException("不明确的类型 " + variableContent);
+ }
+ }
+}
diff --git a/ruoyi-models/ruoyi-message/src/main/resources/mapper/modelMessage/MessageSystemMapper.xml b/ruoyi-models/ruoyi-message/src/main/resources/mapper/modelMessage/MessageSystemMapper.xml
new file mode 100644
index 0000000000000000000000000000000000000000..3ba71d3f4a9b3145ead79d7c1e7c1d8bcdcedcde
--- /dev/null
+++ b/ruoyi-models/ruoyi-message/src/main/resources/mapper/modelMessage/MessageSystemMapper.xml
@@ -0,0 +1,118 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select message_id, message_title, message_content, message_status, message_type, create_by, create_time, update_by, update_time, remark, message_recipient, send_mode, `code` from message_system
+
+
+
+
+
+
+
+ insert into message_system
+
+ message_title,
+ message_content,
+ message_status,
+ message_type,
+ create_by,
+ create_time,
+ update_by,
+ update_time,
+ remark,
+ message_recipient,
+ send_mode,
+ code,
+
+
+ #{messageTitle},
+ #{messageContent},
+ #{messageStatus},
+ #{messageType},
+ #{createBy},
+ #{createTime},
+ #{updateBy},
+ #{updateTime},
+ #{remark},
+ #{messageRecipient},
+ #{sendMode},
+ #{code},
+
+
+
+
+ update message_system
+
+ message_title = #{messageTitle},
+ message_content = #{messageContent},
+ message_status = #{messageStatus},
+ message_type = #{messageType},
+ create_by = #{createBy},
+ create_time = #{createTime},
+ update_by = #{updateBy},
+ update_time = #{updateTime},
+ remark = #{remark},
+ message_recipient = #{messageRecipient},
+ send_mode = #{sendMode},
+ code = #{code},
+
+ where message_system.message_id = #{messageId}
+
+
+
+ delete from message_system where message_id = #{messageId}
+
+
+
+ delete from message_system where message_id in
+
+ #{messageId}
+
+
+
+
+
+ INSERT INTO message_system (message_title, message_content, message_status, message_type, message_recipient,
+ send_mode, `code`, create_by, create_time, update_by, update_time, remark) VALUES
+
+ ( #{item.messageTitle}, #{item.messageContent}, #{item.messageStatus}, #{item.messageType},
+ #{item.messageRecipient}, #{item.sendMode}, #{item.code}, #{item.createBy}, NOW(), #{item.updateBy},
+ NOW(), #{item.remark} )
+
+
+
+
\ No newline at end of file
diff --git a/ruoyi-models/ruoyi-message/src/main/resources/mapper/modelMessage/MessageTemplateMapper.xml b/ruoyi-models/ruoyi-message/src/main/resources/mapper/modelMessage/MessageTemplateMapper.xml
new file mode 100644
index 0000000000000000000000000000000000000000..343c613a8782a4708e097bf6a85bf37cdf9cc7c3
--- /dev/null
+++ b/ruoyi-models/ruoyi-message/src/main/resources/mapper/modelMessage/MessageTemplateMapper.xml
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select template_id, template_name, template_code, template_type, template_content, template_variable, create_by, create_time, update_by, update_time, remark from message_template
+
+
+
+
+
+
+
+ insert into message_template
+
+ template_name,
+ template_code,
+ template_type,
+ template_content,
+ template_variable,
+ create_by,
+ create_time,
+ update_by,
+ update_time,
+ remark,
+
+
+ #{templateName},
+ #{templateCode},
+ #{templateType},
+ #{templateContent},
+ #{templateVariable},
+ #{createBy},
+ #{createTime},
+ #{updateBy},
+ #{updateTime},
+ #{remark},
+
+
+
+
+ update message_template
+
+ template_name = #{templateName},
+ template_code = #{templateCode},
+ template_type = #{templateType},
+ template_content = #{templateContent},
+ template_variable = #{templateVariable},
+ create_by = #{createBy},
+ create_time = #{createTime},
+ update_by = #{updateBy},
+ update_time = #{updateTime},
+ remark = #{remark},
+
+ where message_template.template_id = #{templateId}
+
+
+
+ delete from message_template where template_id = #{templateId}
+
+
+
+ delete from message_template where template_id in
+
+ #{templateId}
+
+
+
\ No newline at end of file
diff --git a/ruoyi-models/ruoyi-message/src/main/resources/mapper/modelMessage/MessageVariableMapper.xml b/ruoyi-models/ruoyi-message/src/main/resources/mapper/modelMessage/MessageVariableMapper.xml
new file mode 100644
index 0000000000000000000000000000000000000000..cea99595ad576b7311b02e799d53e7e0b6250565
--- /dev/null
+++ b/ruoyi-models/ruoyi-message/src/main/resources/mapper/modelMessage/MessageVariableMapper.xml
@@ -0,0 +1,92 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select variable_id, variable_name, variable_type, variable_content, create_by, create_time, update_by, update_time, remark from message_variable
+
+
+
+
+
+
+
+ insert into message_variable
+
+ variable_name,
+ variable_type,
+ variable_content,
+ create_by,
+ create_time,
+ update_by,
+ update_time,
+ remark,
+
+
+ #{variableName},
+ #{variableType},
+ #{variableContent},
+ #{createBy},
+ #{createTime},
+ #{updateBy},
+ #{updateTime},
+ #{remark},
+
+
+
+
+ update message_variable
+
+ variable_name = #{variableName},
+ variable_type = #{variableType},
+ variable_content = #{variableContent},
+ create_by = #{createBy},
+ create_time = #{createTime},
+ update_by = #{updateBy},
+ update_time = #{updateTime},
+ remark = #{remark},
+
+ where message_variable.variable_id = #{variableId}
+
+
+
+ delete from message_variable where variable_id = #{variableId}
+
+
+
+ delete from message_variable where variable_id in
+
+ #{variableId}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sql/mysql/message.sql b/sql/mysql/message.sql
new file mode 100644
index 0000000000000000000000000000000000000000..c5e4cdb5908e6acbdebc942f3be421502eec06e0
--- /dev/null
+++ b/sql/mysql/message.sql
@@ -0,0 +1,86 @@
+-- ----------------------------
+-- 消息系统
+-- ----------------------------
+-- 消息表
+DROP TABLE IF EXISTS `message_system`;
+CREATE TABLE `message_system` (
+ `message_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `message_title` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '标题',
+ `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建者',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
+ `send_mode` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '发送方式(0平台 1手机号 2 邮箱)',
+ `code` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '号码',
+ `message_content` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '消息内容',
+ `message_recipient` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '接收人',
+ `message_status` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '消息状态(0未读 1已读)',
+ `message_type` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '消息类型',
+ `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新者',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
+ `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
+ PRIMARY KEY (`message_id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 893 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '消息表' ROW_FORMAT = Dynamic;
+
+-- 模版表
+DROP TABLE IF EXISTS `message_template`;
+CREATE TABLE `message_template` (
+ `template_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `template_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '模版名称',
+ `template_code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '模版CODE',
+ `template_type` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '模版类型',
+ `template_content` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '模版内容',
+ `template_variable` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '变量属性',
+ `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建者',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
+ `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新者',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
+ `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
+ PRIMARY KEY (`template_id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 113 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '模版表' ROW_FORMAT = Dynamic;
+
+-- 变量表
+DROP TABLE IF EXISTS `message_variable`;
+CREATE TABLE `message_variable` (
+ `variable_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `variable_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '变量名称',
+ `variable_type` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '变量类型',
+ `variable_content` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '变量内容',
+ `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建者',
+ `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
+ `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新者',
+ `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
+ `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
+ PRIMARY KEY (`variable_id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 132 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '变量表' ROW_FORMAT = Dynamic;
+
+-- 消息系统菜单
+INSERT INTO `platform`.`sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2257, '消息管理', 2264, 0, 'messageSystem', 'modelMessage/messageSystem/index', NULL, '', 1, 0, 'C', '0', '0', 'modelMessage:messageSystem:list', '#', 'admin', '2024-12-21 15:00:31', 'admin', '2024-12-31 15:04:49', '消息管理菜单');
+INSERT INTO `platform`.`sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2258, '消息管理查询', 2257, 1, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:messageSystem:query', '#', 'admin', '2024-12-21 15:00:31', '', NULL, '');
+INSERT INTO `platform`.`sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2259, '消息管理新增', 2257, 2, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:messageSystem:add', '#', 'admin', '2024-12-21 15:00:31', '', NULL, '');
+INSERT INTO `platform`.`sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2260, '消息管理修改', 2257, 3, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:messageSystem:edit', '#', 'admin', '2024-12-21 15:00:31', '', NULL, '');
+INSERT INTO `platform`.`sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2261, '消息管理删除', 2257, 4, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:messageSystem:remove', '#', 'admin', '2024-12-21 15:00:31', '', NULL, '');
+INSERT INTO `platform`.`sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2262, '消息管理导出', 2257, 5, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:messageSystem:export', '#', 'admin', '2024-12-21 15:00:31', '', NULL, '');
+INSERT INTO `platform`.`sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2264, '消息系统', 0, 0, 'modelMessage', NULL, NULL, '', 1, 0, 'M', '0', '0', '', 'message', 'admin', '2024-12-31 11:57:29', 'xl', '2025-01-03 15:48:44', '');
+INSERT INTO `platform`.`sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2265, '模版管理', 2264, 1, 'template', 'modelMessage/template/index', NULL, '', 1, 0, 'C', '0', '0', 'modelMessage:template:list', '#', 'admin', '2024-12-31 14:59:52', '', NULL, '模版管理菜单');
+INSERT INTO `platform`.`sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2266, '模版管理查询', 2265, 1, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:template:query', '#', 'admin', '2024-12-31 14:59:52', '', NULL, '');
+INSERT INTO `platform`.`sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2267, '模版管理新增', 2265, 2, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:template:add', '#', 'admin', '2024-12-31 14:59:52', '', NULL, '');
+INSERT INTO `platform`.`sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2268, '模版管理修改', 2265, 3, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:template:edit', '#', 'admin', '2024-12-31 14:59:52', '', NULL, '');
+INSERT INTO `platform`.`sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2269, '模版管理删除', 2265, 4, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:template:remove', '#', 'admin', '2024-12-31 14:59:52', '', NULL, '');
+INSERT INTO `platform`.`sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2270, '模版管理导出', 2265, 5, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:template:export', '#', 'admin', '2024-12-31 14:59:52', '', NULL, '');
+INSERT INTO `platform`.`sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2271, '变量管理', 2264, 2, 'variable', 'modelMessage/variable/index', NULL, '', 1, 0, 'C', '0', '0', 'modelMessage:variable:list', '#', 'admin', '2024-12-31 15:01:50', 'admin', '2024-12-31 15:04:56', '变量管理菜单');
+INSERT INTO `platform`.`sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2272, '变量管理查询', 2271, 1, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:variable:query', '#', 'admin', '2024-12-31 15:01:50', '', NULL, '');
+INSERT INTO `platform`.`sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2273, '变量管理新增', 2271, 2, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:variable:add', '#', 'admin', '2024-12-31 15:01:50', '', NULL, '');
+INSERT INTO `platform`.`sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2274, '变量管理修改', 2271, 3, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:variable:edit', '#', 'admin', '2024-12-31 15:01:50', '', NULL, '');
+INSERT INTO `platform`.`sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2275, '变量管理删除', 2271, 4, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:variable:remove', '#', 'admin', '2024-12-31 15:01:50', '', NULL, '');
+INSERT INTO `platform`.`sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2276, '变量管理导出', 2271, 5, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:variable:export', '#', 'admin', '2024-12-31 15:01:50', '', NULL, '');
+
+-- 消息系统字典
+INSERT INTO `platform`.`sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (142, 0, '未读', '0', 'message_status', NULL, 'primary', 'N', '0', 'xl', '2024-12-21 15:13:02', '', NULL, NULL);
+INSERT INTO `platform`.`sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (143, 1, '已读', '1', 'message_status', NULL, 'success', 'N', '0', 'xl', '2024-12-21 15:13:15', 'xl', '2024-12-21 15:13:22', NULL);
+INSERT INTO `platform`.`sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (144, 0, '平台', '0', 'send_mode', NULL, 'primary', 'N', '0', 'xl', '2024-12-25 09:40:01', '', NULL, NULL);
+INSERT INTO `platform`.`sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (145, 1, '短信', '1', 'send_mode', NULL, 'success', 'N', '0', 'xl', '2024-12-25 09:40:16', 'xl', '2025-01-01 10:12:07', NULL);
+INSERT INTO `platform`.`sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (146, 2, '邮件', '2', 'send_mode', NULL, 'warning', 'N', '0', 'xl', '2024-12-25 09:40:28', 'xl', '2025-01-01 10:12:14', NULL);
+INSERT INTO `platform`.`sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (147, 0, '验证码', '0', 'template_type', NULL, 'primary', 'N', '0', 'xl', '2025-01-03 09:22:52', '', NULL, NULL);
+INSERT INTO `platform`.`sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (148, 0, '通知', '0', 'message_type', NULL, 'primary', 'N', '0', 'xl', '2025-01-03 15:12:29', '', NULL, NULL);
+INSERT INTO `platform`.`sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (149, 0, '提示', '1', 'message_type', NULL, 'success', 'N', '0', 'xl', '2025-01-03 15:12:41', 'xl', '2025-01-03 15:12:45', NULL);
+INSERT INTO `platform`.`sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (150, 1, '推广', '1', 'template_type', NULL, 'success', 'N', '0', 'xl', '2025-01-03 15:13:15', '', NULL, NULL);
+