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
99938109
Commit
99938109
authored
Jan 11, 2022
by
lixiaozhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、创建会话需要传给服务端chatType
2、查询会话列表,返回chatType和memberCount 3、在线文档路径添加新路径扫描
parent
61f36d6a
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
73 additions
and
18 deletions
+73
-18
bootstrap/src/main/java/io/geekidea/springbootplus/config/Swagger2Config.java
+1
-1
core/src/main/java/com/wecloud/im/entity/ImConversation.java
+2
-2
core/src/main/java/com/wecloud/im/enums/ChatTypeEnum.java
+34
-0
core/src/main/java/com/wecloud/im/param/ImConversationQueryVo.java
+2
-2
core/src/main/java/com/wecloud/im/param/add/ImConversationCreate.java
+5
-0
core/src/main/java/com/wecloud/im/service/impl/ImConversationServiceImpl.java
+8
-1
core/src/main/java/com/wecloud/im/service/impl/ImMessageServiceImpl.java
+2
-1
core/src/main/java/com/wecloud/im/thousandchat/controller/ThousandChatController.java
+3
-3
core/src/main/java/com/wecloud/im/vo/MyConversationListVo.java
+8
-3
core/src/main/java/com/wecloud/im/ws/strategy/AbstractImCmdStrategy.java
+2
-1
core/src/main/resources/mapper/ImConversationMapper.xml
+4
-2
core/src/main/resources/mapper/ImConversationMembersMapper.xml
+1
-1
docs/db/wecloud_im.sql
+1
-1
No files found.
bootstrap/src/main/java/io/geekidea/springbootplus/config/Swagger2Config.java
View file @
99938109
...
@@ -155,7 +155,7 @@ public class Swagger2Config {
...
@@ -155,7 +155,7 @@ public class Swagger2Config {
@Bean
@Bean
public
Docket
restAppApi
()
{
public
Docket
restAppApi
()
{
// 获取需要扫描的包
// 获取需要扫描的包
String
[]
basePackages
=
{
"com.wecloud.im.controller"
};
String
[]
basePackages
=
{
"com.wecloud.im.controller"
,
"com.wecloud.im.thousandchat.controller"
};
ApiSelectorBuilder
apiSelectorBuilder
=
new
Docket
(
DocumentationType
.
SWAGGER_2
)
ApiSelectorBuilder
apiSelectorBuilder
=
new
Docket
(
DocumentationType
.
SWAGGER_2
)
.
apiInfo
(
apiInfo
())
.
apiInfo
(
apiInfo
())
.
groupName
(
"app"
)
.
groupName
(
"app"
)
...
...
core/src/main/java/com/wecloud/im/entity/ImConversation.java
View file @
99938109
...
@@ -42,8 +42,8 @@ public class ImConversation extends BaseEntity {
...
@@ -42,8 +42,8 @@ public class ImConversation extends BaseEntity {
@ApiModelProperty
(
"群成员数量"
)
@ApiModelProperty
(
"群成员数量"
)
private
Integer
memberCount
;
private
Integer
memberCount
;
@ApiModelProperty
(
"
是否
万人群"
)
@ApiModelProperty
(
"
会话属性,1:单聊,2:普通群,3:
万人群"
)
private
Boolean
isThousand
;
private
Integer
chatType
;
@NotNull
(
message
=
"应用appid不能为空"
)
@NotNull
(
message
=
"应用appid不能为空"
)
@ApiModelProperty
(
"应用appid"
)
@ApiModelProperty
(
"应用appid"
)
...
...
core/src/main/java/com/wecloud/im/enums/ChatTypeEnum.java
0 → 100644
View file @
99938109
package
com
.
wecloud
.
im
.
enums
;
import
io.geekidea.springbootplus.framework.common.enums.BaseEnum
;
/**
* @Description 会话类型
* @Author lixiaozhong
* @Date 2022/1/11 4:58 下午
*/
public
enum
ChatTypeEnum
implements
BaseEnum
{
SINGLE
(
1
,
"单聊"
),
NORMAL_GROUP
(
2
,
"普通群"
),
THOUSAND_GROUP
(
3
,
"万人群"
);
private
final
Integer
code
;
private
final
String
desc
;
ChatTypeEnum
(
Integer
code
,
String
desc
)
{
this
.
code
=
code
;
this
.
desc
=
desc
;
}
@Override
public
Integer
getCode
()
{
return
this
.
code
;
}
@Override
public
String
getDesc
()
{
return
this
.
desc
;
}
}
core/src/main/java/com/wecloud/im/param/ImConversationQueryVo.java
View file @
99938109
...
@@ -52,6 +52,6 @@ public class ImConversationQueryVo implements Serializable {
...
@@ -52,6 +52,6 @@ public class ImConversationQueryVo implements Serializable {
@ApiModelProperty
(
"群成员数量"
)
@ApiModelProperty
(
"群成员数量"
)
private
Integer
memberCount
;
private
Integer
memberCount
;
@ApiModelProperty
(
"
是否
万人群"
)
@ApiModelProperty
(
"
会话属性,1:单聊,2:普通群,3:
万人群"
)
private
Boolean
isThousand
;
private
Integer
chatType
;
}
}
core/src/main/java/com/wecloud/im/param/add/ImConversationCreate.java
View file @
99938109
...
@@ -7,6 +7,7 @@ import lombok.Data;
...
@@ -7,6 +7,7 @@ import lombok.Data;
import
lombok.EqualsAndHashCode
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
lombok.experimental.Accessors
;
import
javax.validation.constraints.NotNull
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
...
@@ -32,4 +33,8 @@ public class ImConversationCreate extends BaseEntity {
...
@@ -32,4 +33,8 @@ public class ImConversationCreate extends BaseEntity {
@ApiModelProperty
(
"可选 邀请加入会话的客户端,如创建单聊,则填入对方的clientId"
)
@ApiModelProperty
(
"可选 邀请加入会话的客户端,如创建单聊,则填入对方的clientId"
)
private
List
<
String
>
clientIds
;
private
List
<
String
>
clientIds
;
@ApiModelProperty
(
"会话属性,1:单聊,2:普通群,3:万人群"
)
@NotNull
(
message
=
"会话类型不能为空"
)
private
Integer
chatType
;
}
}
core/src/main/java/com/wecloud/im/service/impl/ImConversationServiceImpl.java
View file @
99938109
...
@@ -11,6 +11,7 @@ import com.wecloud.im.entity.ImConversation;
...
@@ -11,6 +11,7 @@ import com.wecloud.im.entity.ImConversation;
import
com.wecloud.im.entity.ImConversationMembers
;
import
com.wecloud.im.entity.ImConversationMembers
;
import
com.wecloud.im.entity.ImMessage
;
import
com.wecloud.im.entity.ImMessage
;
import
com.wecloud.im.entity.ImMessageOnlineSend
;
import
com.wecloud.im.entity.ImMessageOnlineSend
;
import
com.wecloud.im.enums.ChatTypeEnum
;
import
com.wecloud.im.mapper.ImConversationMapper
;
import
com.wecloud.im.mapper.ImConversationMapper
;
import
com.wecloud.im.param.ImConversationPageParam
;
import
com.wecloud.im.param.ImConversationPageParam
;
import
com.wecloud.im.param.ImConversationQueryVo
;
import
com.wecloud.im.param.ImConversationQueryVo
;
...
@@ -35,6 +36,7 @@ import com.wecloud.im.ws.sender.ChannelSender;
...
@@ -35,6 +36,7 @@ import com.wecloud.im.ws.sender.ChannelSender;
import
com.wecloud.utils.JsonUtils
;
import
com.wecloud.utils.JsonUtils
;
import
io.geekidea.springbootplus.framework.common.api.ApiCode
;
import
io.geekidea.springbootplus.framework.common.api.ApiCode
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
import
io.geekidea.springbootplus.framework.common.enums.BaseEnum
;
import
io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl
;
import
io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl
;
import
io.geekidea.springbootplus.framework.core.pagination.PageInfo
;
import
io.geekidea.springbootplus.framework.core.pagination.PageInfo
;
import
io.geekidea.springbootplus.framework.core.pagination.Paging
;
import
io.geekidea.springbootplus.framework.core.pagination.Paging
;
...
@@ -100,6 +102,11 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
...
@@ -100,6 +102,11 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
return
ApiResult
.
result
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
return
ApiResult
.
result
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
}
}
if
(
BaseEnum
.
valueOf
(
ChatTypeEnum
.
class
,
imConversationCreate
.
getChatType
())
==
null
)
{
log
.
info
(
"会话类型不存在"
);
return
ApiResult
.
result
(
ApiCode
.
PARAMETER_EXCEPTION
,
null
);
}
// 成员不存在,不能创建会话
// 成员不存在,不能创建会话
for
(
String
id
:
imConversationCreate
.
getClientIds
())
{
for
(
String
id
:
imConversationCreate
.
getClientIds
())
{
ImClient
imClient
=
imClientService
.
getOne
(
new
QueryWrapper
<
ImClient
>().
lambda
()
ImClient
imClient
=
imClientService
.
getOne
(
new
QueryWrapper
<
ImClient
>().
lambda
()
...
@@ -180,7 +187,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
...
@@ -180,7 +187,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
imConversation
.
setFkAppid
(
createClient
.
getFkAppid
());
imConversation
.
setFkAppid
(
createClient
.
getFkAppid
());
imConversation
.
setCreator
(
creator
);
imConversation
.
setCreator
(
creator
);
imConversation
.
setMemberCount
(
imConversationCreate
.
getClientIds
().
size
()
+
1
);
imConversation
.
setMemberCount
(
imConversationCreate
.
getClientIds
().
size
()
+
1
);
imConversation
.
set
IsThousand
(
false
);
imConversation
.
set
ChatType
(
imConversationCreate
.
getChatType
()
);
imConversation
.
setName
(
imConversationCreate
.
getName
());
imConversation
.
setName
(
imConversationCreate
.
getName
());
imConversation
.
setSystemFlag
(
false
);
imConversation
.
setSystemFlag
(
false
);
// 拓展数据
// 拓展数据
...
...
core/src/main/java/com/wecloud/im/service/impl/ImMessageServiceImpl.java
View file @
99938109
...
@@ -11,6 +11,7 @@ import com.wecloud.im.entity.ImConversation;
...
@@ -11,6 +11,7 @@ import com.wecloud.im.entity.ImConversation;
import
com.wecloud.im.entity.ImConversationMembers
;
import
com.wecloud.im.entity.ImConversationMembers
;
import
com.wecloud.im.entity.ImMessage
;
import
com.wecloud.im.entity.ImMessage
;
import
com.wecloud.im.entity.ImMessageOnlineSend
;
import
com.wecloud.im.entity.ImMessageOnlineSend
;
import
com.wecloud.im.enums.ChatTypeEnum
;
import
com.wecloud.im.mapper.ImMessageMapper
;
import
com.wecloud.im.mapper.ImMessageMapper
;
import
com.wecloud.im.param.ImHistoryMessagePageParam
;
import
com.wecloud.im.param.ImHistoryMessagePageParam
;
import
com.wecloud.im.param.add.ImMsgRecall
;
import
com.wecloud.im.param.add.ImMsgRecall
;
...
@@ -344,7 +345,7 @@ public class ImMessageServiceImpl extends BaseServiceImpl<ImMessageMapper, ImMes
...
@@ -344,7 +345,7 @@ public class ImMessageServiceImpl extends BaseServiceImpl<ImMessageMapper, ImMes
for
(
ImConversation
imConversation
:
myImConversationList
)
{
for
(
ImConversation
imConversation
:
myImConversationList
)
{
//万人群 暂时跳过,后面统一处理
//万人群 暂时跳过,后面统一处理
if
(
BooleanUtils
.
isTrue
(
imConversation
.
getIsThousand
()))
{
if
(
ChatTypeEnum
.
THOUSAND_GROUP
.
getCode
().
equals
(
imConversation
.
getChatType
()))
{
thousandConversations
.
add
(
imConversation
);
thousandConversations
.
add
(
imConversation
);
continue
;
continue
;
}
}
...
...
core/src/main/java/com/wecloud/im/thousandchat/controller/ThousandChatController.java
View file @
99938109
...
@@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
@Slf4j
@Slf4j
@RestController
@RestController
@RequestMapping
(
"/imState"
)
@RequestMapping
(
"/imState"
)
@Api
(
value
=
"
消息收件箱表API"
,
tags
=
{
"消息收件箱表
"
})
@Api
(
value
=
"
万人群消息处理API"
,
tags
=
{
"万人群消息处理
"
})
public
class
ThousandChatController
extends
BaseController
{
public
class
ThousandChatController
extends
BaseController
{
@Autowired
@Autowired
...
@@ -30,7 +30,7 @@ public class ThousandChatController extends BaseController {
...
@@ -30,7 +30,7 @@ public class ThousandChatController extends BaseController {
* 消息修改为已接收状态
* 消息修改为已接收状态
*/
*/
@PostMapping
(
"/msgReceivedUpdate"
)
@PostMapping
(
"/msgReceivedUpdate"
)
@ApiOperation
(
value
=
"消息修改为已接收状态"
)
@ApiOperation
(
value
=
"
万人群
消息修改为已接收状态"
)
public
ApiResult
<
Boolean
>
updateImMsgReceived
(
@RequestBody
@Validated
LastestReceivedMsg
lastestReceivedMsg
)
{
public
ApiResult
<
Boolean
>
updateImMsgReceived
(
@RequestBody
@Validated
LastestReceivedMsg
lastestReceivedMsg
)
{
return
thousandChatService
.
updateImMsgReceived
(
lastestReceivedMsg
);
return
thousandChatService
.
updateImMsgReceived
(
lastestReceivedMsg
);
}
}
...
@@ -39,7 +39,7 @@ public class ThousandChatController extends BaseController {
...
@@ -39,7 +39,7 @@ public class ThousandChatController extends BaseController {
* 消息修改为已读状态
* 消息修改为已读状态
*/
*/
@PostMapping
(
"/msgReadUpdate"
)
@PostMapping
(
"/msgReadUpdate"
)
@ApiOperation
(
value
=
"消息修改为已读状态"
)
@ApiOperation
(
value
=
"
万人群
消息修改为已读状态"
)
public
ApiResult
<
Boolean
>
updateInMsgReadUpdate
(
Long
lastestMsgId
)
{
public
ApiResult
<
Boolean
>
updateInMsgReadUpdate
(
Long
lastestMsgId
)
{
return
thousandChatService
.
updateImMsgRead
(
lastestMsgId
);
return
thousandChatService
.
updateImMsgRead
(
lastestMsgId
);
}
}
...
...
core/src/main/java/com/wecloud/im/vo/MyConversationListVo.java
View file @
99938109
...
@@ -44,7 +44,7 @@ public class MyConversationListVo implements Serializable {
...
@@ -44,7 +44,7 @@ public class MyConversationListVo implements Serializable {
private
HashMap
attributes
;
private
HashMap
attributes
;
@ApiModelProperty
(
"可选 对话类型标志,是否是系统对话,后面会说明。"
)
@ApiModelProperty
(
"可选 对话类型标志,是否是系统对话,后面会说明。"
)
private
Boolean
system
;
private
Boolean
system
Flag
;
@ApiModelProperty
(
"未读消息条数"
)
@ApiModelProperty
(
"未读消息条数"
)
private
Long
msgNotReadCount
;
private
Long
msgNotReadCount
;
...
@@ -52,7 +52,13 @@ public class MyConversationListVo implements Serializable {
...
@@ -52,7 +52,13 @@ public class MyConversationListVo implements Serializable {
@ApiModelProperty
(
"成员"
)
@ApiModelProperty
(
"成员"
)
private
String
members
;
private
String
members
;
@ApiModelProperty
(
"会话属性,1:单聊,2:普通群,3:万人群"
)
private
Integer
chatType
;
@ApiModelProperty
(
"群成员数"
)
private
Integer
memberCount
;
@ApiModelProperty
(
"会话最后一条消息"
)
@ApiModelProperty
(
"会话最后一条消息"
)
private
OfflineMsgDto
lastMsg
;
private
OfflineMsgDto
lastMsg
;
}
}
\ No newline at end of file
core/src/main/java/com/wecloud/im/ws/strategy/AbstractImCmdStrategy.java
View file @
99938109
...
@@ -3,6 +3,7 @@ package com.wecloud.im.ws.strategy;
...
@@ -3,6 +3,7 @@ package com.wecloud.im.ws.strategy;
import
com.wecloud.im.entity.ImApplication
;
import
com.wecloud.im.entity.ImApplication
;
import
com.wecloud.im.entity.ImClient
;
import
com.wecloud.im.entity.ImClient
;
import
com.wecloud.im.enums.ChatTypeEnum
;
import
com.wecloud.im.param.ImConversationQueryVo
;
import
com.wecloud.im.param.ImConversationQueryVo
;
import
com.wecloud.im.service.ImApplicationService
;
import
com.wecloud.im.service.ImApplicationService
;
import
com.wecloud.im.service.ImClientService
;
import
com.wecloud.im.service.ImClientService
;
...
@@ -71,7 +72,7 @@ public abstract class AbstractImCmdStrategy {
...
@@ -71,7 +72,7 @@ public abstract class AbstractImCmdStrategy {
return
;
return
;
}
}
if
(
BooleanUtils
.
isTrue
(
conversation
.
getIsThousand
())
&&
WsRequestCmdEnum
.
NORMAL_CHAT
==
wsRequestPathEnum
)
{
if
(
ChatTypeEnum
.
THOUSAND_GROUP
.
getCode
().
equals
(
conversation
.
getChatType
())
&&
WsRequestCmdEnum
.
NORMAL_CHAT
==
wsRequestPathEnum
)
{
// 普通群升级为万人群
// 普通群升级为万人群
wsRequestPathEnum
=
WsRequestCmdEnum
.
THROUSAND_CHAT
;
wsRequestPathEnum
=
WsRequestCmdEnum
.
THROUSAND_CHAT
;
}
}
...
...
core/src/main/resources/mapper/ImConversationMapper.xml
View file @
99938109
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<!-- 通用查询结果列 -->
<!-- 通用查询结果列 -->
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
id
id
, create_time, update_time, last_message, member_count,
is_thousand
, fk_appid, creator, name, attributes, system_flag
, create_time, update_time, last_message, member_count,
chat_type
, fk_appid, creator, name, attributes, system_flag
</sql>
</sql>
<select
id=
"getImConversationById"
resultType=
"com.wecloud.im.param.ImConversationQueryVo"
>
<select
id=
"getImConversationById"
resultType=
"com.wecloud.im.param.ImConversationQueryVo"
>
...
@@ -24,6 +24,8 @@
...
@@ -24,6 +24,8 @@
SELECT imConversation.id,
SELECT imConversation.id,
imConversation.create_time,
imConversation.create_time,
imConversation.`name`,
imConversation.`name`,
imConversation.chat_type,
imConversation.member_count,
imConversation.attributes as attribute,
imConversation.attributes as attribute,
imConversation.system_flag,
imConversation.system_flag,
im_client.client_id AS creator,
im_client.client_id AS creator,
...
@@ -112,7 +114,7 @@
...
@@ -112,7 +114,7 @@
</update>
</update>
<update
id=
"updateMemberCount"
>
<update
id=
"updateMemberCount"
>
update im_conversation set
is_thousand = 1
where fk_appid = #{appId} and id = #{conversationId}
update im_conversation set
chat_type = 3
where fk_appid = #{appId} and id = #{conversationId}
</update>
</update>
</mapper>
</mapper>
core/src/main/resources/mapper/ImConversationMembersMapper.xml
View file @
99938109
...
@@ -46,7 +46,7 @@
...
@@ -46,7 +46,7 @@
<select
id=
"findThousandGroupsByClientId"
resultType=
"java.lang.Long"
>
<select
id=
"findThousandGroupsByClientId"
resultType=
"java.lang.Long"
>
select a.id from im_conversation a
select a.id from im_conversation a
inner join im_conversation_members b on a.id = b.fk_conversation_id
inner join im_conversation_members b on a.id = b.fk_conversation_id
where b.fk_client_id = #{clientId} and a.
is_thousand = 1
where b.fk_client_id = #{clientId} and a.
chat_type = 3
</select>
</select>
</mapper>
</mapper>
docs/db/wecloud_im.sql
View file @
99938109
...
@@ -220,7 +220,7 @@ ALTER TABLE `im_message` CHANGE COLUMN `system` `system_flag` tinyint(1) NULL DE
...
@@ -220,7 +220,7 @@ ALTER TABLE `im_message` CHANGE COLUMN `system` `system_flag` tinyint(1) NULL DE
-- 在feature-cluster 2022年1月4日之后,需要执行的sql增量脚本
-- 在feature-cluster 2022年1月4日之后,需要执行的sql增量脚本
ALTER
TABLE
im_conversation
`
ALTER
TABLE
im_conversation
`
ADD COLUMN `
member_count
` int NULL COMMENT '群成员数' AFTER `
last_message
`,
ADD COLUMN `
member_count
` int NULL COMMENT '群成员数' AFTER `
last_message
`,
ADD COLUMN `
is_thousand
` tinyint NULL COMMENT '是否万人群' AFTER `
member_count
`;
ADD COLUMN `
chat_type
` tinyint NULL COMMENT '是否万人群' AFTER `
member_count
`;
ALTER TABLE `
im_conversation_members
` ADD INDEX `
fk_client_id
`(`
fk_client_id
`);
ALTER TABLE `
im_conversation_members
` ADD INDEX `
fk_client_id
`(`
fk_client_id
`);
-- 在feature-cluster 2022年1月10日之后,需要执行的sql增量脚本
-- 在feature-cluster 2022年1月10日之后,需要执行的sql增量脚本
...
...
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