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
cbd73dbe
Commit
cbd73dbe
authored
May 03, 2022
by
wangsong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add line api
parent
a783e533
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
114 additions
and
2 deletions
+114
-2
StatisticsController.java
...den/authcenter/agent/controller/StatisticsController.java
+114
-2
No files found.
eden-authcenter-agent/src/main/java/com/chineseall/eden/authcenter/agent/controller/StatisticsController.java
View file @
cbd73dbe
...
@@ -70,7 +70,7 @@ public class StatisticsController {
...
@@ -70,7 +70,7 @@ public class StatisticsController {
*/
*/
@RequestMapping
(
"app"
)
@RequestMapping
(
"app"
)
@ResponseBody
@ResponseBody
public
MapMessage
applications
(
@RequestParam
(
value
=
"clientId"
,
required
=
false
)
String
clientId
,
@RequestParam
(
value
=
"latestDays"
,
required
=
false
)
Integer
latestDays
,
@RequestParam
(
value
=
"topN"
,
required
=
false
)
Integer
topN
)
{
public
MapMessage
applications
(
@RequestParam
(
value
=
"clientId"
,
required
=
false
)
String
clientId
,
@RequestParam
(
value
=
"latestDays"
,
defaultValue
=
"7"
)
Integer
latestDays
,
@RequestParam
(
value
=
"topN"
,
required
=
false
)
Integer
topN
)
{
List
<
StatItem
>
dataList
=
new
ArrayList
<>();
List
<
StatItem
>
dataList
=
new
ArrayList
<>();
List
<
AuthClient
>
clientList
=
authClientService
.
listAll
();
List
<
AuthClient
>
clientList
=
authClientService
.
listAll
();
if
(
StringUtils
.
isNoneBlank
(
clientId
)){
if
(
StringUtils
.
isNoneBlank
(
clientId
)){
...
@@ -108,7 +108,7 @@ public class StatisticsController {
...
@@ -108,7 +108,7 @@ public class StatisticsController {
*/
*/
@RequestMapping
(
"environment"
)
@RequestMapping
(
"environment"
)
@ResponseBody
@ResponseBody
public
MapMessage
environments
(
@RequestParam
(
value
=
"clientId"
,
required
=
false
)
String
clientId
,
@RequestParam
(
value
=
"latestDays"
,
required
=
false
)
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
>
param
=
new
HashMap
<>();
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
param
.
put
(
"loginSuccessFlag"
,
true
);
param
.
put
(
"loginSuccessFlag"
,
true
);
...
@@ -172,4 +172,116 @@ public class StatisticsController {
...
@@ -172,4 +172,116 @@ public class StatisticsController {
return
MapMessage
.
successMessage
().
add
(
"data"
,
result
);
return
MapMessage
.
successMessage
().
add
(
"data"
,
result
);
}
}
/**
* 认证热点单位统计
*
* @return
*/
@RequestMapping
(
"auth_hot_org"
)
@ResponseBody
public
MapMessage
authHotOrgs
(
@RequestParam
(
value
=
"clientId"
,
required
=
false
)
String
clientId
,
@RequestParam
(
value
=
"latestDays"
,
defaultValue
=
"7"
)
Integer
latestDays
,
@RequestParam
(
value
=
"topN"
,
required
=
false
)
Integer
topN
)
{
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
param
.
put
(
"loginSuccessFlag"
,
true
);
if
(
clientId
!=
null
){
param
.
put
(
"clientId"
,
clientId
);
}
Date
startDate
=
getStartDay
(
latestDays
);
List
<
String
>
schoolNames
=
authLogService
.
distinct
(
"logUserInfo.schoolName"
,
param
,
startDate
);
List
<
StatItem
>
result
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
schoolNames
)){
for
(
String
name
:
schoolNames
)
{
param
.
put
(
"logUserInfo.schoolName"
,
name
);
long
count
=
authLogService
.
count
(
param
,
startDate
);
StatItem
item
=
new
StatItem
();
item
.
setCount
(
count
);
item
.
setName
(
name
);
result
.
add
(
item
);
}
}
result
.
sort
(
Comparator
.
comparing
(
StatItem:
:
getCount
).
reversed
());
if
(
result
.
size
()>
topN
){
result
=
result
.
subList
(
0
,
topN
);
}
return
MapMessage
.
successMessage
().
add
(
"data"
,
result
);
}
/**
* 认证身份统计
*
* @return
*/
@RequestMapping
(
"auth_user_type"
)
@ResponseBody
public
MapMessage
authUserTypes
(
@RequestParam
(
value
=
"clientId"
,
required
=
false
)
String
clientId
,
@RequestParam
(
value
=
"startDay"
)
Integer
startDay
,
@RequestParam
(
value
=
"endDay"
)
Integer
endDay
)
{
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
param
.
put
(
"loginSuccessFlag"
,
true
);
if
(
clientId
!=
null
){
param
.
put
(
"clientId"
,
clientId
);
}
List
<
Map
<
String
,
Object
>>
dataList
=
new
ArrayList
<>();
Date
startDate
=
DateUtils
.
stringToDate
(
String
.
valueOf
(
startDay
),
"yyyyMMdd"
);
Date
endDate
=
DateUtils
.
stringToDate
(
String
.
valueOf
(
endDay
),
"yyyyMMdd"
);
while
(
startDate
.
before
(
endDate
)){
String
yearMonthDay
=
DateUtils
.
dateToString
(
startDate
,
"yyyy-MM-dd"
);
param
.
put
(
"yearMonthDay"
,
yearMonthDay
);
long
all_auth
=
authLogService
.
count
(
param
);
param
.
put
(
"logUserInfo.userType"
,
"TEACHER"
);
long
teacherCount
=
authLogService
.
count
(
param
);
param
.
put
(
"logUserInfo.userType"
,
"STUDENT"
);
long
studentCount
=
authLogService
.
count
(
param
);
startDate
=
DateUtils
.
calculateDateDay
(
startDate
,
1
);
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
data
.
put
(
"date"
,
yearMonthDay
);
data
.
put
(
"teacherCount"
,
teacherCount
);
data
.
put
(
"studentCount"
,
studentCount
);
data
.
put
(
"otherCount"
,
all_auth
-
teacherCount
-
studentCount
);
dataList
.
add
(
data
);
}
return
MapMessage
.
successMessage
().
add
(
"dataList"
,
dataList
);
}
@RequestMapping
(
"auth_user_type_sum"
)
@ResponseBody
public
MapMessage
authUserTypeSum
(
@RequestParam
(
value
=
"clientId"
,
required
=
false
)
String
clientId
,
@RequestParam
(
value
=
"latestDays"
,
defaultValue
=
"7"
)
Integer
latestDays
)
{
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
param
.
put
(
"loginSuccessFlag"
,
true
);
if
(
clientId
!=
null
){
param
.
put
(
"clientId"
,
clientId
);
}
Date
startDate
=
getStartDay
(
latestDays
);
long
days
=
DateUtils
.
dayDiff
(
new
Date
(),
startDate
);
long
all_auth
=
authLogService
.
count
(
param
,
startDate
);
param
.
put
(
"logUserInfo.userType"
,
"TEACHER"
);
long
teacherCount
=
authLogService
.
count
(
param
,
startDate
);
param
.
put
(
"logUserInfo.userType"
,
"STUDENT"
);
long
studentCount
=
authLogService
.
count
(
param
,
startDate
);
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
data
.
put
(
"totalCount"
,
all_auth
);
data
.
put
(
"teacherCount"
,
teacherCount
);
data
.
put
(
"studentCount"
,
studentCount
);
data
.
put
(
"otherCount"
,
all_auth
-
teacherCount
-
studentCount
);
data
.
put
(
"avgTotalCount"
,
all_auth
/
days
);
data
.
put
(
"avgTeacherCount"
,
teacherCount
/
days
);
data
.
put
(
"avgStudentCount"
,
studentCount
/
days
);
data
.
put
(
"avgOtherCount"
,
(
all_auth
-
teacherCount
-
studentCount
)/
days
);
return
MapMessage
.
successMessage
().
add
(
"data"
,
data
);
}
}
}
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