Commit d3dd2ecf by Future

bug fix

parent 3a2861b7
package com.wecloud.im.controller; package com.wecloud.im.controller;
import com.alibaba.fastjson.JSON;
import com.wecloud.im.param.ImConversationQueryParam; import com.wecloud.im.param.ImConversationQueryParam;
import com.wecloud.im.param.MutedGroupParam; import com.wecloud.im.param.MutedGroupParam;
import com.wecloud.im.param.SetAdminsParam; import com.wecloud.im.param.SetAdminsParam;
...@@ -71,6 +72,7 @@ public class ImConversationController extends BaseController { ...@@ -71,6 +72,7 @@ public class ImConversationController extends BaseController {
@PostMapping("/leave") @PostMapping("/leave")
@ApiOperation(value = "client退出会话", notes = "若是创建者退出,[创建者]权限将会转移给按加入会话时间排序的下一个client") @ApiOperation(value = "client退出会话", notes = "若是创建者退出,[创建者]权限将会转移给按加入会话时间排序的下一个client")
public ApiResult<Boolean> leaveConversation(@RequestBody ImClientLeaveConversation imClientToConversation) throws Exception { public ApiResult<Boolean> leaveConversation(@RequestBody ImClientLeaveConversation imClientToConversation) throws Exception {
log.info("client退出会话入参 {}", JSON.toJSONString(imClientToConversation));
return imConversationService.leaveConversation(imClientToConversation); return imConversationService.leaveConversation(imClientToConversation);
} }
...@@ -81,6 +83,7 @@ public class ImConversationController extends BaseController { ...@@ -81,6 +83,7 @@ public class ImConversationController extends BaseController {
@PostMapping("/delClient") @PostMapping("/delClient")
@ApiOperation(value = "将client从会话移除", notes = "权限:目前只有创建者有权限操作") @ApiOperation(value = "将client从会话移除", notes = "权限:目前只有创建者有权限操作")
public ApiResult<Boolean> delClientToConversation(@RequestBody ImClientToConversation imClientToConversation) throws Exception { public ApiResult<Boolean> delClientToConversation(@RequestBody ImClientToConversation imClientToConversation) throws Exception {
log.info("将client从会话移除入参 {}", JSON.toJSONString(imClientToConversation));
return imConversationService.delClientToConversation(imClientToConversation); return imConversationService.delClientToConversation(imClientToConversation);
} }
...@@ -91,6 +94,7 @@ public class ImConversationController extends BaseController { ...@@ -91,6 +94,7 @@ public class ImConversationController extends BaseController {
@PostMapping("/addClient") @PostMapping("/addClient")
@ApiOperation(value = "将用户添加进会话", notes = "权限:会话中所有client都有权限操作") @ApiOperation(value = "将用户添加进会话", notes = "权限:会话中所有client都有权限操作")
public ApiResult<Boolean> addClientToConversation(@RequestBody ImClientToConversation imClientToConversation) throws Exception { public ApiResult<Boolean> addClientToConversation(@RequestBody ImClientToConversation imClientToConversation) throws Exception {
log.info("将用户添加进会话入参 {}", JSON.toJSONString(imClientToConversation));
return imConversationService.addClientToConversation(imClientToConversation); return imConversationService.addClientToConversation(imClientToConversation);
} }
...@@ -100,6 +104,7 @@ public class ImConversationController extends BaseController { ...@@ -100,6 +104,7 @@ public class ImConversationController extends BaseController {
@PostMapping("/create") @PostMapping("/create")
@ApiOperation(value = "创建会话", notes = "后台可配置:两个客户端如果已经创建过会话,是否重复创建会话") @ApiOperation(value = "创建会话", notes = "后台可配置:两个客户端如果已经创建过会话,是否重复创建会话")
public ApiResult<ImConversationCreateVo> createImConversation(@RequestBody ImConversationCreate imConversationCreate) throws Exception { public ApiResult<ImConversationCreateVo> createImConversation(@RequestBody ImConversationCreate imConversationCreate) throws Exception {
log.info("创建会话入参 {}", JSON.toJSONString(imConversationCreate));
return imConversationService.createImConversation(imConversationCreate); return imConversationService.createImConversation(imConversationCreate);
} }
...@@ -109,6 +114,7 @@ public class ImConversationController extends BaseController { ...@@ -109,6 +114,7 @@ public class ImConversationController extends BaseController {
@PostMapping("/transferOwner") @PostMapping("/transferOwner")
@ApiOperation(value = "群主转让", notes = "权限:目前只有群主有权限操作") @ApiOperation(value = "群主转让", notes = "权限:目前只有群主有权限操作")
public ApiResult<Boolean> transferOwner(@RequestBody TransferOwnerParam param) { public ApiResult<Boolean> transferOwner(@RequestBody TransferOwnerParam param) {
log.info("群主转让入参 {}", JSON.toJSONString(param));
Boolean result = imConversationService.transferOwner(param); Boolean result = imConversationService.transferOwner(param);
return ApiResult.ok(result); return ApiResult.ok(result);
} }
...@@ -119,6 +125,7 @@ public class ImConversationController extends BaseController { ...@@ -119,6 +125,7 @@ public class ImConversationController extends BaseController {
@PostMapping("/setAdmins") @PostMapping("/setAdmins")
@ApiOperation(value = "设置群管理员", notes = "权限:目前只有群主有权限操作") @ApiOperation(value = "设置群管理员", notes = "权限:目前只有群主有权限操作")
public ApiResult<Boolean> setAdmins(@RequestBody @Validated SetAdminsParam param) { public ApiResult<Boolean> setAdmins(@RequestBody @Validated SetAdminsParam param) {
log.info("设置群管理员入参 {}", JSON.toJSONString(param));
if (CollectionUtils.isEmpty(param.getClientIds())) { if (CollectionUtils.isEmpty(param.getClientIds())) {
return ApiResult.fail(ApiCode.PARAMETER_EXCEPTION, null); return ApiResult.fail(ApiCode.PARAMETER_EXCEPTION, null);
} }
...@@ -132,6 +139,7 @@ public class ImConversationController extends BaseController { ...@@ -132,6 +139,7 @@ public class ImConversationController extends BaseController {
@PostMapping("/mutedGroup") @PostMapping("/mutedGroup")
@ApiOperation(value = "群禁言、取消群禁言", notes = "权限:群主和管理员有权限操作") @ApiOperation(value = "群禁言、取消群禁言", notes = "权限:群主和管理员有权限操作")
public ApiResult<Boolean> mutedGroup(@RequestBody @Validated MutedGroupParam param) { public ApiResult<Boolean> mutedGroup(@RequestBody @Validated MutedGroupParam param) {
log.info("群禁言、取消群禁言入参 {}", JSON.toJSONString(param));
Boolean result = imConversationService.mutedGroup(param); Boolean result = imConversationService.mutedGroup(param);
return ApiResult.ok(result); return ApiResult.ok(result);
} }
...@@ -142,6 +150,7 @@ public class ImConversationController extends BaseController { ...@@ -142,6 +150,7 @@ public class ImConversationController extends BaseController {
@PostMapping("/mutedGroupMember") @PostMapping("/mutedGroupMember")
@ApiOperation(value = "选择禁言", notes = "权限:群主和管理员有权限操作") @ApiOperation(value = "选择禁言", notes = "权限:群主和管理员有权限操作")
public ApiResult<Boolean> mutedGroupMember(@RequestBody @Validated MutedGroupParam param) { public ApiResult<Boolean> mutedGroupMember(@RequestBody @Validated MutedGroupParam param) {
log.info("选择禁言入参 {}", JSON.toJSONString(param));
if (CollectionUtils.isEmpty(param.getClientIds())) { if (CollectionUtils.isEmpty(param.getClientIds())) {
return ApiResult.fail(ApiCode.PARAMETER_EXCEPTION, null); return ApiResult.fail(ApiCode.PARAMETER_EXCEPTION, null);
} }
......
...@@ -28,10 +28,12 @@ public class ImHistoryMessagePageParam extends BasePageOrderParam { ...@@ -28,10 +28,12 @@ public class ImHistoryMessagePageParam extends BasePageOrderParam {
/** /**
* 消息id最小值 * 消息id最小值
*/ */
@ApiModelProperty("消息id最小值")
private Long msgIdStart; private Long msgIdStart;
/** /**
* 消息id最大值 * 消息id最大值
*/ */
@ApiModelProperty("消息id最大值")
private Long msgIdEnd; private Long msgIdEnd;
} }
...@@ -249,7 +249,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap ...@@ -249,7 +249,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
imMessage.setSendStatus(2); imMessage.setSendStatus(2);
imMessage.setFkConversationId(imConversation.getId()); imMessage.setFkConversationId(imConversation.getId());
imMessageService.save(imMessage); imMessageService.save(imMessage);
sendEventMsgToMember(imApplication, client2.getId(), imMessage, createClient, client2); sendEventMsgToMember(imApplication, client2.getId(), imMessage, createClient);
} }
} }
ImConversationCreateVo imConversationCreateVo = new ImConversationCreateVo(); ImConversationCreateVo imConversationCreateVo = new ImConversationCreateVo();
...@@ -343,10 +343,10 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap ...@@ -343,10 +343,10 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
// 遍历发送给已在群内的成员 // 遍历发送给已在群内的成员
for (ImConversationMembers conversationMember : membersList) { for (ImConversationMembers conversationMember : membersList) {
sendEventMsgToMember(imApplication, conversationMember.getFkClientId(), imMessage, imClientSender, clientToConversation); sendEventMsgToMember(imApplication, conversationMember.getFkClientId(), imMessage, imClientSender);
} }
// 发送给刚被拉入群的成员 // 发送给刚被拉入群的成员
sendEventMsgToMember(imApplication, clientToConversation.getId(), imMessage, imClientSender, clientToConversation); sendEventMsgToMember(imApplication, clientToConversation.getId(), imMessage, imClientSender);
} }
// 将群成员数量减 // 将群成员数量减
...@@ -362,7 +362,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap ...@@ -362,7 +362,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
} }
private void sendEventMsgToMember(ImApplication imApplication, Long conversationMemberClientId, ImMessage imMessage, private void sendEventMsgToMember(ImApplication imApplication, Long conversationMemberClientId, ImMessage imMessage,
ImClient clientSender, ImClient clientToConversation) { ImClient clientSender) {
// 查询接收方 // 查询接收方
ImClient imClientReceiver = imClientService.getOne(new QueryWrapper<ImClient>().lambda() ImClient imClientReceiver = imClientService.getOne(new QueryWrapper<ImClient>().lambda()
.eq(ImClient::getFkAppid, imApplication.getId()) .eq(ImClient::getFkAppid, imApplication.getId())
......
...@@ -9,13 +9,20 @@ import java.io.Serializable; ...@@ -9,13 +9,20 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
* 离线消息内容实体 * @Author wenzhida
* @Date 2022/3/3 11:19
* @Description 离线消息内容实体
*/ */
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
@ApiModel(value = "OfflineMsgDto") @ApiModel(value = "OfflineMsgDto")
public class OfflineMsgDto implements Serializable { public class OfflineMsgDto implements Serializable {
private static final long serialVersionUID = -7073389493201687249L;
@ApiModelProperty("会话id")
private Long conversationId;
@ApiModelProperty("消息类型") @ApiModelProperty("消息类型")
private Integer type; private Integer type;
......
...@@ -63,7 +63,8 @@ ...@@ -63,7 +63,8 @@
im_message.system_flag, im_message.system_flag,
im_message.`at`, im_message.`at`,
im_message.send_status, im_message.send_status,
im_message.`msg_type` AS 'type', im_message.fk_conversation_id, im_message.`msg_type` AS 'type',
im_message.fk_conversation_id as conversationId,
(SELECT COUNT(id) FROM im_inbox WHERE fk_msg_id = msgId AND read_msg_status = 0) AS not_read_count, (SELECT COUNT(id) FROM im_inbox WHERE fk_msg_id = msgId AND read_msg_status = 0) AS not_read_count,
(SELECT COUNT(id) (SELECT COUNT(id)
FROM im_inbox FROM im_inbox
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment