Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sh-ds
Project
Project
Details
Activity
Releases
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
李良停
sh-ds
Commits
2530f35f
Commit
2530f35f
authored
May 07, 2022
by
曹雷
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/wangsong_config' into feat-config-web
parents
20b6f5e4
b65852c8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
3 deletions
+23
-3
AuthLogDao.java
...va/com/chineseall/eden/authcenter/log/dao/AuthLogDao.java
+18
-3
AuthLogHourCount.java
...hineseall/eden/authcenter/log/model/AuthLogHourCount.java
+5
-0
No files found.
eden-authcenter-log/src/main/java/com/chineseall/eden/authcenter/log/dao/AuthLogDao.java
View file @
2530f35f
...
...
@@ -11,6 +11,7 @@ import cn.sh.chineseall.framework.dao.core.hql.Criteria;
import
cn.sh.chineseall.framework.dao.core.hql.Query
;
import
cn.sh.chineseall.framework.dao.mongo.dao.StaticCacheDimensionDocumentMongoDao
;
import
cn.sh.chineseall.framework.dao.mongo.hql.MongoCriteriaTranslator
;
import
cn.sh.chineseall.framework.lang.calendar.DateUtils
;
import
com.chineseall.eden.authcenter.log.model.AuthLog
;
import
com.chineseall.eden.authcenter.log.model.AuthLogHourCount
;
import
com.mongodb.MongoClient
;
...
...
@@ -18,9 +19,11 @@ import com.mongodb.client.AggregateIterable;
import
com.mongodb.client.MongoCollection
;
import
com.mongodb.client.MongoDatabase
;
import
com.mongodb.client.model.*
;
import
com.mongodb.util.JSON
;
import
org.bson.BsonDocument
;
import
org.bson.Document
;
import
org.bson.conversions.Bson
;
import
org.json.JSONObject
;
import
org.springframework.stereotype.Component
;
import
java.util.*
;
...
...
@@ -177,11 +180,23 @@ public class AuthLogDao extends StaticCacheDimensionDocumentMongoDao<AuthLog, St
aggregateList
.
add
(
Aggregates
.
sort
(
Sorts
.
descending
(
"count"
)));
aggregateList
.
add
(
Aggregates
.
limit
(
topN
));
AggregateIterable
<
AuthLogHourCount
>
iterable
=
collection
.
aggregate
(
aggregateList
,
AuthLogHourCount
.
class
);
AggregateIterable
<
BsonDocument
>
iterable
=
collection
.
aggregate
(
aggregateList
);
List
<
AuthLogHourCount
>
dataList
=
new
ArrayList
<>();
for
(
AuthLogHourCount
item
:
iterable
){
dataList
.
add
(
item
);
for
(
BsonDocument
item
:
iterable
){
AuthLogHourCount
data
=
new
AuthLogHourCount
();
if
(
item
.
containsKey
(
"yearMonthDay"
)){
data
.
setYearMonthDay
(
item
.
getString
(
"yearMonthDay"
).
getValue
());
}
if
(
item
.
containsKey
(
"hour"
)
){
data
.
setHour
(
item
.
getInt32
(
"hour"
).
getValue
());
}
if
(
item
.
containsKey
(
"count"
)){
double
count
=
item
.
getInt32
(
"count"
).
getValue
();
data
.
setCount
(
Double
.
valueOf
(
count
).
longValue
());
}
dataList
.
add
(
data
);
}
return
dataList
;
}
...
...
eden-authcenter-log/src/main/java/com/chineseall/eden/authcenter/log/model/AuthLogHourCount.java
View file @
2530f35f
package
com
.
chineseall
.
eden
.
authcenter
.
log
.
model
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.io.Serializable
;
@Getter
@Setter
public
class
AuthLogHourCount
implements
Serializable
{
private
String
yearMonthDay
;
...
...
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