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
f66f9905
Commit
f66f9905
authored
Jun 06, 2022
by
吴星煌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
服务概览
parent
87421ae2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
0 deletions
+90
-0
client/src/main/java/com/wecloud/imserver/client/api/ImOverview.java
+9
-0
core/src/main/java/com/wecloud/im/appmanager/ImOverviewImpl.java
+81
-0
No files found.
client/src/main/java/com/wecloud/imserver/client/api/ImOverview.java
0 → 100644
View file @
f66f9905
package
com
.
wecloud
.
imserver
.
client
.
api
;
import
java.util.HashMap
;
public
interface
ImOverview
{
HashMap
<
String
,
Integer
>
overview
(
Long
appId
);
}
core/src/main/java/com/wecloud/im/appmanager/ImOverviewImpl.java
0 → 100644
View file @
f66f9905
package
com
.
wecloud
.
im
.
appmanager
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.wecloud.im.entity.ImClient
;
import
com.wecloud.im.entity.ImConversation
;
import
com.wecloud.im.entity.ImMessage
;
import
com.wecloud.im.sdk.enums.ChatTypeEnum
;
import
com.wecloud.im.service.ImClientService
;
import
com.wecloud.im.service.ImConversationService
;
import
com.wecloud.im.service.ImMessageService
;
import
com.wecloud.imserver.client.api.ImOverview
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.dubbo.config.annotation.DubboService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalTime
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Slf4j
@Service
@DubboService
public
class
ImOverviewImpl
implements
ImOverview
{
@Autowired
private
ImMessageService
imMessageService
;
@Autowired
private
ImClientService
imClientService
;
@Autowired
private
ImConversationService
imConversationService
;
@Override
public
HashMap
<
String
,
Integer
>
overview
(
Long
appId
)
{
HashMap
<
String
,
Integer
>
count
=
new
HashMap
<>();
//今日活跃用户
List
<
Long
>
userIds
=
imMessageService
.
list
(
new
LambdaQueryWrapper
<
ImMessage
>()
.
eq
(
ImMessage:
:
getFkAppid
,
appId
)
.
groupBy
(
ImMessage:
:
getSender
)
.
ge
(
ImMessage:
:
getCreateTime
,
LocalDateTime
.
of
(
LocalDate
.
now
(),
LocalTime
.
MIN
)))
.
stream
().
map
(
ImMessage:
:
getSender
).
collect
(
Collectors
.
toList
());
Integer
activeUser
=
imClientService
.
count
(
new
LambdaQueryWrapper
<
ImClient
>()
.
eq
(
ImClient:
:
getFkAppid
,
appId
)
.
in
(
ImClient:
:
getId
,
userIds
)
);
count
.
put
(
"activeUser"
,
activeUser
);
//总注册用户数
Integer
registerUser
=
imClientService
.
count
(
new
LambdaQueryWrapper
<
ImClient
>()
.
eq
(
ImClient:
:
getFkAppid
,
appId
)
);
count
.
put
(
"registerUser"
,
registerUser
);
//七天内活跃群组数
List
<
Long
>
ids
=
imMessageService
.
list
(
new
LambdaQueryWrapper
<
ImMessage
>()
.
ge
(
ImMessage:
:
getCreateTime
,
LocalDateTime
.
now
().
minusDays
(
7
))
.
le
(
ImMessage:
:
getCreateTime
,
LocalDateTime
.
now
())
.
groupBy
(
ImMessage:
:
getFkConversationId
)
).
stream
().
map
(
ImMessage:
:
getFkConversationId
).
collect
(
Collectors
.
toList
());
Integer
activeGroup
=
imConversationService
.
count
(
new
LambdaQueryWrapper
<
ImConversation
>()
.
eq
(
ImConversation:
:
getFkAppid
,
appId
)
.
eq
(
ImConversation:
:
getChatType
,
ChatTypeEnum
.
NORMAL_GROUP
.
getCode
())
.
eq
(
ImConversation:
:
getChatType
,
ChatTypeEnum
.
THOUSAND_GROUP
.
getCode
())
.
in
(
ImConversation:
:
getId
,
ids
)
);
count
.
put
(
"activeGroup"
,
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
);
return
count
;
}
}
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