Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wecloud_im_server
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hewei
wecloud_im_server
Commits
c80affc9
Commit
c80affc9
authored
Jun 07, 2022
by
吴星煌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据统计bug
parent
44a032b6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
16 deletions
+39
-16
client/src/main/java/com/wecloud/imserver/client/api/ImOverview.java
+5
-3
client/src/main/java/com/wecloud/imserver/client/model/vo/LineChart.java
+2
-1
client/src/main/java/com/wecloud/imserver/client/model/vo/OverviewVo.java
+18
-0
core/src/main/java/com/wecloud/im/appmanager/ImOverviewImpl.java
+14
-12
No files found.
client/src/main/java/com/wecloud/imserver/client/api/ImOverview.java
View file @
c80affc9
package
com
.
wecloud
.
imserver
.
client
.
api
;
import
com.wecloud.imserver.client.model.vo.LineChart
;
import
com.wecloud.imserver.client.model.vo.OverviewVo
;
import
com.wecloud.imserver.client.model.vo.StatisticsVo
;
import
java.time.LocalDateTime
;
...
...
@@ -9,10 +10,11 @@ import java.util.List;
public
interface
ImOverview
{
HashMap
<
String
,
Integer
>
overview
(
Long
appId
);
//服务概览
OverviewVo
overview
(
Long
appId
);
//数据统计中的业务统计
StatisticsVo
groupStatistics
(
Long
appId
,
LocalDateTime
start
,
LocalDateTime
end
);
//用户统计折线图
List
<
LineChart
>
activeUser
(
Long
appId
,
LocalDateTime
start
,
LocalDateTime
end
);
}
client/src/main/java/com/wecloud/imserver/client/model/vo/LineChart.java
View file @
c80affc9
...
...
@@ -2,10 +2,11 @@ package com.wecloud.imserver.client.model.vo;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
@Data
public
class
LineChart
{
public
class
LineChart
implements
Serializable
{
private
Integer
count
;
...
...
client/src/main/java/com/wecloud/imserver/client/model/vo/OverviewVo.java
0 → 100644
View file @
c80affc9
package
com
.
wecloud
.
imserver
.
client
.
model
.
vo
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
public
class
OverviewVo
implements
Serializable
{
private
Integer
activeUser
;
private
Integer
registerUser
;
private
Integer
activeGroup
;
private
Integer
group
;
}
core/src/main/java/com/wecloud/im/appmanager/ImOverviewImpl.java
View file @
c80affc9
package
com
.
wecloud
.
im
.
appmanager
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.wecloud.im.entity.ImClient
;
import
com.wecloud.im.entity.ImConversation
;
import
com.wecloud.im.entity.ImMessage
;
...
...
@@ -13,6 +12,7 @@ import com.wecloud.im.service.ImMessageService;
import
com.wecloud.im.service.ImStatisticsService
;
import
com.wecloud.imserver.client.api.ImOverview
;
import
com.wecloud.imserver.client.model.vo.LineChart
;
import
com.wecloud.imserver.client.model.vo.OverviewVo
;
import
com.wecloud.imserver.client.model.vo.StatisticsVo
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.dubbo.config.annotation.DubboService
;
...
...
@@ -24,7 +24,6 @@ import java.time.LocalDateTime;
import
java.time.LocalTime
;
import
java.time.temporal.ChronoUnit
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.stream.Collectors
;
...
...
@@ -43,9 +42,8 @@ public class ImOverviewImpl implements ImOverview {
private
ImStatisticsService
imStatisticsService
;
@Override
public
HashMap
<
String
,
Integer
>
overview
(
Long
appId
)
{
HashMap
<
String
,
Integer
>
count
=
new
HashMap
<>();
public
OverviewVo
overview
(
Long
appId
)
{
OverviewVo
overviewVo
=
new
OverviewVo
();
//今日活跃用户
Integer
activeUser
=
imMessageService
.
count
(
new
LambdaQueryWrapper
<
ImMessage
>()
.
eq
(
ImMessage:
:
getFkAppid
,
appId
)
...
...
@@ -53,12 +51,12 @@ public class ImOverviewImpl implements ImOverview {
.
groupBy
(
ImMessage:
:
getSender
)
.
select
(
ImMessage:
:
getSender
)
);
count
.
put
(
"activeUser"
,
activeUser
);
overviewVo
.
setActiveUser
(
activeUser
);
//总注册用户数
Integer
registerUser
=
imClientService
.
count
(
new
LambdaQueryWrapper
<
ImClient
>()
.
eq
(
ImClient:
:
getFkAppid
,
appId
)
);
count
.
put
(
"registerUser"
,
registerUser
);
overviewVo
.
setRegisterUser
(
registerUser
);
//七天内活跃群组数
List
<
Long
>
ids
=
imMessageService
.
list
(
new
LambdaQueryWrapper
<
ImMessage
>()
.
ge
(
ImMessage:
:
getCreateTime
,
LocalDateTime
.
now
().
minusDays
(
7
))
...
...
@@ -73,16 +71,16 @@ public class ImOverviewImpl implements ImOverview {
.
eq
(
ImConversation:
:
getChatType
,
ChatTypeEnum
.
THOUSAND_GROUP
.
getCode
())
.
in
(
ImConversation:
:
getId
,
ids
)
);
count
.
put
(
"activeGroup"
,
activeGroup
);
overviewVo
.
setActiveGroup
(
activeGroup
);
//总群组数
Integer
group
=
imConversationService
.
count
(
new
LambdaQueryWrapper
<
ImConversation
>()
.
eq
(
ImConversation:
:
getFkAppid
,
appId
)
.
eq
(
ImConversation:
:
getChatType
,
ChatTypeEnum
.
NORMAL_GROUP
.
getCode
())
.
eq
(
ImConversation:
:
getChatType
,
ChatTypeEnum
.
THOUSAND_GROUP
.
getCode
())
);
count
.
put
(
"group"
,
group
);
overviewVo
.
setGroup
(
group
);
return
count
;
return
overviewVo
;
}
@Override
...
...
@@ -100,7 +98,7 @@ public class ImOverviewImpl implements ImOverview {
.
ge
(
ImStatistics:
:
getTime
,
LocalDateTime
.
of
(
LocalDate
.
now
(),
LocalTime
.
MIN
.
minusHours
(
24
)))
.
le
(
ImStatistics:
:
getTime
,
LocalDateTime
.
of
(
LocalDate
.
now
(),
LocalTime
.
MAX
.
minusHours
(
24
)))
);
Integer
activeGroup
=
statistics
.
getData
();
Integer
activeGroup
=
statistics
==
null
?
0
:
statistics
.
getData
();
statisticsVo
.
setActiveGroup
(
activeGroup
);
//新增群组数(前1天)
...
...
@@ -117,7 +115,7 @@ public class ImOverviewImpl implements ImOverview {
statisticsVo
.
setDismissGroup
(
0
);
//活跃群组平均成员数
Integer
avgMember
=
statistics
.
getGroupMember
()/
statistics
.
getData
();
Integer
avgMember
=
statistics
==
null
?
0
:
statistics
.
getGroupMember
()/
statistics
.
getData
();
statisticsVo
.
setAvgActiveGroup
(
avgMember
);
//活跃群组折线图
...
...
@@ -167,6 +165,10 @@ public class ImOverviewImpl implements ImOverview {
@Override
public
List
<
LineChart
>
activeUser
(
Long
appId
,
LocalDateTime
start
,
LocalDateTime
end
)
{
if
(
start
==
null
&&
end
==
null
){
start
=
LocalDateTime
.
of
(
LocalDate
.
now
(),
LocalTime
.
MIN
.
minusHours
(
24
*
8
));
end
=
start
.
plusDays
(
7
);
}
//活跃用户数
List
<
ImStatistics
>
imStatistics
=
imStatisticsService
.
activeUserOrGroup
(
appId
,
1
,
start
,
end
);
List
<
LineChart
>
activeUser
=
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