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
45d74932
Commit
45d74932
authored
Mar 10, 2020
by
renjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shop接口修改
parent
12d5e24f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
7 deletions
+52
-7
Account.java
...java/com/edgec/browserbackend/account/domain/Account.java
+30
-0
AccountErrorCode.java
...ec/browserbackend/account/exception/AccountErrorCode.java
+4
-1
ShopPageInfo.java
...va/com/edgec/browserbackend/browser/dto/ShopPageInfo.java
+5
-5
GroupServiceImpl.java
...browserbackend/browser/service/Impl/GroupServiceImpl.java
+9
-0
ShopServiceImpl.java
.../browserbackend/browser/service/Impl/ShopServiceImpl.java
+4
-1
No files found.
src/main/java/com/edgec/browserbackend/account/domain/Account.java
View file @
45d74932
...
...
@@ -42,6 +42,12 @@ public class Account {
private
List
<
String
>
whiteList
=
new
ArrayList
<>();
private
int
childCount
=
0
;
private
int
groupCount
=
0
;
private
int
shopCount
=
0
;
public
Date
getSignupDate
()
{
return
signupDate
;
}
...
...
@@ -178,4 +184,28 @@ public class Account {
public
void
setWhiteList
(
List
<
String
>
whiteList
)
{
this
.
whiteList
=
whiteList
;
}
public
int
getChildCount
()
{
return
childCount
;
}
public
void
setChildCount
(
int
childCount
)
{
this
.
childCount
=
childCount
;
}
public
int
getGroupCount
()
{
return
groupCount
;
}
public
void
setGroupCount
(
int
groupCount
)
{
this
.
groupCount
=
groupCount
;
}
public
int
getShopCount
()
{
return
shopCount
;
}
public
void
setShopCount
(
int
shopCount
)
{
this
.
shopCount
=
shopCount
;
}
}
src/main/java/com/edgec/browserbackend/account/exception/AccountErrorCode.java
View file @
45d74932
...
...
@@ -51,7 +51,10 @@ public enum AccountErrorCode implements ErrorCode {
/** alipay errors */
ALIPAYERROR
(
ACCOUNT_BASE
+
130
,
"Alipay order generation error"
),
NOPERMISSION
(
ACCOUNT_BASE
+
140
,
"You have no right to do this operarion"
);
NOPERMISSION
(
ACCOUNT_BASE
+
140
,
"You have no right to do this operarion"
),
GROUPMAX
(
ACCOUNT_BASE
+
141
,
"You can not have more groups"
),
SHOPMAX
(
ACCOUNT_BASE
+
141
,
"You can not have more shops"
),
CHILDMAX
(
ACCOUNT_BASE
+
141
,
"You can not have more subUsers"
);
...
...
src/main/java/com/edgec/browserbackend/browser/dto/ShopPageInfo.java
View file @
45d74932
...
...
@@ -2,7 +2,7 @@ package com.edgec.browserbackend.browser.dto;
public
class
ShopPageInfo
{
int
currentPage
;
int
totalPage
;
int
totalPage
s
;
int
totalShops
;
public
int
getCurrentPage
()
{
...
...
@@ -13,12 +13,12 @@ public class ShopPageInfo {
this
.
currentPage
=
currentPage
;
}
public
int
getTotalPage
()
{
return
totalPage
;
public
int
getTotalPage
s
()
{
return
totalPage
s
;
}
public
void
setTotalPage
(
int
totalPage
)
{
this
.
totalPage
=
totalPage
;
public
void
setTotalPage
s
(
int
totalPage
)
{
this
.
totalPage
s
=
totalPage
;
}
public
int
getTotalShops
()
{
...
...
src/main/java/com/edgec/browserbackend/browser/service/Impl/GroupServiceImpl.java
View file @
45d74932
...
...
@@ -2,6 +2,7 @@ package com.edgec.browserbackend.browser.service.Impl;
import
com.edgec.browserbackend.account.domain.Account
;
import
com.edgec.browserbackend.account.exception.AccountErrorCode
;
import
com.edgec.browserbackend.account.repository.AccountRepository
;
import
com.edgec.browserbackend.browser.ErrorCode.BrowserErrorCode
;
import
com.edgec.browserbackend.browser.domain.Group
;
import
com.edgec.browserbackend.browser.dto.GroupDto
;
...
...
@@ -23,6 +24,9 @@ public class GroupServiceImpl implements GroupService {
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
GroupServiceImpl
.
class
);
@Autowired
private
AccountRepository
accountRepository
;
@Autowired
private
GroupRepository
groupRepository
;
...
...
@@ -33,6 +37,11 @@ public class GroupServiceImpl implements GroupService {
public
String
addGroup
(
String
username
,
String
groupName
)
{
if
(
StringUtils
.
isBlank
(
username
)
||
StringUtils
.
isBlank
(
groupName
))
throw
new
ClientRequestException
(
BrowserErrorCode
.
INFORMATIONNOTCOMPELETE
);
Account
account
=
accountRepository
.
findByName
(
username
);
if
(
account
==
null
)
throw
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
);
if
(
account
.
getGroupCount
()
>=
100
)
throw
new
ClientRequestException
(
AccountErrorCode
.
GROUPMAX
);
Group
group
=
new
Group
();
group
.
setOwner
(
username
);
group
.
setName
(
groupName
);
...
...
src/main/java/com/edgec/browserbackend/browser/service/Impl/ShopServiceImpl.java
View file @
45d74932
...
...
@@ -65,6 +65,9 @@ public class ShopServiceImpl implements ShopService {
if
(
account
.
getPermission
()
<
4
)
{
throw
new
ClientRequestException
(
AccountErrorCode
.
NOPERMISSION
);
}
if
(
account
.
getShopCount
()
>=
10000
)
{
throw
new
ClientRequestException
(
AccountErrorCode
.
SHOPMAX
);
}
UserShop
us
=
userShopRepository
.
findByUsernameAndShopId
(
username
,
shopDto
.
getShopId
());
Group
group
=
groupRepository
.
findById
(
shopDto
.
getGroup
()).
orElse
(
null
);
if
(
group
==
null
)
{
...
...
@@ -317,7 +320,7 @@ public class ShopServiceImpl implements ShopService {
shopPageResultDto
.
setShopList
(
shopDtoPage
.
getContent
());
ShopPageInfo
shopPageInfo
=
new
ShopPageInfo
();
shopPageInfo
.
setCurrentPage
(
shopDtoPage
.
getPageable
().
getPageNumber
()
+
1
);
shopPageInfo
.
setTotalPage
(
shopDtoPage
.
getTotalPages
());
shopPageInfo
.
setTotalPage
s
(
shopDtoPage
.
getTotalPages
());
shopPageInfo
.
setTotalShops
(
shopDtos
.
size
());
shopPageResultDto
.
setShopPage
(
shopPageInfo
);
return
shopPageResultDto
;
...
...
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