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
d9f246c1
Commit
d9f246c1
authored
Mar 31, 2020
by
renjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除ip
parent
313cff66
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
6 deletions
+16
-6
IpResourceRepository.java
...owserbackend/browser/repository/IpResourceRepository.java
+2
-0
IpResourceServiceImpl.java
...erbackend/browser/service/Impl/IpResourceServiceImpl.java
+14
-6
No files found.
src/main/java/com/edgec/browserbackend/browser/repository/IpResourceRepository.java
View file @
d9f246c1
...
@@ -10,7 +10,9 @@ import java.util.List;
...
@@ -10,7 +10,9 @@ import java.util.List;
public
interface
IpResourceRepository
extends
MongoRepository
<
IpResource
,
String
>,
IpResourceRepositoryCustom
{
public
interface
IpResourceRepository
extends
MongoRepository
<
IpResource
,
String
>,
IpResourceRepositoryCustom
{
IpResource
findByAddr
(
String
addr
);
IpResource
findByAddr
(
String
addr
);
IpResource
findByAddrAndIsDeletedAndIsLocked
(
String
addr
,
boolean
isDeleted
,
boolean
isLocked
);
IpResource
findByAddrAndIsDeleted
(
String
addr
,
boolean
isDeleted
);
IpResource
findByAddrAndIsDeleted
(
String
addr
,
boolean
isDeleted
);
IpResource
findByIdAndIsDeletedAndIsLocked
(
String
id
,
boolean
isDeleted
,
boolean
isLocked
);
IpResource
findByIdAndIsDeleted
(
String
id
,
boolean
isDeleted
);
IpResource
findByIdAndIsDeleted
(
String
id
,
boolean
isDeleted
);
List
<
IpResource
>
findByIdInAndIsDeleted
(
List
<
String
>
ipIds
,
boolean
isDeleted
);
List
<
IpResource
>
findByIdInAndIsDeleted
(
List
<
String
>
ipIds
,
boolean
isDeleted
);
Page
<
IpResource
>
findByIdInAndIsDeletedOrderByPurchasedTimeDesc
(
List
<
String
>
ipIds
,
boolean
isDeleted
,
Pageable
pageable
);
Page
<
IpResource
>
findByIdInAndIsDeletedOrderByPurchasedTimeDesc
(
List
<
String
>
ipIds
,
boolean
isDeleted
,
Pageable
pageable
);
...
...
src/main/java/com/edgec/browserbackend/browser/service/Impl/IpResourceServiceImpl.java
View file @
d9f246c1
...
@@ -354,9 +354,14 @@ public class IpResourceServiceImpl implements IpResourceService {
...
@@ -354,9 +354,14 @@ public class IpResourceServiceImpl implements IpResourceService {
if
(
account
==
null
)
if
(
account
==
null
)
throw
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
);
throw
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
);
IpOperationResultDto
ipOperationResultDto
=
new
IpOperationResultDto
();
IpOperationResultDto
ipOperationResultDto
=
new
IpOperationResultDto
();
RestTemplate
restTemplate
=
new
RestTemplate
();
HttpHeaders
headers
=
buildGetHeader
();
Map
<
String
,
String
>
params
=
new
HashMap
<
String
,
String
>();
HttpEntity
<
Map
<
String
,
String
>>
httpEntity
=
new
HttpEntity
<>(
params
,
headers
);
if
(
ipResourceRequestDto
.
getAddr
()
!=
null
&&
ipResourceRequestDto
.
getAddr
().
size
()
>
0
)
{
if
(
ipResourceRequestDto
.
getAddr
()
!=
null
&&
ipResourceRequestDto
.
getAddr
().
size
()
>
0
)
{
ipResourceRequestDto
.
getAddr
().
forEach
(
ipAddr
->
{
ipResourceRequestDto
.
getAddr
().
forEach
(
ipAddr
->
{
IpResource
ipResource
=
ipResourceRepository
.
findByAddrAndIsDeleted
(
ipAddr
,
false
);
IpResource
ipResource
=
ipResourceRepository
.
findByAddrAndIsDeleted
AndIsLocked
(
ipAddr
,
false
,
false
);
if
(
ipResource
==
null
)
{
if
(
ipResource
==
null
)
{
ipOperationResultDto
.
getFailList
().
add
(
ipAddr
);
ipOperationResultDto
.
getFailList
().
add
(
ipAddr
);
return
;
return
;
...
@@ -372,10 +377,6 @@ public class IpResourceServiceImpl implements IpResourceService {
...
@@ -372,10 +377,6 @@ public class IpResourceServiceImpl implements IpResourceService {
ipOperationResultDto
.
getFailList
().
add
(
ipAddr
);
ipOperationResultDto
.
getFailList
().
add
(
ipAddr
);
return
;
return
;
}
}
RestTemplate
restTemplate
=
new
RestTemplate
();
HttpHeaders
headers
=
buildGetHeader
();
Map
<
String
,
String
>
params
=
new
HashMap
<
String
,
String
>();
HttpEntity
<
Map
<
String
,
String
>>
httpEntity
=
new
HttpEntity
<>(
params
,
headers
);
try
{
try
{
ResponseEntity
<
String
>
result
=
restTemplate
.
exchange
(
URL
+
"/intelligroup/ipresources?accountId=browser&ip={ip}"
,
HttpMethod
.
DELETE
,
httpEntity
,
String
.
class
,
ipAddr
);
ResponseEntity
<
String
>
result
=
restTemplate
.
exchange
(
URL
+
"/intelligroup/ipresources?accountId=browser&ip={ip}"
,
HttpMethod
.
DELETE
,
httpEntity
,
String
.
class
,
ipAddr
);
DeleteIpResultDto
deleteIpResultDto
=
JSON
.
parseObject
(
result
.
getBody
(),
DeleteIpResultDto
.
class
);
DeleteIpResultDto
deleteIpResultDto
=
JSON
.
parseObject
(
result
.
getBody
(),
DeleteIpResultDto
.
class
);
...
@@ -406,11 +407,18 @@ public class IpResourceServiceImpl implements IpResourceService {
...
@@ -406,11 +407,18 @@ public class IpResourceServiceImpl implements IpResourceService {
}
}
if
(
ipResourceRequestDto
.
getIpId
()
!=
null
&&
ipResourceRequestDto
.
getIpId
().
size
()
>
0
)
{
if
(
ipResourceRequestDto
.
getIpId
()
!=
null
&&
ipResourceRequestDto
.
getIpId
().
size
()
>
0
)
{
ipResourceRequestDto
.
getIpId
().
forEach
(
ipId
->
{
ipResourceRequestDto
.
getIpId
().
forEach
(
ipId
->
{
IpResource
ipResource
=
ipResourceRepository
.
findByIdAndIsDeleted
(
ipId
,
false
);
IpResource
ipResource
=
ipResourceRepository
.
findByIdAndIsDeleted
AndIsLocked
(
ipId
,
false
,
false
);
if
(
ipResource
==
null
)
{
if
(
ipResource
==
null
)
{
ipOperationResultDto
.
getFailList
().
add
(
ipId
);
ipOperationResultDto
.
getFailList
().
add
(
ipId
);
return
;
return
;
}
}
if
(
ipResource
.
getStatus
()
==
6
)
ipResourceRepository
.
delete
(
ipResource
);
else
if
(
ipResource
.
getStatus
()
==
3
)
{
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
);
}
UserShop
userShop
=
null
;
UserShop
userShop
=
null
;
if
(
ipResource
.
getShopId
()
!=
null
)
{
if
(
ipResource
.
getShopId
()
!=
null
)
{
userShop
=
userShopRepository
.
findByUsernameAndShopId
(
username
,
ipResource
.
getShopId
());
userShop
=
userShopRepository
.
findByUsernameAndShopId
(
username
,
ipResource
.
getShopId
());
...
...
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