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
6aae1d14
Commit
6aae1d14
authored
Apr 02, 2020
by
renjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改account字段为username
parent
45c586c7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
30 additions
and
30 deletions
+30
-30
LoginHistory.java
...com/edgec/browserbackend/browser/domain/LoginHistory.java
+6
-6
OperationHistory.java
...edgec/browserbackend/browser/domain/OperationHistory.java
+6
-6
LoginHistoryDto.java
...com/edgec/browserbackend/browser/dto/LoginHistoryDto.java
+2
-2
OperationHistoryDto.java
...edgec/browserbackend/browser/dto/OperationHistoryDto.java
+2
-2
LoginHistoryRepository.java
...serbackend/browser/repository/LoginHistoryRepository.java
+3
-3
OperationHistoryRepository.java
...ackend/browser/repository/OperationHistoryRepository.java
+3
-3
HistoryServiceImpl.java
...owserbackend/browser/service/Impl/HistoryServiceImpl.java
+8
-8
No files found.
src/main/java/com/edgec/browserbackend/browser/domain/LoginHistory.java
View file @
6aae1d14
...
...
@@ -13,7 +13,7 @@ import java.time.format.DateTimeFormatter;
public
class
LoginHistory
{
@Id
private
String
id
;
private
String
account
;
private
String
username
;
private
String
nickname
;
private
String
loginIp
;
private
String
loginPlace
;
...
...
@@ -26,7 +26,7 @@ public class LoginHistory {
public
LoginHistory
(
LoginHistoryDto
loginHistoryDto
)
{
if
(
loginHistoryDto
.
getAccount
()
!=
null
)
this
.
account
=
loginHistoryDto
.
getAccount
();
this
.
username
=
loginHistoryDto
.
getAccount
();
if
(
loginHistoryDto
.
getNickname
()
!=
null
)
this
.
nickname
=
loginHistoryDto
.
getNickname
();
if
(
loginHistoryDto
.
getLoginIp
()
!=
null
)
...
...
@@ -72,12 +72,12 @@ public class LoginHistory {
this
.
loginIp
=
loginIp
;
}
public
String
get
Account
()
{
return
account
;
public
String
get
Username
()
{
return
username
;
}
public
void
set
Account
(
String
account
)
{
this
.
account
=
account
;
public
void
set
Username
(
String
username
)
{
this
.
username
=
username
;
}
public
long
getLoginTime
()
{
...
...
src/main/java/com/edgec/browserbackend/browser/domain/OperationHistory.java
View file @
6aae1d14
...
...
@@ -12,7 +12,7 @@ import java.time.format.DateTimeFormatter;
public
class
OperationHistory
{
@Id
private
String
id
;
private
String
account
;
private
String
username
;
private
String
nickname
;
private
String
loginIp
;
private
String
loginPlace
;
...
...
@@ -26,7 +26,7 @@ public class OperationHistory {
public
OperationHistory
(
OperationHistoryDto
operationHistoryDto
)
{
if
(
operationHistoryDto
.
getAccount
()
!=
null
)
this
.
account
=
operationHistoryDto
.
getAccount
();
this
.
username
=
operationHistoryDto
.
getAccount
();
if
(
operationHistoryDto
.
getNickname
()
!=
null
)
this
.
nickname
=
operationHistoryDto
.
getNickname
();
if
(
operationHistoryDto
.
getLoginIp
()
!=
null
)
...
...
@@ -50,12 +50,12 @@ public class OperationHistory {
this
.
id
=
id
;
}
public
String
get
Account
()
{
return
account
;
public
String
get
Username
()
{
return
username
;
}
public
void
set
Account
(
String
account
)
{
this
.
account
=
account
;
public
void
set
Username
(
String
username
)
{
this
.
username
=
username
;
}
public
long
getOperationTime
()
{
...
...
src/main/java/com/edgec/browserbackend/browser/dto/LoginHistoryDto.java
View file @
6aae1d14
...
...
@@ -21,8 +21,8 @@ public class LoginHistoryDto {
}
public
LoginHistoryDto
(
LoginHistory
loginHistory
)
{
if
(
loginHistory
.
get
Account
()
!=
null
)
this
.
account
=
loginHistory
.
get
Account
();
if
(
loginHistory
.
get
Username
()
!=
null
)
this
.
account
=
loginHistory
.
get
Username
();
if
(
loginHistory
.
getNickname
()
!=
null
)
this
.
nickname
=
loginHistory
.
getNickname
();
if
(
loginHistory
.
getLoginIp
()
!=
null
)
...
...
src/main/java/com/edgec/browserbackend/browser/dto/OperationHistoryDto.java
View file @
6aae1d14
...
...
@@ -21,8 +21,8 @@ public class OperationHistoryDto {
}
public
OperationHistoryDto
(
OperationHistory
operationHistory
)
{
if
(
operationHistory
.
get
Account
()
!=
null
)
this
.
account
=
operationHistory
.
get
Account
();
if
(
operationHistory
.
get
Username
()
!=
null
)
this
.
account
=
operationHistory
.
get
Username
();
if
(
operationHistory
.
getNickname
()
!=
null
)
this
.
nickname
=
operationHistory
.
getNickname
();
if
(
operationHistory
.
getLoginIp
()
!=
null
)
...
...
src/main/java/com/edgec/browserbackend/browser/repository/LoginHistoryRepository.java
View file @
6aae1d14
...
...
@@ -8,11 +8,11 @@ import org.springframework.data.mongodb.repository.MongoRepository;
import
java.util.List
;
public
interface
LoginHistoryRepository
extends
MongoRepository
<
LoginHistory
,
String
>
{
LoginHistory
findFirstBy
Account
(
String
account
);
LoginHistory
findFirstBy
Username
(
String
username
);
Page
<
LoginHistory
>
findByAdministratorAndLoginTimeGreaterThanOrderByLoginTime
(
String
administrator
,
long
time
,
Pageable
pageable
);
Page
<
LoginHistory
>
findBy
AccountAndLoginTimeGreaterThanOrderByLoginTime
(
String
account
,
long
time
,
Pageable
pageable
);
Page
<
LoginHistory
>
findBy
UsernameAndLoginTimeGreaterThanOrderByLoginTime
(
String
username
,
long
time
,
Pageable
pageable
);
int
countBy
Account
(
String
account
);
int
countBy
Username
(
String
username
);
}
src/main/java/com/edgec/browserbackend/browser/repository/OperationHistoryRepository.java
View file @
6aae1d14
...
...
@@ -6,10 +6,10 @@ import org.springframework.data.domain.Pageable;
import
org.springframework.data.mongodb.repository.MongoRepository
;
public
interface
OperationHistoryRepository
extends
MongoRepository
<
OperationHistory
,
String
>
{
OperationHistory
findFirstBy
Account
(
String
account
);
OperationHistory
findFirstBy
Username
(
String
username
);
Page
<
OperationHistory
>
findByAdministratorAndOperationTimeGreaterThanOrderByOperationTimeDesc
(
String
administrator
,
long
time
,
Pageable
pageable
);
Page
<
OperationHistory
>
findBy
AccountAndOperationTimeGreaterThanOrderByOperationTimeDesc
(
String
account
,
long
time
,
Pageable
pageable
);
Page
<
OperationHistory
>
findBy
UsernameAndOperationTimeGreaterThanOrderByOperationTimeDesc
(
String
username
,
long
time
,
Pageable
pageable
);
int
countBy
Account
(
String
account
);
int
countBy
Username
(
String
username
);
}
src/main/java/com/edgec/browserbackend/browser/service/Impl/HistoryServiceImpl.java
View file @
6aae1d14
...
...
@@ -39,12 +39,12 @@ public class HistoryServiceImpl implements HistoryService {
Account
account
=
accountRepository
.
findById
(
username
).
orElse
(
null
);
if
(
account
==
null
)
throw
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
);
int
num
=
loginHistoryRepository
.
countBy
Account
(
username
);
int
num
=
loginHistoryRepository
.
countBy
Username
(
username
);
if
(
num
>
10000
)
loginHistoryRepository
.
delete
(
loginHistoryRepository
.
findFirstBy
Account
(
username
));
loginHistoryRepository
.
delete
(
loginHistoryRepository
.
findFirstBy
Username
(
username
));
LoginHistory
loginHistory
=
new
LoginHistory
(
loginHistoryDto
);
loginHistory
.
setLoginTime
(
Instant
.
now
().
toEpochMilli
());
loginHistory
.
set
Account
(
username
);
loginHistory
.
set
Username
(
username
);
if
(
account
.
getParent
()
==
null
)
loginHistory
.
setAdministrator
(
username
);
else
...
...
@@ -58,12 +58,12 @@ public class HistoryServiceImpl implements HistoryService {
Account
account
=
accountRepository
.
findById
(
username
).
orElse
(
null
);
if
(
account
==
null
)
throw
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
);
int
num
=
operationHistoryRepository
.
countBy
Account
(
username
);
int
num
=
operationHistoryRepository
.
countBy
Username
(
username
);
if
(
num
>
10000
)
operationHistoryRepository
.
delete
(
operationHistoryRepository
.
findFirstBy
Account
(
username
));
operationHistoryRepository
.
delete
(
operationHistoryRepository
.
findFirstBy
Username
(
username
));
OperationHistory
operationHistory
=
new
OperationHistory
(
operationHistoryDto
);
operationHistory
.
setOperationTime
(
Instant
.
now
().
toEpochMilli
());
operationHistory
.
set
Account
(
username
);
operationHistory
.
set
Username
(
username
);
operationHistory
.
setNickname
(
account
.
getNickname
());
if
(
account
.
getParent
()
==
null
)
operationHistory
.
setAdministrator
(
username
);
...
...
@@ -88,7 +88,7 @@ public class HistoryServiceImpl implements HistoryService {
if
(
account
.
getParent
()
==
null
)
{
loginHistoryPage
=
loginHistoryRepository
.
findByAdministratorAndLoginTimeGreaterThanOrderByLoginTime
(
username
,
time
,
pageable
);
}
else
{
loginHistoryPage
=
loginHistoryRepository
.
findBy
Account
AndLoginTimeGreaterThanOrderByLoginTime
(
username
,
time
,
pageable
);
loginHistoryPage
=
loginHistoryRepository
.
findBy
Username
AndLoginTimeGreaterThanOrderByLoginTime
(
username
,
time
,
pageable
);
}
List
<
LoginHistoryDto
>
loginHistoryDtoList
=
new
ArrayList
<>();
...
...
@@ -120,7 +120,7 @@ public class HistoryServiceImpl implements HistoryService {
if
(
account
.
getParent
()
==
null
)
{
operationHistories
=
operationHistoryRepository
.
findByAdministratorAndOperationTimeGreaterThanOrderByOperationTimeDesc
(
username
,
time
,
pageable
);
}
else
{
operationHistories
=
operationHistoryRepository
.
findBy
Account
AndOperationTimeGreaterThanOrderByOperationTimeDesc
(
username
,
time
,
pageable
);
operationHistories
=
operationHistoryRepository
.
findBy
Username
AndOperationTimeGreaterThanOrderByOperationTimeDesc
(
username
,
time
,
pageable
);
}
List
<
OperationHistoryDto
>
operationHistoryDtos
=
new
ArrayList
<>();
...
...
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