!93 新增消息通知

Merge pull request !93 from 山东云则/hotfix_poster
This commit is contained in:
山东云则
2025-02-28 03:17:41 +00:00
committed by Gitee
10 changed files with 311 additions and 13 deletions
@@ -57,8 +57,8 @@ public class RabbitMQConnection {
connectionFactory.setPort(5672);
connectionFactory.setRequestedHeartbeat( 40 );
//4.设置账户和密码
connectionFactory.setUsername("AhZywl#Mq");
connectionFactory.setPassword("ZhiYuanWuLian@0317");
connectionFactory.setUsername("test");
connectionFactory.setPassword("test@2018");
//5.设置VirtualHost
connectionFactory.setVirtualHost("/VirtualHosts");
return connectionFactory.newConnection();
@@ -0,0 +1,44 @@
package com.yunze.common.constant;
/**
* 缓存的key 常量
*
* @author ruoyi
*/
public class CacheConstants
{
/**
* 登录用户 redis key
*/
public static final String LOGIN_TOKEN_KEY = "login_tokens:";
/**
* 验证码 redis key
*/
public static final String CAPTCHA_CODE_KEY = "captcha_codes:";
/**
* 参数管理 cache key
*/
public static final String SYS_CONFIG_KEY = "sys_config:";
/**
* 字典管理 cache key
*/
public static final String SYS_DICT_KEY = "sys_dict:";
/**
* 防重提交 redis key
*/
public static final String REPEAT_SUBMIT_KEY = "repeat_submit:";
/**
* 限流 redis key
*/
public static final String RATE_LIMIT_KEY = "rate_limit:";
/**
* 登录账户密码错误次数 redis key
*/
public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:";
}
@@ -0,0 +1,16 @@
package com.yunze.common.exception.user;
/**
* 黑名单IP异常类
*
* @author ruoyi
*/
public class BlackListException extends UserException
{
private static final long serialVersionUID = 1L;
public BlackListException()
{
super("login.blocked", null);
}
}
@@ -0,0 +1,16 @@
package com.yunze.common.exception.user;
/**
* 用户不存在异常类
*
* @author ruoyi
*/
public class UserNotExistsException extends UserException
{
private static final long serialVersionUID = 1L;
public UserNotExistsException()
{
super("user.not.exists", null);
}
}
@@ -0,0 +1,16 @@
package com.yunze.common.exception.user;
/**
* 用户错误最大次数异常类
*
* @author ruoyi
*/
public class UserPasswordRetryLimitExceedException extends UserException
{
private static final long serialVersionUID = 1L;
public UserPasswordRetryLimitExceedException(int retryLimitCount, int lockTime)
{
super("user.password.retry.limit.exceed", new Object[] { retryLimitCount, lockTime });
}
}
@@ -0,0 +1,28 @@
package com.yunze.framework.security.context;
import org.springframework.security.core.Authentication;
/**
* 身份验证信息
*
* @author ruoyi
*/
public class AuthenticationContextHolder
{
private static final ThreadLocal<Authentication> contextHolder = new ThreadLocal<>();
public static Authentication getContext()
{
return contextHolder.get();
}
public static void setContext(Authentication context)
{
contextHolder.set(context);
}
public static void clearContext()
{
contextHolder.remove();
}
}
@@ -0,0 +1,27 @@
package com.yunze.framework.security.context;
import com.yunze.common.core.text.Convert;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
/**
* 权限信息
*
* @author ruoyi
*/
public class PermissionContextHolder
{
private static final String PERMISSION_CONTEXT_ATTRIBUTES = "PERMISSION_CONTEXT";
public static void setContext(String permission)
{
RequestContextHolder.currentRequestAttributes().setAttribute(PERMISSION_CONTEXT_ATTRIBUTES, permission,
RequestAttributes.SCOPE_REQUEST);
}
public static String getContext()
{
return Convert.toStr(RequestContextHolder.currentRequestAttributes().getAttribute(PERMISSION_CONTEXT_ATTRIBUTES,
RequestAttributes.SCOPE_REQUEST));
}
}
@@ -40,6 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND create_by like CONCAT( #{createBy}, '%')
</if>
</where>
ORDER BY create_time DESC
</select>
<insert id="insertNotice" parameterType="SysNotice">
@@ -0,0 +1,101 @@
<template>
<div class="app-container">
<el-drawer
title="消息通知"
:loading="loading"
:visible.sync="openNotification"
>
<div v-if="showData===true" v-for="item in tableData" style="justify-content: inherit;width: 100%;height: 19%;border-radius: 2%">
<div style="margin-top: 100px;margin-bottom: -40px;margin-left: 16px;background-color: #7171C6"/>
<div style="padding-top: 10px;margin-left: 16px">
<svg style="margin-bottom: -4px;" t="1740377210197" class="icon" viewBox="0 0 1025 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2576" width="20" height="20"><path d="M336.457143 336.457143m-336.457143 0a336.457143 336.457143 0 1 0 672.914286 0 336.457143 336.457143 0 1 0-672.914286 0Z" fill="#8CF6FB" p-id="2577"></path><path d="M592.457143 1024c-11.702857 0-21.942857-4.388571-30.72-13.165714 0 0-333.531429-175.542857-337.92-175.542857H93.622857c-48.274286 0-87.771429-39.497143-87.771428-87.771429V296.96c0-48.274286 39.497143-87.771429 86.308571-87.771429h131.657143L561.737143 13.165714c7.314286-8.777143 19.017143-13.165714 30.72-13.165714 23.405714 0 43.885714 19.017143 43.885714 43.885714v936.228572c0 24.868571-19.017143 43.885714-43.885714 43.885714z m-29.257143-921.6L269.165714 269.165714c-13.165714 8.777143-27.794286 14.628571-42.422857 14.628572h-131.657143c-7.314286 0-14.628571 5.851429-14.628571 14.628571v452.022857c0 7.314286 5.851429 14.628571 14.628571 14.628572h130.194286c8.777143 0 17.554286 1.462857 26.331429 4.388571 11.702857 5.851429 283.794286 137.508571 313.051428 156.525714L563.2 102.4z" fill="#3C2DCB" p-id="2578"></path><path d="M904.045714 792.868571c-7.314286 7.314286-16.091429 11.702857-26.331428 11.702858s-19.017143-4.388571-26.331429-10.24c-14.628571-14.628571-14.628571-36.571429 0-51.2 128.731429-128.731429 133.12-334.994286 5.851429-465.188572l-7.314286-7.314286c-14.628571-14.628571-14.628571-36.571429 0-51.2s38.034286-14.628571 52.662857 0c157.988571 153.6 160.914286 408.137143 7.314286 566.125715 0 2.925714-2.925714 4.388571-5.851429 7.314285z m-138.971428-102.4c-7.314286 7.314286-16.091429 10.24-26.331429 10.24s-19.017143-4.388571-26.331428-10.24c-14.628571-13.165714-14.628571-35.108571-1.462858-49.737142l1.462858-1.462858c70.217143-65.828571 74.605714-175.542857 8.777142-245.76l-8.777142-8.777142c-14.628571-13.165714-14.628571-35.108571-1.462858-49.737143l1.462858-1.462857c14.628571-14.628571 38.034286-14.628571 52.662857 0 98.011429 92.16 103.862857 245.76 11.702857 345.234285-4.388571 2.925714-7.314286 7.314286-11.702857 11.702857z" fill="#D098FF" p-id="2579"></path></svg>
<label style="margin-left: 10px;margin-top: 10px">{{item.noticeTitle}}</label>
<p style="margin-left: 30px" class="text-ellipsis">{{item.noticeContent.substring(3)}}</p>
<p style="margin-left: 30px">通知时间{{item.createTime}}</p>
<p style="margin-left: 30px">通知单位河北石家庄大象电子</p>
<div style="margin-left: 30px"><el-button @click="detailNotice(item)" type="text">查看详情</el-button></div>
<el-divider></el-divider>
</div>
</div>
<div v-if="showData===false">
<el-empty description="暂无系统消息"></el-empty>
</div>
</el-drawer>
<!-- 添加或修改公告对话框 -->
<el-dialog center="center" :title="'关于'+form.noticeTitle+'通知'" v-model="form" :visible.sync="open" width="666px" append-to-body>
<el-divider></el-divider>
<el-card>
<div slot="header" class="clearfix">
<span style="font-size: 18px;color: #222222;line-height: 24px">内容如下</span>
</div>
<p style="font-weight: 500;font-size: 16px;text-align: justify;line-height: 1.5;word-break: break-word">{{replaceContent(form.noticeContent)}}</p>
</el-card>
</el-dialog>
</div>
</template>
<script>
import {getNotice} from '../../api/system/notice'
import Editor from '@/components/Editor';
export default {
name: 'notification',
props:["params"],
components: {
Editor
},
data(){
return{
openNotification:false,
tableData:[],
// 表单参数
form: {},
showData:false,
loading:false,
title:"",
open:false
}
},
created() {
this.currentNotifices()
},
mounted() {
},
methods:{
replaceContent(va){
if (va){
var replace = va.replace(/<\/?p>/g, '')
return replace;
}
},
currentNotifices(){
if (this.tableData.length>0){
this.showData=true
}else {
this.showData=false
}
this.loading=true;
this.tableData=this.params;
this.openNotification=true;
this.loading=false;
},
/** 修改按钮操作 */
detailNotice(row) {
const noticeId = row.noticeId || this.ids
getNotice(noticeId).then(response => {
this.form = response.data;
this.open = true;
this.title = "公告详情";
});
},
}
}
</script>
<style scoped>
.text-ellipsis{
overflow:hidden;
white-space: nowrap;
text-overflow: ellipsis;
-o-text-overflow:ellipsis;
}
</style>
+60 -11
View File
@@ -15,16 +15,16 @@
<div class="right-menu">
<template v-if="device!=='mobile'">
<my-card-header-search id="my-card-header-search" class="right-menu-item" />
<!--<search id="header-search" class="right-menu-item" />-->
<!--<el-tooltip content="源码地址" effect="dark" placement="bottom">
<ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />
</el-tooltip>-->
<el-badge :is-dot="notifyValue" class="item">
<el-button size="medium" style="margin-bottom: 36px" type="text" @click="showNotifices">
<svg t="1740368951521" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5137" width="26" height="26"><path d="M936.896266 820.049793c-59.485477-80.73029-93.477178-178.456432-93.477179-276.182573v-59.485477c0-144.46473-93.477178-263.435685-220.946058-310.174274 8.497925-16.995851 12.746888-33.991701 12.746888-55.236515C630.970954 55.236515 579.983402 0 512 0S393.029046 55.236515 393.029046 118.970954c0 21.244813 4.248963 38.240664 12.746888 55.236515-127.46888 42.489627-220.946058 165.709544-220.946058 310.174274v59.485477c0 101.975104-33.991701 199.701245-93.477179 276.182573-8.497925 12.746888-12.746888 29.742739-4.248963 46.738589 8.497925 12.746888 21.244813 25.493776 38.240664 25.493776h225.195021c16.995851 76.481328 84.979253 131.717842 165.709544 131.717842s148.713693-55.236515 165.709543-131.717842h220.946058c16.995851 0 29.742739-8.497925 38.240664-25.493776 4.248963-16.995851 4.248963-33.991701-4.248962-46.738589zM478.008299 118.970954c0-16.995851 12.746888-33.991701 33.991701-33.991701s33.991701 16.995851 33.991701 33.991701-12.746888 38.240664-33.991701 38.240664-33.991701-16.995851-33.991701-38.240664zM512 934.771784c-33.991701 0-59.485477-16.995851-76.481328-46.738589h152.962656c-16.995851 29.742739-42.489627 46.738589-76.481328 46.738589z m-310.174274-131.717842c42.489627-80.73029 67.983402-169.958506 67.983403-263.435685v-59.485477c0-135.966805 110.473029-242.190871 242.190871-242.190871s242.190871 110.473029 242.190871 242.190871v59.485477c0 89.228216 25.493776 182.705394 67.983403 263.435685H201.825726z" fill="#374151" p-id="5138"></path></svg>
</el-button>
</el-badge>
<el-tooltip content="执行日志" effect="dark" placement="bottom">
<router-link :to="'/card/ExecutionTask/'" class="link-type">
<svg-icon icon-class="download" class="right-menu-item hover-effect" style="width: 45px" class-name="card-panel-icon"/>
@@ -40,7 +40,6 @@
<el-tooltip content="布局大小" effect="dark" placement="bottom">
<size-select id="size-select" class="right-menu-item hover-effect" />
</el-tooltip>
</template>
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
@@ -61,6 +60,7 @@
</el-dropdown-menu>
</el-dropdown>
</div>
<notification v-if="visable" ref="toNotifices" :params="noticeList"/>
</div>
</template>
@@ -75,21 +75,40 @@ import SizeSelect from '@/components/SizeSelect'
import YunZeGit from '@/components/RuoYi/Git'
import YunZeDoc from '@/components/RuoYi/Doc'
import MyCardHeaderSearch from '@/components/MyCardHeaderSearch'
import Notification from '@/components/message/notification'
import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/system/notice";
export default {
components: {
Notification,
MyCardHeaderSearch,
Breadcrumb,
TopNav,
Hamburger,
Screenfull,
SizeSelect,
YunZeGit,
YunZeDoc
},
data(){
return{
visable:false,
notifyValue:0,
noticeList:[], // 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
noticeTitle: undefined,
createBy: undefined,
status: undefined
},
}
},
created() {
this.getList()
},
/*Search,*/
computed: {
...mapGetters([
@@ -115,9 +134,33 @@ export default {
}
},
methods: {
/** 查询公告列表 */
getList() {
listNotice(this.queryParams).then(response => {
this.noticeList = response.rows;
this.notifyValue = response.total;
// if (this.notifyValue>0){
// this.$notify({
// title: '提示',
// offset: 70,
// message: '您当前有未读的消息,请注意查看 !',
// type: 'success',
// onClick: () => {
// this.visable=true;
// this.$refs.toNotifices.currentNotifices();
// }
// });
// }
});
},
toggleSideBar() {
this.$store.dispatch('app/toggleSideBar')
},
showNotifices(){
this.getList()
this.visable=true;
this.$refs.toNotifices.currentNotifices();
},
async logout() {
this.$confirm('确定注销并退出系统吗?', '提示', {
confirmButtonText: '确定',
@@ -133,7 +176,14 @@ export default {
}
</script>
<style lang="scss" scoped>
<style lang="scss">
.el-badge__content.is-fixed {
position: absolute;
top: 11px;
right: 10px;
-webkit-transform: translateY(-50%) translateX(100%);
transform: translateY(-50%) translateX(100%);
}
.navbar {
height: 50px;
overflow: hidden;
@@ -194,7 +244,6 @@ export default {
}
}
}
.avatar-container {
margin-right: 30px;