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
9a6088da
Commit
9a6088da
authored
Jun 05, 2020
by
jim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ip
parent
97cad9d7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
19 deletions
+13
-19
IpResourceServiceImpl.java
...erbackend/browser/service/Impl/IpResourceServiceImpl.java
+0
-0
ShopServiceImpl.java
.../browserbackend/browser/service/Impl/ShopServiceImpl.java
+13
-19
No files found.
src/main/java/com/edgec/browserbackend/browser/service/Impl/IpResourceServiceImpl.java
View file @
9a6088da
This diff is collapsed.
Click to expand it.
src/main/java/com/edgec/browserbackend/browser/service/Impl/ShopServiceImpl.java
View file @
9a6088da
...
...
@@ -106,7 +106,7 @@ public class ShopServiceImpl implements ShopService {
//可以优化
account
.
setShopCount
(
account
.
getShopCount
()
+
1
);
accountRepository
.
save
(
account
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
ClientRequestException
(
BrowserErrorCode
.
INFORMATIONNOTCOMPELETE
);
}
return
id
;
...
...
@@ -170,7 +170,7 @@ public class ShopServiceImpl implements ShopService {
account
.
setShopCount
(
account
.
getShopCount
()
+
1
);
accountRepository
.
save
(
account
);
ids
.
add
(
id
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"fail to add shops"
,
e
.
getMessage
());
throw
new
ClientRequestException
(
BrowserErrorCode
.
INFORMATIONNOTCOMPELETE
);
}
...
...
@@ -197,7 +197,7 @@ public class ShopServiceImpl implements ShopService {
try
{
shop_old
=
shop_old
.
of
(
shopResultDto
);
shopRepository
.
save
(
shop_old
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"fail to update"
,
e
.
getMessage
());
throw
new
ClientRequestException
(
BrowserErrorCode
.
INFORMATIONNOTCOMPELETE
);
}
...
...
@@ -277,8 +277,7 @@ public class ShopServiceImpl implements ShopService {
if
(
accounts
==
null
||
accounts
.
size
()
!=
users
.
size
())
throw
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
);
for
(
Account
ac
:
accounts
)
{
if
(
ac
.
getParent
()
==
null
||
!
ac
.
getParent
().
equals
(
username
))
{
if
(
ac
.
getParent
()
==
null
||
!
ac
.
getParent
().
equals
(
username
))
{
throw
new
ClientRequestException
(
AccountErrorCode
.
NOPERMISSION
);
}
}
...
...
@@ -336,8 +335,7 @@ public class ShopServiceImpl implements ShopService {
if
(
ipResource
.
isSpecialLine
())
{
SpecialLine
specialLine
=
specialLineRepository
.
findAll
().
get
(
0
);
shopResultDto
=
ShopResultDto
.
of
(
shop
,
group
,
new
IpResourceDto
(
ipResource
,
null
,
false
,
specialLine
));
}
else
}
else
shopResultDto
=
ShopResultDto
.
of
(
shop
,
group
,
new
IpResourceDto
(
ipResource
,
null
,
false
));
return
shopResultDto
;
}
...
...
@@ -369,11 +367,10 @@ public class ShopServiceImpl implements ShopService {
.
map
(
x
->
x
.
getShopId
()).
collect
(
Collectors
.
toList
());
shopIds
=
ipResourceRepository
.
findShopIdInList
(
allIds
,
false
)
.
stream
().
flatMap
((
x
->
x
.
getShopIds
().
stream
())).
collect
(
Collectors
.
toList
());
}
else
{
}
else
{
List
<
String
>
allIds
=
userShopRepository
.
findByUsername
(
username
).
stream
()
.
map
(
x
->
x
.
getShopId
()).
collect
(
Collectors
.
toList
());
for
(
String
id
:
allIds
)
{
for
(
String
id
:
allIds
)
{
IpResource
ipResource
=
ipResourceRepository
.
findFirstByShopIdsIsAndIsDeleted
(
id
,
false
);
if
(
ipResource
==
null
)
{
shopIds
.
add
(
id
);
...
...
@@ -389,11 +386,10 @@ public class ShopServiceImpl implements ShopService {
map
(
x
->
x
.
getShopId
()).
collect
(
Collectors
.
toList
());
shopIds
=
ipResourceRepository
.
findShopIdInList
(
allIds
,
false
)
.
stream
().
flatMap
((
x
->
x
.
getShopIds
().
stream
())).
collect
(
Collectors
.
toList
());
}
else
{
}
else
{
List
<
String
>
allIds
=
userShopRepository
.
findByUsernameAndGroupId
(
username
,
groupId
).
stream
()
.
map
(
x
->
x
.
getShopId
()).
collect
(
Collectors
.
toList
());
for
(
String
id
:
allIds
)
{
for
(
String
id
:
allIds
)
{
IpResource
ipResource
=
ipResourceRepository
.
findFirstByShopIdsIsAndIsDeleted
(
id
,
false
);
if
(
ipResource
==
null
)
shopIds
.
add
(
id
);
...
...
@@ -405,8 +401,7 @@ public class ShopServiceImpl implements ShopService {
List
<
String
>
filter
=
ipResourceRepository
.
findShopIdInListAndRegionLike
(
shopIds
,
false
,
shopFilterDto
.
getIpRegion
())
.
stream
().
flatMap
((
x
->
x
.
getShopIds
().
stream
())).
collect
(
Collectors
.
toList
());
shops
=
shopRepository
.
findByShopIdInOrderByCreateTimeDesc
(
filter
,
pageable
);
}
else
if
(
shopFilterDto
!=
null
&&
StringUtils
.
isNotBlank
(
shopFilterDto
.
getShopAccount
()))
}
else
if
(
shopFilterDto
!=
null
&&
StringUtils
.
isNotBlank
(
shopFilterDto
.
getShopAccount
()))
shops
=
shopRepository
.
findByShopIdInAndShopAccountLikeOrderByCreateTimeDesc
(
shopIds
,
shopFilterDto
.
getShopAccount
(),
pageable
);
else
if
(
shopFilterDto
!=
null
&&
StringUtils
.
isNotBlank
(
shopFilterDto
.
getShopName
()))
shops
=
shopRepository
.
findByShopIdInAndShopNameLikeOrderByCreateTimeDesc
(
shopIds
,
shopFilterDto
.
getShopName
(),
pageable
);
...
...
@@ -464,8 +459,7 @@ public class ShopServiceImpl implements ShopService {
if
(
ipResource
.
isSpecialLine
())
{
SpecialLine
specialLine
=
specialLineRepository
.
findAll
().
get
(
0
);
shopResultDto
=
ShopResultDto
.
of
(
x
,
group1
,
new
IpResourceDto
(
ipResource
,
null
,
false
,
specialLine
));
}
else
}
else
shopResultDto
=
ShopResultDto
.
of
(
x
,
group1
,
new
IpResourceDto
(
ipResource
,
null
,
false
));
shopResultDtos
.
add
(
shopResultDto
);
});
...
...
@@ -489,7 +483,7 @@ public class ShopServiceImpl implements ShopService {
List
<
String
>
allShopIds
=
userShopRepository
.
findByUsername
(
username
).
stream
().
map
(
x
->
x
.
getShopId
()).
collect
(
Collectors
.
toList
());
List
<
String
>
unbind
=
new
ArrayList
<>();
if
(
allShopIds
!=
null
&&
allShopIds
.
size
()
>
0
)
{
for
(
String
id
:
allShopIds
)
{
for
(
String
id
:
allShopIds
)
{
IpResource
ipResource
=
ipResourceRepository
.
findFirstByShopIdsIsAndIsDeleted
(
id
,
false
);
if
(
ipResource
==
null
)
{
unbind
.
add
(
id
);
...
...
@@ -529,7 +523,7 @@ public class ShopServiceImpl implements ShopService {
if
(
shopIds
!=
null
&&
shopIds
.
size
()
>
0
)
{
String
maxShopId
=
null
;
int
max
=
0
;
for
(
String
shopId
:
shopIds
)
{
for
(
String
shopId
:
shopIds
)
{
int
userCount
=
userShopRepository
.
countByShopId
(
shopId
);
if
(
userCount
>
max
)
{
max
=
userCount
;
...
...
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