Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
njgzx
dataease
Commits
24ed0bae
Unverified
提交
24ed0bae
authored
8月 17, 2021
作者:
fit2cloud-chenyw
提交者:
GitHub
8月 17, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #644 from dataease/pr@dev@fix_msg_timer_error
fix: 定时查询未读消息条数错误
上级
238bc186
2fbed9fd
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
75 行增加
和
18 行删除
+75
-18
ShiroServiceImpl.java
.../java/io/dataease/auth/service/impl/ShiroServiceImpl.java
+2
-0
MsgController.java
...c/main/java/io/dataease/controller/sys/MsgController.java
+12
-0
SysMsgService.java
.../main/java/io/dataease/service/message/SysMsgService.java
+7
-0
msg.js
frontend/src/api/system/msg.js
+9
-0
index.vue
frontend/src/components/Notification/index.vue
+42
-16
request.js
frontend/src/utils/request.js
+3
-2
没有找到文件。
backend/src/main/java/io/dataease/auth/service/impl/ShiroServiceImpl.java
浏览文件 @
24ed0bae
...
@@ -45,6 +45,8 @@ public class ShiroServiceImpl implements ShiroService {
...
@@ -45,6 +45,8 @@ public class ShiroServiceImpl implements ShiroService {
//验证链接
//验证链接
filterChainDefinitionMap
.
put
(
"/api/link/validate**"
,
ANON
);
filterChainDefinitionMap
.
put
(
"/api/link/validate**"
,
ANON
);
filterChainDefinitionMap
.
put
(
"/api/map/areaEntitys/**"
,
ANON
);
filterChainDefinitionMap
.
put
(
"/api/map/areaEntitys/**"
,
ANON
);
//未读消息数量
filterChainDefinitionMap
.
put
(
"/api/sys_msg/unReadCount"
,
ANON
);
filterChainDefinitionMap
.
put
(
"/**/*.json"
,
ANON
);
filterChainDefinitionMap
.
put
(
"/**/*.json"
,
ANON
);
filterChainDefinitionMap
.
put
(
"/system/ui/**"
,
ANON
);
filterChainDefinitionMap
.
put
(
"/system/ui/**"
,
ANON
);
...
...
backend/src/main/java/io/dataease/controller/sys/MsgController.java
浏览文件 @
24ed0bae
...
@@ -6,6 +6,7 @@ import com.github.xiaoymin.knife4j.annotations.ApiSupport;
...
@@ -6,6 +6,7 @@ import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import
io.dataease.base.domain.SysMsgChannel
;
import
io.dataease.base.domain.SysMsgChannel
;
import
io.dataease.base.domain.SysMsgSetting
;
import
io.dataease.base.domain.SysMsgSetting
;
import
io.dataease.base.domain.SysMsgType
;
import
io.dataease.base.domain.SysMsgType
;
import
io.dataease.commons.exception.DEException
;
import
io.dataease.commons.utils.AuthUtils
;
import
io.dataease.commons.utils.AuthUtils
;
import
io.dataease.commons.utils.PageUtils
;
import
io.dataease.commons.utils.PageUtils
;
import
io.dataease.commons.utils.Pager
;
import
io.dataease.commons.utils.Pager
;
...
@@ -21,6 +22,7 @@ import org.apache.commons.lang3.ObjectUtils;
...
@@ -21,6 +22,7 @@ import org.apache.commons.lang3.ObjectUtils;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
@Api
(
tags
=
"系统:消息管理"
)
@Api
(
tags
=
"系统:消息管理"
)
...
@@ -46,6 +48,16 @@ public class MsgController {
...
@@ -46,6 +48,16 @@ public class MsgController {
return
listPager
;
return
listPager
;
}
}
@ApiOperation
(
"查询未读数量"
)
@PostMapping
(
"/unReadCount"
)
public
Long
unReadCount
(
@RequestBody
Map
<
String
,
Long
>
request
)
{
if
(
null
==
request
||
null
==
request
.
get
(
"userId"
))
{
throw
new
RuntimeException
(
"缺少用户ID"
);
}
Long
userId
=
request
.
get
(
"userId"
);
return
sysMsgService
.
queryCount
(
userId
);
}
@ApiOperation
(
"设置已读"
)
@ApiOperation
(
"设置已读"
)
@PostMapping
(
"/setReaded/{msgId}"
)
@PostMapping
(
"/setReaded/{msgId}"
)
public
void
setReaded
(
@PathVariable
Long
msgId
)
{
public
void
setReaded
(
@PathVariable
Long
msgId
)
{
...
...
backend/src/main/java/io/dataease/service/message/SysMsgService.java
浏览文件 @
24ed0bae
...
@@ -105,6 +105,13 @@ public class SysMsgService {
...
@@ -105,6 +105,13 @@ public class SysMsgService {
return
msgGridDtos
;
return
msgGridDtos
;
}
}
public
Long
queryCount
(
Long
userId
)
{
SysMsgExample
example
=
new
SysMsgExample
();
SysMsgExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andUserIdEqualTo
(
userId
).
andStatusEqualTo
(
false
);
return
sysMsgMapper
.
countByExample
(
example
);
}
public
void
setReaded
(
Long
msgId
)
{
public
void
setReaded
(
Long
msgId
)
{
SysMsg
sysMsg
=
new
SysMsg
();
SysMsg
sysMsg
=
new
SysMsg
();
sysMsg
.
setMsgId
(
msgId
);
sysMsg
.
setMsgId
(
msgId
);
...
...
frontend/src/api/system/msg.js
浏览文件 @
24ed0bae
...
@@ -9,6 +9,15 @@ export function query(pageIndex, pageSize, data) {
...
@@ -9,6 +9,15 @@ export function query(pageIndex, pageSize, data) {
})
})
}
}
export
function
unReadCount
(
data
)
{
return
request
({
url
:
'/api/sys_msg/unReadCount'
,
method
:
'post'
,
loading
:
false
,
data
})
}
export
function
updateStatus
(
msgId
)
{
export
function
updateStatus
(
msgId
)
{
return
request
({
return
request
({
url
:
'/api/sys_msg/setReaded/'
+
msgId
,
url
:
'/api/sys_msg/setReaded/'
+
msgId
,
...
...
frontend/src/components/Notification/index.vue
浏览文件 @
24ed0bae
...
@@ -53,14 +53,14 @@
...
@@ -53,14 +53,14 @@
class-name=
"notification"
class-name=
"notification"
icon-class=
"notification"
icon-class=
"notification"
/>
/>
<span
v-if=
"
paginationConfig.total"
class=
"msg-number"
>
{{
paginationConfig.total }}
</span>
<span
v-if=
"
count || paginationConfig.total"
class=
"msg-number"
>
{{ count ||
paginationConfig.total }}
</span>
</div>
</div>
</div>
</div>
</el-popover>
</el-popover>
</template>
</template>
<
script
>
<
script
>
import
{
query
,
updateStatus
}
from
'@/api/system/msg'
import
{
query
,
updateStatus
,
unReadCount
}
from
'@/api/system/msg'
import
{
getTypeName
,
loadMsgTypes
}
from
'@/utils/webMsg'
import
{
getTypeName
,
loadMsgTypes
}
from
'@/utils/webMsg'
import
{
mapGetters
}
from
'vuex'
import
{
mapGetters
}
from
'vuex'
import
bus
from
'@/utils/bus'
import
bus
from
'@/utils/bus'
...
@@ -76,21 +76,30 @@ export default {
...
@@ -76,21 +76,30 @@ export default {
pageSize
:
5
,
pageSize
:
5
,
total
:
0
total
:
0
},
},
timer
:
null
timer
:
null
,
count
:
0
}
}
},
},
computed
:
{
computed
:
{
...
mapGetters
([
...
mapGetters
([
'permission_routes'
'permission_routes'
,
'user'
])
])
},
},
watch
:
{
'visible'
:
function
(
newV
,
oldV
)
{
if
(
newV
&&
!
oldV
)
{
this
.
search
()
}
}
},
created
()
{
created
()
{
// 先加载消息类型
// 先加载消息类型
loadMsgTypes
()
loadMsgTypes
()
this
.
search
()
this
.
queryCount
()
// 每30s定时刷新拉取消息
// 每30s定时刷新拉取消息
this
.
timer
=
setInterval
(()
=>
{
this
.
timer
=
setInterval
(()
=>
{
this
.
search
()
this
.
queryCount
()
},
30000
)
},
30000
)
},
},
mounted
()
{
mounted
()
{
...
@@ -105,19 +114,11 @@ export default {
...
@@ -105,19 +114,11 @@ export default {
this
.
timer
&&
clearInterval
(
this
.
timer
)
this
.
timer
&&
clearInterval
(
this
.
timer
)
},
},
methods
:
{
methods
:
{
// handClick(lang) {
// console.log(lang)
// },
showDetail
(
row
)
{
showDetail
(
row
)
{
const
param
=
{
...{
msgNotification
:
true
,
msgType
:
row
.
typeId
,
sourceParam
:
row
.
param
}}
const
param
=
{
...{
msgNotification
:
true
,
msgType
:
row
.
typeId
,
sourceParam
:
row
.
param
}}
this
.
visible
=
false
this
.
visible
=
false
// if (this.$route && this.$route.name && this.$route.name.includes('panel') && row.type === 0) {
// bus.$emit('to-msg-share', param)
// } else if (this.$route && this.$route.name && this.$route.name.includes('dataset') && row.type === 1) {
// bus.$emit('to-msg-dataset', param)
// } else {
// this.$router.push({ name: row.router, params: param })
// }
if
(
this
.
$route
&&
this
.
$route
.
name
&&
this
.
$route
.
name
===
row
.
router
)
{
if
(
this
.
$route
&&
this
.
$route
.
name
&&
this
.
$route
.
name
===
row
.
router
)
{
// 如果当前路由就是目标路由 那么使用router.push页面不会刷新 这时候要使用事件方式
// 如果当前路由就是目标路由 那么使用router.push页面不会刷新 这时候要使用事件方式
row
.
callback
&&
bus
.
$emit
(
row
.
callback
,
param
)
row
.
callback
&&
bus
.
$emit
(
row
.
callback
,
param
)
...
@@ -164,6 +165,31 @@ export default {
...
@@ -164,6 +165,31 @@ export default {
this
.
$store
.
commit
(
'permission/SET_CURRENT_ROUTES'
,
route
)
this
.
$store
.
commit
(
'permission/SET_CURRENT_ROUTES'
,
route
)
// this.setSidebarHide(route)
// this.setSidebarHide(route)
},
},
queryCount
()
{
const
token
=
getToken
()
if
(
!
token
||
token
===
'null'
||
token
===
'undefined'
||
!
this
.
user
||
!
this
.
user
.
userId
)
{
this
.
timer
&&
clearInterval
(
this
.
timer
)
const
message
=
this
.
$t
(
'login.tokenError'
)
this
.
$alert
(
message
,
{
confirmButtonText
:
this
.
$t
(
'login.re_login'
),
showClose
:
false
,
callback
:
function
(
action
,
instance
)
{
if
(
action
===
'confirm'
)
{
this
.
$store
.
dispatch
(
'user/logout'
).
then
(()
=>
{
location
.
reload
()
})
}
}.
bind
(
this
)
})
}
const
param
=
{
userId
:
this
.
user
.
userId
}
unReadCount
(
param
).
then
(
res
=>
{
this
.
count
=
res
.
data
})
},
search
()
{
search
()
{
const
param
=
{
const
param
=
{
status
:
false
,
status
:
false
,
...
...
frontend/src/utils/request.js
浏览文件 @
24ed0bae
...
@@ -8,7 +8,7 @@ import i18n from '@/lang'
...
@@ -8,7 +8,7 @@ import i18n from '@/lang'
import
{
tryShowLoading
,
tryHideLoading
}
from
'./loading'
import
{
tryShowLoading
,
tryHideLoading
}
from
'./loading'
import
{
getLinkToken
,
setLinkToken
}
from
'@/utils/auth'
import
{
getLinkToken
,
setLinkToken
}
from
'@/utils/auth'
// import router from '@/router'
// import router from '@/router'
const
interruptTokenContineUrls
=
Config
.
interruptTokenContineUrls
//
const interruptTokenContineUrls = Config.interruptTokenContineUrls
const
TokenKey
=
Config
.
TokenKey
const
TokenKey
=
Config
.
TokenKey
const
RefreshTokenKey
=
Config
.
RefreshTokenKey
const
RefreshTokenKey
=
Config
.
RefreshTokenKey
const
LinkTokenKey
=
Config
.
LinkTokenKey
const
LinkTokenKey
=
Config
.
LinkTokenKey
...
@@ -88,7 +88,8 @@ const checkAuth = response => {
...
@@ -88,7 +88,8 @@ const checkAuth = response => {
})
})
}
}
// token到期后自动续命 刷新token
// token到期后自动续命 刷新token
if
(
response
.
headers
[
RefreshTokenKey
]
&&
!
interruptTokenContineUrls
.
some
(
item
=>
response
.
config
.
url
.
indexOf
(
item
)
>=
0
))
{
// if (response.headers[RefreshTokenKey] && !interruptTokenContineUrls.some(item => response.config.url.indexOf(item) >= 0)) {
if
(
response
.
headers
[
RefreshTokenKey
])
{
const
refreshToken
=
response
.
headers
[
RefreshTokenKey
]
const
refreshToken
=
response
.
headers
[
RefreshTokenKey
]
store
.
dispatch
(
'user/refreshToken'
,
refreshToken
)
store
.
dispatch
(
'user/refreshToken'
,
refreshToken
)
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论