Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dlink
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhaowei
dlink
Commits
bc6def96
Unverified
Commit
bc6def96
authored
Jul 21, 2022
by
mydq
Committed by
GitHub
Jul 21, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pr allow circular references config add (#754)
* application.yml * alert group : alert instance ids null
parent
cab944cb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
12 deletions
+25
-12
AlertInstanceServiceImpl.java
...java/com/dlink/service/impl/AlertInstanceServiceImpl.java
+23
-12
application.yml
dlink-admin/src/main/resources/application.yml
+2
-0
No files found.
dlink-admin/src/main/java/com/dlink/service/impl/AlertInstanceServiceImpl.java
View file @
bc6def96
...
@@ -22,8 +22,11 @@ package com.dlink.service.impl;
...
@@ -22,8 +22,11 @@ package com.dlink.service.impl;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.dlink.alert.*
;
import
com.dlink.alert.Alert
;
import
com.dlink.assertion.Asserts
;
import
com.dlink.alert.AlertConfig
;
import
com.dlink.alert.AlertMsg
;
import
com.dlink.alert.AlertResult
;
import
com.dlink.alert.ShowType
;
import
com.dlink.common.result.Result
;
import
com.dlink.common.result.Result
;
import
com.dlink.db.service.impl.SuperServiceImpl
;
import
com.dlink.db.service.impl.SuperServiceImpl
;
import
com.dlink.mapper.AlertInstanceMapper
;
import
com.dlink.mapper.AlertInstanceMapper
;
...
@@ -32,7 +35,6 @@ import com.dlink.model.AlertInstance;
...
@@ -32,7 +35,6 @@ import com.dlink.model.AlertInstance;
import
com.dlink.service.AlertGroupService
;
import
com.dlink.service.AlertGroupService
;
import
com.dlink.service.AlertInstanceService
;
import
com.dlink.service.AlertInstanceService
;
import
com.dlink.utils.JSONUtil
;
import
com.dlink.utils.JSONUtil
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.MapUtils
;
import
org.apache.commons.collections4.MapUtils
;
...
@@ -48,6 +50,7 @@ import java.util.HashMap;
...
@@ -48,6 +50,7 @@ import java.util.HashMap;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.UUID
;
import
java.util.UUID
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -131,6 +134,9 @@ public class AlertInstanceServiceImpl extends SuperServiceImpl<AlertInstanceMapp
...
@@ -131,6 +134,9 @@ public class AlertInstanceServiceImpl extends SuperServiceImpl<AlertInstanceMapp
}
}
final
Map
<
Integer
,
String
>
result
=
new
HashMap
<>(
8
);
final
Map
<
Integer
,
String
>
result
=
new
HashMap
<>(
8
);
for
(
Map
.
Entry
<
Integer
,
Set
<
Integer
>>
entry
:
alertGroupInformation
.
entrySet
())
{
for
(
Map
.
Entry
<
Integer
,
Set
<
Integer
>>
entry
:
alertGroupInformation
.
entrySet
())
{
if
(
entry
.
getKey
()
==
null
){
continue
;
}
final
Set
<
Integer
>
groupIdSet
=
entry
.
getValue
();
final
Set
<
Integer
>
groupIdSet
=
entry
.
getValue
();
for
(
Integer
groupId
:
groupIdSet
)
{
for
(
Integer
groupId
:
groupIdSet
)
{
final
String
instanceIdString
=
result
.
get
(
groupId
);
final
String
instanceIdString
=
result
.
get
(
groupId
);
...
@@ -138,18 +144,20 @@ public class AlertInstanceServiceImpl extends SuperServiceImpl<AlertInstanceMapp
...
@@ -138,18 +144,20 @@ public class AlertInstanceServiceImpl extends SuperServiceImpl<AlertInstanceMapp
:
instanceIdString
+
","
+
entry
.
getKey
());
:
instanceIdString
+
","
+
entry
.
getKey
());
}
}
}
}
updateAlertGroupInformation
(
result
);
updateAlertGroupInformation
(
result
,
alertGroupInformation
.
get
(
null
)
);
}
}
private
void
updateAlertGroupInformation
(
Map
<
Integer
,
String
>
result
)
{
private
void
updateAlertGroupInformation
(
Map
<
Integer
,
String
>
result
,
Set
<
Integer
>
groupIdSet
)
{
final
LocalDateTime
now
=
LocalDateTime
.
now
();
final
LocalDateTime
now
=
LocalDateTime
.
now
();
final
List
<
AlertGroup
>
list
=
result
.
entrySet
().
stream
().
map
(
entry
->
{
final
List
<
AlertGroup
>
list
=
groupIdSet
.
stream
().
filter
(
Objects:
:
nonNull
)
final
AlertGroup
alertGroup
=
new
AlertGroup
();
.
map
(
groupId
->
{
alertGroup
.
setId
(
entry
.
getKey
());
final
AlertGroup
alertGroup
=
new
AlertGroup
();
alertGroup
.
setAlertInstanceIds
(
entry
.
getValue
());
alertGroup
.
setId
(
groupId
);
alertGroup
.
setUpdateTime
(
now
);
final
String
groupIds
=
result
.
get
(
groupId
);
return
alertGroup
;
alertGroup
.
setAlertInstanceIds
(
groupIds
==
null
?
""
:
groupIds
);
}).
collect
(
Collectors
.
toList
());
alertGroup
.
setUpdateTime
(
now
);
return
alertGroup
;
}).
collect
(
Collectors
.
toList
());
alertGroupService
.
updateBatchById
(
list
);
alertGroupService
.
updateBatchById
(
list
);
}
}
...
@@ -162,9 +170,12 @@ public class AlertInstanceServiceImpl extends SuperServiceImpl<AlertInstanceMapp
...
@@ -162,9 +170,12 @@ public class AlertInstanceServiceImpl extends SuperServiceImpl<AlertInstanceMapp
return
new
HashMap
<>(
0
);
return
new
HashMap
<>(
0
);
}
}
final
Map
<
Integer
,
Set
<
Integer
>>
map
=
new
HashMap
<>(
list
.
size
());
final
Map
<
Integer
,
Set
<
Integer
>>
map
=
new
HashMap
<>(
list
.
size
());
final
Set
<
Integer
>
groupIdSet
=
new
HashSet
<>();
for
(
AlertGroup
alertGroup
:
list
)
{
for
(
AlertGroup
alertGroup
:
list
)
{
buildGroup
(
map
,
alertGroup
);
buildGroup
(
map
,
alertGroup
);
groupIdSet
.
add
(
alertGroup
.
getId
());
}
}
map
.
put
(
null
,
groupIdSet
);
return
map
;
return
map
;
}
}
...
...
dlink-admin/src/main/resources/application.yml
View file @
bc6def96
...
@@ -6,6 +6,8 @@ spring:
...
@@ -6,6 +6,8 @@ spring:
driver-class-name
:
com.mysql.cj.jdbc.Driver
driver-class-name
:
com.mysql.cj.jdbc.Driver
application
:
application
:
name
:
dlink
name
:
dlink
main
:
allow-circular-references
:
true
# flyway:
# flyway:
# enabled: false
# enabled: false
# clean-disabled: true
# clean-disabled: true
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment