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
fadeaf0d
Commit
fadeaf0d
authored
Mar 06, 2020
by
renjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改返回格式
parent
e50e6d53
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
6 deletions
+21
-6
AccountController.java
.../browserbackend/account/controller/AccountController.java
+1
-1
AccountService.java
.../edgec/browserbackend/account/service/AccountService.java
+3
-1
AccountServiceImpl.java
...owserbackend/account/service/impl/AccountServiceImpl.java
+17
-4
No files found.
src/main/java/com/edgec/browserbackend/account/controller/AccountController.java
View file @
fadeaf0d
...
@@ -77,7 +77,7 @@ public class AccountController {
...
@@ -77,7 +77,7 @@ public class AccountController {
@RequestMapping
(
path
=
"/information"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/information"
,
method
=
RequestMethod
.
GET
)
public
AccountResultDto
getAccount
(
Principal
principal
)
{
public
AccountResultDto
getAccount
(
Principal
principal
)
{
return
accountService
.
find
ByName
(
principal
.
getName
());
return
accountService
.
getAccount
ByName
(
principal
.
getName
());
}
}
@RequestMapping
(
path
=
"/{name}/children/{level}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/{name}/children/{level}"
,
method
=
RequestMethod
.
GET
)
...
...
src/main/java/com/edgec/browserbackend/account/service/AccountService.java
View file @
fadeaf0d
...
@@ -17,7 +17,9 @@ public interface AccountService {
...
@@ -17,7 +17,9 @@ public interface AccountService {
* @param accountName
* @param accountName
* @return found account
* @return found account
*/
*/
AccountResultDto
findByName
(
String
accountName
);
Account
findByName
(
String
accountName
);
AccountResultDto
getAccountByName
(
String
name
);
/**
/**
* Checks if account with the same name already exists
* Checks if account with the same name already exists
...
...
src/main/java/com/edgec/browserbackend/account/service/impl/AccountServiceImpl.java
View file @
fadeaf0d
...
@@ -487,11 +487,25 @@ public class AccountServiceImpl implements AccountService {
...
@@ -487,11 +487,25 @@ public class AccountServiceImpl implements AccountService {
* {@inheritDoc}
* {@inheritDoc}
*/
*/
@Override
@Override
public
Account
ResultDto
findByName
(
String
accountName
)
{
public
Account
findByName
(
String
accountName
)
{
Assert
.
hasLength
(
accountName
);
Assert
.
hasLength
(
accountName
);
Account
account
=
repository
.
findByName
(
accountName
);
if
(
account
==
null
)
{
return
null
;
}
if
(
StringUtils
.
isEmpty
(
account
.
getParent
()))
{
account
.
setPermission
(
15
);
account
.
setAllowedToCreateSubUser
(
true
);
}
return
account
;
}
@Override
public
AccountResultDto
getAccountByName
(
String
name
)
{
Assert
.
hasLength
(
name
);
AccountResultDto
accountResultDto
=
new
AccountResultDto
();
AccountResultDto
accountResultDto
=
new
AccountResultDto
();
try
{
try
{
Account
account
=
repository
.
findByName
(
accountN
ame
);
Account
account
=
repository
.
findByName
(
n
ame
);
if
(
account
==
null
)
{
if
(
account
==
null
)
{
accountResultDto
.
setStatus
(-
1
);
accountResultDto
.
setStatus
(-
1
);
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
Map
<
String
,
Object
>
statusInfo
=
new
HashMap
<>();
...
@@ -502,7 +516,7 @@ public class AccountServiceImpl implements AccountService {
...
@@ -502,7 +516,7 @@ public class AccountServiceImpl implements AccountService {
if
(
StringUtils
.
isEmpty
(
account
.
getParent
()))
{
if
(
StringUtils
.
isEmpty
(
account
.
getParent
()))
{
account
.
setAllowedToCreateSubUser
(
true
);
account
.
setAllowedToCreateSubUser
(
true
);
}
}
Optional
<
UserBalance
>
userBalance
=
userBalanceRepository
.
findById
(
accountN
ame
);
Optional
<
UserBalance
>
userBalance
=
userBalanceRepository
.
findById
(
n
ame
);
AccountDto
accountDto
=
new
AccountDto
(
account
);
AccountDto
accountDto
=
new
AccountDto
(
account
);
accountDto
.
setBalance
((
int
)
userBalance
.
get
().
getBalanced
());
accountDto
.
setBalance
((
int
)
userBalance
.
get
().
getBalanced
());
accountResultDto
.
setStatus
(
0
);
accountResultDto
.
setStatus
(
0
);
...
@@ -517,7 +531,6 @@ public class AccountServiceImpl implements AccountService {
...
@@ -517,7 +531,6 @@ public class AccountServiceImpl implements AccountService {
return
accountResultDto
;
return
accountResultDto
;
}
}
public
void
deleteByName
(
String
name
)
{
public
void
deleteByName
(
String
name
)
{
userAuthService
.
deleteUser
(
name
);
userAuthService
.
deleteUser
(
name
);
repository
.
deleteById
(
name
);
repository
.
deleteById
(
name
);
...
...
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