From 9736e669553114b57cc13d0ea7c8df4566750196 Mon Sep 17 00:00:00 2001 From: Kelvin Date: Mon, 6 Jan 2025 17:22:19 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=B6=88=E6=81=AF):=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E2=80=9C=E6=96=B0=E5=A2=9E=E6=B6=88=E6=81=AF=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E2=80=9D=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/service/ISysMessageService.java | 9 ++++ .../service/impl/SysMessageServiceImpl.java | 51 +++++++++++-------- 2 files changed, 39 insertions(+), 21 deletions(-) diff --git a/ktg-system/src/main/java/com/ktg/system/service/ISysMessageService.java b/ktg-system/src/main/java/com/ktg/system/service/ISysMessageService.java index 47981ed..f024226 100644 --- a/ktg-system/src/main/java/com/ktg/system/service/ISysMessageService.java +++ b/ktg-system/src/main/java/com/ktg/system/service/ISysMessageService.java @@ -35,6 +35,15 @@ public interface ISysMessageService */ public int insertSysMessage(SysMessage sysMessage); + /** + * 新增消息提示 + * + * @param title 标题 + * @param content 内容 + * @return 结果 + */ + public int insertSysPromptMessage(String title,String content); + /** * 修改消息 * diff --git a/ktg-system/src/main/java/com/ktg/system/service/impl/SysMessageServiceImpl.java b/ktg-system/src/main/java/com/ktg/system/service/impl/SysMessageServiceImpl.java index ecf4af2..c74e602 100644 --- a/ktg-system/src/main/java/com/ktg/system/service/impl/SysMessageServiceImpl.java +++ b/ktg-system/src/main/java/com/ktg/system/service/impl/SysMessageServiceImpl.java @@ -1,6 +1,7 @@ package com.ktg.system.service.impl; import java.util.List; + import com.ktg.common.utils.DateUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -10,87 +11,95 @@ import com.ktg.system.service.ISysMessageService; /** * 消息Service业务层处理 - * + * * @author yinjinlu * @date 2023-03-06 */ @Service -public class SysMessageServiceImpl implements ISysMessageService -{ +public class SysMessageServiceImpl implements ISysMessageService { @Autowired private SysMessageMapper sysMessageMapper; /** * 查询消息 - * + * * @param messageId 消息主键 * @return 消息 */ @Override - public SysMessage selectSysMessageByMessageId(Long messageId) - { + public SysMessage selectSysMessageByMessageId(Long messageId) { return sysMessageMapper.selectSysMessageByMessageId(messageId); } /** * 查询消息列表 - * + * * @param sysMessage 消息 * @return 消息 */ @Override - public List selectSysMessageList(SysMessage sysMessage) - { + public List selectSysMessageList(SysMessage sysMessage) { return sysMessageMapper.selectSysMessageList(sysMessage); } /** * 新增消息 - * + * * @param sysMessage 消息 * @return 结果 */ @Override - public int insertSysMessage(SysMessage sysMessage) - { + public int insertSysMessage(SysMessage sysMessage) { sysMessage.setCreateTime(DateUtils.getNowDate()); return sysMessageMapper.insertSysMessage(sysMessage); } + @Override + public int insertSysPromptMessage(String title, String content) { + // 创建消息通知 + SysMessage sysMessage = new SysMessage(); + sysMessage.setMessageType("PROMPT"); + sysMessage.setMessageLevel("A"); + sysMessage.setMessageTitle(title); + sysMessage.setMessageContent(content); + // TODO 当前仅向admin用户推送消息,后续会指定用户 + sysMessage.setRecipientId(1L); + sysMessage.setRecipientName("admin"); + sysMessage.setRecipientNick("若依"); + return sysMessageMapper.insertSysMessage(sysMessage); + } + /** * 修改消息 - * + * * @param sysMessage 消息 * @return 结果 */ @Override - public int updateSysMessage(SysMessage sysMessage) - { + public int updateSysMessage(SysMessage sysMessage) { sysMessage.setUpdateTime(DateUtils.getNowDate()); return sysMessageMapper.updateSysMessage(sysMessage); } /** * 批量删除消息 - * + * * @param messageIds 需要删除的消息主键 * @return 结果 */ @Override - public int deleteSysMessageByMessageIds(Long[] messageIds) - { + public int deleteSysMessageByMessageIds(Long[] messageIds) { return sysMessageMapper.deleteSysMessageByMessageIds(messageIds); } /** * 删除消息信息 - * + * * @param messageId 消息主键 * @return 结果 */ @Override - public int deleteSysMessageByMessageId(Long messageId) - { + public int deleteSysMessageByMessageId(Long messageId) { return sysMessageMapper.deleteSysMessageByMessageId(messageId); } }