first commit
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>skins-service</artifactId>
|
||||
<version>4.8.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>message-service</artifactId>
|
||||
|
||||
<description>
|
||||
消息通知统一发送模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>skins-model</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.ruoyi.message.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.domain.other.TtNotice;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 消息通知 Mapper。
|
||||
*/
|
||||
@Mapper
|
||||
public interface MessageMapper extends BaseMapper<TtNotice> {
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.ruoyi.message.service;
|
||||
|
||||
/**
|
||||
* 消息通知统一发送服务。
|
||||
* <p>
|
||||
* 负责向 tt_notice 表写入用户通知,供邮件/消息中心展示。
|
||||
*/
|
||||
public interface MessageService {
|
||||
|
||||
/**
|
||||
* 发送通知(不带分类,兼容旧调用)。
|
||||
*/
|
||||
void sendNotice(Long userId, String title, String content);
|
||||
|
||||
/**
|
||||
* 发送通知(带消息分类)。
|
||||
*
|
||||
* @param category 分类 code,如 GAME_PVP_TOP / SYS_VIP_REBATE
|
||||
*/
|
||||
void sendNotice(Long userId, String title, String content, String category);
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package com.ruoyi.message.service.impl;
|
||||
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.domain.other.TtNotice;
|
||||
import com.ruoyi.message.mapper.MessageMapper;
|
||||
import com.ruoyi.message.service.MessageService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 消息通知统一发送服务实现。
|
||||
*/
|
||||
@Service
|
||||
public class MessageServiceImpl implements MessageService {
|
||||
|
||||
@Autowired
|
||||
private MessageMapper messageMapper;
|
||||
|
||||
@Override
|
||||
public void sendNotice(Long userId, String title, String content) {
|
||||
sendNotice(userId, title, content, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendNotice(Long userId, String title, String content, String category) {
|
||||
TtNotice notice = new TtNotice();
|
||||
notice.setUserId(userId);
|
||||
notice.setTitle(title);
|
||||
notice.setContent(content);
|
||||
notice.setRead("0");
|
||||
notice.setCategory(category);
|
||||
notice.setCreateTime(DateUtils.getNowDate());
|
||||
messageMapper.insert(notice);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user