refactor(notification): 使用雪花算法ID生成器替换System.currentTimeMillis()

This commit is contained in:
wangzhiwei 2026-05-25 10:09:47 +08:00
parent f06e895eb1
commit 1307216327

View File

@ -1,5 +1,6 @@
package art.kexue.sxwz.service.impl; package art.kexue.sxwz.service.impl;
import art.kexue.sxwz.common.util.IDUtils;
import art.kexue.sxwz.entity.EduCourseStudent; import art.kexue.sxwz.entity.EduCourseStudent;
import art.kexue.sxwz.entity.SysNotification; import art.kexue.sxwz.entity.SysNotification;
import art.kexue.sxwz.entity.SysUser; import art.kexue.sxwz.entity.SysUser;
@ -219,7 +220,7 @@ public class SysNotificationServiceImpl implements SysNotificationService {
String content, Integer type, Long senderId, String content, Integer type, Long senderId,
String senderName, Integer targetType) { String senderName, Integer targetType) {
SysNotification notification = new SysNotification(); SysNotification notification = new SysNotification();
notification.setId(System.currentTimeMillis()); notification.setId(IDUtils.getSnowflakeId());
notification.setSchoolId(schoolId); notification.setSchoolId(schoolId);
notification.setUserId(userId); notification.setUserId(userId);
notification.setTitle(title); notification.setTitle(title);