ticket/models/tk_tickets.json
yumoqing 54f2f2d597 feat: 工单管理模块初版——客户提问→agent预处理→人工运维→转派,接入平台待办
- 3表: tk_tickets(状态机+受理角色/人+agent锁)/tk_messages(客户可见/内部备注)/tk_transfers(append-only流水)
- core.py: 8态13迁移状态机全乐观锁; 转派候选动态查owner角色+'0'机构用户(不硬编码);
  默认受理角色params可配(ticket_default_role=owner.maintainer)
- agent.py: 异步poller(bid_flow范式), RAG检索'0'机构KB+历史工单, llm_call(org_id=0)
  LLM裁决能否回答(严格JSON), 硬门禁reply<20字符转人工, 故障≠答不了(fail_rounds>=3转人工),
  stale回收10min; 追问回流(agent_processing+owner空)立即拾取不等stale
- todos.py: 平台待办provider, 状态派生(客户待确认/角色池待认领/受理人待处理)
- init.py: load_ticket注册env+provider+poller(PIPELINE_MODE=web不启动)
- wwwroot: 客户我的工单页+建单表单, 运维工单管理页(队列切换), 详情弹窗(正文与操作同屏,按视角出按钮)
- load_path.py: logined全部API(业务权限服务端按current_role动态校验)+管理页壳owner三角色
- init/data.json: 7组码表+owner.maintainer角色种子(app_audit先例)
2026-09-10 16:17:58 +08:00

44 lines
2.9 KiB
JSON

{
"summary": [
{
"name": "tk_tickets",
"title": "工单主表",
"primary": ["id"],
"catelog": "entity"
}
],
"fields": [
{"name": "id", "title": "主键ID", "type": "str", "length": 32, "nullable": "no"},
{"name": "ticket_no", "title": "工单编号", "type": "str", "length": 32, "nullable": "no"},
{"name": "title", "title": "问题标题", "type": "str", "length": 200, "nullable": "no"},
{"name": "description", "title": "问题描述", "type": "text"},
{"name": "category", "title": "问题分类", "type": "str", "length": 32, "default": "other"},
{"name": "priority", "title": "优先级", "type": "str", "length": 16, "default": "normal"},
{"name": "status", "title": "工单状态", "type": "str", "length": 32, "nullable": "no", "default": "new"},
{"name": "customer_org_id", "title": "客户机构ID", "type": "str", "length": 32, "nullable": "no"},
{"name": "customer_user_id", "title": "客户用户ID", "type": "str", "length": 32, "nullable": "no"},
{"name": "current_role", "title": "当前受理角色", "type": "str", "length": 64},
{"name": "current_assignee", "title": "当前受理人", "type": "str", "length": 32},
{"name": "processing_owner", "title": "agent处理锁标记", "type": "str", "length": 64},
{"name": "followup_count", "title": "客户追问次数", "type": "int", "default": "0"},
{"name": "agent_fail_rounds", "title": "agent连续失败轮数", "type": "int", "default": "0"},
{"name": "closed_at", "title": "关闭时间", "type": "timestamp"},
{"name": "close_reason", "title": "关闭原因", "type": "str", "length": 32},
{"name": "created_at", "title": "创建时间", "type": "timestamp", "nullable": "no"},
{"name": "updated_at", "title": "更新时间", "type": "timestamp", "nullable": "no"}
],
"indexes": [
{"name": "uk_tk_no", "idxtype": "unique", "idxfields": ["ticket_no"]},
{"name": "idx_tk_cust", "idxtype": "index", "idxfields": ["customer_org_id", "status"]},
{"name": "idx_tk_status", "idxtype": "index", "idxfields": ["status"]},
{"name": "idx_tk_role_status", "idxtype": "index", "idxfields": ["current_role", "status"]},
{"name": "idx_tk_assignee", "idxtype": "index", "idxfields": ["current_assignee", "status"]}
],
"codes": [
{"field": "category", "table": "appcodes_kv", "valuefield": "k", "textfield": "v", "cond": "parentid='tk_category'"},
{"field": "priority", "table": "appcodes_kv", "valuefield": "k", "textfield": "v", "cond": "parentid='tk_priority'"},
{"field": "status", "table": "appcodes_kv", "valuefield": "k", "textfield": "v", "cond": "parentid='tk_status'"},
{"field": "close_reason", "table": "appcodes_kv", "valuefield": "k", "textfield": "v", "cond": "parentid='tk_close_reason'"}
]
}