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
f3bc8799
Commit
f3bc8799
authored
Sep 14, 2020
by
xuxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
针对彭海的店铺分组修改
parent
3af04800
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
9 deletions
+34
-9
ShopController.java
...gec/browserbackend/browser/controller/ShopController.java
+21
-1
ShopServiceImpl.java
.../browserbackend/browser/service/Impl/ShopServiceImpl.java
+12
-7
ShopService.java
...com/edgec/browserbackend/browser/service/ShopService.java
+1
-1
No files found.
src/main/java/com/edgec/browserbackend/browser/controller/ShopController.java
View file @
f3bc8799
...
...
@@ -162,7 +162,27 @@ public class ShopController {
ResultDto
resultDto
=
new
ResultDto
();
try
{
ShopPageResultDto
shopDtos
=
shopService
.
getShopList
(
principal
.
getName
(),
shopRequestDto
.
getGroup
(),
shopRequestDto
.
getPage
(),
shopRequestDto
.
getAmount
(),
shopRequestDto
.
getFilter
());
shopRequestDto
.
getPage
(),
shopRequestDto
.
getAmount
(),
shopRequestDto
.
getFilter
(),
null
);
resultDto
.
setData
(
shopDtos
);
resultDto
.
setStatus
(
0
);
}
catch
(
ClientRequestException
e
)
{
dealClientRequestException
(
resultDto
,
e
);
}
return
resultDto
;
}
/**
* 针对鹏海的需求
* 当 groupId 传 -1 的时候,查询出来的不应该是所有的店铺,而是所有未分配的店铺
*/
@RequestMapping
(
value
=
"/penghai/list"
,
method
=
RequestMethod
.
POST
)
public
ResultDto
getPenghaiShopList
(
Principal
principal
,
@RequestBody
ShopRequestDto
shopRequestDto
)
{
logger
.
info
(
"shop list params {}"
,
JSONObject
.
toJSONString
(
shopRequestDto
));
ResultDto
resultDto
=
new
ResultDto
();
try
{
ShopPageResultDto
shopDtos
=
shopService
.
getShopList
(
principal
.
getName
(),
shopRequestDto
.
getGroup
(),
shopRequestDto
.
getPage
(),
shopRequestDto
.
getAmount
(),
shopRequestDto
.
getFilter
(),
"penghai"
);
resultDto
.
setData
(
shopDtos
);
resultDto
.
setStatus
(
0
);
}
catch
(
ClientRequestException
e
)
{
...
...
src/main/java/com/edgec/browserbackend/browser/service/Impl/ShopServiceImpl.java
View file @
f3bc8799
...
...
@@ -389,11 +389,10 @@ public class ShopServiceImpl implements ShopService {
}
@Override
public
ShopPageResultDto
getShopList
(
String
username
,
String
groupId
,
int
pageNum
,
int
amount
,
ShopFilterDto
shopFilterDto
)
{
public
ShopPageResultDto
getShopList
(
String
username
,
String
groupId
,
int
pageNum
,
int
amount
,
ShopFilterDto
shopFilterDto
,
String
tag
)
{
// 1. 校验当前登录用户的账户是否存在
Account
account
=
accountRepository
.
findByName
(
username
).
orElseThrow
(()
->
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
));
// 2. 如有有分组校验当前查询的分组信息是否正确
Group
group
=
null
;
if
(
groupId
!=
null
)
{
...
...
@@ -405,13 +404,19 @@ public class ShopServiceImpl implements ShopService {
// 3. 根据 groupId 与 username 来查询 shopIds (如果当前用户是父账户,则查询结果包含子账户的shopId)
List
<
String
>
allIds
=
null
;
if
(!
"penghai"
.
equals
(
tag
))
{
if
(
"-1"
.
equals
(
groupId
))
{
allIds
=
userShopRepository
.
findByUsername
(
username
).
stream
()
.
map
(
UserShop:
:
getShopId
).
collect
(
Collectors
.
toList
());
allIds
=
userShopRepository
.
findByUsername
(
username
).
stream
().
map
(
UserShop:
:
getShopId
).
collect
(
Collectors
.
toList
());
}
if
(!
"-1"
.
equals
(
groupId
))
{
// 如果分组
}
else
{
allIds
=
userShopRepository
.
findByUsernameAndGroupId
(
username
,
groupId
).
stream
()
.
map
(
UserShop:
:
getShopId
).
collect
(
Collectors
.
toList
());
allIds
=
userShopRepository
.
findByUsernameAndGroupId
(
username
,
groupId
).
stream
().
map
(
UserShop:
:
getShopId
).
collect
(
Collectors
.
toList
());
}
}
if
(
"penghai"
.
equals
(
tag
))
{
allIds
=
userShopRepository
.
findByUsernameAndGroupId
(
username
,
groupId
).
stream
().
map
(
UserShop:
:
getShopId
).
collect
(
Collectors
.
toList
());
}
// 4. 根据传入的过滤条件得到 shopIds
...
...
src/main/java/com/edgec/browserbackend/browser/service/ShopService.java
View file @
f3bc8799
...
...
@@ -25,7 +25,7 @@ public interface ShopService {
ShopResultDto
queryShop
(
String
username
,
String
shopId
);
ShopPageResultDto
getShopList
(
String
username
,
String
groupId
,
int
page
,
int
amount
,
ShopFilterDto
shopFilterDto
);
ShopPageResultDto
getShopList
(
String
username
,
String
groupId
,
int
page
,
int
amount
,
ShopFilterDto
shopFilterDto
,
String
tag
);
ShopSummary
getShopSummary
(
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