2026-07-11 23:13:10 +08:00
|
|
|
|
# =============================================================================
|
|
|
|
|
|
# 企微IT智能服务台 — 会议室预定 Pydantic 请求/响应模型
|
|
|
|
|
|
# =============================================================================
|
|
|
|
|
|
# 说明:定义会议室预定API的请求和响应数据模型
|
|
|
|
|
|
# =============================================================================
|
|
|
|
|
|
|
|
|
|
|
|
from datetime import datetime
|
|
|
|
|
|
from typing import Any, List, Optional
|
|
|
|
|
|
|
|
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# =============================================================================
|
|
|
|
|
|
# 会议室列表相关
|
|
|
|
|
|
# =============================================================================
|
|
|
|
|
|
|
|
|
|
|
|
class MeetingroomItem(BaseModel):
|
|
|
|
|
|
"""会议室信息项。"""
|
|
|
|
|
|
|
|
|
|
|
|
meetingroom_id: int = Field(..., description="企微会议室ID")
|
|
|
|
|
|
name: str = Field(..., description="会议室名称")
|
|
|
|
|
|
capacity: int = Field(0, description="容纳人数")
|
|
|
|
|
|
location: str = Field("", description="位置描述")
|
|
|
|
|
|
devices: List[int] = Field(default_factory=list, description="设备列表")
|
|
|
|
|
|
need_approval: int = Field(0, description="是否需要审批(0=不需要, 1=需要)")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MeetingroomListResponse(BaseModel):
|
|
|
|
|
|
"""会议室列表响应数据。"""
|
|
|
|
|
|
|
|
|
|
|
|
rooms: List[MeetingroomItem] = Field(default_factory=list, description="会议室列表")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# =============================================================================
|
|
|
|
|
|
# 预定状态查询相关
|
|
|
|
|
|
# =============================================================================
|
|
|
|
|
|
|
|
|
|
|
|
class BookingItem(BaseModel):
|
|
|
|
|
|
"""预定记录项。"""
|
|
|
|
|
|
|
|
|
|
|
|
booking_id: str = Field(..., description="企微预定ID")
|
|
|
|
|
|
subject: str = Field("", description="会议主题")
|
|
|
|
|
|
booker: str = Field("", description="预定人userid")
|
|
|
|
|
|
booker_name: str = Field("", description="预定人姓名")
|
|
|
|
|
|
start_time: str = Field(..., description="开始时间(ISO 8601)")
|
|
|
|
|
|
end_time: str = Field(..., description="结束时间(ISO 8601)")
|
|
|
|
|
|
status: int = Field(0, description="预定状态(0=已预定, 1=已取消)")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BookingInfoResponse(BaseModel):
|
|
|
|
|
|
"""预定状态查询响应数据。"""
|
|
|
|
|
|
|
|
|
|
|
|
bookings: List[BookingItem] = Field(default_factory=list, description="预定记录列表")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class RoomStatusResponse(BaseModel):
|
|
|
|
|
|
"""会议室实时状态响应数据。"""
|
|
|
|
|
|
|
|
|
|
|
|
status: str = Field(..., description="当前状态(free/busy/starting_soon)")
|
|
|
|
|
|
current_meeting: Optional[BookingItem] = Field(None, description="当前进行中的会议")
|
|
|
|
|
|
next_meeting: Optional[BookingItem] = Field(None, description="下一个会议")
|
|
|
|
|
|
minutes_to_next: Optional[int] = Field(None, description="距下一个会议开始的分钟数")
|
|
|
|
|
|
bookings: List[BookingItem] = Field(default_factory=list, description="当日预定列表")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# =============================================================================
|
|
|
|
|
|
# 预定操作相关
|
|
|
|
|
|
# =============================================================================
|
|
|
|
|
|
|
|
|
|
|
|
class BookRequest(BaseModel):
|
|
|
|
|
|
"""预定会议室请求。"""
|
|
|
|
|
|
|
|
|
|
|
|
meetingroom_id: int = Field(..., description="企微会议室ID")
|
|
|
|
|
|
subject: str = Field(..., min_length=1, max_length=200, description="会议主题")
|
|
|
|
|
|
start_time: str = Field(..., description="开始时间(ISO 8601)")
|
|
|
|
|
|
end_time: str = Field(..., description="结束时间(ISO 8601)")
|
|
|
|
|
|
booker: str = Field(..., description="预定人userid")
|
|
|
|
|
|
attendees: Optional[List[str]] = Field(None, description="参与人userid列表(可选)")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BookResponse(BaseModel):
|
|
|
|
|
|
"""预定会议室响应数据。"""
|
|
|
|
|
|
|
|
|
|
|
|
booking_id: str = Field(..., description="企微预定ID")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CancelRequest(BaseModel):
|
|
|
|
|
|
"""取消预定请求。"""
|
|
|
|
|
|
|
|
|
|
|
|
meetingroom_id: int = Field(..., description="企微会议室ID")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BookingDetailResponse(BaseModel):
|
|
|
|
|
|
"""预定详情响应数据。"""
|
|
|
|
|
|
|
|
|
|
|
|
booking_id: str = Field(..., description="企微预定ID")
|
|
|
|
|
|
subject: str = Field("", description="会议主题")
|
|
|
|
|
|
booker: str = Field("", description="预定人userid")
|
|
|
|
|
|
booker_name: str = Field("", description="预定人姓名")
|
|
|
|
|
|
attendees: List[str] = Field(default_factory=list, description="参与人列表")
|
|
|
|
|
|
start_time: str = Field(..., description="开始时间")
|
|
|
|
|
|
end_time: str = Field(..., description="结束时间")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# =============================================================================
|
|
|
|
|
|
# 终端绑定管理相关
|
|
|
|
|
|
# =============================================================================
|
|
|
|
|
|
|
|
|
|
|
|
class TerminalBindingCreate(BaseModel):
|
|
|
|
|
|
"""新增终端绑定请求。"""
|
|
|
|
|
|
|
|
|
|
|
|
terminal_sn: str = Field(..., min_length=1, max_length=64, description="终端序列号")
|
|
|
|
|
|
terminal_name: str = Field("", max_length=100, description="终端名称")
|
|
|
|
|
|
meetingroom_id: int = Field(..., description="企微会议室ID")
|
|
|
|
|
|
meetingroom_name: str = Field("", max_length=100, description="会议室名称")
|
|
|
|
|
|
location: str = Field("", max_length=200, description="位置描述")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TerminalBindingUpdate(BaseModel):
|
|
|
|
|
|
"""更新终端绑定请求。"""
|
|
|
|
|
|
|
|
|
|
|
|
terminal_name: Optional[str] = Field(None, max_length=100, description="终端名称")
|
|
|
|
|
|
meetingroom_id: Optional[int] = Field(None, description="企微会议室ID")
|
|
|
|
|
|
meetingroom_name: Optional[str] = Field(None, max_length=100, description="会议室名称")
|
|
|
|
|
|
location: Optional[str] = Field(None, max_length=200, description="位置描述")
|
|
|
|
|
|
is_active: Optional[bool] = Field(None, description="是否启用")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TerminalBindingResponse(BaseModel):
|
|
|
|
|
|
"""终端绑定响应数据。"""
|
|
|
|
|
|
|
|
|
|
|
|
id: int
|
|
|
|
|
|
terminal_sn: str
|
|
|
|
|
|
terminal_name: str
|
|
|
|
|
|
meetingroom_id: int
|
|
|
|
|
|
meetingroom_name: str
|
|
|
|
|
|
location: str
|
|
|
|
|
|
is_active: bool
|
|
|
|
|
|
created_at: str
|
|
|
|
|
|
updated_at: str
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TerminalBindingListResponse(BaseModel):
|
|
|
|
|
|
"""终端绑定列表响应数据。"""
|
|
|
|
|
|
|
|
|
|
|
|
list: List[TerminalBindingResponse] = Field(default_factory=list)
|
|
|
|
|
|
total: int = 0
|
2026-07-13 02:17:03 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# =============================================================================
|
|
|
|
|
|
# 报修相关
|
|
|
|
|
|
# =============================================================================
|
|
|
|
|
|
|
|
|
|
|
|
class RepairRequest(BaseModel):
|
|
|
|
|
|
"""提交报修请求。"""
|
|
|
|
|
|
|
|
|
|
|
|
terminal_sn: str = Field(..., min_length=1, max_length=64, description="终端序列号")
|
|
|
|
|
|
meetingroom_id: int = Field(..., description="企微会议室ID")
|
|
|
|
|
|
meetingroom_name: str = Field("", max_length=100, description="会议室名称")
|
|
|
|
|
|
device_type: str = Field(..., min_length=1, max_length=50, description="故障设备类型: projector/video_conf/aircon/desk_chair/network/other")
|
|
|
|
|
|
fault_description: str = Field(..., min_length=1, description="故障描述")
|
|
|
|
|
|
reporter_name: Optional[str] = Field(None, max_length=100, description="报修人姓名(为空则匿名)")
|
|
|
|
|
|
reporter_userid: Optional[str] = Field(None, max_length=64, description="报修人企微userid")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class RepairResponse(BaseModel):
|
|
|
|
|
|
"""报修提交响应。"""
|
|
|
|
|
|
|
|
|
|
|
|
repair_id: int = Field(..., description="报修记录ID")
|
|
|
|
|
|
conversation_id: str = Field(..., description="关联的IT工单会话ID")
|
|
|
|
|
|
status: int = Field(0, description="报修状态")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# =============================================================================
|
|
|
|
|
|
# 操作指南相关
|
|
|
|
|
|
# =============================================================================
|
|
|
|
|
|
|
|
|
|
|
|
class GuideItem(BaseModel):
|
|
|
|
|
|
"""操作指南条目。"""
|
|
|
|
|
|
|
|
|
|
|
|
id: int = Field(..., description="指南ID")
|
|
|
|
|
|
category: str = Field(..., description="设备类型")
|
|
|
|
|
|
title: str = Field(..., description="指南标题")
|
|
|
|
|
|
brief: str = Field("", description="简要操作步骤")
|
|
|
|
|
|
detail_url: str = Field("", description="详细文档URL")
|
|
|
|
|
|
icon: str = Field("📋", description="图标emoji")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class GuideListResponse(BaseModel):
|
|
|
|
|
|
"""操作指南列表响应。"""
|
|
|
|
|
|
|
|
|
|
|
|
guides: List[GuideItem] = Field(default_factory=list, description="指南列表")
|