From 22fb459e532c6d211cf056f62e1bb18286e0a768 Mon Sep 17 00:00:00 2001 From: xd Date: Mon, 29 Apr 2024 20:30:42 +0800 Subject: [PATCH] 123 --- .../web/controller/system/SysNoticeController.java | 14 -------------- .../com/ruoyi/web/utils/SendNotice/NoticeUtil.java | 9 --------- .../com/ruoyi/common/constant/WebsocketConst.java | 2 +- ruoyi-ui/src/layout/components/NavbarNotice.vue | 2 +- 4 files changed, 2 insertions(+), 25 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java index 21856c2..3c73c51 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java @@ -1,23 +1,12 @@ package com.ruoyi.web.controller.system; -import java.io.IOException; import java.util.*; import java.util.stream.Collectors; - -import com.alibaba.fastjson2.JSONObject; -import com.ruoyi.common.constant.CacheConstants; -import com.ruoyi.common.constant.RedisConstant; -import com.ruoyi.common.constant.WebsocketConst; import com.ruoyi.common.core.domain.model.LoginUser; -import com.ruoyi.common.core.redis.RedisCache; -import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.framework.websocket.WebSocket; import com.ruoyi.system.domain.NoticeUserSelect; import com.ruoyi.system.domain.SysNoticeUser; -import com.ruoyi.system.domain.SysUserOnline; import com.ruoyi.web.utils.SendNotice.NoticeUtil; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.DeleteMapping; @@ -36,9 +25,6 @@ import com.ruoyi.common.enums.BusinessType; import com.ruoyi.system.domain.SysNotice; import com.ruoyi.system.service.ISysNoticeService; -import javax.annotation.PostConstruct; -import javax.websocket.Session; - /** * 公告 信息操作处理 * diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/utils/SendNotice/NoticeUtil.java b/ruoyi-admin/src/main/java/com/ruoyi/web/utils/SendNotice/NoticeUtil.java index e8cc2a5..a698c22 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/utils/SendNotice/NoticeUtil.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/utils/SendNotice/NoticeUtil.java @@ -6,16 +6,12 @@ import com.ruoyi.common.constant.WebsocketConst; import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.framework.websocket.redisWebsocket.WebsocketService; import com.ruoyi.system.domain.SysNotice; import com.ruoyi.system.domain.SysNoticeUser; import com.ruoyi.system.service.ISysNoticeService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.MessageSource; - -import javax.annotation.PostConstruct; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; @@ -43,19 +39,14 @@ public class NoticeUtil { obj.put(WebsocketConst.MSG_CONTENT, notice.getNoticeContent()); if(!"3".equals(notice.getNoticeType())){//系统通知 或 通知公告 - wbService.sendMessageAll("ruoyi",obj.toString()); - insertNoticeUser(loginUser,notice,noticeService,null); - }else{ if(userIds!=null&&userIds.size()>0){ for(String userId:userIds){ wbService.sendMessageById("ruoyi",userId,obj.toString()); } - insertNoticeUser(loginUser,notice,noticeService,userIds); - } } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/WebsocketConst.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/WebsocketConst.java index 1b1f458..7649d2c 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/WebsocketConst.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/WebsocketConst.java @@ -5,7 +5,7 @@ package com.ruoyi.common.constant; * * @author ruoyi */ -public class Const { +public class WebsocketConst { /** 消息ID */ public static final String MSG_ID = "noticeId"; diff --git a/ruoyi-ui/src/layout/components/NavbarNotice.vue b/ruoyi-ui/src/layout/components/NavbarNotice.vue index 5f6928d..90d0bd5 100644 --- a/ruoyi-ui/src/layout/components/NavbarNotice.vue +++ b/ruoyi-ui/src/layout/components/NavbarNotice.vue @@ -86,7 +86,7 @@ {{item.sendUser}} 提交于 {{parseTime(item.sendTime, '{y}-{m}-{d} {h}:{i}:{s}')}} {{item.isRead=='1'?'已读':'未读'}}
- 详情 + 查看详情