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
d76aab9d
Commit
d76aab9d
authored
Mar 19, 2020
by
renjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IpSummary
排序
parent
5036f086
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
120 additions
and
15 deletions
+120
-15
AccountDto.java
...a/com/edgec/browserbackend/account/domain/AccountDto.java
+11
-0
AccountServiceImpl.java
...owserbackend/account/service/impl/AccountServiceImpl.java
+8
-0
IpSummary.java
...va/com/edgec/browserbackend/browser/domain/IpSummary.java
+40
-0
Shop.java
...in/java/com/edgec/browserbackend/browser/domain/Shop.java
+12
-0
ShopResultDto.java
...a/com/edgec/browserbackend/browser/dto/ShopResultDto.java
+11
-0
IpResourceRepository.java
...owserbackend/browser/repository/IpResourceRepository.java
+3
-3
ShopRepository.java
...gec/browserbackend/browser/repository/ShopRepository.java
+4
-4
IpResourceServiceImpl.java
...erbackend/browser/service/Impl/IpResourceServiceImpl.java
+21
-3
ShopServiceImpl.java
.../browserbackend/browser/service/Impl/ShopServiceImpl.java
+8
-5
IpResourceService.java
...gec/browserbackend/browser/service/IpResourceService.java
+2
-0
No files found.
src/main/java/com/edgec/browserbackend/account/domain/AccountDto.java
View file @
d76aab9d
package
com
.
edgec
.
browserbackend
.
account
.
domain
;
import
com.edgec.browserbackend.browser.domain.IpSummary
;
import
com.edgec.browserbackend.browser.domain.ShopSummary
;
import
java.util.ArrayList
;
...
...
@@ -42,6 +43,8 @@ public class AccountDto {
private
ShopSummary
shopSummary
;
private
IpSummary
ipSummary
;
private
List
<
String
>
queryIpUrlList
;
public
AccountDto
(){
...
...
@@ -199,6 +202,14 @@ public class AccountDto {
this
.
shopSummary
=
shopSummary
;
}
public
IpSummary
getIpSummary
()
{
return
ipSummary
;
}
public
void
setIpSummary
(
IpSummary
ipSummary
)
{
this
.
ipSummary
=
ipSummary
;
}
public
List
<
String
>
getQueryIpUrlList
()
{
return
queryIpUrlList
;
}
...
...
src/main/java/com/edgec/browserbackend/account/service/impl/AccountServiceImpl.java
View file @
d76aab9d
...
...
@@ -12,6 +12,7 @@ import com.edgec.browserbackend.account.utils.AccountServicePool;
import
com.edgec.browserbackend.auth.exception.AuthErrorCode
;
import
com.edgec.browserbackend.auth.repository.UserRepository
;
import
com.edgec.browserbackend.auth.service.UserAuthService
;
import
com.edgec.browserbackend.browser.domain.IpSummary
;
import
com.edgec.browserbackend.browser.domain.ShopSummary
;
import
com.edgec.browserbackend.browser.dto.PageInfo
;
import
com.edgec.browserbackend.browser.dto.ShopPageResultDto
;
...
...
@@ -91,6 +92,9 @@ public class AccountServiceImpl implements AccountService {
@Autowired
private
ShopService
shopService
;
@Autowired
private
IpResourceService
ipResourceService
;
@Override
public
List
<
UserBillList
>
getUserBills0
(
String
name
)
{
...
...
@@ -337,6 +341,10 @@ public class AccountServiceImpl implements AccountService {
if
(
shopSummary
!=
null
)
current
.
setShopSummary
(
shopSummary
);
IpSummary
ipSummary
=
ipResourceService
.
getIpSummary
(
name
);
if
(
ipSummary
!=
null
)
current
.
setIpSummary
(
ipSummary
);
resultDto
.
setStatus
(
0
);
resultDto
.
setData
(
current
);
}
catch
(
Exception
e
)
{
...
...
src/main/java/com/edgec/browserbackend/browser/domain/IpSummary.java
0 → 100644
View file @
d76aab9d
package
com
.
edgec
.
browserbackend
.
browser
.
domain
;
public
class
IpSummary
{
private
int
total
;
private
int
unbind
;
private
int
willExpire
;
private
int
expired
;
public
int
getExpired
()
{
return
expired
;
}
public
void
setExpired
(
int
expired
)
{
this
.
expired
=
expired
;
}
public
int
getTotal
()
{
return
total
;
}
public
void
setTotal
(
int
total
)
{
this
.
total
=
total
;
}
public
int
getUnbind
()
{
return
unbind
;
}
public
void
setUnbind
(
int
unbind
)
{
this
.
unbind
=
unbind
;
}
public
int
getWillExpire
()
{
return
willExpire
;
}
public
void
setWillExpire
(
int
willExpire
)
{
this
.
willExpire
=
willExpire
;
}
}
src/main/java/com/edgec/browserbackend/browser/domain/Shop.java
View file @
d76aab9d
...
...
@@ -36,6 +36,8 @@ public class Shop {
private
String
shopCookie
;
private
long
createTime
;
public
Shop
(){
}
...
...
@@ -60,6 +62,7 @@ public class Shop {
this
.
setShopUA
(
shop
.
getShopUA
());
if
(
shop
.
getShopCookie
()
!=
null
)
this
.
setShopCookie
(
shop
.
getShopCookie
());
this
.
setCreateTime
(
shop
.
getCreateTime
());
return
this
;
}
...
...
@@ -88,6 +91,7 @@ public class Shop {
this
.
setShopUA
(
shop
.
getShopUA
());
if
(
shop
.
getShopCookie
()
!=
null
)
this
.
setShopCookie
(
shop
.
getShopCookie
());
this
.
setCreateTime
(
shop
.
getCreateTime
());
return
this
;
}
...
...
@@ -194,4 +198,12 @@ public class Shop {
public
void
setShopUA
(
String
shopUA
)
{
this
.
shopUA
=
shopUA
;
}
public
long
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
long
createTime
)
{
this
.
createTime
=
createTime
;
}
}
src/main/java/com/edgec/browserbackend/browser/dto/ShopResultDto.java
View file @
d76aab9d
...
...
@@ -32,6 +32,8 @@ public class ShopResultDto {
private
IpResource
bindIp
;
private
long
createTime
;
public
static
ShopResultDto
of
(
Shop
shop
,
String
group
,
IpResource
ipResources
)
{
ShopResultDto
shopResultDto
=
new
ShopResultDto
();
shopResultDto
.
setShopId
(
shop
.
getShopId
());
...
...
@@ -55,6 +57,7 @@ public class ShopResultDto {
shopResultDto
.
setShopAccount
(
shop
.
getShopAccount
());
shopResultDto
.
setGroup
(
group
);
shopResultDto
.
setBindIp
(
ipResources
);
shopResultDto
.
setCreateTime
(
shop
.
getCreateTime
());
return
shopResultDto
;
}
...
...
@@ -153,4 +156,12 @@ public class ShopResultDto {
public
void
setShopCookie
(
String
shopCookie
)
{
this
.
shopCookie
=
shopCookie
;
}
public
long
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
long
createTime
)
{
this
.
createTime
=
createTime
;
}
}
src/main/java/com/edgec/browserbackend/browser/repository/IpResourceRepository.java
View file @
d76aab9d
...
...
@@ -14,9 +14,9 @@ public interface IpResourceRepository extends MongoRepository<IpResource, String
List
<
IpResource
>
findByOwnerAndIsDeletedAndShopIdIsNull
(
String
owner
,
boolean
isDeleted
);
List
<
IpResource
>
findByOwnerAndStatusAndIsDeletedAndShopIdIsNull
(
String
owner
,
int
status
,
boolean
isDeleted
);
List
<
IpResource
>
findByStatusAndIdInAndIsDeleted
(
int
status
,
List
<
String
>
ipIds
,
boolean
isDeleted
);
Page
<
IpResource
>
findByAddrLikeAndIdInAndIsDeleted
(
String
addr
,
List
<
String
>
ipIds
,
boolean
isDeleted
,
Pageable
pageable
);
Page
<
IpResource
>
findByVendorLikeAndIdInAndIsDeleted
(
String
vendor
,
List
<
String
>
ipIds
,
boolean
isDeleted
,
Pageable
pageable
);
Page
<
IpResource
>
findByRegionLikeAndIdInAndIsDeleted
(
String
region
,
List
<
String
>
ipIds
,
boolean
isDeleted
,
Pageable
pageable
);
Page
<
IpResource
>
findByAddrLikeAndIdInAndIsDeleted
OrderByPurchasedTimeDesc
(
String
addr
,
List
<
String
>
ipIds
,
boolean
isDeleted
,
Pageable
pageable
);
Page
<
IpResource
>
findByVendorLikeAndIdInAndIsDeleted
OrderByPurchasedTimeDesc
(
String
vendor
,
List
<
String
>
ipIds
,
boolean
isDeleted
,
Pageable
pageable
);
Page
<
IpResource
>
findByRegionLikeAndIdInAndIsDeleted
OrderByPurchasedTimeDesc
(
String
region
,
List
<
String
>
ipIds
,
boolean
isDeleted
,
Pageable
pageable
);
List
<
IpResource
>
findByValidTimeBetween
(
long
beginTime
,
long
endTime
);
...
...
src/main/java/com/edgec/browserbackend/browser/repository/ShopRepository.java
View file @
d76aab9d
...
...
@@ -8,9 +8,9 @@ import org.springframework.data.mongodb.repository.MongoRepository;
import
java.util.List
;
public
interface
ShopRepository
extends
MongoRepository
<
Shop
,
String
>
{
Page
<
Shop
>
findByShopIdInAndIpRegionLike
(
List
<
String
>
shopIds
,
String
ipRegion
,
Pageable
pageable
);
Page
<
Shop
>
findByShopIdInAndShopAccountLike
(
List
<
String
>
shopIds
,
String
shopAccount
,
Pageable
pageable
);
Page
<
Shop
>
findByShopIdInAndShopNameLike
(
List
<
String
>
shopIds
,
String
shopName
,
Pageable
pageable
);
Page
<
Shop
>
findByShopIdIn
(
List
<
String
>
shopIds
,
Pageable
pageable
);
Page
<
Shop
>
findByShopIdInAndIpRegionLike
OrderByCreateTimeDesc
(
List
<
String
>
shopIds
,
String
ipRegion
,
Pageable
pageable
);
Page
<
Shop
>
findByShopIdInAndShopAccountLike
OrderByCreateTimeDesc
(
List
<
String
>
shopIds
,
String
shopAccount
,
Pageable
pageable
);
Page
<
Shop
>
findByShopIdInAndShopNameLike
OrderByCreateTimeDesc
(
List
<
String
>
shopIds
,
String
shopName
,
Pageable
pageable
);
Page
<
Shop
>
findByShopIdIn
OrderByCreateTimeDesc
(
List
<
String
>
shopIds
,
Pageable
pageable
);
List
<
Shop
>
findByOwnerAndIpIsNotNull
(
String
username
);
}
src/main/java/com/edgec/browserbackend/browser/service/Impl/IpResourceServiceImpl.java
View file @
d76aab9d
...
...
@@ -432,13 +432,13 @@ public class IpResourceServiceImpl implements IpResourceService {
List
<
String
>
allIpIds
=
ipResources
.
stream
().
map
(
x
->
x
.
getId
()).
collect
(
Collectors
.
toList
());
Page
<
IpResource
>
ipResources1
=
null
;
if
(
ipFilterDto
!=
null
&&
StringUtils
.
isNotBlank
(
ipFilterDto
.
getRegion
()))
{
ipResources1
=
ipResourceRepository
.
findByRegionLikeAndIdInAndIsDeleted
(
ipFilterDto
.
getRegion
(),
allIpIds
,
false
,
pageable
);
ipResources1
=
ipResourceRepository
.
findByRegionLikeAndIdInAndIsDeleted
OrderByPurchasedTimeDesc
(
ipFilterDto
.
getRegion
(),
allIpIds
,
false
,
pageable
);
}
else
if
(
ipFilterDto
!=
null
&&
StringUtils
.
isNotBlank
(
ipFilterDto
.
getAddr
()))
{
ipResources1
=
ipResourceRepository
.
findByAddrLikeAndIdInAndIsDeleted
(
ipFilterDto
.
getAddr
(),
allIpIds
,
false
,
pageable
);
ipResources1
=
ipResourceRepository
.
findByAddrLikeAndIdInAndIsDeleted
OrderByPurchasedTimeDesc
(
ipFilterDto
.
getAddr
(),
allIpIds
,
false
,
pageable
);
}
else
if
(
ipFilterDto
!=
null
&&
StringUtils
.
isNotBlank
(
ipFilterDto
.
getVendor
()))
{
ipResources1
=
ipResourceRepository
.
findByVendorLikeAndIdInAndIsDeleted
(
ipFilterDto
.
getVendor
(),
allIpIds
,
false
,
pageable
);
ipResources1
=
ipResourceRepository
.
findByVendorLikeAndIdInAndIsDeleted
OrderByPurchasedTimeDesc
(
ipFilterDto
.
getVendor
(),
allIpIds
,
false
,
pageable
);
}
else
{
ipResources
.
forEach
(
x
->
{
ShopDto
shopDto
;
...
...
@@ -574,4 +574,22 @@ public class IpResourceServiceImpl implements IpResourceService {
// }
return
ipTransactionDto
;
}
@Override
public
IpSummary
getIpSummary
(
String
username
)
{
Account
account
=
accountRepository
.
findByName
(
username
);
if
(
account
==
null
)
throw
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
);
IpSummary
ipSummary
=
new
IpSummary
();
List
<
String
>
used
=
userShopRepository
.
findByUsernameAndIpIdIsNotNull
(
username
).
stream
().
map
(
x
->
x
.
getIpId
()).
collect
(
Collectors
.
toList
());
List
<
String
>
unbind
=
ipResourceRepository
.
findByOwnerAndIsDeletedAndShopIdIsNull
(
username
,
false
).
stream
().
map
(
x
->
x
.
getId
()).
collect
(
Collectors
.
toList
());
ipSummary
.
setUnbind
(
unbind
.
size
());
unbind
.
addAll
(
used
);
int
expired
=
ipResourceRepository
.
countByStatusAndIdInAndIsDeleted
(
1
,
unbind
,
false
);
ipSummary
.
setExpired
(
expired
);
int
willexpired
=
ipResourceRepository
.
countByStatusAndIdInAndIsDeleted
(
2
,
unbind
,
false
);
ipSummary
.
setWillExpire
(
willexpired
);
ipSummary
.
setTotal
(
unbind
.
size
());
return
ipSummary
;
}
}
src/main/java/com/edgec/browserbackend/browser/service/Impl/ShopServiceImpl.java
View file @
d76aab9d
...
...
@@ -315,7 +315,7 @@ public class ShopServiceImpl implements ShopService {
throw
new
ClientRequestException
(
AccountErrorCode
.
NOPERMISSION
);
}
Pageable
pageable
=
PageRequest
.
of
(
0
,
100
);
List
<
Shop
>
shops
=
shopRepository
.
findByShopIdIn
(
shopIds
,
pageable
).
getContent
();
List
<
Shop
>
shops
=
shopRepository
.
findByShopIdIn
OrderByCreateTimeDesc
(
shopIds
,
pageable
).
getContent
();
if
(
shops
==
null
||
shops
.
size
()
<
1
)
throw
new
ClientRequestException
(
BrowserErrorCode
.
SHOPNOTEXIST
);
List
<
Account
>
accounts
=
accountRepository
.
findByNameIn
(
users
);
...
...
@@ -381,13 +381,13 @@ public class ShopServiceImpl implements ShopService {
}
Page
<
Shop
>
shops
;
if
(
shopFilterDto
!=
null
&&
StringUtils
.
isNotBlank
(
shopFilterDto
.
getIpRegion
()))
shops
=
shopRepository
.
findByShopIdInAndIpRegionLike
(
shopIds
,
shopFilterDto
.
getIpRegion
(),
pageable
);
shops
=
shopRepository
.
findByShopIdInAndIpRegionLike
OrderByCreateTimeDesc
(
shopIds
,
shopFilterDto
.
getIpRegion
(),
pageable
);
else
if
(
shopFilterDto
!=
null
&&
StringUtils
.
isNotBlank
(
shopFilterDto
.
getShopAccount
()))
shops
=
shopRepository
.
findByShopIdInAndShopAccountLike
(
shopIds
,
shopFilterDto
.
getShopAccount
(),
pageable
);
shops
=
shopRepository
.
findByShopIdInAndShopAccountLike
OrderByCreateTimeDesc
(
shopIds
,
shopFilterDto
.
getShopAccount
(),
pageable
);
else
if
(
shopFilterDto
!=
null
&&
StringUtils
.
isNotBlank
(
shopFilterDto
.
getShopName
()))
shops
=
shopRepository
.
findByShopIdInAndShopNameLike
(
shopIds
,
shopFilterDto
.
getShopName
(),
pageable
);
shops
=
shopRepository
.
findByShopIdInAndShopNameLike
OrderByCreateTimeDesc
(
shopIds
,
shopFilterDto
.
getShopName
(),
pageable
);
else
shops
=
shopRepository
.
findByShopIdIn
(
shopIds
,
pageable
);
shops
=
shopRepository
.
findByShopIdIn
OrderByCreateTimeDesc
(
shopIds
,
pageable
);
if
(
shops
==
null
||
shops
.
getNumberOfElements
()
<
1
)
return
new
ShopPageResultDto
();
List
<
ShopResultDto
>
shopResultDtos
=
new
ArrayList
<>();
...
...
@@ -411,6 +411,9 @@ public class ShopServiceImpl implements ShopService {
@Override
public
ShopSummary
getShopSummary
(
String
username
)
{
Account
account
=
accountRepository
.
findByName
(
username
);
if
(
account
==
null
)
throw
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
);
ShopSummary
shopSummary
=
new
ShopSummary
();
int
unbind
=
userShopRepository
.
countByUsernameAndIpIdIsNull
(
username
);
shopSummary
.
setUnbind
(
unbind
);
...
...
src/main/java/com/edgec/browserbackend/browser/service/IpResourceService.java
View file @
d76aab9d
...
...
@@ -22,4 +22,6 @@ public interface IpResourceService {
List
<
PlatformOptions
>
getPlatformOptions
();
IpTransactionDto
queryTransaction
(
String
username
,
String
transactionId
);
IpSummary
getIpSummary
(
String
username
);
}
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