Commit cdb20539ea71b38dcae6d6db69ff916233b2267e
1 parent
285a4316
MALL-KEFU: 完善APP端聊天消息获取
Showing
7 changed files
with
81 additions
and
37 deletions
sql/mysql/mall-promotion-kefu.sql
| 1 | DROP TABLE IF EXISTS `promotion_kefu_conversation`; | 1 | DROP TABLE IF EXISTS `promotion_kefu_conversation`; |
| 2 | CREATE TABLE `promotion_kefu_conversation` ( | 2 | CREATE TABLE `promotion_kefu_conversation` ( |
| 3 | - `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '编号', | ||
| 4 | - `user_id` BIGINT NOT NULL COMMENT '会话所属用户', | ||
| 5 | - `last_message_time` DATETIME NOT NULL COMMENT '最后聊天时间', | ||
| 6 | - `last_message_content` VARCHAR(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '最后聊天内容', | ||
| 7 | - `last_message_content_type` INT NOT NULL COMMENT '最后发送的消息类型', | ||
| 8 | - `admin_pinned` BIT(1) NOT NULL DEFAULT b'0' COMMENT '管理端置顶', | ||
| 9 | - `user_deleted` BIT(1) NOT NULL DEFAULT b'0' COMMENT '用户是否可见', | ||
| 10 | - `admin_deleted` BIT(1) NOT NULL DEFAULT b'0' COMMENT '管理员是否可见', | ||
| 11 | - `admin_unread_message_count` INT NOT NULL COMMENT '管理员未读消息数', | ||
| 12 | - `creator` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', | ||
| 13 | - `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 14 | - `updater` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | ||
| 15 | - `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 16 | - `deleted` BIT(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | 3 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', |
| 4 | + `user_id` bigint NOT NULL COMMENT '会话所属用户', | ||
| 5 | + `last_message_time` datetime NOT NULL COMMENT '最后聊天时间', | ||
| 6 | + `last_message_content` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '最后聊天内容', | ||
| 7 | + `last_message_content_type` int NOT NULL COMMENT '最后发送的消息类型', | ||
| 8 | + `admin_pinned` bit(1) NOT NULL DEFAULT b'0' COMMENT '管理端置顶', | ||
| 9 | + `user_deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '用户是否可见', | ||
| 10 | + `admin_deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '管理员是否可见', | ||
| 11 | + `admin_unread_message_count` int NOT NULL COMMENT '管理员未读消息数', | ||
| 12 | + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', | ||
| 13 | + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 14 | + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', | ||
| 15 | + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 16 | + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 17 | + `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | ||
| 17 | PRIMARY KEY (`id`) USING BTREE | 18 | PRIMARY KEY (`id`) USING BTREE |
| 18 | -) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '客服会话' ROW_FORMAT = Dynamic; | 19 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='客服会话'; |
| 19 | 20 | ||
| 20 | DROP TABLE IF EXISTS `promotion_kefu_message`; | 21 | DROP TABLE IF EXISTS `promotion_kefu_message`; |
| 21 | CREATE TABLE `promotion_kefu_message` ( | 22 | CREATE TABLE `promotion_kefu_message` ( |
| 22 | - `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '编号', | ||
| 23 | - `conversation_id` BIGINT NOT NULL COMMENT '会话编号', | ||
| 24 | - `sender_id` BIGINT NOT NULL COMMENT '发送人编号', | ||
| 25 | - `sender_type` INT NOT NULL COMMENT '发送人类型', | ||
| 26 | - `receiver_id` BIGINT NOT NULL COMMENT '接收人编号', | ||
| 27 | - `receiver_type` INT NOT NULL COMMENT '接收人类型', | ||
| 28 | - `content_type` INT NOT NULL COMMENT '消息类型', | ||
| 29 | - `content` VARCHAR(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '消息', | ||
| 30 | - `read_status` BIT(1) NOT NULL DEFAULT b'0' COMMENT '是否已读', | ||
| 31 | - `creator` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', | ||
| 32 | - `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 33 | - `updater` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | ||
| 34 | - `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 35 | - `deleted` BIT(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | 23 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', |
| 24 | + `conversation_id` bigint NOT NULL COMMENT '会话编号', | ||
| 25 | + `sender_id` bigint NOT NULL COMMENT '发送人编号', | ||
| 26 | + `sender_type` int NOT NULL COMMENT '发送人类型', | ||
| 27 | + `receiver_id` bigint DEFAULT NULL COMMENT '接收人编号', | ||
| 28 | + `receiver_type` int DEFAULT NULL COMMENT '接收人类型', | ||
| 29 | + `content_type` int NOT NULL COMMENT '消息类型', | ||
| 30 | + `content` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '消息', | ||
| 31 | + `read_status` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否已读', | ||
| 32 | + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', | ||
| 33 | + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 34 | + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', | ||
| 35 | + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 36 | + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 37 | + `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | ||
| 36 | PRIMARY KEY (`id`) USING BTREE | 38 | PRIMARY KEY (`id`) USING BTREE |
| 37 | -) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '客服消息' ROW_FORMAT = Dynamic; | 39 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='客服消息'; |
| 38 | \ No newline at end of file | 40 | \ No newline at end of file |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/kefu/AppKeFuMessageController.java
| @@ -5,9 +5,8 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; | @@ -5,9 +5,8 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 6 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 7 | import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated; | 7 | import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated; |
| 8 | -import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessagePageReqVO; | ||
| 9 | import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessageRespVO; | 8 | import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessageRespVO; |
| 10 | -import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessageSendReqVO; | 9 | +import cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message.AppKeFuMessagePageReqVO; |
| 11 | import cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message.AppKeFuMessageSendReqVO; | 10 | import cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message.AppKeFuMessageSendReqVO; |
| 12 | import cn.iocoder.yudao.module.promotion.dal.dataobject.kefu.KeFuMessageDO; | 11 | import cn.iocoder.yudao.module.promotion.dal.dataobject.kefu.KeFuMessageDO; |
| 13 | import cn.iocoder.yudao.module.promotion.service.kefu.KeFuMessageService; | 12 | import cn.iocoder.yudao.module.promotion.service.kefu.KeFuMessageService; |
| @@ -16,14 +15,13 @@ import io.swagger.v3.oas.annotations.Parameter; | @@ -16,14 +15,13 @@ import io.swagger.v3.oas.annotations.Parameter; | ||
| 16 | import io.swagger.v3.oas.annotations.tags.Tag; | 15 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 17 | import jakarta.annotation.Resource; | 16 | import jakarta.annotation.Resource; |
| 18 | import jakarta.validation.Valid; | 17 | import jakarta.validation.Valid; |
| 19 | -import org.springframework.security.access.prepost.PreAuthorize; | ||
| 20 | import org.springframework.validation.annotation.Validated; | 18 | import org.springframework.validation.annotation.Validated; |
| 21 | import org.springframework.web.bind.annotation.*; | 19 | import org.springframework.web.bind.annotation.*; |
| 22 | 20 | ||
| 23 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 21 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 24 | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | 22 | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
| 25 | 23 | ||
| 26 | -@Tag(name = "管理后台 - 客服消息") | 24 | +@Tag(name = "用户 APP - 客服消息") |
| 27 | @RestController | 25 | @RestController |
| 28 | @RequestMapping("/promotion/kefu-message") | 26 | @RequestMapping("/promotion/kefu-message") |
| 29 | @Validated | 27 | @Validated |
| @@ -52,8 +50,8 @@ public class AppKeFuMessageController { | @@ -52,8 +50,8 @@ public class AppKeFuMessageController { | ||
| 52 | @GetMapping("/page") | 50 | @GetMapping("/page") |
| 53 | @Operation(summary = "获得客服消息分页") | 51 | @Operation(summary = "获得客服消息分页") |
| 54 | @PreAuthenticated | 52 | @PreAuthenticated |
| 55 | - public CommonResult<PageResult<KeFuMessageRespVO>> getKefuMessagePage(@Valid KeFuMessagePageReqVO pageReqVO) { | ||
| 56 | - PageResult<KeFuMessageDO> pageResult = kefuMessageService.getKefuMessagePage(pageReqVO); | 53 | + public CommonResult<PageResult<KeFuMessageRespVO>> getKefuMessagePage(@Valid AppKeFuMessagePageReqVO pageReqVO) { |
| 54 | + PageResult<KeFuMessageDO> pageResult = kefuMessageService.getKefuMessagePage(pageReqVO, getLoginUserId()); | ||
| 57 | return success(BeanUtils.toBean(pageResult, KeFuMessageRespVO.class)); | 55 | return success(BeanUtils.toBean(pageResult, KeFuMessageRespVO.class)); |
| 58 | } | 56 | } |
| 59 | 57 |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/kefu/KeFuMessageMapper.java
| @@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; | @@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessagePageReqVO; | 6 | import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessagePageReqVO; |
| 7 | +import cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message.AppKeFuMessagePageReqVO; | ||
| 7 | import cn.iocoder.yudao.module.promotion.dal.dataobject.kefu.KeFuMessageDO; | 8 | import cn.iocoder.yudao.module.promotion.dal.dataobject.kefu.KeFuMessageDO; |
| 8 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 9 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| 9 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | 10 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| @@ -23,7 +24,7 @@ public interface KeFuMessageMapper extends BaseMapperX<KeFuMessageDO> { | @@ -23,7 +24,7 @@ public interface KeFuMessageMapper extends BaseMapperX<KeFuMessageDO> { | ||
| 23 | default PageResult<KeFuMessageDO> selectPage(KeFuMessagePageReqVO reqVO) { | 24 | default PageResult<KeFuMessageDO> selectPage(KeFuMessagePageReqVO reqVO) { |
| 24 | return selectPage(reqVO, new LambdaQueryWrapperX<KeFuMessageDO>() | 25 | return selectPage(reqVO, new LambdaQueryWrapperX<KeFuMessageDO>() |
| 25 | .eqIfPresent(KeFuMessageDO::getConversationId, reqVO.getConversationId()) | 26 | .eqIfPresent(KeFuMessageDO::getConversationId, reqVO.getConversationId()) |
| 26 | - .orderByDesc(KeFuMessageDO::getId)); | 27 | + .orderByDesc(KeFuMessageDO::getCreateTime)); |
| 27 | } | 28 | } |
| 28 | 29 | ||
| 29 | default List<KeFuMessageDO> selectListByConversationIdAndReadStatus(Long conversationId, Boolean readStatus) { | 30 | default List<KeFuMessageDO> selectListByConversationIdAndReadStatus(Long conversationId, Boolean readStatus) { |
| @@ -37,4 +38,10 @@ public interface KeFuMessageMapper extends BaseMapperX<KeFuMessageDO> { | @@ -37,4 +38,10 @@ public interface KeFuMessageMapper extends BaseMapperX<KeFuMessageDO> { | ||
| 37 | .in(KeFuMessageDO::getId, ids)); | 38 | .in(KeFuMessageDO::getId, ids)); |
| 38 | } | 39 | } |
| 39 | 40 | ||
| 41 | + default PageResult<KeFuMessageDO> selectPage(AppKeFuMessagePageReqVO pageReqVO){ | ||
| 42 | + return selectPage(pageReqVO, new LambdaQueryWrapperX<KeFuMessageDO>() | ||
| 43 | + .eqIfPresent(KeFuMessageDO::getConversationId, pageReqVO.getConversationId()) | ||
| 44 | + .orderByDesc(KeFuMessageDO::getCreateTime)); | ||
| 45 | + } | ||
| 46 | + | ||
| 40 | } | 47 | } |
| 41 | \ No newline at end of file | 48 | \ No newline at end of file |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/kefu/KeFuConversationService.java
| @@ -74,4 +74,12 @@ public interface KeFuConversationService { | @@ -74,4 +74,12 @@ public interface KeFuConversationService { | ||
| 74 | */ | 74 | */ |
| 75 | KeFuConversationDO validateKefuConversationExists(Long id); | 75 | KeFuConversationDO validateKefuConversationExists(Long id); |
| 76 | 76 | ||
| 77 | + /** | ||
| 78 | + * 【会员】获得客服会话 | ||
| 79 | + * | ||
| 80 | + * @param userId 用户编号 | ||
| 81 | + * @return 客服会话 | ||
| 82 | + */ | ||
| 83 | + KeFuConversationDO getConversationByUserId(Long userId); | ||
| 84 | + | ||
| 77 | } | 85 | } |
| 78 | \ No newline at end of file | 86 | \ No newline at end of file |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/kefu/KeFuConversationServiceImpl.java
| @@ -104,4 +104,9 @@ public class KeFuConversationServiceImpl implements KeFuConversationService { | @@ -104,4 +104,9 @@ public class KeFuConversationServiceImpl implements KeFuConversationService { | ||
| 104 | return conversation; | 104 | return conversation; |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | + @Override | ||
| 108 | + public KeFuConversationDO getConversationByUserId(Long userId) { | ||
| 109 | + return conversationMapper.selectOne(KeFuConversationDO::getUserId, userId); | ||
| 110 | + } | ||
| 111 | + | ||
| 107 | } | 112 | } |
| 108 | \ No newline at end of file | 113 | \ No newline at end of file |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/kefu/KeFuMessageService.java
| @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.promotion.service.kefu; | @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.promotion.service.kefu; | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessagePageReqVO; | 4 | import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessagePageReqVO; |
| 5 | import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessageSendReqVO; | 5 | import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessageSendReqVO; |
| 6 | +import cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message.AppKeFuMessagePageReqVO; | ||
| 6 | import cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message.AppKeFuMessageSendReqVO; | 7 | import cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message.AppKeFuMessageSendReqVO; |
| 7 | import cn.iocoder.yudao.module.promotion.dal.dataobject.kefu.KeFuMessageDO; | 8 | import cn.iocoder.yudao.module.promotion.dal.dataobject.kefu.KeFuMessageDO; |
| 8 | import jakarta.validation.Valid; | 9 | import jakarta.validation.Valid; |
| @@ -45,4 +46,13 @@ public interface KeFuMessageService { | @@ -45,4 +46,13 @@ public interface KeFuMessageService { | ||
| 45 | */ | 46 | */ |
| 46 | PageResult<KeFuMessageDO> getKefuMessagePage(KeFuMessagePageReqVO pageReqVO); | 47 | PageResult<KeFuMessageDO> getKefuMessagePage(KeFuMessagePageReqVO pageReqVO); |
| 47 | 48 | ||
| 49 | + /** | ||
| 50 | + * 【会员】获得客服消息分页 | ||
| 51 | + * | ||
| 52 | + * @param pageReqVO 请求 | ||
| 53 | + * @param userId 用户编号 | ||
| 54 | + * @return 客服消息分页 | ||
| 55 | + */ | ||
| 56 | + PageResult<KeFuMessageDO> getKefuMessagePage(AppKeFuMessagePageReqVO pageReqVO, Long userId); | ||
| 57 | + | ||
| 48 | } | 58 | } |
| 49 | \ No newline at end of file | 59 | \ No newline at end of file |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/kefu/KeFuMessageServiceImpl.java
| @@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.infra.api.websocket.WebSocketSenderApi; | @@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.infra.api.websocket.WebSocketSenderApi; | ||
| 10 | import cn.iocoder.yudao.module.member.api.user.MemberUserApi; | 10 | import cn.iocoder.yudao.module.member.api.user.MemberUserApi; |
| 11 | import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessagePageReqVO; | 11 | import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessagePageReqVO; |
| 12 | import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessageSendReqVO; | 12 | import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessageSendReqVO; |
| 13 | +import cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message.AppKeFuMessagePageReqVO; | ||
| 13 | import cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message.AppKeFuMessageSendReqVO; | 14 | import cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message.AppKeFuMessageSendReqVO; |
| 14 | import cn.iocoder.yudao.module.promotion.dal.dataobject.kefu.KeFuConversationDO; | 15 | import cn.iocoder.yudao.module.promotion.dal.dataobject.kefu.KeFuConversationDO; |
| 15 | import cn.iocoder.yudao.module.promotion.dal.dataobject.kefu.KeFuMessageDO; | 16 | import cn.iocoder.yudao.module.promotion.dal.dataobject.kefu.KeFuMessageDO; |
| @@ -21,6 +22,7 @@ import org.springframework.stereotype.Service; | @@ -21,6 +22,7 @@ import org.springframework.stereotype.Service; | ||
| 21 | import org.springframework.transaction.annotation.Transactional; | 22 | import org.springframework.transaction.annotation.Transactional; |
| 22 | import org.springframework.validation.annotation.Validated; | 23 | import org.springframework.validation.annotation.Validated; |
| 23 | 24 | ||
| 25 | +import java.util.Collections; | ||
| 24 | import java.util.List; | 26 | import java.util.List; |
| 25 | 27 | ||
| 26 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; | 28 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; |
| @@ -131,6 +133,18 @@ public class KeFuMessageServiceImpl implements KeFuMessageService { | @@ -131,6 +133,18 @@ public class KeFuMessageServiceImpl implements KeFuMessageService { | ||
| 131 | return keFuMessageMapper.selectPage(pageReqVO); | 133 | return keFuMessageMapper.selectPage(pageReqVO); |
| 132 | } | 134 | } |
| 133 | 135 | ||
| 136 | + @Override | ||
| 137 | + public PageResult<KeFuMessageDO> getKefuMessagePage(AppKeFuMessagePageReqVO pageReqVO, Long userId) { | ||
| 138 | + // 1. 获得客服会话 | ||
| 139 | + KeFuConversationDO conversation = conversationService.getConversationByUserId(userId); | ||
| 140 | + if (conversation == null) { | ||
| 141 | + return PageResult.empty(); | ||
| 142 | + } | ||
| 143 | + // 2. 设置会话编号 | ||
| 144 | + pageReqVO.setConversationId(conversation.getId()); | ||
| 145 | + return keFuMessageMapper.selectPage(pageReqVO); | ||
| 146 | + } | ||
| 147 | + | ||
| 134 | private KeFuMessageServiceImpl getSelf() { | 148 | private KeFuMessageServiceImpl getSelf() { |
| 135 | return SpringUtil.getBean(getClass()); | 149 | return SpringUtil.getBean(getClass()); |
| 136 | } | 150 | } |