Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
browser-backend
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
Administrator
browser-backend
Commits
55f900cd
Commit
55f900cd
authored
May 15, 2020
by
renjie
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev-zrj' into 'staging'
1.删除未释放ip See merge request
!113
parents
61371356
c70c4e75
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
2 deletions
+37
-2
IpControlloer.java
...dgec/browserbackend/browser/controller/IpControlloer.java
+16
-0
IpResourceRepository.java
...owserbackend/browser/repository/IpResourceRepository.java
+3
-0
IpResourceRepositoryCustomImpl.java
...nd/browser/repository/IpResourceRepositoryCustomImpl.java
+2
-2
IpResourceServiceImpl.java
...erbackend/browser/service/Impl/IpResourceServiceImpl.java
+14
-0
IpResourceService.java
...gec/browserbackend/browser/service/IpResourceService.java
+2
-0
No files found.
src/main/java/com/edgec/browserbackend/browser/controller/IpControlloer.java
View file @
55f900cd
...
...
@@ -167,4 +167,20 @@ public class IpControlloer {
}
return
resultDto
;
}
@RequestMapping
(
value
=
"/releasedeleted"
,
method
=
RequestMethod
.
PUT
)
public
ResultDto
deleteUseless
(
Principal
principal
)
{
ResultDto
resultDto
=
new
ResultDto
();
try
{
ipResourceService
.
releaseDeletedIp
();
resultDto
.
setStatus
(
0
);
}
catch
(
Exception
e
)
{
resultDto
.
setStatus
(-
1
);
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
statusInfo
.
put
(
"code"
,
80001
);
statusInfo
.
put
(
"message"
,
e
.
getMessage
());
resultDto
.
setStatusInfo
(
statusInfo
);
}
return
resultDto
;
}
}
src/main/java/com/edgec/browserbackend/browser/repository/IpResourceRepository.java
View file @
55f900cd
package
com
.
edgec
.
browserbackend
.
browser
.
repository
;
import
com.edgec.browserbackend.browser.domain.IpResource
;
import
com.edgec.browserbackend.browser.domain.IpType
;
import
com.edgec.browserbackend.browser.domain.Shop
;
import
com.google.gson.internal.
$Gson$Preconditions
;
import
org.springframework.data.domain.Page
;
...
...
@@ -28,6 +29,8 @@ public interface IpResourceRepository extends MongoRepository<IpResource, String
Page
<
IpResource
>
findByIsDeletedAndIdInAndRegionCnLikeOrderByPurchasedTimeDesc
(
boolean
isDeleted
,
List
<
String
>
ipIds
,
String
region
,
Pageable
pageable
);
List
<
IpResource
>
findByIsDeletedAndShopIdInAndRegionCnLike
(
boolean
isDeleted
,
List
<
String
>
shopIds
,
String
regionCn
);
List
<
IpResource
>
findByIsDeleted
(
boolean
isDeleted
);
List
<
IpResource
>
findByOwnerInAndSpecialLine
(
List
<
String
>
owners
,
boolean
specialLine
);
List
<
IpResource
>
findBySpecialLineAndIsDeleted
(
boolean
specialLine
,
boolean
isDeleted
);
...
...
src/main/java/com/edgec/browserbackend/browser/repository/IpResourceRepositoryCustomImpl.java
View file @
55f900cd
...
...
@@ -112,8 +112,8 @@ public class IpResourceRepositoryCustomImpl implements IpResourceRepositoryCusto
@Override
public
List
<
IpResource
>
sampleTasks
(
List
<
Integer
>
status
)
{
Criteria
matchCriteria
=
new
Criteria
();
matchCriteria
.
orOperator
(
where
(
"status"
).
in
(
status
).
and
(
"isLocked"
).
is
(
false
).
and
(
"isDeleted"
).
is
(
false
).
and
(
"healthLockTimestamp"
).
lte
(
Instant
.
now
().
minusSeconds
(
60
*
30
).
toEpochMilli
()),
where
(
"status"
).
in
(
status
).
and
(
"isLocked"
).
is
(
true
).
and
(
"healthLockTimestamp"
).
lte
(
Instant
.
now
().
minusSeconds
(
3
00
).
toEpochMilli
()).
and
(
"isDeleted"
).
is
(
false
));
matchCriteria
.
orOperator
(
where
(
"status"
).
in
(
status
).
and
(
"isLocked"
).
is
(
false
).
and
(
"
validTime"
).
lte
(
Instant
.
now
().
toEpochMilli
()).
and
(
"
isDeleted"
).
is
(
false
).
and
(
"healthLockTimestamp"
).
lte
(
Instant
.
now
().
minusSeconds
(
60
*
30
).
toEpochMilli
()),
where
(
"status"
).
in
(
status
).
and
(
"isLocked"
).
is
(
true
).
and
(
"healthLockTimestamp"
).
lte
(
Instant
.
now
().
minusSeconds
(
6
00
).
toEpochMilli
()).
and
(
"isDeleted"
).
is
(
false
));
MatchOperation
match
=
Aggregation
.
match
(
matchCriteria
);
...
...
src/main/java/com/edgec/browserbackend/browser/service/Impl/IpResourceServiceImpl.java
View file @
55f900cd
...
...
@@ -801,4 +801,18 @@ public class IpResourceServiceImpl implements IpResourceService {
ipResourceRepository
.
save
(
ipResource
);
}
}
@Override
public
void
releaseDeletedIp
()
{
String
URL
=
(
profiles
.
equals
(
"dev"
)
||
profiles
.
equals
(
"staging"
))?
TESTURL
:
CLOUDAMURL
;
RestTemplate
restTemplate
=
new
RestTemplate
();
HttpHeaders
headers
=
buildGetHeader
();
Map
<
String
,
String
>
params
=
new
HashMap
<
String
,
String
>();
HttpEntity
<
Map
<
String
,
String
>>
httpEntity
=
new
HttpEntity
<>(
params
,
headers
);
List
<
IpResource
>
ipResources
=
ipResourceRepository
.
findByIsDeleted
(
true
);
for
(
IpResource
ipResource
:
ipResources
)
{
ResponseEntity
<
String
>
result
=
restTemplate
.
exchange
(
URL
+
"/intelligroup/ipresources?accountId=browser&ip={ip}"
,
HttpMethod
.
DELETE
,
httpEntity
,
String
.
class
,
ipResource
.
getAddr
());
DeleteIpResultDto
deleteIpResultDto
=
JSON
.
parseObject
(
result
.
getBody
(),
DeleteIpResultDto
.
class
);
}
}
}
src/main/java/com/edgec/browserbackend/browser/service/IpResourceService.java
View file @
55f900cd
...
...
@@ -30,4 +30,6 @@ public interface IpResourceService {
IpResourceDto
queryIp
(
String
username
,
IpResourceRequestDto
ipResourceRequestDto
);
void
setSpecialLine
();
void
releaseDeletedIp
();
}
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