'123'
This commit is contained in:
parent
9681fd1a48
commit
ad34d7e219
|
@ -1,5 +1,6 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -9,6 +10,7 @@ import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.ruoyi.common.constant.WebsocketConst;
|
import com.ruoyi.common.constant.WebsocketConst;
|
||||||
import com.ruoyi.framework.websocket.WebSocketServer;
|
import com.ruoyi.framework.websocket.WebSocketServer;
|
||||||
import com.ruoyi.framework.websocket.WebSocketUsers;
|
import com.ruoyi.framework.websocket.WebSocketUsers;
|
||||||
|
import com.ruoyi.system.domain.SysNoticeUser;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
@ -28,6 +30,8 @@ import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.system.domain.SysNotice;
|
import com.ruoyi.system.domain.SysNotice;
|
||||||
import com.ruoyi.system.service.ISysNoticeService;
|
import com.ruoyi.system.service.ISysNoticeService;
|
||||||
|
|
||||||
|
import javax.websocket.Session;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公告 信息操作处理
|
* 公告 信息操作处理
|
||||||
*
|
*
|
||||||
|
@ -79,7 +83,12 @@ public class SysNoticeController extends BaseController
|
||||||
obj.put(WebsocketConst.MSG_ID, notice.getNoticeId());
|
obj.put(WebsocketConst.MSG_ID, notice.getNoticeId());
|
||||||
obj.put(WebsocketConst.MSG_TITLE, notice.getNoticeTitle());
|
obj.put(WebsocketConst.MSG_TITLE, notice.getNoticeTitle());
|
||||||
obj.put(WebsocketConst.MSG_CONTENT, notice.getNoticeContent());
|
obj.put(WebsocketConst.MSG_CONTENT, notice.getNoticeContent());
|
||||||
|
if(!"3".equals(notice.getNoticeType())){//系统通知 或 通知公告
|
||||||
WebSocketUsers.sendMessageToUsersByText(obj.toString());
|
WebSocketUsers.sendMessageToUsersByText(obj.toString());
|
||||||
|
SysNoticeUser sysNoticeUser = new SysNoticeUser();
|
||||||
|
sysNoticeUser.setNoticeId(notice.getNoticeId());
|
||||||
|
sysNoticeUser.setUserId(notice.getNoticeId());
|
||||||
|
}
|
||||||
|
|
||||||
return toAjax(noticeService.insertNotice(notice));
|
return toAjax(noticeService.insertNotice(notice));
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.ruoyi.system.domain;
|
||||||
|
|
||||||
|
public class SysNoticeUser {
|
||||||
|
private Long noticeId;
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
public Long getNoticeId() {
|
||||||
|
return noticeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNoticeId(Long noticeId) {
|
||||||
|
this.noticeId = noticeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(Long userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,7 +9,7 @@
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
<el-tabs v-model="activeName" @tab-click="handleClick" style="width:100%">
|
<el-tabs v-model="activeName" @tab-click="handleClick" style="width:100%">
|
||||||
<el-tab-pane label="系统通知" name="first">
|
<el-tab-pane label="系统通知" name="first">
|
||||||
<el-dropdown-item v-for="(item,index) in noticeData" :key="index" >
|
<el-dropdown-item v-for="(item,index) in noticeData" :key="index">
|
||||||
<el-link :underline="false" @click="clickNote(item)" :style="index==0?'': 'margin-top :15px'">{{item.noticeTitle}}</el-link>
|
<el-link :underline="false" @click="clickNote(item)" :style="index==0?'': 'margin-top :15px'">{{item.noticeTitle}}</el-link>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-link :underline="false" style="margin-top :15px" v-if="noticeData.length>5" type="primary">更多消息</el-link>
|
<el-link :underline="false" style="margin-top :15px" v-if="noticeData.length>5" type="primary">更多消息</el-link>
|
||||||
|
@ -39,12 +39,6 @@
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
activeName: 'first',
|
activeName: 'first',
|
||||||
// 查询参数
|
|
||||||
queryParams: {
|
|
||||||
pageNum: 1,
|
|
||||||
pageSize: 5,
|
|
||||||
readFlag: '0'
|
|
||||||
},
|
|
||||||
noteTotal: '',
|
noteTotal: '',
|
||||||
// 公告
|
// 公告
|
||||||
sysLog: [],
|
sysLog: [],
|
||||||
|
@ -67,12 +61,14 @@
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getList() {
|
getList() {
|
||||||
this.noticeData = []
|
this.noticeData = [];
|
||||||
this.sysLog = []
|
this.sysLog = [];
|
||||||
navbarNoticelist(this.queryParams).then(res => {
|
navbarNoticelist(this.queryParams).then(res => {
|
||||||
console.log(res[1])
|
var noticeData = res[1]?res[1]:[];
|
||||||
this.noticeData = res[1]?res[1]:[];
|
this.noticeData = noticeData.slice(0,5);
|
||||||
this.sysLog = res[2]?res[2]:[];
|
|
||||||
|
var sysLog = res[2]?res[2]:[];
|
||||||
|
this.sysLog = sysLog.slice(0,5);
|
||||||
|
|
||||||
this.noteTotal = this.noticeData.length+this.sysLog.length;
|
this.noteTotal = this.noticeData.length+this.sysLog.length;
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue