微信修改
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
export * from './workcase'
|
||||
export * from './workcaseChat'
|
||||
@@ -0,0 +1,167 @@
|
||||
import { request } from '../base'
|
||||
import type { ResultDomain, PageRequest } from '../../types'
|
||||
import type { TbWorkcaseDTO, TbWorkcaseProcessDTO, TbWorkcaseDeviceDTO } from '../../types/workcase'
|
||||
|
||||
/**
|
||||
* @description 工单管理接口
|
||||
* @filename workcase.ts
|
||||
* @author yslg
|
||||
* @copyright xyzh
|
||||
* @since 2025-12-19
|
||||
*/
|
||||
export const workcaseAPI = {
|
||||
baseUrl: '/urban-lifeline/workcase',
|
||||
|
||||
// ========================= 工单管理 =========================
|
||||
|
||||
/**
|
||||
* 创建工单
|
||||
* @param workcase 工单信息
|
||||
*/
|
||||
createWorkcase(workcase: TbWorkcaseDTO): Promise<ResultDomain<TbWorkcaseDTO>> {
|
||||
return request<TbWorkcaseDTO>({ url: this.baseUrl, method: 'POST', data: workcase })
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新工单
|
||||
* @param workcase 工单信息
|
||||
*/
|
||||
updateWorkcase(workcase: TbWorkcaseDTO): Promise<ResultDomain<TbWorkcaseDTO>> {
|
||||
return request<TbWorkcaseDTO>({ url: this.baseUrl, method: 'PUT', data: workcase })
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除工单
|
||||
* @param workcaseId 工单ID
|
||||
*/
|
||||
deleteWorkcase(workcaseId: string): Promise<ResultDomain<TbWorkcaseDTO>> {
|
||||
return request<TbWorkcaseDTO>({ url: `${this.baseUrl}/${workcaseId}`, method: 'DELETE' })
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取工单详情
|
||||
* @param workcaseId 工单ID
|
||||
*/
|
||||
getWorkcaseById(workcaseId: string): Promise<ResultDomain<TbWorkcaseDTO>> {
|
||||
return request<TbWorkcaseDTO>({ url: `${this.baseUrl}/${workcaseId}`, method: 'GET' })
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询工单列表
|
||||
* @param filter 筛选条件
|
||||
*/
|
||||
getWorkcaseList(filter?: TbWorkcaseDTO): Promise<ResultDomain<TbWorkcaseDTO>> {
|
||||
return request<TbWorkcaseDTO>({ url: `${this.baseUrl}/list`, method: 'POST', data: filter || {} })
|
||||
},
|
||||
|
||||
/**
|
||||
* 分页查询工单
|
||||
* @param pageRequest 分页请求
|
||||
*/
|
||||
getWorkcasePage(pageRequest: PageRequest<TbWorkcaseDTO>): Promise<ResultDomain<TbWorkcaseDTO>> {
|
||||
return request<TbWorkcaseDTO>({ url: `${this.baseUrl}/page`, method: 'POST', data: pageRequest })
|
||||
},
|
||||
|
||||
// ========================= CRM同步接口 =========================
|
||||
|
||||
/**
|
||||
* 同步工单到CRM
|
||||
* @param workcase 工单信息
|
||||
*/
|
||||
syncWorkcaseToCrm(workcase: TbWorkcaseDTO): Promise<ResultDomain<void>> {
|
||||
return request<void>({ url: `${this.baseUrl}/sync/crm`, method: 'POST', data: workcase })
|
||||
},
|
||||
|
||||
/**
|
||||
* 接收CRM工单更新(CRM回调)
|
||||
* @param jsonBody JSON字符串
|
||||
*/
|
||||
receiveWorkcaseFromCrm(jsonBody: string): Promise<ResultDomain<void>> {
|
||||
return request<void>({ url: `${this.baseUrl}/receive/crm`, method: 'POST', data: jsonBody })
|
||||
},
|
||||
|
||||
// ========================= 工单处理过程 =========================
|
||||
|
||||
/**
|
||||
* 创建工单处理过程
|
||||
* @param process 处理过程信息
|
||||
*/
|
||||
createWorkcaseProcess(process: TbWorkcaseProcessDTO): Promise<ResultDomain<TbWorkcaseProcessDTO>> {
|
||||
return request<TbWorkcaseProcessDTO>({ url: `${this.baseUrl}/process`, method: 'POST', data: process })
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新工单处理过程
|
||||
* @param process 处理过程信息
|
||||
*/
|
||||
updateWorkcaseProcess(process: TbWorkcaseProcessDTO): Promise<ResultDomain<TbWorkcaseProcessDTO>> {
|
||||
return request<TbWorkcaseProcessDTO>({ url: `${this.baseUrl}/process`, method: 'PUT', data: process })
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除工单处理过程
|
||||
* @param processId 处理过程ID
|
||||
*/
|
||||
deleteWorkcaseProcess(processId: string): Promise<ResultDomain<TbWorkcaseProcessDTO>> {
|
||||
return request<TbWorkcaseProcessDTO>({ url: `${this.baseUrl}/process/${processId}`, method: 'DELETE' })
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询工单处理过程列表
|
||||
* @param filter 筛选条件
|
||||
*/
|
||||
getWorkcaseProcessList(filter?: TbWorkcaseProcessDTO): Promise<ResultDomain<TbWorkcaseProcessDTO>> {
|
||||
return request<TbWorkcaseProcessDTO>({ url: `${this.baseUrl}/process/list`, method: 'POST', data: filter || {} })
|
||||
},
|
||||
|
||||
/**
|
||||
* 分页查询工单处理过程
|
||||
* @param pageRequest 分页请求
|
||||
*/
|
||||
getWorkcaseProcessPage(pageRequest: PageRequest<TbWorkcaseProcessDTO>): Promise<ResultDomain<TbWorkcaseProcessDTO>> {
|
||||
return request<TbWorkcaseProcessDTO>({ url: `${this.baseUrl}/process/page`, method: 'POST', data: pageRequest })
|
||||
},
|
||||
|
||||
// ========================= 工单设备管理 =========================
|
||||
|
||||
/**
|
||||
* 创建工单设备
|
||||
* @param device 设备信息
|
||||
*/
|
||||
createWorkcaseDevice(device: TbWorkcaseDeviceDTO): Promise<ResultDomain<TbWorkcaseDeviceDTO>> {
|
||||
return request<TbWorkcaseDeviceDTO>({ url: `${this.baseUrl}/device`, method: 'POST', data: device })
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新工单设备
|
||||
* @param device 设备信息
|
||||
*/
|
||||
updateWorkcaseDevice(device: TbWorkcaseDeviceDTO): Promise<ResultDomain<TbWorkcaseDeviceDTO>> {
|
||||
return request<TbWorkcaseDeviceDTO>({ url: `${this.baseUrl}/device`, method: 'PUT', data: device })
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除工单设备
|
||||
* @param workcaseId 工单ID
|
||||
* @param device 设备名称
|
||||
*/
|
||||
deleteWorkcaseDevice(workcaseId: string, device: string): Promise<ResultDomain<TbWorkcaseDeviceDTO>> {
|
||||
return request<TbWorkcaseDeviceDTO>({ url: `${this.baseUrl}/device/${workcaseId}/${device}`, method: 'DELETE' })
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询工单设备列表
|
||||
* @param filter 筛选条件
|
||||
*/
|
||||
getWorkcaseDeviceList(filter?: TbWorkcaseDeviceDTO): Promise<ResultDomain<TbWorkcaseDeviceDTO>> {
|
||||
return request<TbWorkcaseDeviceDTO>({ url: `${this.baseUrl}/device/list`, method: 'POST', data: filter || {} })
|
||||
},
|
||||
|
||||
/**
|
||||
* 分页查询工单设备
|
||||
* @param pageRequest 分页请求
|
||||
*/
|
||||
getWorkcaseDevicePage(pageRequest: PageRequest<TbWorkcaseDeviceDTO>): Promise<ResultDomain<TbWorkcaseDeviceDTO>> {
|
||||
return request<TbWorkcaseDeviceDTO>({ url: `${this.baseUrl}/device/page`, method: 'POST', data: pageRequest })
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,281 @@
|
||||
import { request } from '../base'
|
||||
import type { ResultDomain, PageRequest } from '../../types'
|
||||
import type { TbWorkcaseDTO } from '../../types/workcase/workcase'
|
||||
import type {
|
||||
TbChatRoomDTO,
|
||||
TbChatRoomMemberDTO,
|
||||
TbChatRoomMessageDTO,
|
||||
TbCustomerServiceDTO,
|
||||
TbWordCloudDTO,
|
||||
ChatRoomVO,
|
||||
ChatMemberVO,
|
||||
ChatRoomMessageVO,
|
||||
CustomerServiceVO
|
||||
} from '../../types/workcase/chatRoom'
|
||||
|
||||
// AI对话相关类型(简化版)
|
||||
interface TbChat {
|
||||
chatId?: string
|
||||
userId?: string
|
||||
title?: string
|
||||
status?: string
|
||||
}
|
||||
interface TbChatMessage {
|
||||
messageId?: string
|
||||
chatId?: string
|
||||
content?: string
|
||||
role?: string
|
||||
}
|
||||
interface ChatPrepareData {
|
||||
chatId?: string
|
||||
message?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 工单对话相关接口
|
||||
* @filename workcaseChat.ts
|
||||
* @author cascade
|
||||
* @copyright xyzh
|
||||
* @since 2025-12-22
|
||||
*/
|
||||
export const workcaseChatAPI = {
|
||||
baseUrl: '/urban-lifeline/workcase/chat',
|
||||
|
||||
// ====================== AI对话管理 ======================
|
||||
|
||||
/**
|
||||
* 创建对话
|
||||
*/
|
||||
createChat(chat: TbChat): Promise<ResultDomain<TbChat>> {
|
||||
return request<TbChat>({ url: this.baseUrl, method: 'POST', data: chat })
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新对话
|
||||
*/
|
||||
updateChat(chat: TbChat): Promise<ResultDomain<TbChat>> {
|
||||
return request<TbChat>({ url: this.baseUrl, method: 'PUT', data: chat })
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询对话列表
|
||||
*/
|
||||
getChatList(filter: TbChat): Promise<ResultDomain<TbChat>> {
|
||||
return request<TbChat>({ url: `${this.baseUrl}/list`, method: 'POST', data: filter })
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取对话消息列表
|
||||
*/
|
||||
getChatMessageList(filter: TbChat): Promise<ResultDomain<TbChatMessage>> {
|
||||
return request<TbChatMessage>({ url: `${this.baseUrl}/message/list`, method: 'POST', data: filter })
|
||||
},
|
||||
|
||||
/**
|
||||
* 准备对话会话
|
||||
*/
|
||||
prepareChatMessageSession(prepareData: ChatPrepareData): Promise<ResultDomain<string>> {
|
||||
return request<string>({ url: `${this.baseUrl}/prepare`, method: 'POST', data: prepareData })
|
||||
},
|
||||
|
||||
/**
|
||||
* 流式对话(SSE)- 返回EventSource URL
|
||||
*/
|
||||
getStreamUrl(sessionId: string): string {
|
||||
return `${this.baseUrl}/stream/${sessionId}`
|
||||
},
|
||||
|
||||
/**
|
||||
* 停止对话
|
||||
*/
|
||||
stopChat(filter: TbChat, taskId: string): Promise<ResultDomain<boolean>> {
|
||||
return request<boolean>({ url: `${this.baseUrl}/stop/${taskId}`, method: 'POST', data: filter })
|
||||
},
|
||||
|
||||
/**
|
||||
* 评论对话消息
|
||||
*/
|
||||
commentChatMessage(filter: TbChat, messageId: string, comment: string): Promise<ResultDomain<boolean>> {
|
||||
return request<boolean>({ url: `${this.baseUrl}/comment?messageId=${messageId}&comment=${comment}`, method: 'POST', data: filter })
|
||||
},
|
||||
|
||||
// ====================== 对话分析 ======================
|
||||
|
||||
/**
|
||||
* 分析对话(AI预填工单信息)
|
||||
*/
|
||||
analyzeChat(chatId: string): Promise<ResultDomain<TbWorkcaseDTO>> {
|
||||
return request<TbWorkcaseDTO>({ url: `${this.baseUrl}/analyze/${chatId}`, method: 'GET' })
|
||||
},
|
||||
|
||||
/**
|
||||
* 总结对话
|
||||
*/
|
||||
summaryChat(chatId: string): Promise<ResultDomain<TbWorkcaseDTO>> {
|
||||
return request<TbWorkcaseDTO>({ url: `${this.baseUrl}/summary/${chatId}`, method: 'POST' })
|
||||
},
|
||||
|
||||
// ====================== ChatRoom聊天室管理 ======================
|
||||
|
||||
/**
|
||||
* 创建聊天室
|
||||
*/
|
||||
createChatRoom(chatRoom: TbChatRoomDTO): Promise<ResultDomain<TbChatRoomDTO>> {
|
||||
return request<TbChatRoomDTO>({ url: `${this.baseUrl}/room`, method: 'POST', data: chatRoom })
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新聊天室
|
||||
*/
|
||||
updateChatRoom(chatRoom: TbChatRoomDTO): Promise<ResultDomain<TbChatRoomDTO>> {
|
||||
return request<TbChatRoomDTO>({ url: `${this.baseUrl}/room`, method: 'PUT', data: chatRoom })
|
||||
},
|
||||
|
||||
/**
|
||||
* 关闭聊天室
|
||||
*/
|
||||
closeChatRoom(roomId: string, closedBy: string): Promise<ResultDomain<boolean>> {
|
||||
return request<boolean>({ url: `${this.baseUrl}/room/${roomId}/close?closedBy=${closedBy}`, method: 'POST' })
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取聊天室详情
|
||||
*/
|
||||
getChatRoomById(roomId: string): Promise<ResultDomain<TbChatRoomDTO>> {
|
||||
return request<TbChatRoomDTO>({ url: `${this.baseUrl}/room/${roomId}`, method: 'GET' })
|
||||
},
|
||||
|
||||
/**
|
||||
* 分页查询聊天室
|
||||
*/
|
||||
getChatRoomPage(pageRequest: PageRequest<TbChatRoomDTO>): Promise<ResultDomain<ChatRoomVO>> {
|
||||
return request<ChatRoomVO>({ url: `${this.baseUrl}/room/page`, method: 'POST', data: pageRequest })
|
||||
},
|
||||
|
||||
// ====================== ChatRoom成员管理 ======================
|
||||
|
||||
/**
|
||||
* 添加聊天室成员
|
||||
*/
|
||||
addChatRoomMember(member: TbChatRoomMemberDTO): Promise<ResultDomain<TbChatRoomMemberDTO>> {
|
||||
return request<TbChatRoomMemberDTO>({ url: `${this.baseUrl}/room/member`, method: 'POST', data: member })
|
||||
},
|
||||
|
||||
/**
|
||||
* 移除聊天室成员
|
||||
*/
|
||||
removeChatRoomMember(memberId: string): Promise<ResultDomain<boolean>> {
|
||||
return request<boolean>({ url: `${this.baseUrl}/room/member/${memberId}`, method: 'DELETE' })
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取聊天室成员列表
|
||||
*/
|
||||
getChatRoomMemberList(roomId: string): Promise<ResultDomain<ChatMemberVO>> {
|
||||
return request<ChatMemberVO>({ url: `${this.baseUrl}/room/${roomId}/members`, method: 'GET' })
|
||||
},
|
||||
|
||||
// ====================== ChatRoom消息管理 ======================
|
||||
|
||||
/**
|
||||
* 发送聊天室消息
|
||||
*/
|
||||
sendMessage(message: TbChatRoomMessageDTO): Promise<ResultDomain<TbChatRoomMessageDTO>> {
|
||||
return request<TbChatRoomMessageDTO>({ url: `${this.baseUrl}/room/message`, method: 'POST', data: message })
|
||||
},
|
||||
|
||||
/**
|
||||
* 分页查询聊天室消息
|
||||
*/
|
||||
getChatMessagePage(pageRequest: PageRequest<TbChatRoomMessageDTO>): Promise<ResultDomain<ChatRoomMessageVO>> {
|
||||
return request<ChatRoomMessageVO>({ url: `${this.baseUrl}/room/message/page`, method: 'POST', data: pageRequest })
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除聊天室消息
|
||||
*/
|
||||
deleteMessage(messageId: string): Promise<ResultDomain<boolean>> {
|
||||
return request<boolean>({ url: `${this.baseUrl}/room/message/${messageId}`, method: 'DELETE' })
|
||||
},
|
||||
|
||||
// ====================== 客服人员管理 ======================
|
||||
|
||||
/**
|
||||
* 添加客服人员
|
||||
*/
|
||||
addCustomerService(customerService: TbCustomerServiceDTO): Promise<ResultDomain<TbCustomerServiceDTO>> {
|
||||
return request<TbCustomerServiceDTO>({ url: `${this.baseUrl}/customer-service`, method: 'POST', data: customerService })
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新客服人员
|
||||
*/
|
||||
updateCustomerService(customerService: TbCustomerServiceDTO): Promise<ResultDomain<TbCustomerServiceDTO>> {
|
||||
return request<TbCustomerServiceDTO>({ url: `${this.baseUrl}/customer-service`, method: 'PUT', data: customerService })
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除客服人员
|
||||
*/
|
||||
deleteCustomerService(userId: string): Promise<ResultDomain<boolean>> {
|
||||
return request<boolean>({ url: `${this.baseUrl}/customer-service/${userId}`, method: 'DELETE' })
|
||||
},
|
||||
|
||||
/**
|
||||
* 分页查询客服人员
|
||||
*/
|
||||
getCustomerServicePage(pageRequest: PageRequest<TbCustomerServiceDTO>): Promise<ResultDomain<CustomerServiceVO>> {
|
||||
return request<CustomerServiceVO>({ url: `${this.baseUrl}/customer-service/page`, method: 'POST', data: pageRequest })
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新客服在线状态
|
||||
*/
|
||||
updateCustomerServiceStatus(userId: string, status: string): Promise<ResultDomain<boolean>> {
|
||||
return request<boolean>({ url: `${this.baseUrl}/customer-service/${userId}/status?status=${status}`, method: 'POST' })
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取可接待客服列表
|
||||
*/
|
||||
getAvailableCustomerServices(): Promise<ResultDomain<CustomerServiceVO>> {
|
||||
return request<CustomerServiceVO>({ url: `${this.baseUrl}/customer-service/available`, method: 'GET' })
|
||||
},
|
||||
|
||||
/**
|
||||
* 自动分配客服
|
||||
*/
|
||||
assignCustomerService(roomId: string): Promise<ResultDomain<CustomerServiceVO>> {
|
||||
return request<CustomerServiceVO>({ url: `${this.baseUrl}/room/${roomId}/assign`, method: 'POST' })
|
||||
},
|
||||
|
||||
// ====================== 词云管理 ======================
|
||||
|
||||
/**
|
||||
* 添加词云
|
||||
*/
|
||||
addWordCloud(wordCloud: TbWordCloudDTO): Promise<ResultDomain<TbWordCloudDTO>> {
|
||||
return request<TbWordCloudDTO>({ url: `${this.baseUrl}/wordcloud`, method: 'POST', data: wordCloud })
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新词云
|
||||
*/
|
||||
updateWordCloud(wordCloud: TbWordCloudDTO): Promise<ResultDomain<TbWordCloudDTO>> {
|
||||
return request<TbWordCloudDTO>({ url: `${this.baseUrl}/wordcloud`, method: 'PUT', data: wordCloud })
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询词云列表
|
||||
*/
|
||||
getWordCloudList(filter: TbWordCloudDTO): Promise<ResultDomain<TbWordCloudDTO>> {
|
||||
return request<TbWordCloudDTO>({ url: `${this.baseUrl}/wordcloud/list`, method: 'POST', data: filter })
|
||||
},
|
||||
|
||||
/**
|
||||
* 分页查询词云
|
||||
*/
|
||||
getWordCloudPage(pageRequest: PageRequest<TbWordCloudDTO>): Promise<ResultDomain<TbWordCloudDTO>> {
|
||||
return request<TbWordCloudDTO>({ url: `${this.baseUrl}/wordcloud/page`, method: 'POST', data: pageRequest })
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user