Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ops
/
monitor-service
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
qinchao
7 years ago
Commit
0912edfa97f9c7be15c5e03cc12c8fc9dec28f0c
1 parent
299d5646
恶意ip处理
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
1 deletions
monitor-service-other/src/main/java/com/monitor/other/maliciousip/service/impl/MaliciousIpServiceImpl.java
monitor-service-other/src/main/java/com/monitor/other/maliciousip/service/impl/MaliciousIpServiceImpl.java
View file @
0912edf
...
...
@@ -188,7 +188,7 @@ public class MaliciousIpServiceImpl implements MaliciousIpService {
for
(
int
i
=
0
;
i
<
ipsObjArray
.
size
();
i
++){
JSONObject
jo
=
ipsObjArray
.
getJSONObject
(
i
);
String
ip
=
jo
.
getString
(
"ip"
);
String
reason
=
jo
.
getString
(
"reason"
);
String
reason
=
jo
.
toJSONString
(
);
//写入mysql
MaliciousIpsRecord
record
=
new
MaliciousIpsRecord
();
...
...
@@ -213,6 +213,21 @@ public class MaliciousIpServiceImpl implements MaliciousIpService {
if
(
org
.
springframework
.
util
.
CollectionUtils
.
isEmpty
(
ls
))
{
return
new
BaseResponse
<>();
}
//解析reason到汉字
for
(
MaliciousIpsRecord
record:
ls
){
String
reason
=
record
.
getReason
();
if
(
StringUtils
.
isNotBlank
(
reason
)){
try
{
MaliciousIpModel
model
=
JSON
.
parseObject
(
reason
,
MaliciousIpModel
.
class
);
reason
=
model
.
toHtmlString
();
record
.
setReason
(
reason
);
}
catch
(
Exception
e
){
///查询异常就不管了
}
}
}
PageResponse
<
MaliciousIpsRecord
>
pageResp
=
new
PageResponse
<>();
pageResp
.
setCurrentPage
(
request
.
getCurrentPage
());
pageResp
.
setPageSize
(
request
.
getPageSize
());
...
...
Please
register
or
login
to post a comment