【代码评审】IM:会话、消息相关的接口
This commit is contained in:
parent
788c24dff4
commit
40be6ed727
|
@ -46,6 +46,7 @@ public class ImConversationController {
|
|||
public CommonResult<List<ImConversationRespVO>> getConversationList() {
|
||||
List<ImConversationDO> conversationList = imConversationService.getConversationList(getLoginUserId());
|
||||
List<ImConversationRespVO> imConversationRespVOList = BeanUtils.toBean(conversationList, ImConversationRespVO.class);
|
||||
// TODO @dylan:这块,交给前端聚合哈。im 这块,我们重前端,后端更多解决消息的通信和存储。
|
||||
imConversationRespVOList.forEach(item -> {
|
||||
// 处理个人图像和昵称
|
||||
Long receiverId = item.getTargetId();
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package cn.iocoder.yudao.module.im.controller.admin.conversation.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -35,6 +33,10 @@ public class ImConversationRespVO {
|
|||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
// TODO @dylan:这块,交给前端聚合哈。im 这块,我们重前端,后端更多解决消息的通信和存储。
|
||||
// 1. 基础信息:根据会话类型,查询会话接受者的头像、昵称
|
||||
// 2. 未读信息:前端自己增量拉取,基于本地 db 查看
|
||||
|
||||
@Schema(description = "会话接受者头像", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String avatar;
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package cn.iocoder.yudao.module.im.controller.admin.message.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||
import cn.iocoder.yudao.module.im.enums.conversation.ImConversationTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
@ -12,6 +10,7 @@ import java.time.LocalDateTime;
|
|||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
|
||||
|
||||
// TODO @dylan:看看,是不是融合到 ImMessageListReqVO 里
|
||||
@Schema(description = "管理后台 - 消息列表 Request VO")
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
|
|
|
@ -5,7 +5,6 @@ import cn.iocoder.yudao.module.im.enums.conversation.ImConversationTypeEnum;
|
|||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
@ -14,9 +13,9 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
|||
|
||||
@Schema(description = "管理后台 - 消息列表 Request VO")
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
public class ImMessageListReqVO {
|
||||
|
||||
// TODO @dylan:是不是 receiverId 和 senderId 保留一个 receiverId 就行。这样,A + 自己(调用接口,从 getLoginUserId 拿),然后 conversationType,最终可以拼接出 conversationNo
|
||||
@Schema(description = "接收人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "32494")
|
||||
@NotNull(message = "接收人编号不能为空")
|
||||
private Long receiverId;
|
||||
|
@ -34,8 +33,9 @@ public class ImMessageListReqVO {
|
|||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDateTime sendTime;
|
||||
|
||||
// TODO @dylan:这个,可以根据 receiverId、senderId、conversationType 推导的,建议可以去掉。
|
||||
@Schema(description = "会话编号编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "32494")
|
||||
@NotNull(message = "会话编号不能为空")
|
||||
private String conversationNo ;
|
||||
private String conversationNo;
|
||||
|
||||
}
|
|
@ -24,6 +24,7 @@ public class ImMessageSendReqVO {
|
|||
@NotNull(message = "会话类型不能为空")
|
||||
private Integer conversationType;
|
||||
|
||||
// TODO @dylan:这个 conversationNo,直接计算哈。不用传递
|
||||
@Schema(description = "会话编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotNull(message = "会话编号不能为空")
|
||||
private String conversationNo;
|
||||
|
|
|
@ -22,7 +22,6 @@ public interface ImMessageService {
|
|||
*/
|
||||
List<ImMessageDO> getMessageList(ImMessageListReqVO listReqVO);
|
||||
|
||||
|
||||
/**
|
||||
* 获得历史消息
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue