Commit c0ba524d by giaogiao

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

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