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
9deeeb23
Commit
9deeeb23
authored
Oct 09, 2020
by
Administrator
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix-hotbugs' into 'master'
注册bug修复以及店铺列表部分业务修改 See merge request
!189
parents
43139220
38acd057
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
27 deletions
+47
-27
AccountRepository.java
.../browserbackend/account/repository/AccountRepository.java
+1
-1
AccountServiceImpl.java
...owserbackend/account/service/impl/AccountServiceImpl.java
+6
-6
ShopController.java
...gec/browserbackend/browser/controller/ShopController.java
+3
-1
ShopServiceImpl.java
.../browserbackend/browser/service/Impl/ShopServiceImpl.java
+37
-19
No files found.
src/main/java/com/edgec/browserbackend/account/repository/AccountRepository.java
View file @
9deeeb23
...
@@ -17,7 +17,7 @@ public interface AccountRepository extends MongoRepository<Account, String>, Acc
...
@@ -17,7 +17,7 @@ public interface AccountRepository extends MongoRepository<Account, String>, Acc
Account
findByEmail
(
String
email
);
Account
findByEmail
(
String
email
);
Account
findByPhoneNumber
(
String
phone
);
Account
find
One
ByPhoneNumber
(
String
phone
);
Account
findByPhoneNumberAndParentIsNull
(
String
phone
);
Account
findByPhoneNumberAndParentIsNull
(
String
phone
);
...
...
src/main/java/com/edgec/browserbackend/account/service/impl/AccountServiceImpl.java
View file @
9deeeb23
...
@@ -426,8 +426,8 @@ public class AccountServiceImpl implements AccountService {
...
@@ -426,8 +426,8 @@ public class AccountServiceImpl implements AccountService {
public
Account
createWithSms
(
User
user
)
{
public
Account
createWithSms
(
User
user
)
{
// 1. 校验注册用户是否已存在
// 1. 校验注册用户是否已存在
Account
existing1
=
accountRepository
.
findByName
(
user
.
getUsername
()).
orElse
(
null
);
Account
existing1
=
accountRepository
.
findByName
(
user
.
getUsername
()).
orElse
(
null
);
Account
existing2
=
accountRepository
.
findByPhoneNumber
(
user
.
getUsername
());
Account
existing2
=
accountRepository
.
find
One
ByPhoneNumber
(
user
.
getUsername
());
Account
existing3
=
accountRepository
.
findByPhoneNumber
(
user
.
getPhone
());
Account
existing3
=
accountRepository
.
find
One
ByPhoneNumber
(
user
.
getPhone
());
Account
existing4
=
accountRepository
.
findByName
(
user
.
getPhone
()).
orElse
(
null
);
Account
existing4
=
accountRepository
.
findByName
(
user
.
getPhone
()).
orElse
(
null
);
if
(
existing1
!=
null
||
existing2
!=
null
||
existing3
!=
null
||
existing4
!=
null
)
{
if
(
existing1
!=
null
||
existing2
!=
null
||
existing3
!=
null
||
existing4
!=
null
)
{
throw
new
ClientRequestException
(
AccountErrorCode
.
NAMEEXIST
,
"account already exists: "
+
user
.
getUsername
());
throw
new
ClientRequestException
(
AccountErrorCode
.
NAMEEXIST
,
"account already exists: "
+
user
.
getUsername
());
...
@@ -492,7 +492,7 @@ public class AccountServiceImpl implements AccountService {
...
@@ -492,7 +492,7 @@ public class AccountServiceImpl implements AccountService {
if
(
existing
!=
null
)
{
if
(
existing
!=
null
)
{
throw
new
ClientRequestException
(
AccountErrorCode
.
NAMEEXIST
,
"account already exists: "
+
user
.
getUsername
());
throw
new
ClientRequestException
(
AccountErrorCode
.
NAMEEXIST
,
"account already exists: "
+
user
.
getUsername
());
}
}
existing
=
accountRepository
.
findByPhoneNumber
(
user
.
getUsername
());
existing
=
accountRepository
.
find
One
ByPhoneNumber
(
user
.
getUsername
());
if
(
existing
!=
null
)
{
if
(
existing
!=
null
)
{
throw
new
ClientRequestException
(
AccountErrorCode
.
NAMEEXIST
,
"account already exists: "
+
user
.
getUsername
());
throw
new
ClientRequestException
(
AccountErrorCode
.
NAMEEXIST
,
"account already exists: "
+
user
.
getUsername
());
}
}
...
@@ -617,12 +617,12 @@ public class AccountServiceImpl implements AccountService {
...
@@ -617,12 +617,12 @@ public class AccountServiceImpl implements AccountService {
}
}
if
(!
StringUtils
.
isEmpty
(
user
.
getPhoneNumber
()))
{
if
(!
StringUtils
.
isEmpty
(
user
.
getPhoneNumber
()))
{
existing
=
accountRepository
.
findByPhoneNumber
(
user
.
getPhoneNumber
());
existing
=
accountRepository
.
find
One
ByPhoneNumber
(
user
.
getPhoneNumber
());
if
(
existing
!=
null
)
if
(
existing
!=
null
)
throw
new
ClientRequestException
(
AccountErrorCode
.
PHONEEXIST
,
"phone number already exists: "
+
user
.
getEmail
());
throw
new
ClientRequestException
(
AccountErrorCode
.
PHONEEXIST
,
"phone number already exists: "
+
user
.
getEmail
());
}
}
existing
=
accountRepository
.
findByPhoneNumber
(
user
.
getName
());
existing
=
accountRepository
.
find
One
ByPhoneNumber
(
user
.
getName
());
if
(
existing
!=
null
)
{
if
(
existing
!=
null
)
{
throw
new
ClientRequestException
(
AccountErrorCode
.
PHONEEXIST
,
"phone number already exists: "
+
user
.
getEmail
());
throw
new
ClientRequestException
(
AccountErrorCode
.
PHONEEXIST
,
"phone number already exists: "
+
user
.
getEmail
());
}
}
...
@@ -918,7 +918,7 @@ public class AccountServiceImpl implements AccountService {
...
@@ -918,7 +918,7 @@ public class AccountServiceImpl implements AccountService {
@Override
@Override
public
AccountDto
getAccountByCellphone
(
String
cellphone
)
{
public
AccountDto
getAccountByCellphone
(
String
cellphone
)
{
Account
account
=
accountRepository
.
findByPhoneNumber
(
cellphone
);
Account
account
=
accountRepository
.
find
One
ByPhoneNumber
(
cellphone
);
if
(
account
==
null
)
{
if
(
account
==
null
)
{
return
null
;
return
null
;
}
}
...
...
src/main/java/com/edgec/browserbackend/browser/controller/ShopController.java
View file @
9deeeb23
...
@@ -169,7 +169,7 @@ public class ShopController {
...
@@ -169,7 +169,7 @@ public class ShopController {
}
catch
(
ClientRequestException
e
)
{
}
catch
(
ClientRequestException
e
)
{
dealClientRequestException
(
resultDto
,
e
);
dealClientRequestException
(
resultDto
,
e
);
}
}
logger
.
info
(
"getshoplist totalTime:{}, {}
"
,
principal
.
getName
(),
System
.
currentTimeMillis
()
-
start
);
logger
.
info
(
"getshoplist totalTime:{}, {}
,{}"
,
principal
.
getName
(),
System
.
currentTimeMillis
()
-
start
,
Thread
.
currentThread
().
getName
()
);
return
resultDto
;
return
resultDto
;
}
}
...
@@ -180,6 +180,7 @@ public class ShopController {
...
@@ -180,6 +180,7 @@ public class ShopController {
@RequestMapping
(
value
=
"/penghai/list"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/penghai/list"
,
method
=
RequestMethod
.
POST
)
public
ResultDto
getPenghaiShopList
(
Principal
principal
,
@RequestBody
ShopRequestDto
shopRequestDto
)
{
public
ResultDto
getPenghaiShopList
(
Principal
principal
,
@RequestBody
ShopRequestDto
shopRequestDto
)
{
logger
.
info
(
"shop list params {}"
,
JSONObject
.
toJSONString
(
shopRequestDto
));
logger
.
info
(
"shop list params {}"
,
JSONObject
.
toJSONString
(
shopRequestDto
));
long
start
=
System
.
currentTimeMillis
();
ResultDto
resultDto
=
new
ResultDto
();
ResultDto
resultDto
=
new
ResultDto
();
try
{
try
{
...
@@ -190,6 +191,7 @@ public class ShopController {
...
@@ -190,6 +191,7 @@ public class ShopController {
}
catch
(
ClientRequestException
e
)
{
}
catch
(
ClientRequestException
e
)
{
dealClientRequestException
(
resultDto
,
e
);
dealClientRequestException
(
resultDto
,
e
);
}
}
logger
.
info
(
"getshoplist totalTime:{},{}, {},{}"
,
"penghai"
,
principal
.
getName
(),
System
.
currentTimeMillis
()
-
start
,
Thread
.
currentThread
().
getName
());
return
resultDto
;
return
resultDto
;
}
}
...
...
src/main/java/com/edgec/browserbackend/browser/service/Impl/ShopServiceImpl.java
View file @
9deeeb23
...
@@ -481,6 +481,10 @@ public class ShopServiceImpl implements ShopService {
...
@@ -481,6 +481,10 @@ public class ShopServiceImpl implements ShopService {
ShopPageResultDto
<
ShopResultDto
>
shopPageResultDto
=
new
ShopPageResultDto
<>();
ShopPageResultDto
<
ShopResultDto
>
shopPageResultDto
=
new
ShopPageResultDto
<>();
if
(
shops
!=
null
&&
shops
.
getNumberOfElements
()
>=
1
)
{
if
(
shops
!=
null
&&
shops
.
getNumberOfElements
()
>=
1
)
{
List
<
ShopResultDto
>
shopResultDtos
=
new
ArrayList
<>();
List
<
ShopResultDto
>
shopResultDtos
=
new
ArrayList
<>();
SpecialLine
specialLine
=
specialLineRepository
.
findAll
().
get
(
0
);
List
<
IpResource
>
pageIpResourceListToSave
=
new
ArrayList
<>();
shops
.
getContent
().
stream
().
forEach
(
shops
.
getContent
().
stream
().
forEach
(
// 设置ip资源状态 并 封装 shopResultDto信息
// 设置ip资源状态 并 封装 shopResultDto信息
x
->
{
x
->
{
...
@@ -492,34 +496,32 @@ public class ShopServiceImpl implements ShopService {
...
@@ -492,34 +496,32 @@ public class ShopServiceImpl implements ShopService {
if
(
ipResource
.
getValidTime
()
<=
Instant
.
now
().
plusSeconds
(
60
*
60
*
24
*
7
).
toEpochMilli
()
&&
ipResource
.
getValidTime
()
>
Instant
.
now
().
toEpochMilli
())
{
if
(
ipResource
.
getValidTime
()
<=
Instant
.
now
().
plusSeconds
(
60
*
60
*
24
*
7
).
toEpochMilli
()
&&
ipResource
.
getValidTime
()
>
Instant
.
now
().
toEpochMilli
())
{
if
(
ipResource
.
getStatus
()
!=
5
&&
ipResource
.
getStatus
()
!=
3
&&
ipResource
.
getStatus
()
!=
6
)
{
if
(
ipResource
.
getStatus
()
!=
5
&&
ipResource
.
getStatus
()
!=
3
&&
ipResource
.
getStatus
()
!=
6
)
{
ipResource
.
setStatus
(
2
);
ipResource
.
setStatus
(
2
);
ipResourceRepository
.
save
(
ipResource
);
//ipResourceRepository.save(ipResource);
pageIpResourceListToSave
.
add
(
ipResource
);
}
}
// 2. ip资源在七天前到期,且 ip 资源的状态不是 3(正在分配)、6(未分配),则删除 ip 资源
// 2. ip资源在七天前到期,且 ip 资源的状态不是 3(正在分配)、6(未分配),则删除 ip 资源
}
else
if
(
ipResource
.
getValidTime
()
<=
Instant
.
now
().
minusSeconds
(
60
*
60
*
24
*
7
).
toEpochMilli
()
&&
ipResource
.
getStatus
()
!=
3
&&
ipResource
.
getStatus
()
!=
6
)
{
}
else
if
(
ipResource
.
getValidTime
()
<=
Instant
.
now
().
minusSeconds
(
60
*
60
*
24
*
7
).
toEpochMilli
()
&&
ipResource
.
getStatus
()
!=
3
&&
ipResource
.
getStatus
()
!=
6
)
{
IpResourceRequestDto
ipResourceRequestDto1
=
new
IpResourceRequestDto
();
if
(
ipResource
.
getIpType
()
==
IpType
.
VENDOR
)
{
if
(
ipResource
.
getIpType
()
==
IpType
.
VENDOR
)
{
IpResourceRequestDto
ipResourceRequestDto1
=
new
IpResourceRequestDto
();
ipResourceRequestDto1
.
setAddr
(
Arrays
.
asList
(
ipResource
.
getAddr
()));
ipResourceRequestDto1
.
setAddr
(
Arrays
.
asList
(
ipResource
.
getAddr
()));
try
{
ipResourceService
.
deleteExpiredIp
(
username
,
ipResourceRequestDto1
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
}
else
{
}
else
{
IpResourceRequestDto
ipResourceRequestDto1
=
new
IpResourceRequestDto
();
ipResourceRequestDto1
.
setIpId
(
Arrays
.
asList
(
ipResource
.
getId
()));
ipResourceRequestDto1
.
setIpId
(
Arrays
.
asList
(
ipResource
.
getId
()));
try
{
ipResourceService
.
deleteExpiredIp
(
username
,
ipResourceRequestDto1
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
}
}
try
{
ipResourceService
.
deleteExpiredIp
(
username
,
ipResourceRequestDto1
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
return
;
return
;
// 3. ip资源到期,且 ip 资源的状态不是 3(正在分配)、6(未分配),则设置 ip 资源的状态为 1(已过期)
// 3. ip资源到期,且 ip 资源的状态不是 3(正在分配)、6(未分配),则设置 ip 资源的状态为 1(已过期)
}
else
if
(
ipResource
.
getValidTime
()
<=
Instant
.
now
().
toEpochMilli
()
&&
ipResource
.
getStatus
()
!=
3
&&
ipResource
.
getStatus
()
!=
6
)
{
}
else
if
(
ipResource
.
getValidTime
()
<=
Instant
.
now
().
toEpochMilli
()
&&
ipResource
.
getStatus
()
!=
3
&&
ipResource
.
getStatus
()
!=
6
)
{
ipResource
.
setStatus
(
1
);
ipResource
.
setStatus
(
1
);
ipResourceRepository
.
save
(
ipResource
);
//ipResourceRepository.save(ipResource);
pageIpResourceListToSave
.
add
(
ipResource
);
// 4. 其他,将ip资源状态设置为 未使用
// 4. 其他,将ip资源状态设置为 未使用
}
else
{
}
else
{
...
@@ -528,16 +530,19 @@ public class ShopServiceImpl implements ShopService {
...
@@ -528,16 +530,19 @@ public class ShopServiceImpl implements ShopService {
}
else
if
(
ipResource
.
getIpType
().
equals
(
IpType
.
LOCAL
)
&&
(
ipResource
.
getStatus
()
==
1
||
ipResource
.
getStatus
()
==
2
)
&&
ipResource
.
getAddr
().
equals
(
"本地Ip未使用"
))
{
}
else
if
(
ipResource
.
getIpType
().
equals
(
IpType
.
LOCAL
)
&&
(
ipResource
.
getStatus
()
==
1
||
ipResource
.
getStatus
()
==
2
)
&&
ipResource
.
getAddr
().
equals
(
"本地Ip未使用"
))
{
ipResource
.
setStatus
(
4
);
ipResource
.
setStatus
(
4
);
}
}
ipResourceRepository
.
save
(
ipResource
);
// ipResourceRepository.save(ipResource);
pageIpResourceListToSave
.
add
(
ipResource
);
}
}
}
}
ShopResultDto
shopResultDto
=
getShopResultDto
(
username
,
x
,
ipResource
);
//ShopResultDto shopResultDto = getShopResultDto(username, x, ipResource, specialLine);
ShopResultDto
shopResultDto
=
getShopResultDto
(
groupId
,
x
,
ipResource
,
specialLine
);
shopResultDtos
.
add
(
shopResultDto
);
shopResultDtos
.
add
(
shopResultDto
);
logger
.
info
(
"getshoplist step-6.x:{},{}
"
,
username
,
System
.
currentTimeMillis
()
-
start1
);
logger
.
info
(
"getshoplist step-6.x:{},{}
,{}"
,
username
,
System
.
currentTimeMillis
()
-
start1
,
Thread
.
currentThread
().
getName
()
);
}
}
);
);
ipResourceRepository
.
saveAll
(
pageIpResourceListToSave
);
Page
<
ShopResultDto
>
shopDtoPage
=
new
PageImpl
<>(
shopResultDtos
,
pageable
,
shopIds
.
size
());
Page
<
ShopResultDto
>
shopDtoPage
=
new
PageImpl
<>(
shopResultDtos
,
pageable
,
shopIds
.
size
());
shopPageResultDto
.
setShopList
(
shopDtoPage
.
getContent
());
shopPageResultDto
.
setShopList
(
shopDtoPage
.
getContent
());
...
@@ -765,18 +770,31 @@ public class ShopServiceImpl implements ShopService {
...
@@ -765,18 +770,31 @@ public class ShopServiceImpl implements ShopService {
return
shops
;
return
shops
;
}
}
private
ShopResultDto
getShopResultDto
(
String
username
,
Shop
x
,
IpResource
ipResourc
e
)
{
/*private ShopResultDto getShopResultDto(String username, Shop x, IpResource ipResource, SpecialLine specialLin
e) {
if (ipResource == null) {
if (ipResource == null) {
ipResource = new IpResource();
ipResource = new IpResource();
}
}
String group1 = userShopRepository.findByUsernameAndShopId(username, x.getShopId()).getGroupId();
String group1 = userShopRepository.findByUsernameAndShopId(username, x.getShopId()).getGroupId();
ShopResultDto shopResultDto = null;
ShopResultDto shopResultDto = null;
if (ipResource.isSpecialLine()) {
if (ipResource.isSpecialLine()) {
SpecialLine
specialLine
=
specialLineRepository
.
findAll
().
get
(
0
);
shopResultDto = ShopResultDto.of(x, group1, new IpResourceDto(ipResource, null, false, specialLine));
shopResultDto = ShopResultDto.of(x, group1, new IpResourceDto(ipResource, null, false, specialLine));
} else {
} else {
shopResultDto = ShopResultDto.of(x, group1, new IpResourceDto(ipResource, null, false));
shopResultDto = ShopResultDto.of(x, group1, new IpResourceDto(ipResource, null, false));
}
}
return shopResultDto;
return shopResultDto;
}*/
private
ShopResultDto
getShopResultDto
(
String
groupId
,
Shop
x
,
IpResource
ipResource
,
SpecialLine
specialLine
)
{
if
(
ipResource
==
null
)
{
ipResource
=
new
IpResource
();
}
ShopResultDto
shopResultDto
=
null
;
if
(
ipResource
.
isSpecialLine
())
{
shopResultDto
=
ShopResultDto
.
of
(
x
,
groupId
,
new
IpResourceDto
(
ipResource
,
null
,
false
,
specialLine
));
}
else
{
shopResultDto
=
ShopResultDto
.
of
(
x
,
groupId
,
new
IpResourceDto
(
ipResource
,
null
,
false
));
}
return
shopResultDto
;
}
}
}
}
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