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
0ccd72a6
Commit
0ccd72a6
authored
Mar 10, 2020
by
renjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shop接口bug修改
parent
b586b3b8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
13 deletions
+14
-13
ShopRepository.java
...gec/browserbackend/browser/repository/ShopRepository.java
+4
-4
ShopServiceImpl.java
.../browserbackend/browser/service/Impl/ShopServiceImpl.java
+10
-9
No files found.
src/main/java/com/edgec/browserbackend/browser/repository/ShopRepository.java
View file @
0ccd72a6
...
...
@@ -8,8 +8,8 @@ import org.springframework.data.mongodb.repository.MongoRepository;
import
java.util.List
;
public
interface
ShopRepository
extends
MongoRepository
<
Shop
,
String
>
{
List
<
Shop
>
findByShopIdInAndIpRegionLike
(
List
<
String
>
shopIds
,
String
ipRegion
);
List
<
Shop
>
findByShopIdInAndShopAccountLike
(
List
<
String
>
shopIds
,
String
shopAccount
);
List
<
Shop
>
findByShopIdInAndShopNameLike
(
List
<
String
>
shopIds
,
String
shopNam
e
);
List
<
Shop
>
findByShopIdIn
(
List
<
String
>
shopIds
);
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
pageabl
e
);
Page
<
Shop
>
findByShopIdIn
(
List
<
String
>
shopIds
,
Pageable
pageable
);
}
src/main/java/com/edgec/browserbackend/browser/service/Impl/ShopServiceImpl.java
View file @
0ccd72a6
...
...
@@ -250,7 +250,7 @@ public class ShopServiceImpl implements ShopService {
throw
new
ClientRequestException
(
AccountErrorCode
.
NOPERMISSION
);
}
Pageable
pageable
=
PageRequest
.
of
(
0
,
100
);
List
<
Shop
>
shops
=
shopRepository
.
findByShopIdIn
(
shopIds
);
List
<
Shop
>
shops
=
shopRepository
.
findByShopIdIn
(
shopIds
,
pageable
).
getContent
(
);
if
(
shops
==
null
||
shops
.
size
()
<
1
)
throw
new
ClientRequestException
(
BrowserErrorCode
.
SHOPNOTEXIST
);
List
<
Account
>
accounts
=
accountRepository
.
findByNameIn
(
users
);
...
...
@@ -296,19 +296,20 @@ public class ShopServiceImpl implements ShopService {
shopIds
=
userShopRepository
.
findByUsernameAndGroupId
(
username
,
groupId
).
stream
().
map
(
x
->
x
.
getShopId
()).
collect
(
Collectors
.
toList
());
}
List
<
Shop
>
shops
;
logger
.
error
(
"shopIds.size "
+
shopIds
.
size
());
Page
<
Shop
>
shops
;
if
(
filterDto
!=
null
&&
StringUtils
.
isNotBlank
(
filterDto
.
getIpRegion
()))
shops
=
shopRepository
.
findByShopIdInAndIpRegionLike
(
shopIds
,
filterDto
.
getIpRegion
());
shops
=
shopRepository
.
findByShopIdInAndIpRegionLike
(
shopIds
,
filterDto
.
getIpRegion
()
,
pageable
);
else
if
(
filterDto
!=
null
&&
StringUtils
.
isNotBlank
(
filterDto
.
getShopAccount
()))
shops
=
shopRepository
.
findByShopIdInAndShopAccountLike
(
shopIds
,
filterDto
.
getShopAccount
());
shops
=
shopRepository
.
findByShopIdInAndShopAccountLike
(
shopIds
,
filterDto
.
getShopAccount
()
,
pageable
);
else
if
(
filterDto
!=
null
&&
StringUtils
.
isNotBlank
(
filterDto
.
getShopName
()))
shops
=
shopRepository
.
findByShopIdInAndShopNameLike
(
shopIds
,
filterDto
.
getShopName
());
shops
=
shopRepository
.
findByShopIdInAndShopNameLike
(
shopIds
,
filterDto
.
getShopName
()
,
pageable
);
else
shops
=
shopRepository
.
findByShopIdIn
(
shopIds
);
if
(
shops
==
null
||
shops
.
size
()
<
1
)
shops
=
shopRepository
.
findByShopIdIn
(
shopIds
,
pageable
);
if
(
shops
==
null
||
shops
.
getNumberOfElements
()
<
1
)
return
new
ShopPageResultDto
();
List
<
ShopDto
>
shopDtos
=
new
ArrayList
<>();
shops
.
stream
().
forEach
(
x
->
{
shops
.
getContent
().
stream
().
forEach
(
x
->
{
IpResource
ipResource
=
ipResourceRepository
.
findByAddrAndIsDeleted
(
x
.
getIp
(),
false
);
if
(
ipResource
==
null
)
ipResource
=
new
IpResource
();
...
...
@@ -321,7 +322,7 @@ public class ShopServiceImpl implements ShopService {
ShopPageInfo
shopPageInfo
=
new
ShopPageInfo
();
shopPageInfo
.
setCurrentPage
(
shopDtoPage
.
getPageable
().
getPageNumber
());
shopPageInfo
.
setTotalPages
(
shopDtoPage
.
getTotalPages
());
shopPageInfo
.
setTotalShops
(
shop
Dto
s
.
size
());
shopPageInfo
.
setTotalShops
(
shop
Id
s
.
size
());
shopPageResultDto
.
setShopPage
(
shopPageInfo
);
return
shopPageResultDto
;
}
...
...
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