Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
李苗
/
Vion-DevOps
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 6277fc51
authored
Dec 10, 2024
by
HlQ
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[add] EventVO 添加时区相关字段
[chg] 优化项目监控的查询速度
1 parent
2ba553fb
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
8 deletions
src/main/java/vion/service/impl/monitor/MallServiceImpl.java
src/main/java/vion/service/impl/monitor/RAgentEventServiceImpl.java
src/main/java/vion/vo/monitor/EventVO.java
src/main/java/vion/service/impl/monitor/MallServiceImpl.java
View file @
6277fc5
...
...
@@ -56,7 +56,11 @@ public class MallServiceImpl extends MPJBaseServiceImpl<MallMapper, Mall> implem
@Override
public
Page
<
MAccount
>
listAttentionAccount
(
MAccount
dto
)
{
var
attentionMallList
=
this
.
query
().
select
(
"distinct account_uid"
).
eq
(
"attention"
,
1
).
list
();
var
attentionMallList
=
this
.
query
()
.
select
(
"distinct account_uid"
)
.
eq
(
"agent_type"
,
dto
.
getAgentType
())
.
eq
(
"attention"
,
1
)
.
list
();
return
accountService
.
lambdaQuery
()
.
in
(
MAccount:
:
getUid
,
attentionMallList
.
stream
().
map
(
Mall:
:
getAccountUid
).
toList
())
.
orderByAsc
(
MAccount:
:
getName
)
...
...
@@ -160,7 +164,7 @@ public class MallServiceImpl extends MPJBaseServiceImpl<MallMapper, Mall> implem
var
eventRecordList
=
eventRecordService
.
list
(
eventRecWrapper
);
var
mallUid2RecMap
=
eventRecordList
.
stream
().
collect
(
Collectors
.
groupingBy
(
EventRecord:
:
getMallUid
));
var
remarkList
=
mallRemarkService
.
lambdaQuery
().
in
(
RMallRemark:
:
getMallUid
,
m
allUidList
).
list
();
var
remarkList
=
mallRemarkService
.
lambdaQuery
().
in
(
RMallRemark:
:
getMallUid
,
tmpM
allUidList
).
list
();
var
mallUid2RemarkMap
=
remarkList
.
stream
().
sorted
(
Comparator
.
comparing
(
RMallRemark:
:
getRemarkDate
).
reversed
().
thenComparing
(
Comparator
.
comparing
(
RMallRemark:
:
getCreateTime
).
reversed
())).
collect
(
Collectors
.
toMap
(
RMallRemark:
:
getMallUid
,
Function
.
identity
(),
(
r1
,
r2
)
->
r1
));
var
tmpWrapper
=
new
MPJLambdaWrapper
<
RAgentEvent
>()
...
...
@@ -168,7 +172,7 @@ public class MallServiceImpl extends MPJBaseServiceImpl<MallMapper, Mall> implem
.
selectAs
(
Event:
:
getDescription
,
RAgentEvent:
:
getDescription
)
.
selectAs
(
Event:
:
getRemark
,
RAgentEvent:
:
getRemark
)
.
leftJoin
(
Event
.
class
,
Event:
:
getUid
,
RAgentEvent:
:
getEventUid
)
.
in
(
RAgentEvent:
:
getMallUid
,
m
allUidList
);
.
in
(
RAgentEvent:
:
getMallUid
,
tmpM
allUidList
);
var
tmpAgentEventList
=
agentEventService
.
selectJoinList
(
RAgentEvent
.
class
,
tmpWrapper
);
var
mallUid2AgentEventMap
=
tmpAgentEventList
.
stream
().
collect
(
Collectors
.
groupingBy
(
RAgentEvent:
:
getMallUid
));
...
...
@@ -220,7 +224,7 @@ public class MallServiceImpl extends MPJBaseServiceImpl<MallMapper, Mall> implem
var
tmpEventRecordList
=
eventRecordService
.
list
(
tmpWrapper
);
var
tmpMallUid2RecMap
=
tmpEventRecordList
.
stream
().
collect
(
Collectors
.
groupingBy
(
EventRecord:
:
getMallUid
));
var
remarkList
=
mallRemarkService
.
lambdaQuery
().
in
(
RMallRemark:
:
getMallUid
,
m
allUidList
).
list
();
var
remarkList
=
mallRemarkService
.
lambdaQuery
().
in
(
RMallRemark:
:
getMallUid
,
tmpM
allUidList
).
list
();
var
mallUid2RemarkMap
=
remarkList
.
stream
().
sorted
(
Comparator
.
comparing
(
RMallRemark:
:
getRemarkDate
).
reversed
().
thenComparing
(
Comparator
.
comparing
(
RMallRemark:
:
getCreateTime
).
reversed
())).
collect
(
Collectors
.
toMap
(
RMallRemark:
:
getMallUid
,
Function
.
identity
(),
(
r1
,
r2
)
->
r1
));
var
tmpAgentEventWrapper
=
new
MPJLambdaWrapper
<
RAgentEvent
>()
...
...
@@ -228,7 +232,7 @@ public class MallServiceImpl extends MPJBaseServiceImpl<MallMapper, Mall> implem
.
selectAs
(
Event:
:
getDescription
,
RAgentEvent:
:
getDescription
)
.
selectAs
(
Event:
:
getRemark
,
RAgentEvent:
:
getRemark
)
.
leftJoin
(
Event
.
class
,
Event:
:
getUid
,
RAgentEvent:
:
getEventUid
)
.
in
(
RAgentEvent:
:
getMallUid
,
m
allUidList
);
.
in
(
RAgentEvent:
:
getMallUid
,
tmpM
allUidList
);
var
tmpAgentEventList
=
agentEventService
.
selectJoinList
(
RAgentEvent
.
class
,
tmpAgentEventWrapper
);
var
mallUid2AgentEventMap
=
tmpAgentEventList
.
stream
().
collect
(
Collectors
.
groupingBy
(
RAgentEvent:
:
getMallUid
));
...
...
src/main/java/vion/service/impl/monitor/RAgentEventServiceImpl.java
View file @
6277fc5
...
...
@@ -5,6 +5,7 @@ import com.github.yulichang.base.MPJBaseServiceImpl;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.dromara.hutool.core.collection.CollUtil
;
import
org.dromara.hutool.core.lang.Opt
;
import
org.dromara.hutool.core.text.StrUtil
;
import
org.dromara.hutool.core.util.ObjUtil
;
import
org.dromara.mica.mqtt.codec.MqttQoS
;
...
...
@@ -46,7 +47,7 @@ public class RAgentEventServiceImpl extends MPJBaseServiceImpl<RAgentEventMapper
List
<
RAgentEvent
>
updList
=
new
ArrayList
<>();
List
<
RAgentEvent
>
insList
=
new
ArrayList
<>();
dtoList
.
forEach
(
dto
->
{
dto
.
setTimeZone
(
timeZone
);
dto
.
setTimeZone
(
Opt
.
ofBlankAble
(
timeZone
).
orElse
(
""
)
);
String
offsetCron
=
dto
.
getCron
();
if
(
StrUtil
.
isNotBlank
(
timeZone
))
{
var
offsetMinute
=
TimeZoneUtil
.
getOffsetMinute
(
timeZone
);
...
...
@@ -122,7 +123,7 @@ public class RAgentEventServiceImpl extends MPJBaseServiceImpl<RAgentEventMapper
rAgentEvent
.
setEventUid
(
dto
.
getEventUid
());
rAgentEvent
.
setEventType
(
dto
.
getEventType
());
rAgentEvent
.
setCron
(
dto
.
getCron
());
rAgentEvent
.
setTimeZone
(
timeZone
);
rAgentEvent
.
setTimeZone
(
Opt
.
ofBlankAble
(
timeZone
).
orElse
(
""
)
);
String
offsetCron
=
dto
.
getCron
();
if
(
StrUtil
.
isNotBlank
(
timeZone
))
{
var
offsetMinute
=
TimeZoneUtil
.
getOffsetMinute
(
timeZone
);
...
...
@@ -158,7 +159,7 @@ public class RAgentEventServiceImpl extends MPJBaseServiceImpl<RAgentEventMapper
rAgentEvent
.
setEventUid
(
dto
.
getEventUid
());
rAgentEvent
.
setEventType
(
dto
.
getEventType
());
rAgentEvent
.
setCron
(
dto
.
getCron
());
rAgentEvent
.
setTimeZone
(
timeZone
);
rAgentEvent
.
setTimeZone
(
Opt
.
ofBlankAble
(
timeZone
).
orElse
(
""
)
);
String
offsetCron
=
dto
.
getCron
();
if
(
StrUtil
.
isNotBlank
(
timeZone
))
{
var
offsetMinute
=
TimeZoneUtil
.
getOffsetMinute
(
timeZone
);
...
...
src/main/java/vion/vo/monitor/EventVO.java
View file @
6277fc5
...
...
@@ -46,6 +46,16 @@ public class EventVO {
private
String
cron
;
/**
* 时区
*/
private
String
timeZone
;
/**
* 时区偏移后的Cron表达式
*/
private
String
offsetCron
;
/**
* 默认阈值,可为空
*/
private
String
threshold
;
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment