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
5a80bad5
Commit
5a80bad5
authored
Apr 30, 2020
by
renjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.getIplist加速
2.延迟ip显示2分钟
parent
9d9c17fc
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
15 deletions
+14
-15
IpResource.java
...a/com/edgec/browserbackend/browser/domain/IpResource.java
+1
-1
IpResourceRepository.java
...owserbackend/browser/repository/IpResourceRepository.java
+5
-5
IpResourceServiceImpl.java
...erbackend/browser/service/Impl/IpResourceServiceImpl.java
+7
-8
ShopServiceImpl.java
.../browserbackend/browser/service/Impl/ShopServiceImpl.java
+1
-1
No files found.
src/main/java/com/edgec/browserbackend/browser/domain/IpResource.java
View file @
5a80bad5
...
@@ -21,7 +21,7 @@ public class IpResource implements Serializable {
...
@@ -21,7 +21,7 @@ public class IpResource implements Serializable {
private
String
vendorCn
;
private
String
vendorCn
;
private
String
region
;
private
String
region
;
private
String
regionCn
;
private
String
regionCn
;
//0:正常, 1:已过期, 2:即将过期, 3:正在分配, 4:未使用, 5:已失效, 6:未分配, 7:未缴费
//0:正常, 1:已过期, 2:即将过期, 3:正在分配, 4:未使用, 5:已失效, 6:未分配, 7:未缴费
, 8:分配成功
private
int
status
;
private
int
status
;
private
List
<
String
>
port
;
private
List
<
String
>
port
;
private
long
purchasedTime
;
private
long
purchasedTime
;
...
...
src/main/java/com/edgec/browserbackend/browser/repository/IpResourceRepository.java
View file @
5a80bad5
...
@@ -22,11 +22,11 @@ public interface IpResourceRepository extends MongoRepository<IpResource, String
...
@@ -22,11 +22,11 @@ public interface IpResourceRepository extends MongoRepository<IpResource, String
List
<
IpResource
>
findByOwnerAndStatusIsNotInAndIsDeletedAndShopIdIsNull
(
String
owner
,
List
<
Integer
>
status
,
boolean
isDeleted
);
List
<
IpResource
>
findByOwnerAndStatusIsNotInAndIsDeletedAndShopIdIsNull
(
String
owner
,
List
<
Integer
>
status
,
boolean
isDeleted
);
List
<
IpResource
>
findByOwnerAndStatusAndIsDeletedAndShopIdIsNull
(
String
owner
,
int
status
,
boolean
isDeleted
);
List
<
IpResource
>
findByOwnerAndStatusAndIsDeletedAndShopIdIsNull
(
String
owner
,
int
status
,
boolean
isDeleted
);
List
<
IpResource
>
findByStatusAndShopIdInAndIsDeleted
(
int
status
,
List
<
String
>
ipIds
,
boolean
isDeleted
);
List
<
IpResource
>
findByStatusAndShopIdInAndIsDeleted
(
int
status
,
List
<
String
>
ipIds
,
boolean
isDeleted
);
Page
<
IpResource
>
findBy
AddrLikeAndIdInAndIsDeletedOrderByPurchasedTimeDesc
(
String
addr
,
List
<
String
>
ipIds
,
boolean
isDeleted
,
Pageable
pageable
);
Page
<
IpResource
>
findBy
IsDeletedAndIdInAndAddrLikeOrderByPurchasedTimeDesc
(
boolean
isDeleted
,
List
<
String
>
ipIds
,
String
addr
,
Pageable
pageable
);
Page
<
IpResource
>
findBy
VendorCnLikeAndIdInAndIsDeletedOrderByPurchasedTimeDesc
(
String
vendorCn
,
List
<
String
>
ipIds
,
boolean
isDeleted
,
Pageable
pageable
);
Page
<
IpResource
>
findBy
IsDeletedAndIdInAndVendorCnLikeOrderByPurchasedTimeDesc
(
boolean
isDeleted
,
List
<
String
>
ipIds
,
String
vendorCn
,
Pageable
pageable
);
Page
<
IpResource
>
findBy
VendorLikeAndIdInAndIsDeletedOrderByPurchasedTimeDesc
(
String
vendor
,
List
<
String
>
ipIds
,
boolean
isDeleted
,
Pageable
pageable
);
Page
<
IpResource
>
findBy
IsDeletedAndIdInAndVendorLikeOrderByPurchasedTimeDesc
(
boolean
isDeleted
,
List
<
String
>
ipIds
,
String
vendor
,
Pageable
pageable
);
Page
<
IpResource
>
findBy
RegionCnLikeAndIdInAndIsDeletedOrderByPurchasedTimeDesc
(
String
region
,
List
<
String
>
ipIds
,
boolean
isDeleted
,
Pageable
pageable
);
Page
<
IpResource
>
findBy
IsDeletedAndIdInAndRegionCnLikeOrderByPurchasedTimeDesc
(
boolean
isDeleted
,
List
<
String
>
ipIds
,
String
region
,
Pageable
pageable
);
List
<
IpResource
>
findBy
RegionCnLikeAndShopIdInAndIsDeleted
(
String
regionCn
,
List
<
String
>
shopIds
,
boolean
isDeleted
);
List
<
IpResource
>
findBy
IsDeletedAndShopIdInAndRegionCnLike
(
boolean
isDeleted
,
List
<
String
>
shopIds
,
String
regionCn
);
List
<
IpResource
>
findByStatusAndLockedAndLockTimestampLessThan
(
int
status
,
boolean
locked
,
long
timestamp
);
List
<
IpResource
>
findByStatusAndLockedAndLockTimestampLessThan
(
int
status
,
boolean
locked
,
long
timestamp
);
...
...
src/main/java/com/edgec/browserbackend/browser/service/Impl/IpResourceServiceImpl.java
View file @
5a80bad5
...
@@ -510,13 +510,13 @@ public class IpResourceServiceImpl implements IpResourceService {
...
@@ -510,13 +510,13 @@ public class IpResourceServiceImpl implements IpResourceService {
List
<
String
>
allIpIds
=
ipResources
.
stream
().
map
(
x
->
x
.
getId
()).
collect
(
Collectors
.
toList
());
List
<
String
>
allIpIds
=
ipResources
.
stream
().
map
(
x
->
x
.
getId
()).
collect
(
Collectors
.
toList
());
Page
<
IpResource
>
ipResources1
=
null
;
Page
<
IpResource
>
ipResources1
=
null
;
if
(
ipFilterDto
!=
null
&&
StringUtils
.
isNotBlank
(
ipFilterDto
.
getRegion
()))
{
if
(
ipFilterDto
!=
null
&&
StringUtils
.
isNotBlank
(
ipFilterDto
.
getRegion
()))
{
ipResources1
=
ipResourceRepository
.
findBy
RegionCnLikeAndIdInAndIsDeletedOrderByPurchasedTimeDesc
(
ipFilterDto
.
getRegion
(),
allIpIds
,
false
,
pageable
);
ipResources1
=
ipResourceRepository
.
findBy
IsDeletedAndIdInAndRegionCnLikeOrderByPurchasedTimeDesc
(
false
,
allIpIds
,
ipFilterDto
.
getRegion
()
,
pageable
);
}
}
else
if
(
ipFilterDto
!=
null
&&
StringUtils
.
isNotBlank
(
ipFilterDto
.
getAddr
()))
{
else
if
(
ipFilterDto
!=
null
&&
StringUtils
.
isNotBlank
(
ipFilterDto
.
getAddr
()))
{
ipResources1
=
ipResourceRepository
.
findBy
AddrLikeAndIdInAndIsDeletedOrderByPurchasedTimeDesc
(
ipFilterDto
.
getAddr
(),
allIpIds
,
false
,
pageable
);
ipResources1
=
ipResourceRepository
.
findBy
IsDeletedAndIdInAndAddrLikeOrderByPurchasedTimeDesc
(
false
,
allIpIds
,
ipFilterDto
.
getAddr
()
,
pageable
);
}
}
else
if
(
ipFilterDto
!=
null
&&
StringUtils
.
isNotBlank
(
ipFilterDto
.
getVendor
()))
{
else
if
(
ipFilterDto
!=
null
&&
StringUtils
.
isNotBlank
(
ipFilterDto
.
getVendor
()))
{
ipResources1
=
ipResourceRepository
.
findBy
VendorCnLikeAndIdInAndIsDeletedOrderByPurchasedTimeDesc
(
ipFilterDto
.
getVendor
(),
allIpIds
,
false
,
pageable
);
ipResources1
=
ipResourceRepository
.
findBy
IsDeletedAndIdInAndVendorCnLikeOrderByPurchasedTimeDesc
(
false
,
allIpIds
,
ipFilterDto
.
getVendor
()
,
pageable
);
}
else
{
}
else
{
ipResources1
=
ipResourceRepository
.
findByIdInAndIsDeletedOrderByPurchasedTimeDesc
(
allIpIds
,
false
,
pageable
);
ipResources1
=
ipResourceRepository
.
findByIdInAndIsDeletedOrderByPurchasedTimeDesc
(
allIpIds
,
false
,
pageable
);
}
}
...
@@ -532,7 +532,10 @@ public class IpResourceServiceImpl implements IpResourceService {
...
@@ -532,7 +532,10 @@ public class IpResourceServiceImpl implements IpResourceService {
shopDto
=
new
ShopDto
(
shop
);
shopDto
=
new
ShopDto
(
shop
);
}
}
if
(
StringUtils
.
isNotBlank
(
x
.
getAddr
()))
{
if
(
StringUtils
.
isNotBlank
(
x
.
getAddr
()))
{
if
(
x
.
getValidTime
()
<=
Instant
.
now
().
plusSeconds
(
60
*
60
*
24
*
7
).
toEpochMilli
()
&&
x
.
getValidTime
()
>
Instant
.
now
().
toEpochMilli
())
{
if
(
x
.
getLockTimestamp
()
>=
Instant
.
now
().
minusSeconds
(
120
).
toEpochMilli
()
&&
x
.
getIpType
()
==
IpType
.
VENDOR
&&
(
x
.
getStatus
()
==
0
||
x
.
getStatus
()
==
2
))
{
x
.
setStatus
(
3
);
}
else
if
(
x
.
getValidTime
()
<=
Instant
.
now
().
plusSeconds
(
60
*
60
*
24
*
7
).
toEpochMilli
()
&&
x
.
getValidTime
()
>
Instant
.
now
().
toEpochMilli
())
{
if
(
x
.
getStatus
()
!=
5
&&
x
.
getStatus
()
!=
3
&&
x
.
getStatus
()
!=
6
)
{
if
(
x
.
getStatus
()
!=
5
&&
x
.
getStatus
()
!=
3
&&
x
.
getStatus
()
!=
6
)
{
x
.
setStatus
(
2
);
x
.
setStatus
(
2
);
ipResourceRepository
.
save
(
x
);
ipResourceRepository
.
save
(
x
);
...
@@ -692,11 +695,7 @@ public class IpResourceServiceImpl implements IpResourceService {
...
@@ -692,11 +695,7 @@ public class IpResourceServiceImpl implements IpResourceService {
ipResource
.
setStatus
(
2
);
ipResource
.
setStatus
(
2
);
ipResourceRepository
.
save
(
ipResource
);
ipResourceRepository
.
save
(
ipResource
);
}
else
if
(
ipResource
.
getValidTime
()
<=
Instant
.
now
().
minusSeconds
(
60
*
60
*
24
*
7
).
toEpochMilli
())
{
}
else
if
(
ipResource
.
getValidTime
()
<=
Instant
.
now
().
minusSeconds
(
60
*
60
*
24
*
7
).
toEpochMilli
())
{
if
(
ipResource
.
getIpType
()
==
IpType
.
VENDOR
)
{
deleteIp
(
username
,
ipResourceRequestDto
);
deleteIp
(
username
,
ipResourceRequestDto
);
}
else
{
deleteIp
(
username
,
ipResourceRequestDto
);
}
}
else
if
(
ipResource
.
getValidTime
()
<=
Instant
.
now
().
toEpochMilli
())
{
}
else
if
(
ipResource
.
getValidTime
()
<=
Instant
.
now
().
toEpochMilli
())
{
ipResource
.
setStatus
(
1
);
ipResource
.
setStatus
(
1
);
ipResourceRepository
.
save
(
ipResource
);
ipResourceRepository
.
save
(
ipResource
);
...
...
src/main/java/com/edgec/browserbackend/browser/service/Impl/ShopServiceImpl.java
View file @
5a80bad5
...
@@ -382,7 +382,7 @@ public class ShopServiceImpl implements ShopService {
...
@@ -382,7 +382,7 @@ public class ShopServiceImpl implements ShopService {
}
}
Page
<
Shop
>
shops
;
Page
<
Shop
>
shops
;
if
(
shopFilterDto
!=
null
&&
StringUtils
.
isNotBlank
(
shopFilterDto
.
getIpRegion
()))
{
if
(
shopFilterDto
!=
null
&&
StringUtils
.
isNotBlank
(
shopFilterDto
.
getIpRegion
()))
{
List
<
String
>
filter
=
ipResourceRepository
.
findBy
RegionCnLikeAndShopIdInAndIsDeleted
(
shopFilterDto
.
getIpRegion
(),
shopIds
,
false
)
List
<
String
>
filter
=
ipResourceRepository
.
findBy
IsDeletedAndShopIdInAndRegionCnLike
(
false
,
shopIds
,
shopFilterDto
.
getIpRegion
()
)
.
stream
().
map
(
x
->
x
.
getShopId
()).
collect
(
Collectors
.
toList
());
.
stream
().
map
(
x
->
x
.
getShopId
()).
collect
(
Collectors
.
toList
());
shops
=
shopRepository
.
findByShopIdInOrderByCreateTimeDesc
(
filter
,
pageable
);
shops
=
shopRepository
.
findByShopIdInOrderByCreateTimeDesc
(
filter
,
pageable
);
}
}
...
...
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