This commit is contained in:
xd 2024-04-29 20:30:42 +08:00
parent 8b39b24151
commit 22fb459e53
4 changed files with 2 additions and 25 deletions

View File

@ -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;
/**
* 公告 信息操作处理
*

View File

@ -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);
}
}
}

View File

@ -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";

View File

@ -86,7 +86,7 @@
<span>{{item.sendUser}} 提交于 {{parseTime(item.sendTime, '{y}-{m}-{d} {h}:{i}:{s}')}}</span>
<el-button class="mb5" size="mini" :style="item.isRead==0?'float :right;background-color :#ffba00;border-color: #ffba00;': 'float :right;background-color :#c0c4cc;border-color: #c0c4cc;'" type="info">{{item.isRead=='1'?'已读':'未读'}}</el-button>
<div style="width:100%;height:1px;margin:0px auto;padding:0px;overflow:hidden;background-color: #c0c4ccab"></div>
<el-link :underline="false" @click="clickMoreNote(item)" style="color:#46a6ff;margin-top :10px">详情</el-link>
<el-link :underline="false" @click="clickMoreNote(item)" style="color:#46a6ff;margin-top :10px">查看详情</el-link>
</el-card>
</el-timeline-item>
</el-timeline>