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
e01ba82d
Commit
e01ba82d
authored
Jun 29, 2020
by
jim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
null
parent
aa9ad17b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
15 deletions
+13
-15
ShopServiceImpl.java
.../browserbackend/browser/service/Impl/ShopServiceImpl.java
+13
-15
No files found.
src/main/java/com/edgec/browserbackend/browser/service/Impl/ShopServiceImpl.java
View file @
e01ba82d
...
...
@@ -169,7 +169,7 @@ public class ShopServiceImpl implements ShopService {
ids
.
add
(
id
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"fail to add shops"
,
e
.
getMessage
()
);
logger
.
error
(
"fail to add shops"
,
e
);
throw
new
ClientRequestException
(
BrowserErrorCode
.
INFORMATIONNOTCOMPELETE
);
}
}
...
...
@@ -201,7 +201,7 @@ public class ShopServiceImpl implements ShopService {
// 4. 更新店铺信息
shopRepository
.
save
(
shop_old
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"fail to update"
,
e
.
getMessage
()
);
logger
.
error
(
"fail to update"
,
e
);
throw
new
ClientRequestException
(
BrowserErrorCode
.
INFORMATIONNOTCOMPELETE
);
}
return
shop_old
.
getShopId
();
...
...
@@ -276,7 +276,7 @@ public class ShopServiceImpl implements ShopService {
userShop
.
setGroupId
(
groupId
);
userShopRepository
.
save
(
userShop
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"fail to unbind"
,
e
.
getMessage
()
);
logger
.
error
(
"fail to unbind"
,
e
);
throw
new
ClientRequestException
(
BrowserErrorCode
.
UNKNOWN
);
}
...
...
@@ -344,7 +344,7 @@ public class ShopServiceImpl implements ShopService {
);
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"fail to assign"
,
e
.
getMessage
()
);
logger
.
error
(
"fail to assign"
,
e
);
throw
new
ClientRequestException
(
BrowserErrorCode
.
UNKNOWN
);
}
}
...
...
@@ -404,7 +404,7 @@ public class ShopServiceImpl implements ShopService {
}
// 4. 根据传入的过滤条件得到 shopIds
List
<
String
>
shopIds
=
n
ull
;
List
<
String
>
shopIds
=
n
ew
ArrayList
<>()
;
if
(
shopFilterDto
.
getBindIp
()
==
0
)
{
shopIds
=
allIds
;
...
...
@@ -425,7 +425,7 @@ public class ShopServiceImpl implements ShopService {
}
}
amount
=
amount
>
100
?
100
:
amount
;
amount
=
Math
.
min
(
amount
,
100
)
;
Pageable
pageable
=
PageRequest
.
of
(
pageNum
,
amount
);
// 5. 根据过滤后的商铺ids 与 其他过滤条件 得到商铺信息并分页
Page
<
Shop
>
shops
=
getShopsByFilter
(
shopFilterDto
,
shopIds
,
pageable
);
...
...
@@ -434,7 +434,7 @@ public class ShopServiceImpl implements ShopService {
ShopPageResultDto
<
ShopResultDto
>
shopPageResultDto
=
new
ShopPageResultDto
<>();
if
(
shops
!=
null
&&
shops
.
getNumberOfElements
()
>=
1
)
{
List
<
ShopResultDto
>
shopResultDtos
=
new
ArrayList
<>();
shops
.
getContent
().
stream
().
forEach
(
shops
.
getContent
().
forEach
(
// 设置ip资源状态 并 封装 shopResultDto信息
x
->
{
IpResource
ipResource
=
ipResourceRepository
.
findFirstByShopIdsIsAndIsDeleted
(
x
.
getShopId
(),
false
);
...
...
@@ -539,7 +539,7 @@ public class ShopServiceImpl implements ShopService {
// 获取当前登录用户绑定了当前商铺的 所有子用户名
List
<
String
>
shopUsers
=
userShopRepository
.
findByShopId
(
shopId
).
stream
()
.
map
(
x
->
x
.
getUsername
()
)
.
map
(
UserShop:
:
getUsername
)
.
filter
(
x
->
!
x
.
equals
(
username
))
.
collect
(
Collectors
.
toList
());
return
shopUsers
;
...
...
@@ -567,7 +567,7 @@ public class ShopServiceImpl implements ShopService {
return
shopUsers
;
}
List
<
String
>
users
=
userShopRepository
.
findByShopId
(
maxShopId
).
stream
().
map
(
x
->
x
.
getUsername
()
).
filter
(
x
->
!
x
.
equals
(
username
)).
collect
(
Collectors
.
toList
());
List
<
String
>
users
=
userShopRepository
.
findByShopId
(
maxShopId
).
stream
().
map
(
UserShop:
:
getUsername
).
filter
(
x
->
!
x
.
equals
(
username
)).
collect
(
Collectors
.
toList
());
for
(
String
user
:
users
)
{
int
shopCount
=
userShopRepository
.
countByUsernameAndShopIdIn
(
user
,
shopIds
);
if
(
shopCount
<
shopIds
.
size
())
{
...
...
@@ -602,21 +602,19 @@ public class ShopServiceImpl implements ShopService {
}
}
Integer
result
=
0
;
Iterator
<
Map
.
Entry
<
Account
,
List
<
Account
>>>
entries
=
map
.
entrySet
().
iterator
();
while
(
entries
.
hasNext
())
{
Map
.
Entry
<
Account
,
List
<
Account
>>
entry
=
entries
.
next
();
int
result
=
0
;
for
(
Map
.
Entry
<
Account
,
List
<
Account
>>
entry
:
map
.
entrySet
())
{
List
<
Account
>
children
=
entry
.
getValue
();
// 查找子类所拥有的店铺
List
<
Shop
>
childrenShop
=
shopRepository
.
findByOwnerIn
(
children
.
stream
().
map
(
Account:
:
getName
).
collect
(
Collectors
.
toList
()));
if
(
childrenShop
.
size
()
==
0
)
{
continue
;
}
List
<
String
>
ids
=
childrenShop
.
stream
().
map
(
x
->
x
.
getShopId
()
).
collect
(
Collectors
.
toList
());
List
<
String
>
ids
=
childrenShop
.
stream
().
map
(
Shop:
:
getShopId
).
collect
(
Collectors
.
toList
());
// 查出来 父账户已有的 usershop信息
List
<
UserShop
>
parentUserShops
=
userShopRepository
.
findByUsernameAndShopIdIn
(
entry
.
getKey
().
getName
(),
ids
);
List
<
String
>
parentShopIds
=
parentUserShops
.
stream
().
map
(
x
->
x
.
getShopId
()
).
collect
(
Collectors
.
toList
());
List
<
String
>
parentShopIds
=
parentUserShops
.
stream
().
map
(
UserShop:
:
getShopId
).
collect
(
Collectors
.
toList
());
// 剩下的就是 父账户的 usershop 缺失的信息
ids
.
removeAll
(
parentShopIds
);
...
...
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