Commit c0ba524d by giaogiao

完成消息修改为已接收状态,消息修改为已读状态;

完成消息修改为已接收状态,消息修改为已读状态的websocket在线下发
parent d3cbe9ee
...@@ -9,6 +9,7 @@ import io.swagger.annotations.Api; ...@@ -9,6 +9,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -34,7 +35,7 @@ public class ImInboxController extends BaseController { ...@@ -34,7 +35,7 @@ public class ImInboxController extends BaseController {
*/ */
@PostMapping("/msgReceivedUpdate") @PostMapping("/msgReceivedUpdate")
@ApiOperation(value = "消息修改为已接收状态") @ApiOperation(value = "消息修改为已接收状态")
public ApiResult<Boolean> updateImMsgReceived(@RequestBody ImMsgReceivedStatusUpdate imMsgReceivedUpdate) throws Exception { public ApiResult<Boolean> updateImMsgReceived(@RequestBody @Validated ImMsgReceivedStatusUpdate imMsgReceivedUpdate) throws Exception {
return imInboxService.updateImMsgReceived(imMsgReceivedUpdate); return imInboxService.updateImMsgReceived(imMsgReceivedUpdate);
} }
......
...@@ -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.NotEmpty;
import java.util.List; import java.util.List;
/** /**
...@@ -22,9 +23,10 @@ import java.util.List; ...@@ -22,9 +23,10 @@ import java.util.List;
public class ImMsgReceivedStatusUpdate extends BaseEntity { public class ImMsgReceivedStatusUpdate extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty("消息id数组,可以传入单个或多个, 如接收离线消息列表时可以批量修改 则传入多个") @ApiModelProperty(value = "消息id数组,可以传入单个或多个, 如接收离线消息列表时可以批量修改 则传入多个", required = true)
@NotEmpty(message = "msgIds==null")
private List<Long> msgIds; private List<Long> msgIds;
@ApiModelProperty("是否同时修改为已读状态") @ApiModelProperty(value = "是否同时修改为已读状态", required = false)
private Boolean readStatus; private Boolean readStatus = false;
} }
...@@ -100,7 +100,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap ...@@ -100,7 +100,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
ImApplication imApplication = imApplicationService.getOneByAppKey(curentJwtToken.getAppKey()); ImApplication imApplication = imApplicationService.getOneByAppKey(curentJwtToken.getAppKey());
// 该应用 是否允许重复创建会话 // 该应用 是否允许重复创建会话
if (imApplication.getRepeatSessionStatus() == 0) { if (imApplication.getRepeatSessionStatus() != null && imApplication.getRepeatSessionStatus() == 0) {
// 判断是否已经存在会话 // 判断是否已经存在会话
// 两个用户如果已经创建过会话,不能重复创建会话 // 两个用户如果已经创建过会话,不能重复创建会话
// size() == 1 为单聊的时候不允许重复创建 // size() == 1 为单聊的时候不允许重复创建
...@@ -124,7 +124,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap ...@@ -124,7 +124,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
} }
} else { } else {
//创建会话时对比扩展字段 0不 1是 //创建重复会话时对比扩展字段 0不 1是
if (imApplication.getContrastExtendedFieldStatus() == 1) { if (imApplication.getContrastExtendedFieldStatus() == 1) {
ImClient client2 = imClientService.getOne(new QueryWrapper<ImClient>().lambda() ImClient client2 = imClientService.getOne(new QueryWrapper<ImClient>().lambda()
...@@ -146,18 +146,16 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap ...@@ -146,18 +146,16 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
} }
if (imConversationCreate.getAttributes().equals(hashMap)) { if (imConversationCreate.getAttributes().equals(hashMap)) {
log.info(imConversationCreate.getAttributes() + "重复"); log.debug(imConversationCreate.getAttributes() + ",出现重复");
ImConversationCreateVo imConversationCreateVo = new ImConversationCreateVo(); ImConversationCreateVo imConversationCreateVo = new ImConversationCreateVo();
imConversationCreateVo.setId(repetitionConversationInfo.getId()); imConversationCreateVo.setId(repetitionConversationInfo.getId());
// 为重复 // 为重复
return ApiResult.ok(imConversationCreateVo); return ApiResult.ok(imConversationCreateVo);
} }
} }
} }
} }
// 会话id // 会话id
Long imConversationId = SnowflakeUtil.getId(); Long imConversationId = SnowflakeUtil.getId();
...@@ -172,6 +170,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap ...@@ -172,6 +170,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
imConversation.setFkAppid(client.getFkAppid()); imConversation.setFkAppid(client.getFkAppid());
imConversation.setCreator(creator); imConversation.setCreator(creator);
imConversation.setName(imConversationCreate.getName()); imConversation.setName(imConversationCreate.getName());
imConversation.setSystem(false);
JsonMapper jsonMapper = new JsonMapper(); JsonMapper jsonMapper = new JsonMapper();
try { try {
...@@ -181,7 +180,6 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap ...@@ -181,7 +180,6 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
e.printStackTrace(); e.printStackTrace();
} }
imConversation.setSystem(false);
imConversationService.save(imConversation); imConversationService.save(imConversation);
// 将自己添加到会话 // 将自己添加到会话
......
...@@ -153,7 +153,7 @@ public class ImInboxServiceImpl extends BaseServiceImpl<ImInboxMapper, ImInbox> ...@@ -153,7 +153,7 @@ public class ImInboxServiceImpl extends BaseServiceImpl<ImInboxMapper, ImInbox>
// 查询该消息 // 查询该消息
ImMessage imMessageDb = imMessageService.getById(MsgId); ImMessage imMessageDb = imMessageService.getById(MsgId);
// 根据消息id查询该会话所有成员 // 根据会话id查询该会话所有成员
List<ImConversationMembers> membersList = imConversationMembersService.list( List<ImConversationMembers> membersList = imConversationMembersService.list(
new QueryWrapper<ImConversationMembers>().lambda() new QueryWrapper<ImConversationMembers>().lambda()
.eq(ImConversationMembers::getFkConversationId, imMessageDb.getFkConversationId()) .eq(ImConversationMembers::getFkConversationId, imMessageDb.getFkConversationId())
...@@ -184,7 +184,7 @@ public class ImInboxServiceImpl extends BaseServiceImpl<ImInboxMapper, ImInbox> ...@@ -184,7 +184,7 @@ public class ImInboxServiceImpl extends BaseServiceImpl<ImInboxMapper, ImInbox>
imMessageOnlineSend.setConversationId(conversationMember.getFkConversationId()); imMessageOnlineSend.setConversationId(conversationMember.getFkConversationId());
// 查询接收方 // 查询接收方
ImClient imClientReceiver = imClientService.getOne(new QueryWrapper<ImClient>().lambda() ImClient imClientReceiver = imClientService.getOne(new QueryWrapper<ImClient>().lambda()
.eq(ImClient::getFkAppid, curentClient.getId()) .eq(ImClient::getFkAppid, curentClient.getFkAppid())
.eq(ImClient::getId, conversationMember.getFkClientId())); .eq(ImClient::getId, conversationMember.getFkClientId()));
if (imClientReceiver == null) { if (imClientReceiver == null) {
continue; continue;
......
...@@ -24,25 +24,25 @@ public interface MangerChannelService { ...@@ -24,25 +24,25 @@ public interface MangerChannelService {
/** /**
* CLIENT_ID,是客户端的字符串id * CLIENT_ID,是客户端的字符串id
*/ */
AttributeKey<String> CLIENT_ID = AttributeKey.valueOf("CLIENTID"); AttributeKey<String> CLIENT_ID = AttributeKey.valueOf("ci");
/** /**
* 是app的字符串id * 是app的字符串id
*/ */
AttributeKey<String> APP_KEY = AttributeKey.valueOf("APPKEY"); AttributeKey<String> APP_KEY = AttributeKey.valueOf("ak");
/** /**
* LANGUAGE * LANGUAGE
*/ */
AttributeKey<String> LANGUAGE = AttributeKey.valueOf("language"); AttributeKey<String> LANGUAGE = AttributeKey.valueOf("lan");
/** /**
* APP_VERSION * APP_VERSION
*/ */
AttributeKey<String> APP_VERSION = AttributeKey.valueOf("appVersion"); // AttributeKey<String> APP_VERSION = AttributeKey.valueOf("appVersion");
AttributeKey<String> TOKEN = AttributeKey.valueOf("TOKEN"); // AttributeKey<String> TOKEN = AttributeKey.valueOf("TOKEN");
AttributeKey<String> DEVICEID = AttributeKey.valueOf("DEVICEID"); // AttributeKey<String> DEVICEID = AttributeKey.valueOf("DEVICEID");
AttributeKey<String> PLATFORM = AttributeKey.valueOf("PLATFORM"); // AttributeKey<String> PLATFORM = AttributeKey.valueOf("PLATFORM");
/** /**
* 根据userID获取channel * 根据userID获取channel
......
...@@ -36,7 +36,7 @@ public class WriteDataServiceImpl implements WriteDataService { ...@@ -36,7 +36,7 @@ public class WriteDataServiceImpl implements WriteDataService {
* io密集型任务配置尽可能多的线程数量 * io密集型任务配置尽可能多的线程数量
*/ */
private final static ExecutorService WRITE_TASK_THREAD_POOL_EXECUTOR = private final static ExecutorService WRITE_TASK_THREAD_POOL_EXECUTOR =
new ThreadPoolExecutor(WsConstants.CPU_PROCESSORS * 10, WsConstants.CPU_PROCESSORS * 500, new ThreadPoolExecutor(WsConstants.CPU_PROCESSORS * 2, WsConstants.CPU_PROCESSORS * 3,
1L, TimeUnit.MILLISECONDS, 1L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>(), WRITE_NAMED_THREAD_FACTORY, new ThreadPoolExecutor.CallerRunsPolicy()); new LinkedBlockingQueue<Runnable>(), WRITE_NAMED_THREAD_FACTORY, new ThreadPoolExecutor.CallerRunsPolicy());
......
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