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
21b06852
Commit
21b06852
authored
May 15, 2020
by
Administrator
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'staging' into 'master'
Staging See merge request
!115
parents
f95ec053
ebfc8950
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 @
21b06852
...
...
@@ -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 @
21b06852
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 @
21b06852
...
...
@@ -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"
).
gt
(
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 @
21b06852
...
...
@@ -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 @
21b06852
...
...
@@ -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