148 lines
3.6 KiB
Java
148 lines
3.6 KiB
Java
package com.emotion.service;
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.service.IService;
|
|
import com.emotion.common.PageResult;
|
|
import com.emotion.dto.request.ConversationCreateRequest;
|
|
import com.emotion.dto.request.ConversationPageRequest;
|
|
import com.emotion.dto.response.ConversationResponse;
|
|
import com.emotion.entity.Conversation;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import java.time.LocalDateTime;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* 会话服务接口
|
|
*
|
|
* @author emotion-museum
|
|
* @date 2025-07-23
|
|
*/
|
|
public interface ConversationService extends IService<Conversation> {
|
|
|
|
/**
|
|
* 分页查询会话
|
|
*/
|
|
IPage<Conversation> getPage(ConversationPageRequest request);
|
|
|
|
/**
|
|
* 根据用户ID分页查询会话
|
|
*/
|
|
IPage<Conversation> getPageByUserId(ConversationPageRequest request);
|
|
|
|
/**
|
|
* 根据用户ID查询会话列表
|
|
*/
|
|
List<Conversation> getByUserId(String userId);
|
|
|
|
/**
|
|
* 根据用户ID查询活跃会话列表
|
|
*/
|
|
List<Conversation> getActiveByUserId(String userId);
|
|
|
|
/**
|
|
* 根据Coze会话ID查询会话
|
|
*/
|
|
Conversation getByCozeConversationId(String cozeConversationId);
|
|
|
|
/**
|
|
* 更新会话消息数量
|
|
*/
|
|
boolean updateMessageCount(String conversationId, Integer messageCount);
|
|
|
|
/**
|
|
* 更新会话状态
|
|
*/
|
|
boolean updateStatus(String conversationId, Integer status);
|
|
|
|
/**
|
|
* 更新会话结束时间
|
|
*/
|
|
boolean updateEndTime(String conversationId, LocalDateTime endTime);
|
|
|
|
/**
|
|
* 统计用户的会话数量
|
|
*/
|
|
Long countByUserId(String userId);
|
|
|
|
/**
|
|
* 统计用户的活跃会话数量
|
|
*/
|
|
Long countActiveByUserId(String userId);
|
|
|
|
/**
|
|
* 查询需要归档的会话(超过指定天数未活跃)
|
|
*/
|
|
List<Conversation> getForArchive(Integer days);
|
|
|
|
/**
|
|
* 批量归档会话
|
|
*/
|
|
boolean batchArchive(List<String> conversationIds);
|
|
|
|
/**
|
|
* 创建会话
|
|
*/
|
|
Conversation createConversation(String userId, String title, String cozeConversationId);
|
|
|
|
/**
|
|
* 结束会话
|
|
*/
|
|
boolean endConversation(String conversationId);
|
|
|
|
/**
|
|
* 分页查询会话响应
|
|
*/
|
|
PageResult<ConversationResponse> getPageWithResponse(ConversationPageRequest request);
|
|
|
|
/**
|
|
* 根据用户ID分页查询会话响应
|
|
*/
|
|
PageResult<ConversationResponse> getPageByUserIdWithResponse(ConversationPageRequest request);
|
|
|
|
/**
|
|
* 根据ID获取会话响应
|
|
*/
|
|
ConversationResponse getConversationResponseById(String id);
|
|
|
|
/**
|
|
* 根据用户ID查询会话响应列表
|
|
*/
|
|
List<ConversationResponse> getByUserIdWithResponse(String userId);
|
|
|
|
/**
|
|
* 获取活跃会话响应列表
|
|
*/
|
|
List<ConversationResponse> getActiveConversationsWithResponse();
|
|
|
|
/**
|
|
* 获取归档会话响应列表
|
|
*/
|
|
List<ConversationResponse> getArchivedConversationsWithResponse();
|
|
|
|
/**
|
|
* 归档对话
|
|
*/
|
|
boolean archiveConversation(String id);
|
|
|
|
/**
|
|
* 激活对话
|
|
*/
|
|
boolean activateConversation(String id);
|
|
|
|
/**
|
|
* 创建会话并返回响应对象
|
|
*/
|
|
ConversationResponse createConversationWithResponse(ConversationCreateRequest request,
|
|
HttpServletRequest httpRequest);
|
|
|
|
/**
|
|
* 更新会话并返回响应对象
|
|
*/
|
|
ConversationResponse updateConversationWithResponse(ConversationCreateRequest request);
|
|
|
|
/**
|
|
* 更新会话状态
|
|
*/
|
|
boolean updateConversationStatus(String id, String status);
|
|
} |