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
b0f09124
Commit
b0f09124
authored
May 04, 2022
by
wangsong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update user type api
parent
eb97f95a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
7 deletions
+30
-7
StatisticsController.java
...den/authcenter/agent/controller/StatisticsController.java
+28
-7
AuthLog.java
...ava/com/chineseall/eden/authcenter/log/model/AuthLog.java
+2
-0
No files found.
eden-authcenter-agent/src/main/java/com/chineseall/eden/authcenter/agent/controller/StatisticsController.java
View file @
b0f09124
...
...
@@ -218,7 +218,7 @@ public class StatisticsController {
*/
@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
)
{
public
MapMessage
authUserTypes
(
@RequestParam
(
value
=
"clientId"
,
required
=
false
)
String
clientId
,
@RequestParam
(
value
=
"
latestDays"
,
defaultValue
=
"7"
)
Integer
latestDays
)
{
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
param
.
put
(
"loginSuccessFlag"
,
true
);
...
...
@@ -226,21 +226,42 @@ public class StatisticsController {
param
.
put
(
"clientId"
,
clientId
);
}
int
type
=
1
;
// 1: 日数据 2: 月数据
if
(
latestDays
>
30
){
type
=
2
;
}
Date
startDate
=
getStartDay
(
latestDays
);
List
<
Map
<
String
,
Object
>>
dataList
=
new
ArrayList
<>();
Date
startDate
=
DateUtils
.
stringToDate
(
String
.
valueOf
(
startDay
),
"yyyyMMdd"
);
Date
endDate
=
DateUtils
.
stringToDate
(
String
.
valueOf
(
endDay
),
"yyyyMMdd"
);
Date
endDate
=
new
Date
();
while
(
startDate
.
before
(
endDate
)){
String
yearMonthDay
=
DateUtils
.
dateToString
(
startDate
,
"yyyy-MM-dd"
);
param
.
put
(
"yearMonthDay"
,
yearMonthDay
);
String
dateStr
=
""
;
if
(
Objects
.
equals
(
type
,
1
)){
// 日数据
String
yearMonthDay
=
DateUtils
.
dateToString
(
startDate
,
"yyyy-MM-dd"
);
param
.
put
(
"yearMonthDay"
,
yearMonthDay
);
dateStr
=
DateUtils
.
dateToString
(
startDate
,
"M月dd日"
);
}
else
{
// 月数据
String
yearMonth
=
DateUtils
.
dateToString
(
startDate
,
"yyyy-MM"
);
param
.
put
(
"yearMonth"
,
yearMonth
);
dateStr
=
DateUtils
.
dateToString
(
startDate
,
"M月"
);
}
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
);
if
(
Objects
.
equals
(
type
,
1
)){
// 日数据
startDate
=
DateUtils
.
calculateDateDay
(
startDate
,
1
);
}
else
{
// 月数据
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
startDate
);
calendar
.
add
(
Calendar
.
MONTH
,
1
);
startDate
=
calendar
.
getTime
();
}
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
data
.
put
(
"date"
,
yearMonthDay
);
data
.
put
(
"date"
,
dateStr
);
data
.
put
(
"teacherCount"
,
teacherCount
);
data
.
put
(
"studentCount"
,
studentCount
);
data
.
put
(
"otherCount"
,
all_auth
-
teacherCount
-
studentCount
);
...
...
eden-authcenter-log/src/main/java/com/chineseall/eden/authcenter/log/model/AuthLog.java
View file @
b0f09124
...
...
@@ -79,6 +79,8 @@ public class AuthLog implements CacheDimensionDocument {
@DocumentField
private
String
yearMonthDay
;
private
Integer
hour
;
@Override
public
String
[]
generateCacheDimensions
()
{
return
new
String
[
0
];
...
...
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