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
d74cb6d2
Commit
d74cb6d2
authored
Mar 05, 2020
by
renjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
browser-backend
parent
4e6f31b8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
4 additions
and
143 deletions
+4
-143
AccountController.java
.../browserbackend/account/controller/AccountController.java
+3
-3
AdministratorController.java
...erbackend/account/controller/AdministratorController.java
+0
-8
Account.java
...java/com/edgec/browserbackend/account/domain/Account.java
+0
-55
AccountDto.java
...a/com/edgec/browserbackend/account/domain/AccountDto.java
+0
-43
AdministratorService.java
.../browserbackend/account/service/AdministratorService.java
+0
-4
AccountServiceImpl.java
...owserbackend/account/service/impl/AccountServiceImpl.java
+0
-4
AdministratorServiceImpl.java
...ackend/account/service/impl/AdministratorServiceImpl.java
+0
-25
WebSecurityConfig.java
...m/edgec/browserbackend/auth/config/WebSecurityConfig.java
+1
-1
No files found.
src/main/java/com/edgec/browserbackend/account/controller/AccountController.java
View file @
d74cb6d2
...
...
@@ -95,12 +95,12 @@ public class AccountController {
return
accountService
.
saveChanges
(
principal
.
getName
(),
account
);
}
@RequestMapping
(
path
=
"/
smsotp/{phone}
"
,
method
=
RequestMethod
.
GET
)
public
void
requestOTP
(
@
PathVariable
String
phone
,
@RequestParam
(
value
=
"by"
)
String
by
)
{
@RequestMapping
(
path
=
"/
authCode
"
,
method
=
RequestMethod
.
GET
)
public
void
requestOTP
(
@
RequestParam
(
value
=
"mobile"
)
String
phone
,
@RequestParam
(
value
=
"by"
)
String
by
)
{
accountService
.
sendSmsOtp
(
phone
,
by
);
}
@RequestMapping
(
path
=
"/"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
path
=
"/
signup
"
,
method
=
RequestMethod
.
POST
)
public
Account
createNewAccount
(
@Valid
@RequestBody
User
user
)
{
if
(!
StringUtils
.
isEmpty
(
user
.
getEmail
()))
return
accountService
.
create
(
user
);
...
...
src/main/java/com/edgec/browserbackend/account/controller/AdministratorController.java
View file @
d74cb6d2
...
...
@@ -118,14 +118,6 @@ public class AdministratorController {
return
administratorService
.
lockAbnormalAccount
(
name
,
account
);
}
//将某个用户归属于代理tested
@PreAuthorize
(
"hasRole('ADMIN')"
)
@RequestMapping
(
path
=
"/0xadministrator/belongtoagency/{name}"
,
method
=
RequestMethod
.
PUT
)
public
Account
belongToAgency
(
@PathVariable
String
name
,
@Valid
@RequestBody
Account
account
){
return
administratorService
.
accountBelongToAgency
(
name
,
account
);
}
//查询用户余额
@PreAuthorize
(
Securitys
.
ADMIN_EL
)
@RequestMapping
(
path
=
"/0xadministrator/finduserbalance"
,
method
=
RequestMethod
.
GET
)
...
...
src/main/java/com/edgec/browserbackend/account/domain/Account.java
View file @
d74cb6d2
...
...
@@ -30,49 +30,12 @@ public class Account {
private
String
phoneNumber
;
private
String
country
;
private
String
province
;
private
String
agencyID
;
private
String
lockReason
;
private
int
iprate
;
private
boolean
isPrePaid
=
true
;
private
String
token
;
/**
是否具有参与免费试用两小时云主机资格
*/
private
Boolean
isQualified
=
true
;
public
Boolean
isQualified
()
{
return
isQualified
;
}
public
void
setQualified
(
Boolean
qualified
)
{
isQualified
=
qualified
;
}
public
int
getIprate
()
{
return
iprate
;
}
public
void
setIprate
(
int
iprate
)
{
this
.
iprate
=
iprate
;
}
public
String
getAgencyID
(){
return
agencyID
;
}
public
void
setAgencyID
(
String
agencyID
){
this
.
agencyID
=
agencyID
;
}
private
boolean
allowedToCreateSubUser
=
false
;
private
boolean
allowedToCreateCloudAccount
=
false
;
...
...
@@ -123,11 +86,9 @@ public class Account {
this
.
setAllowedToCreateSubUser
(
account
.
isAllowedToCreateSubUser
());
this
.
setAllowedToCreateCloudAccount
(
account
.
isAllowedToCreateCloudAccount
());
this
.
setCompanyName
(
account
.
getCompanyName
());
this
.
setCountry
(
account
.
getCountry
());
this
.
setEmail
(
account
.
getEmail
());
this
.
setJobTitle
(
account
.
getJobTitle
());
this
.
setPhoneNumber
(
account
.
getPhoneNumber
());
this
.
setProvince
(
account
.
getProvince
());
}
public
String
getEmail
()
{
...
...
@@ -162,22 +123,6 @@ public class Account {
this
.
phoneNumber
=
phoneNumber
;
}
public
String
getCountry
()
{
return
country
;
}
public
void
setCountry
(
String
country
)
{
this
.
country
=
country
;
}
public
String
getProvince
()
{
return
province
;
}
public
void
setProvince
(
String
province
)
{
this
.
province
=
province
;
}
@Length
(
min
=
0
,
max
=
20000
)
private
String
note
;
...
...
src/main/java/com/edgec/browserbackend/account/domain/AccountDto.java
View file @
d74cb6d2
...
...
@@ -24,22 +24,14 @@ public class AccountDto {
private
String
phoneNumber
;
private
String
country
;
private
String
province
;
private
boolean
allowedToCreateSubUser
;
private
boolean
allowedToCreateCloudAccount
;
private
List
<
CloudAccountDto
>
cloudAccounts
;
private
int
balance
;
private
boolean
isPrePaid
=
true
;
private
boolean
isVpsUser
=
false
;
private
String
parent
;
private
String
token
;
...
...
@@ -53,24 +45,14 @@ public class AccountDto {
this
.
setAllowedToCreateSubUser
(
account
.
isAllowedToCreateSubUser
());
this
.
setAllowedToCreateCloudAccount
(
account
.
isAllowedToCreateCloudAccount
());
this
.
setCompanyName
(
account
.
getCompanyName
());
this
.
setCountry
(
account
.
getCountry
());
this
.
setEmail
(
account
.
getEmail
());
this
.
setJobTitle
(
account
.
getJobTitle
());
this
.
setPhoneNumber
(
account
.
getPhoneNumber
());
this
.
setProvince
(
account
.
getProvince
());
this
.
setUserServices
(
account
.
getUserServices
());
this
.
setParent
(
account
.
getParent
());
this
.
setToken
(
account
.
getToken
());
}
public
boolean
isVpsUser
()
{
return
isVpsUser
;
}
public
void
setVpsUser
(
boolean
vpsUser
)
{
isVpsUser
=
vpsUser
;
}
public
boolean
isPrePaid
()
{
return
isPrePaid
;
}
...
...
@@ -97,15 +79,6 @@ public class AccountDto {
this
.
userServices
=
userServices
;
}
public
List
<
CloudAccountDto
>
getCloudAccounts
()
{
return
cloudAccounts
;
}
public
void
setCloudAccounts
(
List
<
CloudAccountDto
>
cloudAccounts
)
{
this
.
cloudAccounts
=
cloudAccounts
;
}
public
boolean
isAllowedToCreateCloudAccount
()
{
return
allowedToCreateCloudAccount
;
}
...
...
@@ -186,22 +159,6 @@ public class AccountDto {
this
.
phoneNumber
=
phoneNumber
;
}
public
String
getCountry
()
{
return
country
;
}
public
void
setCountry
(
String
country
)
{
this
.
country
=
country
;
}
public
String
getProvince
()
{
return
province
;
}
public
void
setProvince
(
String
province
)
{
this
.
province
=
province
;
}
public
boolean
isAllowedToCreateSubUser
()
{
return
allowedToCreateSubUser
;
}
...
...
src/main/java/com/edgec/browserbackend/account/service/AdministratorService.java
View file @
d74cb6d2
...
...
@@ -28,10 +28,6 @@ public interface AdministratorService {
Account
lockAbnormalAccount
(
String
name
,
Account
account
);
Account
accountBelongToAgency
(
String
name
,
Account
account
);
Account
accountDismissalAgency
(
String
name
,
Account
account
);
Page
<
Account
>
searchAllUserPage
(
Pageable
pageable
);
Page
<
UserPrePaidBilling
>
searchAllUserBillingPage
(
int
page
,
int
year1
,
int
month1
,
int
year2
,
int
month2
);
...
...
src/main/java/com/edgec/browserbackend/account/service/impl/AccountServiceImpl.java
View file @
d74cb6d2
...
...
@@ -742,10 +742,8 @@ public class AccountServiceImpl implements AccountService {
}
childAccount
.
setAllowedToCreateSubUser
(
user
.
isAllowedToCreateSubUser
());
childAccount
.
setAllowedToCreateCloudAccount
(
user
.
isAllowedToCreateCloudAccount
());
childAccount
.
setProvince
(
user
.
getProvince
());
childAccount
.
setPhoneNumber
(
user
.
getPhoneNumber
());
childAccount
.
setJobTitle
(
user
.
getJobTitle
());
childAccount
.
setCountry
(
user
.
getCountry
());
childAccount
.
setCompanyName
(
user
.
getCompanyName
());
repository
.
save
(
childAccount
);
return
childAccount
;
...
...
@@ -764,10 +762,8 @@ public class AccountServiceImpl implements AccountService {
account
.
setNote
(
update
.
getNote
());
account
.
setLastSeen
(
new
Date
());
account
.
setCompanyName
(
update
.
getCompanyName
());
account
.
setCountry
(
update
.
getCountry
());
account
.
setJobTitle
(
update
.
getJobTitle
());
// account.setPhoneNumber(update.getPhoneNumber());
account
.
setProvince
(
update
.
getProvince
());
account
.
setEmail
(
update
.
getEmail
());
log
.
debug
(
"account {} changes has been saved"
,
name
);
if
(!
org
.
apache
.
commons
.
lang3
.
StringUtils
.
equalsIgnoreCase
(
preEmail
,
update
.
getEmail
()))
{
...
...
src/main/java/com/edgec/browserbackend/account/service/impl/AdministratorServiceImpl.java
View file @
d74cb6d2
...
...
@@ -138,31 +138,6 @@ public class AdministratorServiceImpl implements AdministratorService {
return
abnormalAccount
;
}
@Override
public
Account
accountBelongToAgency
(
String
name
,
Account
account
)
{
Account
belongToAgencyAccount
=
accountRepository
.
findByName
(
name
);
if
(
belongToAgencyAccount
==
null
)
throw
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
,
"Username does not exist: "
+
name
);
belongToAgencyAccount
.
setAgencyID
(
account
.
getAgencyID
());
accountRepository
.
save
(
belongToAgencyAccount
);
return
belongToAgencyAccount
;
}
@Override
public
Account
accountDismissalAgency
(
String
name
,
Account
account
)
{
Account
dismissalAgencyAccount
=
accountRepository
.
findByName
(
name
);
if
(
dismissalAgencyAccount
==
null
)
throw
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
,
"Username does not exist: "
+
name
);
dismissalAgencyAccount
.
setAgencyID
(
null
);
accountRepository
.
save
(
dismissalAgencyAccount
);
return
dismissalAgencyAccount
;
}
@Override
public
Page
<
Account
>
searchAllUserPage
(
Pageable
pageable
)
{
Page
<
Account
>
accounts
=
accountRepository
.
findAll
(
pageable
);
...
...
src/main/java/com/edgec/browserbackend/auth/config/WebSecurityConfig.java
View file @
d74cb6d2
...
...
@@ -30,7 +30,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
public
void
configure
(
WebSecurity
web
)
throws
Exception
{
web
.
ignoring
()
.
antMatchers
(
"/users/verify/**"
,
"/users/changepass"
,
"/"
);
.
antMatchers
(
"/users/verify/**"
,
"/users/changepass"
,
"/
account/authCode"
,
"/account/signup
"
);
}
@Override
...
...
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