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
fae5790e
Commit
fae5790e
authored
Sep 15, 2020
by
Administrator
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'staging' into 'master'
Staging See merge request
!170
parents
358ce5c8
f3bc8799
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
13 deletions
+44
-13
HistoryController.java
.../browserbackend/browser/controller/HistoryController.java
+8
-2
ShopController.java
...gec/browserbackend/browser/controller/ShopController.java
+21
-1
ShopServiceImpl.java
.../browserbackend/browser/service/Impl/ShopServiceImpl.java
+14
-9
ShopService.java
...com/edgec/browserbackend/browser/service/ShopService.java
+1
-1
No files found.
src/main/java/com/edgec/browserbackend/browser/controller/HistoryController.java
View file @
fae5790e
...
...
@@ -72,8 +72,14 @@ public class HistoryController {
@PostMapping
(
"/url/add"
)
public
void
addWinlog
(
Principal
principal
,
@RequestBody
String
urlRecord
)
{
WinHistory
winHistory
=
new
WinHistory
(
Instant
.
now
().
toEpochMilli
(),
urlRecord
);
historyService
.
addBrowserWinLog
(
principal
.
getName
(),
winHistory
);
ResultDto
resultDto
=
new
ResultDto
();
try
{
WinHistory
winHistory
=
new
WinHistory
(
Instant
.
now
().
toEpochMilli
(),
urlRecord
);
historyService
.
addBrowserWinLog
(
principal
.
getName
(),
winHistory
);
resultDto
.
setStatus
(
0
);
}
catch
(
ClientRequestException
e
)
{
dealClientRequestException
(
resultDto
,
e
);
}
}
private
void
dealClientRequestException
(
ResultDto
resultDto
,
ClientRequestException
e
)
{
...
...
src/main/java/com/edgec/browserbackend/browser/controller/ShopController.java
View file @
fae5790e
...
...
@@ -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 @
fae5790e
...
...
@@ -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
(
"-1"
.
equals
(
groupId
))
{
allIds
=
userShopRepository
.
findByUsername
(
username
).
stream
()
.
map
(
UserShop:
:
getShopId
).
collect
(
Collectors
.
toList
());
// 如果分组
}
else
{
allIds
=
userShopRepository
.
findByUsernameAndGroupId
(
username
,
groupId
).
stream
()
.
map
(
UserShop:
:
getShopId
).
collect
(
Collectors
.
toList
());
if
(!
"penghai"
.
equals
(
tag
))
{
if
(
"-1"
.
equals
(
groupId
))
{
allIds
=
userShopRepository
.
findByUsername
(
username
).
stream
().
map
(
UserShop:
:
getShopId
).
collect
(
Collectors
.
toList
());
}
if
(!
"-1"
.
equals
(
groupId
))
{
// 如果分组
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 @
fae5790e
...
...
@@ -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