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
ffe4ea54
Commit
ffe4ea54
authored
May 04, 2022
by
wangsong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update evn api
parent
b0f09124
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
51 deletions
+63
-51
StatisticsController.java
...den/authcenter/agent/controller/StatisticsController.java
+37
-51
AuthLogDao.java
...va/com/chineseall/eden/authcenter/log/dao/AuthLogDao.java
+19
-0
AuthLogService.java
...hineseall/eden/authcenter/log/service/AuthLogService.java
+2
-0
AuthLogServiceImpl.java
.../eden/authcenter/log/service/impl/AuthLogServiceImpl.java
+5
-0
No files found.
eden-authcenter-agent/src/main/java/com/chineseall/eden/authcenter/agent/controller/StatisticsController.java
View file @
ffe4ea54
...
@@ -110,66 +110,51 @@ public class StatisticsController {
...
@@ -110,66 +110,51 @@ public class StatisticsController {
@ResponseBody
@ResponseBody
public
MapMessage
environments
(
@RequestParam
(
value
=
"clientId"
,
required
=
false
)
String
clientId
,
@RequestParam
(
value
=
"latestDays"
,
defaultValue
=
"7"
)
Integer
latestDays
)
{
public
MapMessage
environments
(
@RequestParam
(
value
=
"clientId"
,
required
=
false
)
String
clientId
,
@RequestParam
(
value
=
"latestDays"
,
defaultValue
=
"7"
)
Integer
latestDays
)
{
Map
<
String
,
List
<
StatItem
>>
result
=
new
HashMap
<>();
Map
<
String
,
List
<
StatItem
>>
result
=
new
HashMap
<>();
Map
<
String
,
Object
>
p
aram
=
new
HashMap
<>();
Map
<
String
,
Object
>
commonP
aram
=
new
HashMap
<>();
p
aram
.
put
(
"loginSuccessFlag"
,
true
);
commonP
aram
.
put
(
"loginSuccessFlag"
,
true
);
if
(
clientId
!=
null
){
if
(
clientId
!=
null
){
p
aram
.
put
(
"clientId"
,
clientId
);
commonP
aram
.
put
(
"clientId"
,
clientId
);
}
}
Date
startDate
=
getStartDay
(
latestDays
);
Date
startDate
=
getStartDay
(
latestDays
);
long
all_auth
=
authLogService
.
count
(
param
,
startDate
);
List
<
String
>
browserList
=
authLogService
.
distinct
(
"browser"
,
commonParam
,
startDate
);
List
<
StatItem
>
browserResult
=
new
ArrayList
<>();
List
<
String
>
osList
=
authLogService
.
distinct
(
"os"
,
commonParam
,
startDate
);
List
<
String
>
browserList
=
authLogService
.
distinct
(
"browser"
,
param
,
startDate
);
long
unknownBrowser
=
all_auth
;
Map
<
String
,
List
<
Long
>>
browserOsListMap
=
new
HashMap
<>();
if
(
CollectionUtils
.
isNotEmpty
(
browserList
)){
if
(
CollectionUtils
.
isNotEmpty
(
browserList
)
&&
CollectionUtils
.
isNotEmpty
(
osList
)){
for
(
String
item
:
browserList
)
{
for
(
String
browser
:
browserList
)
{
param
.
put
(
"browser"
,
item
);
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
long
count
=
authLogService
.
count
(
param
,
startDate
);
param
.
putAll
(
commonParam
);
StatItem
statItem
=
new
StatItem
();
param
.
put
(
"browser"
,
browser
);
statItem
.
setName
(
item
);
long
otherCount
=
authLogService
.
count
(
param
,
startDate
);
statItem
.
setCount
(
count
);
List
<
Long
>
osDataList
=
new
ArrayList
<>();
unknownBrowser
=
unknownBrowser
-
count
;
for
(
String
os
:
osList
){
browserResult
.
add
(
statItem
);
param
.
put
(
"os"
,
os
);
long
osCount
=
authLogService
.
count
(
param
,
startDate
);
osDataList
.
add
(
osCount
);
otherCount
=
otherCount
-
osCount
;
}
osDataList
.
add
(
otherCount
);
browserOsListMap
.
put
(
browser
,
osDataList
);
}
}
}
if
(
unknownBrowser
>
0
){
StatItem
statItem
=
new
StatItem
();
statItem
.
setName
(
"unknown"
);
statItem
.
setCount
(
unknownBrowser
);
browserResult
.
add
(
statItem
);
}
result
.
put
(
"browser"
,
browserResult
);
Map
<
String
,
Object
>
unknownParam
=
new
HashMap
<>();
unknownParam
.
putAll
(
commonParam
);
List
<
StatItem
>
osResult
=
new
ArrayList
<>();
long
unknownOtherCount
=
authLogService
.
count
(
unknownParam
,
browserList
,
startDate
);
List
<
Long
>
unknownDataList
=
new
ArrayList
<>();
param
.
remove
(
"browser"
);
for
(
String
os
:
osList
){
List
<
String
>
osList
=
authLogService
.
distinct
(
"os"
,
param
,
startDate
);
unknownParam
.
put
(
"os"
,
os
);
long
osCount
=
authLogService
.
count
(
unknownParam
,
browserList
,
startDate
);
long
unknownOs
=
all_auth
;
unknownDataList
.
add
(
osCount
);
if
(
CollectionUtils
.
isNotEmpty
(
osList
)){
unknownOtherCount
=
unknownOtherCount
-
osCount
;
for
(
String
item
:
osList
)
{
param
.
put
(
"os"
,
item
);
long
count
=
authLogService
.
count
(
param
,
startDate
);
StatItem
statItem
=
new
StatItem
();
statItem
.
setName
(
item
);
statItem
.
setCount
(
count
);
osResult
.
add
(
statItem
);
unknownOs
=
unknownOs
-
count
;
}
}
unknownDataList
.
add
(
unknownOtherCount
);
browserOsListMap
.
put
(
"unknown"
,
unknownDataList
);
}
}
if
(
unknownOs
>
0
){
browserList
.
add
(
"unknown"
);
StatItem
statItem
=
new
StatItem
();
osList
.
add
(
"unknown"
);
statItem
.
setName
(
"unknown"
);
return
MapMessage
.
successMessage
().
add
(
"browserList"
,
browserList
).
add
(
"osList"
,
osList
).
add
(
"dataMap"
,
browserOsListMap
);
statItem
.
setCount
(
unknownOs
);
osResult
.
add
(
statItem
);
}
result
.
put
(
"os"
,
osResult
);
return
MapMessage
.
successMessage
().
add
(
"data"
,
result
);
}
}
...
@@ -305,4 +290,5 @@ public class StatisticsController {
...
@@ -305,4 +290,5 @@ public class StatisticsController {
return
MapMessage
.
successMessage
().
add
(
"data"
,
data
);
return
MapMessage
.
successMessage
().
add
(
"data"
,
data
);
}
}
}
}
eden-authcenter-log/src/main/java/com/chineseall/eden/authcenter/log/dao/AuthLogDao.java
View file @
ffe4ea54
...
@@ -3,6 +3,7 @@ package com.chineseall.eden.authcenter.log.dao;
...
@@ -3,6 +3,7 @@ package com.chineseall.eden.authcenter.log.dao;
import
cn.sh.chineseall.framework.core.repackaged.org.springframework.data.domain.PageRequest
;
import
cn.sh.chineseall.framework.core.repackaged.org.springframework.data.domain.PageRequest
;
import
cn.sh.chineseall.framework.core.repackaged.org.springframework.data.domain.Pageable
;
import
cn.sh.chineseall.framework.core.repackaged.org.springframework.data.domain.Pageable
;
import
cn.sh.chineseall.framework.core.repackaged.org.springframework.data.domain.Sort
;
import
cn.sh.chineseall.framework.core.repackaged.org.springframework.data.domain.Sort
;
import
cn.sh.chineseall.framework.core.util.CollectionUtils
;
import
cn.sh.chineseall.framework.core.util.StringUtils
;
import
cn.sh.chineseall.framework.core.util.StringUtils
;
import
cn.sh.chineseall.framework.dao.core.hql.Criteria
;
import
cn.sh.chineseall.framework.dao.core.hql.Criteria
;
import
cn.sh.chineseall.framework.dao.core.hql.Query
;
import
cn.sh.chineseall.framework.dao.core.hql.Query
;
...
@@ -103,6 +104,24 @@ public class AuthLogDao extends StaticCacheDimensionDocumentMongoDao<AuthLog, St
...
@@ -103,6 +104,24 @@ public class AuthLogDao extends StaticCacheDimensionDocumentMongoDao<AuthLog, St
return
count
(
query
);
return
count
(
query
);
}
}
public
long
count
(
Map
<
String
,
Object
>
params
,
List
<
String
>
notInBrowserList
,
Date
beginTime
){
Criteria
criteria
=
new
Criteria
();
if
(
null
!=
params
&&
params
.
size
()
>
0
){
params
.
forEach
((
k
,
v
)->{
criteria
.
and
(
k
).
is
(
v
);
});
}
if
(
CollectionUtils
.
isNotEmpty
(
notInBrowserList
)){
criteria
.
and
(
"browser"
).
nin
(
notInBrowserList
);
}
if
(
beginTime
!=
null
){
criteria
.
and
(
"createTime"
).
gte
(
beginTime
);
}
Query
query
=
Query
.
query
(
criteria
);
return
count
(
query
);
}
public
List
<
AuthLog
>
listLogWithPage
(
int
pageNo
,
int
pageSize
,
Map
<
String
,
Object
>
prams
)
{
public
List
<
AuthLog
>
listLogWithPage
(
int
pageNo
,
int
pageSize
,
Map
<
String
,
Object
>
prams
)
{
Criteria
criteria
=
new
Criteria
();
Criteria
criteria
=
new
Criteria
();
if
(
null
!=
prams
&&
prams
.
size
()
>
0
){
if
(
null
!=
prams
&&
prams
.
size
()
>
0
){
...
...
eden-authcenter-log/src/main/java/com/chineseall/eden/authcenter/log/service/AuthLogService.java
View file @
ffe4ea54
...
@@ -23,6 +23,8 @@ public interface AuthLogService {
...
@@ -23,6 +23,8 @@ public interface AuthLogService {
long
count
(
Map
<
String
,
Object
>
prams
);
long
count
(
Map
<
String
,
Object
>
prams
);
long
count
(
Map
<
String
,
Object
>
prams
,
Date
beginTime
);
long
count
(
Map
<
String
,
Object
>
prams
,
Date
beginTime
);
long
count
(
Map
<
String
,
Object
>
params
,
List
<
String
>
notInBrowserList
,
Date
beginTime
);
void
replace
(
AuthLog
authLog
);
void
replace
(
AuthLog
authLog
);
public
List
<
AuthLog
>
listLogWithPage
(
int
pageNo
,
int
pageSize
,
Map
<
String
,
Object
>
prams
);
public
List
<
AuthLog
>
listLogWithPage
(
int
pageNo
,
int
pageSize
,
Map
<
String
,
Object
>
prams
);
...
...
eden-authcenter-log/src/main/java/com/chineseall/eden/authcenter/log/service/impl/AuthLogServiceImpl.java
View file @
ffe4ea54
...
@@ -82,6 +82,11 @@ public class AuthLogServiceImpl implements AuthLogService {
...
@@ -82,6 +82,11 @@ public class AuthLogServiceImpl implements AuthLogService {
return
authLogDao
.
count
(
prams
,
beginTime
);
return
authLogDao
.
count
(
prams
,
beginTime
);
}
}
@Override
public
long
count
(
Map
<
String
,
Object
>
params
,
List
<
String
>
notInBrowserList
,
Date
beginTime
)
{
return
authLogDao
.
count
(
params
,
notInBrowserList
,
beginTime
);
}
@Override
@Override
public
void
replace
(
AuthLog
authLog
)
{
public
void
replace
(
AuthLog
authLog
)
{
authLogDao
.
replace
(
authLog
);
authLogDao
.
replace
(
authLog
);
...
...
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