From efdb99f8cecc4afb592afad79c761081d5d5cf22 Mon Sep 17 00:00:00 2001 From: lee <4766465@qq.com> Date: Wed, 18 Dec 2024 13:27:00 +0800 Subject: [PATCH] init --- yami-shop-api/src/main/java/com/yami/shop/api/controller/im/LuckImMsgController.java | 76 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 76 insertions(+), 0 deletions(-) diff --git a/yami-shop-api/src/main/java/com/yami/shop/api/controller/im/LuckImMsgController.java b/yami-shop-api/src/main/java/com/yami/shop/api/controller/im/LuckImMsgController.java new file mode 100644 index 0000000..99d1919 --- /dev/null +++ b/yami-shop-api/src/main/java/com/yami/shop/api/controller/im/LuckImMsgController.java @@ -0,0 +1,76 @@ +package com.yami.shop.api.controller.im; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.yami.shop.bean.model.LuckImGroupHistoryEx; +import com.yami.shop.bean.model.LuckImMsgUserHistory; +import com.yami.shop.bean.param.im.GetGroupChatMsgParam; +import com.yami.shop.bean.param.im.GetUserAndUserChatMsgParam; +import com.yami.shop.bean.param.im.MarkMsgReadParam; +import com.yami.shop.bean.param.im.UserMsgListParam; +import com.yami.shop.bean.result.GetUserSystemMsgCountResult; +import com.yami.shop.bean.result.MsgUserRecordResult; +import com.yami.shop.common.response.ServerResponseEntity; +import com.yami.shop.security.api.util.SecurityUtils; +import com.yami.shop.service.ILuckImGroupService; +import com.yami.shop.service.ILuckImMsgUserService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 用户最近聊天记录表 + * + * @author xub + * @since 2024-06-19 14:55:00 + */ +@RestController +@RequestMapping("/p/userMsg") +@Tag(name = "聊天记录接口") +public class LuckImMsgController { + + @Autowired + private ILuckImMsgUserService luckImMsgUserService; + + @Autowired + private ILuckImGroupService luckImGroupService; + + @Operation(summary = "查询用户最近聊天记录") + @GetMapping(value = "/getUserMsgUserList") + public ServerResponseEntity<List<MsgUserRecordResult>> getUserMsgUserList(UserMsgListParam params) { + params.setUserId(SecurityUtils.getUser().getUserId()); + return ServerResponseEntity.success(luckImMsgUserService.getUserMsgUserList(params)); + } + + @Operation(summary = "查询用户与用户的详细聊天记录") + @GetMapping(value = "/getUserAndUserChatMsg") + public ServerResponseEntity<List<LuckImMsgUserHistory>> getUserAndUserChatMsg(GetUserAndUserChatMsgParam params) { + params.setSelfUserId(SecurityUtils.getUser().getUserId()); + return ServerResponseEntity.success(luckImMsgUserService.getUserAndUserChatMsg(params)); + } + + @Operation(summary = "获取系统消息数量") + @GetMapping(value = "/getUserSystemMsgCount") + public ServerResponseEntity<GetUserSystemMsgCountResult> getUserSystemMsgCount() { + return ServerResponseEntity.success(luckImMsgUserService.getUserSystemMsgCount(SecurityUtils.getUser().getUserId())); + } + + @Operation(summary = "标记消息已读") + @PostMapping(value = "/markMsgRead") + public ServerResponseEntity<GetUserSystemMsgCountResult> markMsgRead(@RequestBody MarkMsgReadParam params) { + params.setSelfUserId(SecurityUtils.getUser().getUserId()); + luckImMsgUserService.markMsgRead(params); + return ServerResponseEntity.success(); + } + + @Operation(summary = "查询群聊记录") + @GetMapping(value = "/getGroupChatMsg") + public ServerResponseEntity<Page<LuckImGroupHistoryEx>> getGroupChatMsg(GetGroupChatMsgParam params) { + params.setSelfUserId(SecurityUtils.getUser().getUserId()); + return ServerResponseEntity.success(luckImGroupService.getGroupChatMsg(params)); + } + + +} -- Gitblit v1.9.3