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
0401697b
Commit
0401697b
authored
Nov 20, 2022
by
Future
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
保存未读消息异常添加捕获
parent
5d956318
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
141 deletions
+22
-141
core/src/main/java/com/wecloud/im/action/NormalChatAction.java
+4
-0
core/src/main/java/com/wecloud/im/controller/ImApplicationController.java
+0
-137
core/src/main/java/com/wecloud/im/service/impl/ImInboxServiceImpl.java
+10
-2
core/src/main/java/com/wecloud/im/service/impl/ImMessageServiceImpl.java
+8
-2
No files found.
core/src/main/java/com/wecloud/im/action/NormalChatAction.java
View file @
0401697b
...
...
@@ -288,6 +288,7 @@ public class NormalChatAction {
private
void
batchSaveInbox
(
ImApplication
imApplication
,
ImClient
clientSender
,
ImConversationQueryVo
conversation
,
long
messageId
,
List
<
ImConversationMembers
>
membersList
)
{
List
<
ImInbox
>
inboxes
=
Lists
.
newArrayList
();
try
{
for
(
ImConversationMembers
member
:
membersList
)
{
if
(
clientSender
.
getClientId
().
equals
(
member
.
getClientId
()))
{
continue
;
...
...
@@ -306,6 +307,9 @@ public class NormalChatAction {
if
(
CollectionUtils
.
isNotEmpty
(
inboxes
))
{
imInboxService
.
saveBatch
(
inboxes
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"批量保存未读消息异常 "
,
e
);
}
}
/**
...
...
core/src/main/java/com/wecloud/im/controller/ImApplicationController.java
deleted
100644 → 0
View file @
5d956318
//package com.wecloud.im.controller;
//
//import com.wecloud.im.entity.ImApplication;
//import com.wecloud.im.param.ImApplicationPageParam;
//import com.wecloud.im.param.ImApplicationQueryVo;
//import com.wecloud.im.param.add.ImApplicationAdd;
//import com.wecloud.im.service.ImApplicationService;
//import com.wecloud.im.ws.utils.RSAGenerator;
//import io.geekidea.springbootplus.framework.common.api.ApiResult;
//import io.geekidea.springbootplus.framework.common.controller.BaseController;
//import io.geekidea.springbootplus.framework.core.pagination.Paging;
//import io.geekidea.springbootplus.framework.core.validator.groups.Add;
//import io.geekidea.springbootplus.framework.core.validator.groups.Update;
//import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
//import io.geekidea.springbootplus.framework.log.enums.OperationLogType;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.BeanUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.validation.annotation.Validated;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//
///**
// * 第三方应用表 控制器
// *
// * @author wei
// * @since 2021-04-27
// */
//@Slf4j
//@RestController
//@RequestMapping("/imApplication")
//@Api(value = "第三方应用表API", tags = {"第三方应用表"})
//public class ImApplicationController extends BaseController {
//
// public static final String ADMIN_PWD = "si0132g9ad4gd6xv8x888wd6g86aga731h6pzc1pzc68b7eln96s2360j0sjkh028sj131h0gjb";
//
// @Autowired
// private ImApplicationService imApplicationService;
//
// /**
// * 添加第三方应用表
// */
// @PostMapping("/add")
// @OperationLog(name = "添加第三方应用表", type = OperationLogType.ADD)
// @ApiOperation(value = "添加第三方应用表")
// public ApiResult<Boolean> addImApplication(@Validated(Add.class) @RequestBody ImApplicationAdd imApplicationAdd) throws Exception {
//
// if (!imApplicationAdd.getAdminPwd().equals(ADMIN_PWD)) {
// return ApiResult.fail();
// }
//
// ImApplication imApplication = new ImApplication();
// BeanUtils.copyProperties(imApplicationAdd, imApplication);
//
// // 生成AppKey
// String appKey = RSAGenerator.getAppKey(); //定义变量接收
// // 生成appSecret
// String appSecret = RSAGenerator.getAppSecret(appKey);
//
// imApplication.setAppKey(appKey);
// imApplication.setAppSecret(appSecret);
//
// boolean flag = imApplicationService.saveImApplication(imApplication);
// return ApiResult.result(flag);
// }
//
// /**
// * 修改第三方应用表
// */
// @PostMapping("/update")
// @OperationLog(name = "修改第三方应用表", type = OperationLogType.UPDATE)
// @ApiOperation(value = "修改第三方应用表")
// public ApiResult<Boolean> updateImApplication(@Validated(Update.class) @RequestBody ImApplicationAdd imApplicationAdd) throws Exception {
//
// if (!imApplicationAdd.getAdminPwd().equals(ADMIN_PWD)) {
// return ApiResult.fail();
// }
//
// ImApplication imApplication = new ImApplication();
// boolean flag = imApplicationService.updateImApplication(imApplication);
// return ApiResult.result(flag);
// }
//
// /**
// * 删除第三方应用表
// */
// @PostMapping("/delete")
// @OperationLog(name = "删除第三方应用表", type = OperationLogType.DELETE)
// @ApiOperation(value = "删除第三方应用表")
// public ApiResult<Boolean> deleteImApplication(@RequestParam("id") Long id, @RequestParam("pwd") String pwd) throws Exception {
//
// if (!pwd.equals(ADMIN_PWD)) {
// return ApiResult.fail();
// }
// boolean flag = imApplicationService.deleteImApplication(id);
// return ApiResult.result(flag);
// }
//
// /**
// * 获取第三方应用表详情
// */
// @GetMapping("/info/")
// @OperationLog(name = "第三方应用表详情", type = OperationLogType.INFO)
// @ApiOperation(value = "第三方应用表详情")
// public ApiResult<ImApplicationQueryVo> getImApplication(@RequestParam("id") Long id, @RequestParam("pwd") String pwd) throws Exception {
//
// if (!pwd.equals(ADMIN_PWD)) {
// return null;
// }
//
// ImApplicationQueryVo imApplicationQueryVo = imApplicationService.getImApplicationById(id);
// return ApiResult.ok(imApplicationQueryVo);
// }
//
// /**
// * 第三方应用表分页列表
// */
// @PostMapping("/getPageList")
// @OperationLog(name = "第三方应用表分页列表", type = OperationLogType.PAGE)
// @ApiOperation(value = "第三方应用表分页列表")
// public ApiResult<Paging<ImApplicationQueryVo>> getImApplicationPageList(@Validated @RequestBody ImApplicationPageParam imApplicationPageParam) throws Exception {
//
// if (!imApplicationPageParam.getPwd().equals(ADMIN_PWD)) {
// return null;
// }
// Paging<ImApplicationQueryVo> paging = imApplicationService.getImApplicationPageList(imApplicationPageParam);
// return ApiResult.ok(paging);
// }
//
//}
//
core/src/main/java/com/wecloud/im/service/impl/ImInboxServiceImpl.java
View file @
0401697b
...
...
@@ -13,6 +13,7 @@ import com.wecloud.im.service.ImInboxService;
import
com.wecloud.im.vo.ConversationCountVo
;
import
io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -68,10 +69,17 @@ public class ImInboxServiceImpl extends BaseServiceImpl<ImInboxMapper, ImInbox>
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Boolean
updateImMsgRead
(
MsgReadStatusUpdateParam
msgReadStatusUpdateP
aram
)
{
public
Boolean
updateImMsgRead
(
MsgReadStatusUpdateParam
p
aram
)
{
ImClient
currentClient
=
imClientService
.
getCurrentClient
();
// 修改已读状态
imInboxMapper
.
updateImMsgReadByIds
(
currentClient
.
getId
(),
msgReadStatusUpdateParam
.
getMsgIds
());
LambdaQueryWrapper
<
ImInbox
>
wrapper
=
new
QueryWrapper
<
ImInbox
>().
lambda
()
.
eq
(
ImInbox:
:
getFkConversationId
,
param
.
getConversationId
())
.
eq
(
ImInbox:
:
getReceiver
,
currentClient
.
getId
());
if
(
CollectionUtils
.
isEmpty
(
param
.
getMsgIds
()))
{
return
true
;
}
wrapper
.
in
(
ImInbox:
:
getFkMsgId
,
param
.
getMsgIds
());
this
.
remove
(
wrapper
);
return
true
;
}
...
...
core/src/main/java/com/wecloud/im/service/impl/ImMessageServiceImpl.java
View file @
0401697b
...
...
@@ -474,7 +474,7 @@ public class ImMessageServiceImpl extends BaseServiceImpl<ImMessageMapper, ImMes
param
.
setCurrentFkClientId
(
currentClient
.
getId
());
ImConversation
imConversation
=
imConversationService
.
getById
(
param
.
getConversationId
());
if
(
imConversation
==
null
)
{
return
new
Paging
<>(
null
);
throw
new
BusinessException
(
"查无会话信息"
);
}
if
(
ChatTypeEnum
.
NORMAL_GROUP
.
getCode
().
equals
(
imConversation
.
getChatType
()))
{
// 普通群聊判断是否已被踢出群
...
...
@@ -483,7 +483,9 @@ public class ImMessageServiceImpl extends BaseServiceImpl<ImMessageMapper, ImMes
.
eq
(
ImConversationMembers:
:
getFkConversationId
,
param
.
getConversationId
())
.
eq
(
ImConversationMembers:
:
getClientId
,
currentClient
.
getClientId
()));
if
(
CollectionUtils
.
isEmpty
(
members
))
{
return
new
Paging
<>(
null
);
PageInfo
emptyPage
=
new
PageInfo
(
param
.
getPageIndex
(),
param
.
getPageSize
(),
0
);
emptyPage
.
setRecords
(
Lists
.
newArrayList
());
return
new
Paging
<>(
emptyPage
);
}
}
IPage
<
OfflineMsgDto
>
iPage
=
imMessageMapper
.
getHistoryMsgConversationId
(
page
,
param
);
...
...
@@ -647,6 +649,7 @@ public class ImMessageServiceImpl extends BaseServiceImpl<ImMessageMapper, ImMes
private
void
batchSaveInbox
(
ImApplication
imApplication
,
String
senderClientId
,
ImConversation
conversation
,
long
messageId
,
List
<
ImConversationMembers
>
membersList
)
{
List
<
ImInbox
>
inboxes
=
Lists
.
newArrayList
();
try
{
for
(
ImConversationMembers
member
:
membersList
)
{
if
(
senderClientId
.
equals
(
member
.
getClientId
()))
{
continue
;
...
...
@@ -665,6 +668,9 @@ public class ImMessageServiceImpl extends BaseServiceImpl<ImMessageMapper, ImMes
if
(
CollectionUtils
.
isNotEmpty
(
inboxes
))
{
imInboxService
.
saveBatch
(
inboxes
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"批量保存未读消息异常 "
,
e
);
}
}
@Override
...
...
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