ETL 完成

This commit is contained in:
Neo
2026-01-18 22:37:38 +08:00
parent 8da6cb6563
commit 7ca19a4a2c
159 changed files with 31225 additions and 467 deletions

View File

@@ -12,9 +12,9 @@ STORE_ID=2790685415443269
TIMEZONE=Asia/Taipei
# API 基础地址config/env_parser.py -> api.base_urlFETCH 类任务调用
API_BASE=https://api.example.com
API_BASE=https://pc.ficoo.vip/apiprod/admin/v1/
# API 鉴权 Tokenconfig/env_parser.py -> api.tokenFETCH 类任务调用
API_TOKEN=your_token_here
API_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjbGllbnQtdHlwZSI6IjQiLCJ1c2VyLXR5cGUiOiIxIiwiaHR0cDovL3NjaGVtYXMubWljcm9zb2Z0LmNvbS93cy8yMDA4LzA2L2lkZW50aXR5L2NsYWltcy9yb2xlIjoiMTIiLCJyb2xlLWlkIjoiMTIiLCJ0ZW5hbnQtaWQiOiIyNzkwNjgzMTYwNzA5OTU3Iiwibmlja25hbWUiOiLnp5_miLfnrqHnkIblkZjvvJrmganmgakxIiwic2l0ZS1pZCI6IjAiLCJtb2JpbGUiOiIxMzgxMDUwMjMwNCIsInNpZCI6IjI5NTA0ODk2NTgzOTU4NDUiLCJzdGFmZi1pZCI6IjMwMDk5MTg2OTE1NTkwNDUiLCJvcmctaWQiOiIwIiwicm9sZS10eXBlIjoiMyIsInJlZnJlc2hUb2tlbiI6IlpWV3grVThBc2FYekFJeTRiaXF6MktwNjMxbTFNRlozV3pLaXNjOHREY289IiwicmVmcmVzaEV4cGlyeVRpbWUiOiIyMDI2LzEvMTcg5LiL5Y2INDoyMjo1OSIsIm5lZWRDaGVja1Rva2VuIjoiZmFsc2UiLCJleHAiOjE3Njg2MzgxNzksImlzcyI6InRlc3QiLCJhdWQiOiJVc2VyIn0.PVeAIx1iHqmHRNaQ4OMFPuOlHBoE47bR5TGJjZP-eOE
# API 请求超时秒config/env_parser.py -> api.timeout_sec
API_TIMEOUT=20
# API 分页大小config/env_parser.py -> api.page_size
@@ -40,6 +40,10 @@ PIPELINE_FLOW=FULL
# 指定任务列表逗号分隔覆盖默认config/env_parser.py -> run.tasks
# RUN_TASKS=INIT_ODS_SCHEMA,MANUAL_INGEST
# 固定回溯窗口(可选):同时设置 WINDOW_START + WINDOW_END将覆盖游标/当前时间窗口
# WINDOW_START=2025-07-01 00:00:00
# WINDOW_END=2025-08-01 00:00:00
# 窗口/补偿参数config/env_parser.py -> run.*
OVERLAP_SECONDS=120
WINDOW_BUSY_MIN=30

View File

@@ -8,6 +8,8 @@ import requests
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry
from api.endpoint_routing import plan_calls
DEFAULT_BROWSER_HEADERS = {
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json",
@@ -142,7 +144,7 @@ class APIClient:
raise ValueError(f"API 返回错误 code={code} msg={msg}")
# ------------------------------------------------------------------ 分页
def iter_paginated(
def _iter_paginated_single(
self,
endpoint: str,
params: dict | None,
@@ -155,8 +157,7 @@ class APIClient:
page_end: int | None = None,
) -> Iterable[tuple[int, list, dict, dict]]:
"""
分页迭代器:逐页拉取数据并产出 (page_no, records, request_params, raw_response)
page_size=None 时不附带分页参数,仅拉取一次。
单一 endpoint 的分页迭代器(不包含 recent/former 路由逻辑)
"""
base_params = dict(params or {})
page = page_start
@@ -183,6 +184,42 @@ class APIClient:
page += 1
def iter_paginated(
self,
endpoint: str,
params: dict | None,
page_size: int | None = 200,
page_field: str = "page",
size_field: str = "limit",
data_path: tuple = ("data",),
list_key: str | Sequence[str] | None = None,
page_start: int = 1,
page_end: int | None = None,
) -> Iterable[tuple[int, list, dict, dict]]:
"""
分页迭代器:逐页拉取数据并产出 (page_no, records, request_params, raw_response)。
page_size=None 时不附带分页参数,仅拉取一次。
"""
# recent/former 路由:当 params 带时间范围字段时按“3个月自然月”边界决定走哪个 endpoint
# 跨越边界则拆分为两段请求并顺序产出,确保调用方使用 page_no 命名文件时不会被覆盖。
call_plan = plan_calls(endpoint, params)
global_page = 1
for call in call_plan:
for _, records, request_params, payload in self._iter_paginated_single(
endpoint=call.endpoint,
params=call.params,
page_size=page_size,
page_field=page_field,
size_field=size_field,
data_path=data_path,
list_key=list_key,
page_start=page_start,
page_end=page_end,
):
yield global_page, records, request_params, payload
global_page += 1
def get_paginated(
self,
endpoint: str,

View File

@@ -0,0 +1,166 @@
# -*- coding: utf-8 -*-
"""
“近期记录 / 历史记录(Former)”接口路由规则。
需求:
- 当请求参数包含可定义时间范围的字段时,根据当前时间(北京时间/上海时区)判断:
- 3个月自然月之前 -> 使用“历史记录”接口
- 3个月以内 -> 使用“近期记录”接口
- 若时间范围跨越边界 -> 拆分为两段分别请求并合并(由上层分页迭代器顺序产出)
"""
from __future__ import annotations
from dataclasses import dataclass
from datetime import datetime
from typing import Optional
from dateutil import parser as dtparser
from dateutil.relativedelta import relativedelta
from zoneinfo import ZoneInfo
ROUTING_TZ = ZoneInfo("Asia/Shanghai")
RECENT_MONTHS = 3
# 按 `fetch-test/recent_vs_former_report.md` 更新(“无”表示没有历史接口;相同 path 表示同一个接口可查历史)
RECENT_TO_FORMER_OVERRIDES: dict[str, str | None] = {
"/AssistantPerformance/GetAbolitionAssistant": None,
"/Site/GetSiteTableUseDetails": "/Site/GetSiteTableUseDetails",
"/GoodsStockManage/QueryGoodsOutboundReceipt": "/GoodsStockManage/QueryFormerGoodsOutboundReceipt",
"/Promotion/GetOfflineCouponConsumePageList": "/Promotion/GetOfflineCouponConsumePageList",
"/Order/GetRefundPayLogList": None,
# 已知特殊
"/Site/GetAllOrderSettleList": "/Site/GetFormerOrderSettleList",
"/PayLog/GetPayLogListPage": "/PayLog/GetFormerPayLogListPage",
}
TIME_WINDOW_KEYS: tuple[tuple[str, str], ...] = (
("startTime", "endTime"),
("rangeStartTime", "rangeEndTime"),
("StartPayTime", "EndPayTime"),
)
@dataclass(frozen=True)
class WindowSpec:
start_key: str
end_key: str
start: datetime
end: datetime
@dataclass(frozen=True)
class RoutedCall:
endpoint: str
params: dict
def is_former_endpoint(endpoint: str) -> bool:
return "Former" in str(endpoint or "")
def _parse_dt(value: object, tz: ZoneInfo) -> datetime | None:
if value is None:
return None
s = str(value).strip()
if not s:
return None
dt = dtparser.parse(s)
if dt.tzinfo is None:
return dt.replace(tzinfo=tz)
return dt.astimezone(tz)
def _fmt_dt(dt: datetime, tz: ZoneInfo) -> str:
return dt.astimezone(tz).strftime("%Y-%m-%d %H:%M:%S")
def extract_window_spec(params: dict | None, tz: ZoneInfo = ROUTING_TZ) -> WindowSpec | None:
if not isinstance(params, dict) or not params:
return None
for start_key, end_key in TIME_WINDOW_KEYS:
if start_key in params or end_key in params:
start = _parse_dt(params.get(start_key), tz)
end = _parse_dt(params.get(end_key), tz)
if start and end:
return WindowSpec(start_key=start_key, end_key=end_key, start=start, end=end)
return None
def derive_former_endpoint(recent_endpoint: str) -> str | None:
endpoint = str(recent_endpoint or "").strip()
if not endpoint:
return None
if endpoint in RECENT_TO_FORMER_OVERRIDES:
return RECENT_TO_FORMER_OVERRIDES[endpoint]
if is_former_endpoint(endpoint):
return endpoint
idx = endpoint.find("Get")
if idx == -1:
return endpoint
return f"{endpoint[:idx]}GetFormer{endpoint[idx + 3:]}"
def recent_boundary(now: datetime, months: int = RECENT_MONTHS) -> datetime:
"""
3个月自然月边界取 (now - months) 所在月份的 1 号 00:00:00。
"""
if now.tzinfo is None:
raise ValueError("now 必须为时区时间")
base = now - relativedelta(months=months)
return base.replace(day=1, hour=0, minute=0, second=0, microsecond=0)
def plan_calls(
endpoint: str,
params: dict | None,
*,
now: datetime | None = None,
tz: ZoneInfo = ROUTING_TZ,
months: int = RECENT_MONTHS,
) -> list[RoutedCall]:
"""
根据 endpoint + params 的时间窗口,返回要调用的 endpoint/params 列表(可能拆分为两段)。
"""
base_params = dict(params or {})
if not base_params:
return [RoutedCall(endpoint=endpoint, params=base_params)]
# 若调用方显式传了 Former 接口,则不二次路由。
if is_former_endpoint(endpoint):
return [RoutedCall(endpoint=endpoint, params=base_params)]
window = extract_window_spec(base_params, tz)
if not window:
return [RoutedCall(endpoint=endpoint, params=base_params)]
former_endpoint = derive_former_endpoint(endpoint)
if former_endpoint is None or former_endpoint == endpoint:
return [RoutedCall(endpoint=endpoint, params=base_params)]
now_dt = (now or datetime.now(tz)).astimezone(tz)
boundary = recent_boundary(now_dt, months=months)
start, end = window.start, window.end
if end <= boundary:
return [RoutedCall(endpoint=former_endpoint, params=base_params)]
if start >= boundary:
return [RoutedCall(endpoint=endpoint, params=base_params)]
# 跨越边界:拆分两段(老数据 -> former新数据 -> recent
p1 = dict(base_params)
p1[window.start_key] = _fmt_dt(start, tz)
p1[window.end_key] = _fmt_dt(boundary, tz)
p2 = dict(base_params)
p2[window.start_key] = _fmt_dt(boundary, tz)
p2[window.end_key] = _fmt_dt(end, tz)
return [RoutedCall(endpoint=former_endpoint, params=p1), RoutedCall(endpoint=endpoint, params=p2)]

View File

@@ -20,6 +20,10 @@ class LocalJsonClient:
if not self.base_dir.exists():
raise FileNotFoundError(f"JSON 目录不存在: {self.base_dir}")
def get_source_hint(self, endpoint: str) -> str:
"""Return the JSON file path for this endpoint (for source_file lineage)."""
return str(self.base_dir / endpoint_to_filename(endpoint))
def iter_paginated(
self,
endpoint: str,

View File

@@ -7,6 +7,7 @@ from pathlib import Path
from typing import Any, Iterable, Tuple
from api.client import APIClient
from api.endpoint_routing import plan_calls
from utils.json_store import dump_json, endpoint_to_filename
@@ -33,6 +34,10 @@ class RecordingAPIClient:
self.last_dump: dict[str, Any] | None = None
# ------------------------------------------------------------------ public API
def get_source_hint(self, endpoint: str) -> str:
"""Return the JSON dump path for this endpoint (for source_file lineage)."""
return str(self.output_dir / endpoint_to_filename(endpoint))
def iter_paginated(
self,
endpoint: str,
@@ -99,11 +104,18 @@ class RecordingAPIClient:
):
filename = endpoint_to_filename(endpoint)
path = self.output_dir / filename
routing_calls = []
try:
for call in plan_calls(endpoint, params):
routing_calls.append({"endpoint": call.endpoint, "params": call.params})
except Exception:
routing_calls = []
payload = {
"task_code": self.task_code,
"run_id": self.run_id,
"endpoint": endpoint,
"params": params or {},
"endpoint_routing": {"calls": routing_calls} if routing_calls else None,
"page_size": page_size,
"pages": pages,
"total_records": total_records,

View File

@@ -40,6 +40,23 @@ def parse_args():
parser.add_argument("--api-timeout", type=int, help="API超时(秒)")
parser.add_argument("--api-page-size", type=int, help="分页大小")
parser.add_argument("--api-retry-max", type=int, help="API重试最大次数")
# 回溯/手动窗口
parser.add_argument(
"--window-start",
dest="window_start",
help="固定时间窗口开始优先级高于游标例如2025-07-01 00:00:00",
)
parser.add_argument(
"--window-end",
dest="window_end",
help="固定时间窗口结束(优先级高于游标,推荐用月末+1例如2025-08-01 00:00:00",
)
parser.add_argument(
"--force-window-override",
action="store_true",
help="强制使用 window_start/window_end不走 MAX(fetched_at) 兜底",
)
# 目录参数
parser.add_argument("--export-root", help="导出根目录")
@@ -108,6 +125,16 @@ def build_cli_overrides(args) -> dict:
if args.write_pretty_json:
overrides.setdefault("io", {})["write_pretty_json"] = True
# 回溯/手动窗口
if args.window_start or args.window_end:
overrides.setdefault("run", {}).setdefault("window_override", {})
if args.window_start:
overrides["run"]["window_override"]["start"] = args.window_start
if args.window_end:
overrides["run"]["window_override"]["end"] = args.window_end
if args.force_window_override:
overrides.setdefault("run", {})["force_window_override"] = True
# 运行窗口
if args.idle_start:
overrides.setdefault("run", {}).setdefault("idle_window", {})["start"] = args.idle_start

View File

@@ -40,6 +40,8 @@ ENV_MAP = {
"IDLE_WINDOW_END": ("run.idle_window.end",),
"ALLOW_EMPTY_RESULT_ADVANCE": ("run.allow_empty_result_advance",),
"ALLOW_EMPTY_ADVANCE": ("run.allow_empty_result_advance",),
"WINDOW_START": ("run.window_override.start",),
"WINDOW_END": ("run.window_override.end",),
"PIPELINE_FLOW": ("pipeline.flow",),
"JSON_FETCH_ROOT": ("pipeline.fetch_root",),
"JSON_SOURCE_DIR": ("pipeline.ingest_source_dir",),

View File

@@ -25,46 +25,54 @@ class DatabaseOperations:
use_returning = "RETURNING" in sql.upper()
with self.conn.cursor() as c:
if not use_returning:
# 不带 RETURNING直接批量执行即可
if not use_returning:
with self.conn.cursor() as c:
psycopg2.extras.execute_batch(c, sql, rows, page_size=page_size)
return (0, 0)
# 尝试向量化执行
return (0, 0)
# 尝试向量化执行execute_values + fetch returning
vectorized_failed = False
m = re.search(r"VALUES\s*\((.*?)\)", sql, flags=re.IGNORECASE | re.DOTALL)
if m:
tpl = "(" + m.group(1) + ")"
base_sql = sql[:m.start()] + "VALUES %s" + sql[m.end():]
try:
m = re.search(r"VALUES\s*\((.*?)\)", sql, flags=re.IGNORECASE | re.DOTALL)
if m:
tpl = "(" + m.group(1) + ")"
base_sql = sql[:m.start()] + "VALUES %s" + sql[m.end():]
with self.conn.cursor() as c:
ret = psycopg2.extras.execute_values(
c, base_sql, rows, template=tpl, page_size=page_size, fetch=True
)
if not ret:
return (0, 0)
inserted = sum(1 for rec in ret if self._is_inserted(rec))
return (inserted, len(ret) - inserted)
if not ret:
return (0, 0)
inserted = sum(1 for rec in ret if self._is_inserted(rec))
return (inserted, len(ret) - inserted)
except Exception:
# 向量化失败后,事务通常处于 aborted 状态,需要先 rollback 才能继续执行。
vectorized_failed = True
if vectorized_failed:
try:
self.conn.rollback()
except Exception:
pass
# 回退:逐行执行
inserted = 0
updated = 0
# 回退:逐行执行
inserted = 0
updated = 0
with self.conn.cursor() as c:
for r in rows:
c.execute(sql, r)
try:
rec = c.fetchone()
except Exception:
rec = None
if self._is_inserted(rec):
inserted += 1
else:
updated += 1
return (inserted, updated)
return (inserted, updated)
@staticmethod
def _is_inserted(rec) -> bool:

View File

@@ -0,0 +1,50 @@
-- DWS schema for aggregated / serving tables.
CREATE SCHEMA IF NOT EXISTS billiards_dws;
CREATE TABLE IF NOT EXISTS billiards_dws.dws_order_summary (
site_id BIGINT NOT NULL,
order_settle_id BIGINT NOT NULL,
order_trade_no TEXT,
order_date DATE,
tenant_id BIGINT,
member_id BIGINT,
member_flag BOOLEAN,
recharge_order_flag BOOLEAN,
item_count INT,
total_item_quantity NUMERIC,
table_fee_amount NUMERIC,
assistant_service_amount NUMERIC,
goods_amount NUMERIC,
group_amount NUMERIC,
total_coupon_deduction NUMERIC,
member_discount_amount NUMERIC,
manual_discount_amount NUMERIC,
order_original_amount NUMERIC,
order_final_amount NUMERIC,
stored_card_deduct NUMERIC,
external_paid_amount NUMERIC,
total_paid_amount NUMERIC,
book_table_flow NUMERIC,
book_assistant_flow NUMERIC,
book_goods_flow NUMERIC,
book_group_flow NUMERIC,
book_order_flow NUMERIC,
order_effective_consume_cash NUMERIC,
order_effective_recharge_cash NUMERIC,
order_effective_flow NUMERIC,
refund_amount NUMERIC,
net_income NUMERIC,
created_at TIMESTAMPTZ DEFAULT now(),
updated_at TIMESTAMPTZ DEFAULT now(),
PRIMARY KEY (site_id, order_settle_id)
);
CREATE INDEX IF NOT EXISTS idx_dws_order_summary_order_date
ON billiards_dws.dws_order_summary (order_date);
CREATE INDEX IF NOT EXISTS idx_dws_order_summary_tenant_date
ON billiards_dws.dws_order_summary (tenant_id, order_date);
CREATE INDEX IF NOT EXISTS idx_dws_order_summary_member_date
ON billiards_dws.dws_order_summary (member_id, order_date);

View File

@@ -8,28 +8,30 @@ WITH target_store AS (
),
task_codes AS (
SELECT unnest(ARRAY[
'assistant_accounts_masterS',
'assistant_service_records',
'assistant_cancellation_records',
'goods_stock_movements',
'ODS_INVENTORY_STOCK',
'ODS_PACKAGE',
'ODS_GROUP_BUY_REDEMPTION',
'ODS_MEMBER',
'ODS_MEMBER_BALANCE',
'member_stored_value_cards',
-- Must match tasks/ods_tasks.py (ENABLED_ODS_CODES)
'ODS_ASSISTANT_ACCOUNT',
'ODS_ASSISTANT_LEDGER',
'ODS_ASSISTANT_ABOLISH',
'ODS_SETTLEMENT_RECORDS',
'ODS_TABLE_USE',
'ODS_PAYMENT',
'ODS_REFUND',
'platform_coupon_redemption_records',
'recharge_settlements',
'ODS_PLATFORM_COUPON',
'ODS_MEMBER',
'ODS_MEMBER_CARD',
'ODS_MEMBER_BALANCE',
'ODS_RECHARGE_SETTLE',
'ODS_GROUP_PACKAGE',
'ODS_GROUP_BUY_REDEMPTION',
'ODS_INVENTORY_STOCK',
'ODS_INVENTORY_CHANGE',
'ODS_TABLES',
'ODS_GOODS_CATEGORY',
'ODS_STORE_GOODS',
'table_fee_discount_records',
'ODS_STORE_GOODS_SALES',
'ODS_TABLE_FEE_DISCOUNT',
'ODS_TENANT_GOODS',
'ODS_SETTLEMENT_TICKET',
'settlement_records',
'INIT_ODS_SCHEMA'
'ODS_SETTLEMENT_TICKET'
]) AS task_code
)
INSERT INTO etl_admin.etl_task (task_code, store_id, enabled)

View File

@@ -0,0 +1,49 @@
-- Seed scheduler-compatible tasks into etl_admin.etl_task.
--
-- Notes:
-- - These task_code values must match orchestration/task_registry.py.
-- - ODS_* tasks are intentionally excluded here because they don't follow the
-- BaseTask(cursor_data) scheduler interface in this repo version.
--
-- Usage (example):
-- psql "%PG_DSN%" -f etl_billiards/database/seed_scheduler_tasks.sql
--
WITH target_store AS (
SELECT 2790685415443269::bigint AS store_id -- TODO: replace with your store_id
),
task_codes AS (
SELECT unnest(ARRAY[
'ASSISTANT_ABOLISH',
'ASSISTANTS',
'COUPON_USAGE',
'CHECK_CUTOFF',
'DWD_LOAD_FROM_ODS',
'DWD_QUALITY_CHECK',
'INIT_DWD_SCHEMA',
'INIT_DWS_SCHEMA',
'INIT_ODS_SCHEMA',
'INVENTORY_CHANGE',
'LEDGER',
'MANUAL_INGEST',
'MEMBERS',
'MEMBERS_DWD',
'ODS_JSON_ARCHIVE',
'ORDERS',
'PACKAGES_DEF',
'PAYMENTS',
'PAYMENTS_DWD',
'PRODUCTS',
'REFUNDS',
'TABLE_DISCOUNT',
'TABLES',
'TICKET_DWD',
'TOPUPS',
'DWS_BUILD_ORDER_SUMMARY'
]) AS task_code
)
INSERT INTO etl_admin.etl_task (task_code, store_id, enabled)
SELECT t.task_code, s.store_id, TRUE
FROM task_codes t CROSS JOIN target_store s
ON CONFLICT (task_code, store_id) DO UPDATE
SET enabled = EXCLUDED.enabled,
updated_at = now();

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,585 @@
# -*- coding: utf-8 -*-
"""生成 2025年10-12月 助教排行榜 + 助教详情表CSV + MD
输出目录etl_billiards/docs/table_2025-12-19
注意:客户流水/充值归因涉及“多助教/多订单命中”时按全额复制计入,会导致助教汇总>门店汇总,表格说明会写明。
"""
from __future__ import annotations
import csv
import re
from dataclasses import dataclass
from decimal import Decimal
from pathlib import Path
from statistics import median
from typing import Any
import psycopg2
import psycopg2.extras
SITE_ID = 2790685415443269
TZ = "Asia/Shanghai"
WIN_OCT = ("2025-10-01 00:00:00+08", "2025-11-01 00:00:00+08")
WIN_NOV = ("2025-11-01 00:00:00+08", "2025-12-01 00:00:00+08")
WIN_DEC = ("2025-12-01 00:00:00+08", "2026-01-01 00:00:00+08")
WIN_ALL = (WIN_OCT[0], WIN_DEC[1])
MONTHS = [
("2025-10", "10月", WIN_OCT),
("2025-11", "11月", WIN_NOV),
("2025-12", "12月", WIN_DEC),
]
REPO_ROOT = Path(__file__).resolve().parents[3]
ENV_PATH = REPO_ROOT / "etl_billiards" / ".env"
OUT_DIR = Path(__file__).resolve().parent
@dataclass(frozen=True)
class SqlBlock:
title: str
sql: str
def read_pg_dsn() -> str:
text = ENV_PATH.read_text(encoding="utf-8")
m = re.search(r"^PG_DSN=(.+)$", text, re.M)
if not m:
raise RuntimeError(f"未在 {ENV_PATH} 中找到 PG_DSN")
return m.group(1).strip()
def conn():
return psycopg2.connect(read_pg_dsn(), connect_timeout=10)
def sanitize_filename(name: str) -> str:
name = name.strip()
name = re.sub(r"[<>:\"/\\|?*]+", "_", name)
name = re.sub(r"\s+", " ", name)
return name
def d(v: Any) -> Decimal:
if v is None:
return Decimal("0")
if isinstance(v, Decimal):
return v
return Decimal(str(v))
def fmt_money(v: Any) -> str:
return f"{d(v):.2f}"
def fmt_hours(v: Any, digits: int = 2) -> str:
q = Decimal("1").scaleb(-digits)
return f"{d(v).quantize(q):f}h"
def write_csv(path: Path, title: str, description: str, header_rows: list[list[str]], rows: list[list[Any]]) -> None:
path.parent.mkdir(parents=True, exist_ok=True)
with path.open("w", newline="", encoding="utf-8") as f:
w = csv.writer(f)
w.writerow([title])
w.writerow([description])
w.writerow([])
for hr in header_rows:
w.writerow(hr)
for r in rows:
w.writerow(["" if v is None else v for v in r])
def write_csv_sections(path: Path, title: str, description: str, section_rows: list[list[Any]]) -> None:
path.parent.mkdir(parents=True, exist_ok=True)
with path.open("w", newline="", encoding="utf-8") as f:
w = csv.writer(f)
w.writerow([title])
w.writerow([description])
w.writerow([])
for r in section_rows:
w.writerow(["" if v is None else v for v in r])
def write_md(path: Path, title: str, thinking: str, description: str, sql_blocks: list[SqlBlock]) -> None:
parts: list[str] = []
parts.append(f"# {title}\n")
parts.append("## 思考过程\n")
parts.append(thinking.strip() + "\n")
parts.append("\n## 查询说明\n")
parts.append(description.strip() + "\n")
parts.append("\n## SQL\n")
for b in sql_blocks:
parts.append(f"\n### {b.title}\n")
parts.append("```sql\n")
parts.append(b.sql.strip() + "\n")
parts.append("```\n")
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text("".join(parts), encoding="utf-8")
def fetch_all(cur, sql: str, params: dict[str, Any]) -> list[dict[str, Any]]:
cur.execute(sql, params)
return list(cur.fetchall())
def month_case(ts_expr: str) -> str:
parts = []
for month_key, _, (ws, we) in MONTHS:
parts.append(
f"when {ts_expr} >= '{ws}'::timestamptz and {ts_expr} < '{we}'::timestamptz then '{month_key}'"
)
return "case " + " ".join(parts) + " else null end"
def sql_order_base(window_start: str, window_end: str) -> str:
return f"""
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '{window_start}'::timestamptz
and tfl.start_use_time < '{window_end}'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
"""
def dense_rank_desc(values: dict[str, Decimal]) -> dict[str, int]:
uniq = sorted({v for v in values.values() if v > 0}, reverse=True)
rank_map = {v: i + 1 for i, v in enumerate(uniq)}
return {k: rank_map.get(v, 0) for k, v in values.items()}
def calc_diff(all_values: dict[str, Decimal], current: Decimal) -> tuple[Decimal, Decimal]:
xs = [v for v in all_values.values() if v > 0]
if not xs or current <= 0:
return Decimal("0"), Decimal("0")
avg = sum(xs) / Decimal(len(xs))
med = Decimal(str(median([float(v) for v in xs])))
return current - avg, current - med
def main() -> None:
OUT_DIR.mkdir(parents=True, exist_ok=True)
with conn() as c, c.cursor(cursor_factory=psycopg2.extras.RealDictCursor) as cur:
assistants_rows = fetch_all(
cur,
"""
select distinct nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
order by assistant;
""",
{"site_id": SITE_ID, "window_start": WIN_ALL[0], "window_end": WIN_ALL[1]},
)
assistants = [r["assistant"] for r in assistants_rows if r.get("assistant")]
# 助教-客户-月份:服务时长
sql_svc = f"""
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
{month_case('asl.start_use_time')} as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
"""
svc_rows = fetch_all(cur, sql_svc, {"site_id": SITE_ID, "window_start": WIN_ALL[0], "window_end": WIN_ALL[1]})
# 助教-客户-月份:客户流水
sql_rev = sql_order_base(WIN_ALL[0], WIN_ALL[1]) + f"""
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
{month_case('o.order_start_time')} as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
"""
rev_rows = fetch_all(cur, sql_rev, {"site_id": SITE_ID, "window_start": WIN_ALL[0], "window_end": WIN_ALL[1]})
# 助教-客户-月份:充值归因
sql_rech = f"""
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
{month_case('m.pay_time')} as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
"""
rech_rows = fetch_all(cur, sql_rech, {"site_id": SITE_ID, "window_start": WIN_ALL[0], "window_end": WIN_ALL[1]})
# 汇总:月度助教指标
svc_map = {mk: {a: {"base": Decimal('0'), "extra": Decimal('0')} for a in assistants} for mk,_,_ in MONTHS}
for r in svc_rows:
mk = r["month_key"]; a = r["assistant"]
if mk in svc_map and a in svc_map[mk]:
svc_map[mk][a]["base"] += d(r["base_hours"])
svc_map[mk][a]["extra"] += d(r["extra_hours"])
revenue_map = {mk: {a: Decimal('0') for a in assistants} for mk,_,_ in MONTHS}
for r in rev_rows:
mk = r["month_key"]; a = r["assistant"]
if mk in revenue_map and a in revenue_map[mk]:
revenue_map[mk][a] += d(r["revenue_amount"])
recharge_map = {mk: {a: Decimal('0') for a in assistants} for mk,_,_ in MONTHS}
for r in rech_rows:
mk = r["month_key"]; a = r["assistant"]
if mk in recharge_map and a in recharge_map[mk]:
recharge_map[mk][a] += d(r["recharge_amount"])
# ====== 输出4张排行榜 ======
def write_rank(file_stem: str, title: str, desc: str, rows: list[list[Any]]):
write_csv(OUT_DIR / f"{file_stem}.csv", title, desc, [["月份", "排名", "助教昵称", "指标"]], rows)
write_md(OUT_DIR / f"{file_stem}.md", title, "按月聚合并做dense_rank排名。", desc, [])
rows = []
for mk,_,_ in MONTHS:
values = {a: svc_map[mk][a]["base"] for a in assistants}
ranks = dense_rank_desc(values)
for a in sorted(assistants, key=lambda x: (ranks[x] if ranks[x] else 999999, x)):
v = values[a]
if v > 0:
rows.append([mk, ranks[a], a, fmt_hours(v, 2)])
write_rank(
"助教_基础课时长排行_2025年10-12月",
"2025年10-12月 助教基础课时长排行榜",
"口径order_assistant_type=1时长=income_seconds/3600小时按月排名。",
rows,
)
rows = []
for mk,_,_ in MONTHS:
values = {a: svc_map[mk][a]["extra"] for a in assistants}
ranks = dense_rank_desc(values)
for a in sorted(assistants, key=lambda x: (ranks[x] if ranks[x] else 999999, x)):
v = values[a]
if v > 0:
rows.append([mk, ranks[a], a, fmt_hours(v, 2)])
write_rank(
"助教_附加课时长排行_2025年10-12月",
"2025年10-12月 助教附加课(超休)时长排行榜",
"口径order_assistant_type=2超休时长=income_seconds/3600小时按月排名。",
rows,
)
rows = []
for mk,_,_ in MONTHS:
values = revenue_map[mk]
ranks = dense_rank_desc(values)
for a in sorted(assistants, key=lambda x: (ranks[x] if ranks[x] else 999999, x)):
v = values[a]
if v > 0:
rows.append([mk, ranks[a], a, fmt_money(v)])
write_rank(
"助教_客户流水排行_2025年10-12月",
"2025年10-12月 助教客户流水排行榜(全额复制口径)",
"口径:客户流水=台费+助教+商品应付金额按订单归集后,全额计入订单内每位助教;多助教会导致汇总>门店总额。",
rows,
)
rows = []
for mk,_,_ in MONTHS:
values = recharge_map[mk]
ranks = dense_rank_desc(values)
for a in sorted(assistants, key=lambda x: (ranks[x] if ranks[x] else 999999, x)):
v = values[a]
if v > 0:
rows.append([mk, ranks[a], a, fmt_money(v)])
write_rank(
"助教_客户充值归因排行_2025年10-12月",
"2025年10-12月 助教客户充值归因排行榜(全额复制口径)",
"口径:充值支付(dwd_payment.relate_type=5)在消费窗口±30分钟内命中且订单有助教则全额计入助教多助教/多订单命中会重复计入。",
rows,
)
# ====== 输出助教详情(每人一份) ======
# 会员昵称
cur.execute("select member_id, nickname from billiards_dwd.dim_member where scd2_is_current=1")
member_name = {r["member_id"]: (r.get("nickname") or "") for r in cur.fetchall()}
# 索引assistant->member->month
svc_idx = {a: {} for a in assistants}
for r in svc_rows:
a = r["assistant"]; mid = int(r["member_id"]); mk = r["month_key"]
svc_idx.setdefault(a, {}).setdefault(mid, {})[mk] = {"base": d(r["base_hours"]), "extra": d(r["extra_hours"])}
rev_idx = {a: {} for a in assistants}
for r in rev_rows:
a = r["assistant"]; mid = int(r["member_id"]); mk = r["month_key"]
rev_idx.setdefault(a, {}).setdefault(mid, {})[mk] = d(r["revenue_amount"])
rech_idx = {a: {} for a in assistants}
for r in rech_rows:
a = r["assistant"]; mid = int(r["member_id"]); mk = r["month_key"]
rech_idx.setdefault(a, {}).setdefault(mid, {})[mk] = d(r["recharge_amount"])
for a in assistants:
safe = sanitize_filename(a)
csv_path = OUT_DIR / f"助教详情_{safe}.csv"
md_path = OUT_DIR / f"助教详情_{safe}.md"
# 评价(简短)
base_total = sum((svc_map[mk][a]["base"] for mk,_,_ in MONTHS), Decimal('0'))
extra_total = sum((svc_map[mk][a]["extra"] for mk,_,_ in MONTHS), Decimal('0'))
rev_total = sum((revenue_map[mk][a] for mk,_,_ in MONTHS), Decimal('0'))
rech_total = sum((recharge_map[mk][a] for mk,_,_ in MONTHS), Decimal('0'))
# 头部客户 Top100按12月消费业绩
members = set(rev_idx.get(a, {}).keys()) | set(svc_idx.get(a, {}).keys()) | set(rech_idx.get(a, {}).keys())
def rev_dec(mid: int) -> Decimal:
return rev_idx.get(a, {}).get(mid, {}).get('2025-12', Decimal('0'))
top_members = sorted(members, key=lambda mid: rev_dec(mid), reverse=True)[:100]
top3 = ''.join([(member_name.get(mid) or str(mid)) for mid in top_members[:3]])
assistant_review = (
f"评价:基础{fmt_hours(base_total,1)},附加{fmt_hours(extra_total,1)}"
f"客户流水¥{rev_total:.2f},充值归因¥{rech_total:.2f}"
f"头部客户(12月)Top3{top3 or ''}"
)
# Part1-4
part1=[]; part2=[]; part3=[]; part4=[]
for mk, mcn, _ in MONTHS:
base_v = svc_map[mk][a]["base"]
extra_v = svc_map[mk][a]["extra"]
rev_v = revenue_map[mk][a]
rech_v = recharge_map[mk][a]
base_all = {x: svc_map[mk][x]["base"] for x in assistants}
extra_all = {x: svc_map[mk][x]["extra"] for x in assistants}
rev_all = {x: revenue_map[mk][x] for x in assistants}
rech_all = {x: recharge_map[mk][x] for x in assistants}
base_rank = dense_rank_desc(base_all).get(a, 0)
extra_rank = dense_rank_desc(extra_all).get(a, 0)
rev_rank = dense_rank_desc(rev_all).get(a, 0)
rech_rank = dense_rank_desc(rech_all).get(a, 0)
base_da, base_dm = calc_diff(base_all, base_v)
extra_da, extra_dm = calc_diff(extra_all, extra_v)
rev_da, rev_dm = calc_diff(rev_all, rev_v)
rech_da, rech_dm = calc_diff(rech_all, rech_v)
part1.append([mcn, fmt_hours(base_v,2), base_rank or "", fmt_hours(base_da,2), fmt_hours(base_dm,2)])
part2.append([mcn, fmt_hours(extra_v,2), extra_rank or "", fmt_hours(extra_da,2), fmt_hours(extra_dm,2)])
part3.append([mcn, fmt_money(rev_v), rev_rank or "", fmt_money(rev_da), fmt_money(rev_dm)])
part4.append([mcn, fmt_money(rech_v), rech_rank or "", fmt_money(rech_da), fmt_money(rech_dm)])
# Part5 rows
part5=[]
for i, mid in enumerate(top_members, start=1):
def h_pair(month_key: str) -> str:
v = svc_idx.get(a, {}).get(mid, {}).get(month_key, {})
return f"{fmt_hours(v.get('base',Decimal('0')),1)} / {fmt_hours(v.get('extra',Decimal('0')),1)}"
def rev_m(month_key: str) -> Decimal:
return rev_idx.get(a, {}).get(mid, {}).get(month_key, Decimal('0'))
def rech_m(month_key: str) -> Decimal:
return rech_idx.get(a, {}).get(mid, {}).get(month_key, Decimal('0'))
name = member_name.get(mid) or str(mid)
part5.append([
i,
name,
h_pair('2025-12'), fmt_money(rev_m('2025-12')), fmt_money(rech_m('2025-12')),
h_pair('2025-11'), fmt_money(rev_m('2025-11')), fmt_money(rech_m('2025-11')),
h_pair('2025-10'), fmt_money(rev_m('2025-10')), fmt_money(rech_m('2025-10')),
])
title = f"助教详情:{a}2025年10-12月"
desc = (
"本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。"
"均值/中位数差值对比集合为当月该指标>0的助教。"
"充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。"
)
rows=[]
rows += [["一、基础课业绩"], ["说明:" + assistant_review], []]
rows += [["月份", "基础课业绩", "基础课业绩", "基础课业绩", "基础课业绩"], ["月份", "小时数", "排名", "平均值差值小时数", "中位数值差值小时数"]]
rows += part1
rows += [[], ["二、附加课业绩"], ["说明:附加课=order_assistant_type=2。"], []]
rows += [["月份", "附加课业绩", "附加课业绩", "附加课业绩", "附加课业绩"], ["月份", "小时数", "排名", "平均值差值小时数", "中位数值差值小时数"]]
rows += part2
rows += [[], ["三、客户消费业绩"], ["说明:订单台费+助教+商品应付金额全额计入订单内助教。"], []]
rows += [["月份", "客户消费业绩", "客户消费业绩", "客户消费业绩", "客户消费业绩"], ["月份", "合计元", "排名", "平均值差值元", "中位数值差值元"]]
rows += part3
rows += [[], ["四、客户充值业绩"], ["说明充值命中消费窗口±30分钟且有助教则归因全额复制。"], []]
rows += [["月份", "客户充值业绩", "客户充值业绩", "客户充值业绩", "客户充值业绩"], ["月份", "合计元", "排名", "平均值差值元", "中位数值差值元"]]
rows += part4
rows += [[], ["五、头部客户按12月消费业绩排序Top100"], ["说明:基础/附加课时=基础h/附加h。"], []]
rows += [["排名", "客户名称", "12月", "12月", "12月", "11月", "11月", "11月", "10月", "10月", "10月"],
["排名", "客户名称", "基础/附加课时", "消费业绩(元)", "客户充值(元)", "基础/附加课时", "消费业绩(元)", "客户充值(元)", "基础/附加课时", "消费业绩(元)", "客户充值(元)"]]
rows += part5
write_csv_sections(csv_path, title, desc, rows)
write_md(
md_path,
title,
"按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。",
desc + "\n" + assistant_review,
[
SqlBlock("服务时长(助教-客户-月份)", sql_svc),
SqlBlock("客户流水(助教-客户-月份)", sql_rev),
SqlBlock("充值归因(助教-客户-月份)", sql_rech),
],
)
print(f"完成:{OUT_DIR}")
if __name__ == "__main__":
main()

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,73 @@
2025年10-12月 助教基础课时长排行榜
口径order_assistant_type=1时长=income_seconds/3600小时按月排名。
月份,排名,助教昵称,指标
2025-10,1,佳怡,139.55h
2025-10,2,璇子,120.20h
2025-10,3,婉婉,90.68h
2025-10,4,七七,64.70h
2025-10,5,小柔,63.87h
2025-10,6,球球,57.45h
2025-10,7,小敌,55.82h
2025-10,8,涛涛,50.13h
2025-10,9,周周,41.33h
2025-10,10,素素,40.45h
2025-10,11,乔西,32.60h
2025-10,12,苏苏,25.15h
2025-10,13,奈千,23.62h
2025-10,14,年糕,21.23h
2025-10,15,欣怡,19.50h
2025-10,16,饭团,16.00h
2025-10,17,Amy,11.97h
2025-10,18,姜姜,6.60h
2025-10,19,希希,5.02h
2025-10,20,悦悦,2.30h
2025-11,1,佳怡,176.25h
2025-11,2,璇子,147.92h
2025-11,3,小燕,109.28h
2025-11,4,Amy,93.53h
2025-11,5,七七,91.90h
2025-11,6,小柔,88.65h
2025-11,7,涛涛,74.40h
2025-11,8,阿清,73.48h
2025-11,9,小敌,72.90h
2025-11,10,周周,71.27h
2025-11,11,球球,66.50h
2025-11,12,婉婉,46.03h
2025-11,13,小侯,42.58h
2025-11,14,千千,38.88h
2025-11,15,年糕,35.80h
2025-11,16,柚子,35.40h
2025-11,17,素素,35.03h
2025-11,18,瑶瑶,34.25h
2025-11,19,奈千,32.83h
2025-11,20,乔西,30.57h
2025-11,21,泡芙,21.38h
2025-11,22,梦梦,19.60h
2025-11,23,苏苏,13.52h
2025-11,24,欣怡,10.33h
2025-11,25,QQ,5.17h
2025-11,26,西子,1.82h
2025-11,27,希希,1.58h
2025-12,1,小燕,159.02h
2025-12,2,佳怡,109.40h
2025-12,3,璇子,90.75h
2025-12,4,七七,77.72h
2025-12,5,阿清,66.45h
2025-12,6,周周,60.02h
2025-12,7,小柔,54.93h
2025-12,8,小侯,49.57h
2025-12,9,球球,48.58h
2025-12,10,涛涛,44.08h
2025-12,11,苏苏,43.90h
2025-12,12,千千,38.28h
2025-12,13,乔西,25.82h
2025-12,14,年糕,25.62h
2025-12,15,瑶瑶,19.48h
2025-12,16,Amy,18.08h
2025-12,17,婉婉,17.83h
2025-12,18,梦梦,16.08h
2025-12,19,素素,9.98h
2025-12,20,小敌,6.40h
2025-12,21,奈千,2.58h
2025-12,22,QQ,1.22h
1 2025年10-12月 助教基础课时长排行榜
2 口径:order_assistant_type=1,时长=income_seconds/3600(小时),按月排名。
3 月份,排名,助教昵称,指标
4 2025-10,1,佳怡,139.55h
5 2025-10,2,璇子,120.20h
6 2025-10,3,婉婉,90.68h
7 2025-10,4,七七,64.70h
8 2025-10,5,小柔,63.87h
9 2025-10,6,球球,57.45h
10 2025-10,7,小敌,55.82h
11 2025-10,8,涛涛,50.13h
12 2025-10,9,周周,41.33h
13 2025-10,10,素素,40.45h
14 2025-10,11,乔西,32.60h
15 2025-10,12,苏苏,25.15h
16 2025-10,13,奈千,23.62h
17 2025-10,14,年糕,21.23h
18 2025-10,15,欣怡,19.50h
19 2025-10,16,饭团,16.00h
20 2025-10,17,Amy,11.97h
21 2025-10,18,姜姜,6.60h
22 2025-10,19,希希,5.02h
23 2025-10,20,悦悦,2.30h
24 2025-11,1,佳怡,176.25h
25 2025-11,2,璇子,147.92h
26 2025-11,3,小燕,109.28h
27 2025-11,4,Amy,93.53h
28 2025-11,5,七七,91.90h
29 2025-11,6,小柔,88.65h
30 2025-11,7,涛涛,74.40h
31 2025-11,8,阿清,73.48h
32 2025-11,9,小敌,72.90h
33 2025-11,10,周周,71.27h
34 2025-11,11,球球,66.50h
35 2025-11,12,婉婉,46.03h
36 2025-11,13,小侯,42.58h
37 2025-11,14,千千,38.88h
38 2025-11,15,年糕,35.80h
39 2025-11,16,柚子,35.40h
40 2025-11,17,素素,35.03h
41 2025-11,18,瑶瑶,34.25h
42 2025-11,19,奈千,32.83h
43 2025-11,20,乔西,30.57h
44 2025-11,21,泡芙,21.38h
45 2025-11,22,梦梦,19.60h
46 2025-11,23,苏苏,13.52h
47 2025-11,24,欣怡,10.33h
48 2025-11,25,QQ,5.17h
49 2025-11,26,西子,1.82h
50 2025-11,27,希希,1.58h
51 2025-12,1,小燕,159.02h
52 2025-12,2,佳怡,109.40h
53 2025-12,3,璇子,90.75h
54 2025-12,4,七七,77.72h
55 2025-12,5,阿清,66.45h
56 2025-12,6,周周,60.02h
57 2025-12,7,小柔,54.93h
58 2025-12,8,小侯,49.57h
59 2025-12,9,球球,48.58h
60 2025-12,10,涛涛,44.08h
61 2025-12,11,苏苏,43.90h
62 2025-12,12,千千,38.28h
63 2025-12,13,乔西,25.82h
64 2025-12,14,年糕,25.62h
65 2025-12,15,瑶瑶,19.48h
66 2025-12,16,Amy,18.08h
67 2025-12,17,婉婉,17.83h
68 2025-12,18,梦梦,16.08h
69 2025-12,19,素素,9.98h
70 2025-12,20,小敌,6.40h
71 2025-12,21,奈千,2.58h
72 2025-12,22,QQ,1.22h

View File

@@ -0,0 +1,31 @@
# 2025年10-12月 助教基础课时长排行榜
## 思考过程
按月汇总助教基础课时长,并用 dense_rank 做排名。
## 查询说明
口径order_assistant_type=1时长=income_seconds/3600小时
## SQL
### 基础课时长(助教+月份汇总)
```sql
with raw as (
select
asl.nickname as assistant,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0)=0
and asl.order_assistant_type=1
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
)
select
assistant,
month_key,
sum(income_seconds)/3600.0 as hours
from raw
where month_key is not null
group by assistant, month_key;
```

View File

@@ -0,0 +1,35 @@
2025年10-12月 助教客户充值归因排行榜(全额复制口径)
口径:充值支付(dwd_payment.relate_type=5)在消费窗口±30分钟内命中且订单有助教则全额计入助教多助教/多订单命中会重复计入。
月份,排名,助教昵称,指标
2025-10,1,璇子,34700.00
2025-10,2,小柔,31700.00
2025-10,3,佳怡,27000.00
2025-10,4,婉婉,24000.00
2025-10,5,小敌,21000.00
2025-10,5,涛涛,21000.00
2025-10,6,奈千,18000.00
2025-10,7,乔西,17000.00
2025-10,8,球球,15000.00
2025-10,9,周周,11000.00
2025-10,10,年糕,9000.00
2025-10,11,七七,6000.00
2025-10,11,素素,6000.00
2025-10,11,苏苏,6000.00
2025-10,12,姜姜,4000.00
2025-10,13,Amy,3000.00
2025-10,13,悦悦,3000.00
2025-10,13,欣怡,3000.00
2025-11,1,佳怡,20000.00
2025-11,2,小柔,11000.00
2025-11,3,璇子,10000.00
2025-11,4,Amy,9000.00
2025-11,4,周周,9000.00
2025-11,4,婉婉,9000.00
2025-11,4,球球,9000.00
2025-11,5,小敌,8000.00
2025-11,6,涛涛,5000.00
2025-11,7,欣怡,4000.00
2025-11,8,乔西,3000.00
2025-11,8,柚子,3000.00
2025-11,9,素素,1000.00
1 2025年10-12月 助教客户充值归因排行榜(全额复制口径)
2 口径:充值支付(dwd_payment.relate_type=5)在消费窗口±30分钟内命中且订单有助教,则全额计入助教;多助教/多订单命中会重复计入。
3 月份,排名,助教昵称,指标
4 2025-10,1,璇子,34700.00
5 2025-10,2,小柔,31700.00
6 2025-10,3,佳怡,27000.00
7 2025-10,4,婉婉,24000.00
8 2025-10,5,小敌,21000.00
9 2025-10,5,涛涛,21000.00
10 2025-10,6,奈千,18000.00
11 2025-10,7,乔西,17000.00
12 2025-10,8,球球,15000.00
13 2025-10,9,周周,11000.00
14 2025-10,10,年糕,9000.00
15 2025-10,11,七七,6000.00
16 2025-10,11,素素,6000.00
17 2025-10,11,苏苏,6000.00
18 2025-10,12,姜姜,4000.00
19 2025-10,13,Amy,3000.00
20 2025-10,13,悦悦,3000.00
21 2025-10,13,欣怡,3000.00
22 2025-11,1,佳怡,20000.00
23 2025-11,2,小柔,11000.00
24 2025-11,3,璇子,10000.00
25 2025-11,4,Amy,9000.00
26 2025-11,4,周周,9000.00
27 2025-11,4,婉婉,9000.00
28 2025-11,4,球球,9000.00
29 2025-11,5,小敌,8000.00
30 2025-11,6,涛涛,5000.00
31 2025-11,7,欣怡,4000.00
32 2025-11,8,乔西,3000.00
33 2025-11,8,柚子,3000.00
34 2025-11,9,素素,1000.00

View File

@@ -0,0 +1,85 @@
# 2025年10-12月 助教客户充值归因排行榜(全额复制口径)
## 思考过程
按“消费窗口±30分钟”把充值支付命中到订单再全额计入订单内助教并按月排名。
## 查询说明
注意:多助教/多订单命中按全额复制,充值会重复计入,故助教汇总可能大于门店总额。
## SQL
### 充值归因(助教+月份汇总,全额复制)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select rp.pay_time, ow.order_settle_id, rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select assistant, month_key, sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, month_key;
```

View File

@@ -0,0 +1,51 @@
2025年10-12月 助教客户流水排行榜(全额复制口径)
口径:客户流水=台费+助教+商品应付金额按订单归集后,全额计入订单内每位助教;多助教会导致汇总>门店总额。
月份,排名,助教昵称,指标
2025-10,1,璇子,80804.14
2025-10,2,婉婉,62187.64
2025-10,3,小柔,52623.85
2025-10,4,小敌,44510.29
2025-10,5,佳怡,44466.03
2025-10,6,七七,38810.44
2025-10,7,奈千,38653.58
2025-10,8,涛涛,35940.84
2025-10,9,素素,34135.89
2025-10,10,球球,33923.75
2025-10,11,周周,27375.91
2025-10,12,年糕,26289.89
2025-10,13,乔西,17649.50
2025-10,14,Amy,15810.80
2025-10,15,苏苏,11236.84
2025-10,16,饭团,7955.28
2025-10,17,欣怡,4824.69
2025-10,18,希希,3086.34
2025-10,19,悦悦,2970.96
2025-10,20,姜姜,2333.94
2025-11,1,璇子,154486.83
2025-11,2,Amy,121568.32
2025-11,3,小柔,110137.94
2025-11,4,涛涛,88677.55
2025-11,5,七七,84500.79
2025-11,6,佳怡,79249.31
2025-11,7,奈千,68543.08
2025-11,8,瑶瑶,65924.36
2025-11,9,小敌,47986.57
2025-11,10,球球,41907.39
2025-11,11,梦梦,39768.09
2025-11,12,小燕,39426.42
2025-11,13,阿清,37302.04
2025-11,14,婉婉,33326.32
2025-11,15,周周,31436.74
2025-11,16,小侯,27313.21
2025-11,17,千千,24684.71
2025-11,18,柚子,23234.98
2025-11,19,素素,18707.30
2025-11,20,年糕,15696.08
2025-11,21,乔西,15536.78
2025-11,22,苏苏,10254.59
2025-11,23,泡芙,8323.03
2025-11,24,欣怡,5157.29
2025-11,25,QQ,1134.18
2025-11,26,西子,303.51
2025-11,27,希希,281.22
1 2025年10-12月 助教客户流水排行榜(全额复制口径)
2 口径:客户流水=台费+助教+商品应付金额按订单归集后,全额计入订单内每位助教;多助教会导致汇总>门店总额。
3 月份,排名,助教昵称,指标
4 2025-10,1,璇子,80804.14
5 2025-10,2,婉婉,62187.64
6 2025-10,3,小柔,52623.85
7 2025-10,4,小敌,44510.29
8 2025-10,5,佳怡,44466.03
9 2025-10,6,七七,38810.44
10 2025-10,7,奈千,38653.58
11 2025-10,8,涛涛,35940.84
12 2025-10,9,素素,34135.89
13 2025-10,10,球球,33923.75
14 2025-10,11,周周,27375.91
15 2025-10,12,年糕,26289.89
16 2025-10,13,乔西,17649.50
17 2025-10,14,Amy,15810.80
18 2025-10,15,苏苏,11236.84
19 2025-10,16,饭团,7955.28
20 2025-10,17,欣怡,4824.69
21 2025-10,18,希希,3086.34
22 2025-10,19,悦悦,2970.96
23 2025-10,20,姜姜,2333.94
24 2025-11,1,璇子,154486.83
25 2025-11,2,Amy,121568.32
26 2025-11,3,小柔,110137.94
27 2025-11,4,涛涛,88677.55
28 2025-11,5,七七,84500.79
29 2025-11,6,佳怡,79249.31
30 2025-11,7,奈千,68543.08
31 2025-11,8,瑶瑶,65924.36
32 2025-11,9,小敌,47986.57
33 2025-11,10,球球,41907.39
34 2025-11,11,梦梦,39768.09
35 2025-11,12,小燕,39426.42
36 2025-11,13,阿清,37302.04
37 2025-11,14,婉婉,33326.32
38 2025-11,15,周周,31436.74
39 2025-11,16,小侯,27313.21
40 2025-11,17,千千,24684.71
41 2025-11,18,柚子,23234.98
42 2025-11,19,素素,18707.30
43 2025-11,20,年糕,15696.08
44 2025-11,21,乔西,15536.78
45 2025-11,22,苏苏,10254.59
46 2025-11,23,泡芙,8323.03
47 2025-11,24,欣怡,5157.29
48 2025-11,25,QQ,1134.18
49 2025-11,26,西子,303.51
50 2025-11,27,希希,281.22

View File

@@ -0,0 +1,73 @@
# 2025年10-12月 助教客户流水排行榜(全额复制口径)
## 思考过程
先把订单应付金额汇总为 order_amount再把该订单全额计入订单内每位助教并按月排名。
## 查询说明
注意:多助教按全额复制计入,导致助教汇总>门店总额,这是刻意口径。
## SQL
### 客户流水(助教+月份汇总,全额复制)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id=g.order_settle_id
where g.site_id=%(site_id)s and coalesce(g.is_delete,0)=0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
coalesce(bo.table_amount,0)+coalesce(a.assistant_amount,0)+coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id=bo.order_settle_id
left join goods_amount g on g.order_settle_id=bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
)
select assistant, month_key, sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, month_key;
```

View File

@@ -0,0 +1,37 @@
2025年10-12月 助教附加课(超休)时长排行榜
口径order_assistant_type=2超休时长=income_seconds/3600小时按月排名。
月份,排名,助教昵称,指标
2025-10,1,球球,11.00h
2025-10,2,佳怡,9.00h
2025-10,3,璇子,8.00h
2025-10,3,苏苏,8.00h
2025-10,4,婉婉,4.00h
2025-10,5,姜姜,3.00h
2025-10,5,小敌,3.00h
2025-11,1,周周,25.00h
2025-11,1,球球,25.00h
2025-11,2,婉婉,15.00h
2025-11,3,佳怡,10.00h
2025-11,3,柚子,10.00h
2025-11,3,璇子,10.00h
2025-11,3,素素,10.00h
2025-11,4,小柔,7.00h
2025-11,4,年糕,7.00h
2025-11,5,泡芙,3.00h
2025-11,5,涛涛,3.00h
2025-11,5,瑶瑶,3.00h
2025-11,6,小燕,2.00h
2025-11,7,乔西,1.00h
2025-11,7,梦梦,1.00h
2025-12,1,七七,22.00h
2025-12,2,小燕,21.00h
2025-12,3,婉婉,15.00h
2025-12,3,小柔,15.00h
2025-12,4,璇子,14.00h
2025-12,5,周周,8.00h
2025-12,6,千千,5.00h
2025-12,6,球球,5.00h
2025-12,7,佳怡,4.00h
2025-12,8,QQ,3.00h
2025-12,9,苏苏,1.00h
1 2025年10-12月 助教附加课(超休)时长排行榜
2 口径:order_assistant_type=2,超休时长=income_seconds/3600(小时),按月排名。
3 月份,排名,助教昵称,指标
4 2025-10,1,球球,11.00h
5 2025-10,2,佳怡,9.00h
6 2025-10,3,璇子,8.00h
7 2025-10,3,苏苏,8.00h
8 2025-10,4,婉婉,4.00h
9 2025-10,5,姜姜,3.00h
10 2025-10,5,小敌,3.00h
11 2025-11,1,周周,25.00h
12 2025-11,1,球球,25.00h
13 2025-11,2,婉婉,15.00h
14 2025-11,3,佳怡,10.00h
15 2025-11,3,柚子,10.00h
16 2025-11,3,璇子,10.00h
17 2025-11,3,素素,10.00h
18 2025-11,4,小柔,7.00h
19 2025-11,4,年糕,7.00h
20 2025-11,5,泡芙,3.00h
21 2025-11,5,涛涛,3.00h
22 2025-11,5,瑶瑶,3.00h
23 2025-11,6,小燕,2.00h
24 2025-11,7,乔西,1.00h
25 2025-11,7,梦梦,1.00h
26 2025-12,1,七七,22.00h
27 2025-12,2,小燕,21.00h
28 2025-12,3,婉婉,15.00h
29 2025-12,3,小柔,15.00h
30 2025-12,4,璇子,14.00h
31 2025-12,5,周周,8.00h
32 2025-12,6,千千,5.00h
33 2025-12,6,球球,5.00h
34 2025-12,7,佳怡,4.00h
35 2025-12,8,QQ,3.00h
36 2025-12,9,苏苏,1.00h

View File

@@ -0,0 +1,31 @@
# 2025年10-12月 助教附加课(超休)时长排行榜
## 思考过程
按月汇总助教附加课时长,并用 dense_rank 做排名。
## 查询说明
口径order_assistant_type=2时长=income_seconds/3600小时
## SQL
### 附加课时长(助教+月份汇总)
```sql
with raw as (
select
asl.nickname as assistant,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0)=0
and asl.order_assistant_type=2
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
)
select
assistant,
month_key,
sum(income_seconds)/3600.0 as hours
from raw
where month_key is not null
group by assistant, month_key;
```

View File

@@ -0,0 +1,56 @@
助教详情Amy2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础123.6h附加0.0h客户流水¥150692.64充值归因¥12000.00;头部客户(12月)Top3轩哥、明哥、江先生。
一、基础课业绩
说明评价基础123.6h附加0.0h客户流水¥150692.64充值归因¥12000.00;头部客户(12月)Top3轩哥、明哥、江先生。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,11.97h,17,-32.44h,-24.56h
11月,93.53h,4,39.06h,54.65h
12月,18.08h,16,-26.73h,-23.01h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,0.00h,,0.00h,0.00h
12月,0.00h,,0.00h,0.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,15810.80,14,-13468.73,-14839.03
11月,121568.32,2,77313.93,88242.00
12月,13313.52,12,-7417.01,-327.12
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,3000.00,13,-11466.67,-10000.00
11月,9000.00,4,1230.77,0.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1,轩哥,8.8h / 0.0h,4500.95,0.00,36.0h / 0.0h,38175.17,0.00,4.6h / 0.0h,8281.61,0.00
2,明哥,0.1h / 0.0h,4190.45,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
3,江先生,2.2h / 0.0h,3202.78,0.00,4.5h / 0.0h,1719.24,0.00,0.0h / 0.0h,0.00,0.00
4,amy,4.8h / 0.0h,1105.90,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
5,小燕,1.0h / 0.0h,313.44,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
6,叶先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,7.4h / 0.0h,7529.19,3000.00
7,,0.0h / 0.0h,0.00,0.00,4.1h / 0.0h,1017.50,1000.00,0.0h / 0.0h,0.00,0.00
8,葛先生,0.0h / 0.0h,0.00,0.00,1.6h / 0.0h,1585.38,0.00,0.0h / 0.0h,0.00,0.00
9,陈先生,0.0h / 0.0h,0.00,0.00,4.2h / 0.0h,2566.75,3000.00,0.0h / 0.0h,0.00,0.00
10,李先生,0.0h / 0.0h,0.00,0.00,1.0h / 0.0h,816.28,0.00,0.0h / 0.0h,0.00,0.00
11,蔡总,1.2h / 0.0h,0.00,0.00,40.2h / 0.0h,75063.98,5000.00,0.0h / 0.0h,0.00,0.00
12,昌哥,0.0h / 0.0h,0.00,0.00,2.0h / 0.0h,624.02,0.00,0.0h / 0.0h,0.00,0.00
1 助教详情:Amy(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础123.6h,附加0.0h;客户流水¥150692.64,充值归因¥12000.00;头部客户(12月)Top3:轩哥、明哥、江先生。
3 一、基础课业绩
4 说明:评价:基础123.6h,附加0.0h;客户流水¥150692.64,充值归因¥12000.00;头部客户(12月)Top3:轩哥、明哥、江先生。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,11.97h,17,-32.44h,-24.56h
8 11月,93.53h,4,39.06h,54.65h
9 12月,18.08h,16,-26.73h,-23.01h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,0.00h,,0.00h,0.00h
15 11月,0.00h,,0.00h,0.00h
16 12月,0.00h,,0.00h,0.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,15810.80,14,-13468.73,-14839.03
22 11月,121568.32,2,77313.93,88242.00
23 12月,13313.52,12,-7417.01,-327.12
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,3000.00,13,-11466.67,-10000.00
29 11月,9000.00,4,1230.77,0.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
35 1,轩哥,8.8h / 0.0h,4500.95,0.00,36.0h / 0.0h,38175.17,0.00,4.6h / 0.0h,8281.61,0.00
36 2,明哥,0.1h / 0.0h,4190.45,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
37 3,江先生,2.2h / 0.0h,3202.78,0.00,4.5h / 0.0h,1719.24,0.00,0.0h / 0.0h,0.00,0.00
38 4,amy,4.8h / 0.0h,1105.90,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
39 5,小燕,1.0h / 0.0h,313.44,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
40 6,叶先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,7.4h / 0.0h,7529.19,3000.00
41 7,羊,0.0h / 0.0h,0.00,0.00,4.1h / 0.0h,1017.50,1000.00,0.0h / 0.0h,0.00,0.00
42 8,葛先生,0.0h / 0.0h,0.00,0.00,1.6h / 0.0h,1585.38,0.00,0.0h / 0.0h,0.00,0.00
43 9,陈先生,0.0h / 0.0h,0.00,0.00,4.2h / 0.0h,2566.75,3000.00,0.0h / 0.0h,0.00,0.00
44 10,李先生,0.0h / 0.0h,0.00,0.00,1.0h / 0.0h,816.28,0.00,0.0h / 0.0h,0.00,0.00
45 11,蔡总,1.2h / 0.0h,0.00,0.00,40.2h / 0.0h,75063.98,5000.00,0.0h / 0.0h,0.00,0.00
46 12,昌哥,0.0h / 0.0h,0.00,0.00,2.0h / 0.0h,624.02,0.00,0.0h / 0.0h,0.00,0.00

View File

@@ -0,0 +1,196 @@
# 助教详情Amy2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础123.6h附加0.0h客户流水¥150692.64充值归因¥12000.00;头部客户(12月)Top3轩哥、明哥、江先生。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,47 @@
助教详情QQ2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础6.4h附加3.0h客户流水¥1517.46充值归因¥0.00;头部客户(12月)Top3游、张先生、黄先生。
一、基础课业绩
说明评价基础6.4h附加3.0h客户流水¥1517.46充值归因¥0.00;头部客户(12月)Top3游、张先生、黄先生。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,5.17h,25,-49.31h,-33.72h
12月,1.22h,22,-43.59h,-39.88h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,0.00h,,0.00h,0.00h
12月,3.00h,8,-7.27h,-5.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,0.00,,0.00,0.00
11月,1134.18,25,-43120.21,-32192.14
12月,383.28,21,-20347.25,-13257.36
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,0.00,,0.00,0.00
11月,0.00,,0.00,0.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1,,1.2h / 0.0h,383.28,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
2,张先生,0.0h / 0.0h,0.00,0.00,2.8h / 0.0h,502.16,0.00,0.0h / 0.0h,0.00,0.00
3,黄先生,0.0h / 3.0h,0.00,0.00,2.4h / 0.0h,632.02,0.00,0.0h / 0.0h,0.00,0.00
1 助教详情:QQ(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础6.4h,附加3.0h;客户流水¥1517.46,充值归因¥0.00;头部客户(12月)Top3:游、张先生、黄先生。
3 一、基础课业绩
4 说明:评价:基础6.4h,附加3.0h;客户流水¥1517.46,充值归因¥0.00;头部客户(12月)Top3:游、张先生、黄先生。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,0.00h,,0.00h,0.00h
8 11月,5.17h,25,-49.31h,-33.72h
9 12月,1.22h,22,-43.59h,-39.88h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,0.00h,,0.00h,0.00h
15 11月,0.00h,,0.00h,0.00h
16 12月,3.00h,8,-7.27h,-5.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,0.00,,0.00,0.00
22 11月,1134.18,25,-43120.21,-32192.14
23 12月,383.28,21,-20347.25,-13257.36
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,0.00,,0.00,0.00
29 11月,0.00,,0.00,0.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
35 1,游,1.2h / 0.0h,383.28,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
36 2,张先生,0.0h / 0.0h,0.00,0.00,2.8h / 0.0h,502.16,0.00,0.0h / 0.0h,0.00,0.00
37 3,黄先生,0.0h / 3.0h,0.00,0.00,2.4h / 0.0h,632.02,0.00,0.0h / 0.0h,0.00,0.00

View File

@@ -0,0 +1,196 @@
# 助教详情QQ2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础6.4h附加3.0h客户流水¥1517.46充值归因¥0.00;头部客户(12月)Top3游、张先生、黄先生。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,56 @@
助教详情七七2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础234.3h附加22.0h客户流水¥187346.62充值归因¥6000.00;头部客户(12月)Top3蔡总、轩哥、林先生。
一、基础课业绩
说明评价基础234.3h附加22.0h客户流水¥187346.62充值归因¥6000.00;头部客户(12月)Top3蔡总、轩哥、林先生。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,64.70h,4,20.29h,28.17h
11月,91.90h,5,37.42h,53.02h
12月,77.72h,4,32.91h,36.62h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,0.00h,,0.00h,0.00h
12月,22.00h,1,11.73h,14.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,38810.44,6,9530.91,8160.61
11月,84500.79,5,40246.40,51174.47
12月,64035.39,2,43304.86,50394.74
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,6000.00,11,-8466.67,-7000.00
11月,0.00,,0.00,0.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1,蔡总,26.6h / 0.0h,29660.33,0.00,45.7h / 0.0h,52373.96,0.00,0.0h / 0.0h,0.00,0.00
2,轩哥,32.8h / 22.0h,27236.57,0.00,24.2h / 0.0h,21849.91,0.00,39.5h / 0.0h,29630.52,3000.00
3,林先生,14.0h / 0.0h,3808.56,0.00,5.4h / 0.0h,1623.92,0.00,0.0h / 0.0h,0.00,0.00
4,江先生,3.2h / 0.0h,3042.99,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
5,张先生,1.0h / 0.0h,286.94,0.00,10.9h / 0.0h,3995.10,0.00,13.2h / 0.0h,5315.81,0.00
6,,0.0h / 0.0h,0.00,0.00,0.2h / 0.0h,3544.42,0.00,0.0h / 0.0h,0.00,0.00
7,罗先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.1h / 0.0h,545.55,0.00
8,小熊,0.0h / 0.0h,0.00,0.00,1.3h / 0.0h,314.44,0.00,0.0h / 0.0h,0.00,0.00
9,叶总,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,3.0h / 0.0h,862.68,0.00
10,,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,4.2h / 0.0h,1278.72,0.00
11,T,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,3.8h / 0.0h,1177.16,3000.00
12,胡先生,0.0h / 0.0h,0.00,0.00,4.2h / 0.0h,799.04,0.00,0.0h / 0.0h,0.00,0.00
1 助教详情:七七(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础234.3h,附加22.0h;客户流水¥187346.62,充值归因¥6000.00;头部客户(12月)Top3:蔡总、轩哥、林先生。
3 一、基础课业绩
4 说明:评价:基础234.3h,附加22.0h;客户流水¥187346.62,充值归因¥6000.00;头部客户(12月)Top3:蔡总、轩哥、林先生。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,64.70h,4,20.29h,28.17h
8 11月,91.90h,5,37.42h,53.02h
9 12月,77.72h,4,32.91h,36.62h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,0.00h,,0.00h,0.00h
15 11月,0.00h,,0.00h,0.00h
16 12月,22.00h,1,11.73h,14.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,38810.44,6,9530.91,8160.61
22 11月,84500.79,5,40246.40,51174.47
23 12月,64035.39,2,43304.86,50394.74
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,6000.00,11,-8466.67,-7000.00
29 11月,0.00,,0.00,0.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
35 1,蔡总,26.6h / 0.0h,29660.33,0.00,45.7h / 0.0h,52373.96,0.00,0.0h / 0.0h,0.00,0.00
36 2,轩哥,32.8h / 22.0h,27236.57,0.00,24.2h / 0.0h,21849.91,0.00,39.5h / 0.0h,29630.52,3000.00
37 3,林先生,14.0h / 0.0h,3808.56,0.00,5.4h / 0.0h,1623.92,0.00,0.0h / 0.0h,0.00,0.00
38 4,江先生,3.2h / 0.0h,3042.99,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
39 5,张先生,1.0h / 0.0h,286.94,0.00,10.9h / 0.0h,3995.10,0.00,13.2h / 0.0h,5315.81,0.00
40 6,游,0.0h / 0.0h,0.00,0.00,0.2h / 0.0h,3544.42,0.00,0.0h / 0.0h,0.00,0.00
41 7,罗先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.1h / 0.0h,545.55,0.00
42 8,小熊,0.0h / 0.0h,0.00,0.00,1.3h / 0.0h,314.44,0.00,0.0h / 0.0h,0.00,0.00
43 9,叶总,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,3.0h / 0.0h,862.68,0.00
44 10,陶,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,4.2h / 0.0h,1278.72,0.00
45 11,T,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,3.8h / 0.0h,1177.16,3000.00
46 12,胡先生,0.0h / 0.0h,0.00,0.00,4.2h / 0.0h,799.04,0.00,0.0h / 0.0h,0.00,0.00

View File

@@ -0,0 +1,196 @@
# 助教详情七七2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础234.3h附加22.0h客户流水¥187346.62充值归因¥6000.00;头部客户(12月)Top3蔡总、轩哥、林先生。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,59 @@
助教详情乔西2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础89.0h附加1.0h客户流水¥46219.50充值归因¥20000.00;头部客户(12月)Top3轩哥、T、林先生。
一、基础课业绩
说明评价基础89.0h附加1.0h客户流水¥46219.50充值归因¥20000.00;头部客户(12月)Top3轩哥、T、林先生。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,32.60h,11,-11.81h,-3.93h
11月,30.57h,20,-23.91h,-8.32h
12月,25.82h,13,-18.99h,-15.28h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,1.00h,7,-7.80h,-6.00h
12月,0.00h,,0.00h,0.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,17649.50,13,-11630.03,-13000.33
11月,15536.78,21,-28717.61,-17789.54
12月,13033.22,13,-7697.31,-607.42
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,17000.00,7,2533.33,4000.00
11月,3000.00,8,-4769.23,-6000.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1,轩哥,8.2h / 0.0h,8244.84,0.00,8.3h / 0.0h,7623.25,0.00,9.3h / 0.0h,11503.53,8000.00
2,T,6.8h / 0.0h,1789.02,0.00,4.4h / 0.0h,1100.80,0.00,0.0h / 0.0h,0.00,0.00
3,林先生,4.6h / 0.0h,1369.51,0.00,5.0h / 0.0h,1645.89,0.00,0.0h / 0.0h,0.00,0.00
4,张先生,3.3h / 0.0h,1066.81,0.00,0.0h / 0.0h,0.00,0.00,2.5h / 0.0h,489.66,0.00
5,,2.9h / 0.0h,563.04,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
6,罗先生,0.0h / 0.0h,0.00,0.00,1.4h / 0.0h,454.46,0.00,0.0h / 0.0h,0.00,0.00
7,陈腾鑫,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,0.9h / 0.0h,162.29,3000.00
8,葛先生,0.0h / 0.0h,0.00,0.00,2.2h / 0.0h,707.97,0.00,0.0h / 0.0h,0.00,0.00
9,陈先生,0.0h / 0.0h,0.00,0.00,4.2h / 0.0h,2566.75,3000.00,0.0h / 0.0h,0.00,0.00
10,陈淑涛,0.0h / 0.0h,0.00,0.00,3.4h / 0.0h,1021.49,0.00,0.0h / 0.0h,0.00,0.00
11,周先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,7.5h / 0.0h,2726.01,0.00
12,陈德韩,0.0h / 0.0h,0.00,0.00,0.0h / 1.0h,0.00,0.00,7.6h / 0.0h,1568.91,5000.00
13,黄先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.6h / 0.0h,300.37,0.00
14,陈先生,0.0h / 0.0h,0.00,0.00,1.8h / 0.0h,416.17,0.00,0.0h / 0.0h,0.00,0.00
15,方先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,3.2h / 0.0h,898.73,1000.00
1 助教详情:乔西(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础89.0h,附加1.0h;客户流水¥46219.50,充值归因¥20000.00;头部客户(12月)Top3:轩哥、T、林先生。
3 一、基础课业绩
4 说明:评价:基础89.0h,附加1.0h;客户流水¥46219.50,充值归因¥20000.00;头部客户(12月)Top3:轩哥、T、林先生。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,32.60h,11,-11.81h,-3.93h
8 11月,30.57h,20,-23.91h,-8.32h
9 12月,25.82h,13,-18.99h,-15.28h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,0.00h,,0.00h,0.00h
15 11月,1.00h,7,-7.80h,-6.00h
16 12月,0.00h,,0.00h,0.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,17649.50,13,-11630.03,-13000.33
22 11月,15536.78,21,-28717.61,-17789.54
23 12月,13033.22,13,-7697.31,-607.42
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,17000.00,7,2533.33,4000.00
29 11月,3000.00,8,-4769.23,-6000.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
35 1,轩哥,8.2h / 0.0h,8244.84,0.00,8.3h / 0.0h,7623.25,0.00,9.3h / 0.0h,11503.53,8000.00
36 2,T,6.8h / 0.0h,1789.02,0.00,4.4h / 0.0h,1100.80,0.00,0.0h / 0.0h,0.00,0.00
37 3,林先生,4.6h / 0.0h,1369.51,0.00,5.0h / 0.0h,1645.89,0.00,0.0h / 0.0h,0.00,0.00
38 4,张先生,3.3h / 0.0h,1066.81,0.00,0.0h / 0.0h,0.00,0.00,2.5h / 0.0h,489.66,0.00
39 5,候,2.9h / 0.0h,563.04,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
40 6,罗先生,0.0h / 0.0h,0.00,0.00,1.4h / 0.0h,454.46,0.00,0.0h / 0.0h,0.00,0.00
41 7,陈腾鑫,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,0.9h / 0.0h,162.29,3000.00
42 8,葛先生,0.0h / 0.0h,0.00,0.00,2.2h / 0.0h,707.97,0.00,0.0h / 0.0h,0.00,0.00
43 9,陈先生,0.0h / 0.0h,0.00,0.00,4.2h / 0.0h,2566.75,3000.00,0.0h / 0.0h,0.00,0.00
44 10,陈淑涛,0.0h / 0.0h,0.00,0.00,3.4h / 0.0h,1021.49,0.00,0.0h / 0.0h,0.00,0.00
45 11,周先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,7.5h / 0.0h,2726.01,0.00
46 12,陈德韩,0.0h / 0.0h,0.00,0.00,0.0h / 1.0h,0.00,0.00,7.6h / 0.0h,1568.91,5000.00
47 13,黄先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.6h / 0.0h,300.37,0.00
48 14,陈先生,0.0h / 0.0h,0.00,0.00,1.8h / 0.0h,416.17,0.00,0.0h / 0.0h,0.00,0.00
49 15,方先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,3.2h / 0.0h,898.73,1000.00

View File

@@ -0,0 +1,196 @@
# 助教详情乔西2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础89.0h附加1.0h客户流水¥46219.50充值归因¥20000.00;头部客户(12月)Top3轩哥、T、林先生。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,63 @@
助教详情佳怡2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础425.2h附加23.0h客户流水¥156229.68充值归因¥47000.00;头部客户(12月)Top3罗先生、周周、轩哥。
一、基础课业绩
说明评价基础425.2h附加23.0h客户流水¥156229.68充值归因¥47000.00;头部客户(12月)Top3罗先生、周周、轩哥。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,139.55h,1,95.14h,103.02h
11月,176.25h,1,121.77h,137.37h
12月,109.40h,2,64.59h,68.31h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,9.00h,2,2.43h,1.00h
11月,10.00h,3,1.20h,3.00h
12月,4.00h,7,-6.27h,-4.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,44466.03,5,15186.50,13816.20
11月,79249.31,6,34994.92,45922.99
12月,32514.34,6,11783.81,18873.70
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,27000.00,3,12533.33,14000.00
11月,20000.00,1,12230.77,11000.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1,罗先生,67.8h / 4.0h,16680.01,0.00,57.5h / 10.0h,12309.26,0.00,46.9h / 8.0h,12047.56,7000.00
2,周周,13.2h / 0.0h,3866.19,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
3,轩哥,6.4h / 0.0h,3741.42,0.00,18.0h / 0.0h,24036.03,0.00,24.6h / 1.0h,17999.86,3000.00
4,大G,9.5h / 0.0h,2623.97,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
5,T,1.9h / 0.0h,2053.02,0.00,5.0h / 0.0h,2490.70,0.00,8.1h / 0.0h,1323.17,3000.00
6,林先生,4.5h / 0.0h,1720.12,0.00,10.4h / 0.0h,3269.81,0.00,0.0h / 0.0h,0.00,0.00
7,,3.2h / 0.0h,1307.16,0.00,10.3h / 0.0h,4754.69,0.00,0.0h / 0.0h,0.00,0.00
8,胡先生,3.0h / 0.0h,522.45,0.00,26.4h / 0.0h,9712.14,13000.00,0.0h / 0.0h,0.00,0.00
9,江先生,0.0h / 0.0h,0.00,0.00,3.8h / 0.0h,1374.85,0.00,0.0h / 0.0h,0.00,0.00
10,陈先生,0.0h / 0.0h,0.00,0.00,7.6h / 0.0h,2566.75,3000.00,0.0h / 0.0h,0.00,0.00
11,陈腾鑫,0.0h / 0.0h,0.00,0.00,19.2h / 0.0h,4276.97,1000.00,38.5h / 0.0h,7626.75,12000.00
12,张先生,0.0h / 0.0h,0.00,0.00,4.9h / 0.0h,2233.65,0.00,0.0h / 0.0h,0.00,0.00
13,歌神,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.0h / 0.0h,361.38,0.00
14,,0.0h / 0.0h,0.00,0.00,2.0h / 0.0h,455.03,0.00,5.8h / 0.0h,2595.54,1000.00
15,小熊,0.0h / 0.0h,0.00,0.00,6.4h / 0.0h,2072.54,3000.00,6.8h / 0.0h,1213.06,1000.00
16,蔡总,0.0h / 0.0h,0.00,0.00,4.5h / 0.0h,9696.89,0.00,0.0h / 0.0h,0.00,0.00
17,吕先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.7h / 0.0h,337.17,0.00
18,贺斌,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.0h / 0.0h,247.34,0.00
19,,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,4.1h / 0.0h,714.20,0.00
1 助教详情:佳怡(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础425.2h,附加23.0h;客户流水¥156229.68,充值归因¥47000.00;头部客户(12月)Top3:罗先生、周周、轩哥。
3 一、基础课业绩
4 说明:评价:基础425.2h,附加23.0h;客户流水¥156229.68,充值归因¥47000.00;头部客户(12月)Top3:罗先生、周周、轩哥。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,139.55h,1,95.14h,103.02h
8 11月,176.25h,1,121.77h,137.37h
9 12月,109.40h,2,64.59h,68.31h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,9.00h,2,2.43h,1.00h
15 11月,10.00h,3,1.20h,3.00h
16 12月,4.00h,7,-6.27h,-4.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,44466.03,5,15186.50,13816.20
22 11月,79249.31,6,34994.92,45922.99
23 12月,32514.34,6,11783.81,18873.70
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,27000.00,3,12533.33,14000.00
29 11月,20000.00,1,12230.77,11000.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
35 1,罗先生,67.8h / 4.0h,16680.01,0.00,57.5h / 10.0h,12309.26,0.00,46.9h / 8.0h,12047.56,7000.00
36 2,周周,13.2h / 0.0h,3866.19,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
37 3,轩哥,6.4h / 0.0h,3741.42,0.00,18.0h / 0.0h,24036.03,0.00,24.6h / 1.0h,17999.86,3000.00
38 4,大G,9.5h / 0.0h,2623.97,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
39 5,T,1.9h / 0.0h,2053.02,0.00,5.0h / 0.0h,2490.70,0.00,8.1h / 0.0h,1323.17,3000.00
40 6,林先生,4.5h / 0.0h,1720.12,0.00,10.4h / 0.0h,3269.81,0.00,0.0h / 0.0h,0.00,0.00
41 7,游,3.2h / 0.0h,1307.16,0.00,10.3h / 0.0h,4754.69,0.00,0.0h / 0.0h,0.00,0.00
42 8,胡先生,3.0h / 0.0h,522.45,0.00,26.4h / 0.0h,9712.14,13000.00,0.0h / 0.0h,0.00,0.00
43 9,江先生,0.0h / 0.0h,0.00,0.00,3.8h / 0.0h,1374.85,0.00,0.0h / 0.0h,0.00,0.00
44 10,陈先生,0.0h / 0.0h,0.00,0.00,7.6h / 0.0h,2566.75,3000.00,0.0h / 0.0h,0.00,0.00
45 11,陈腾鑫,0.0h / 0.0h,0.00,0.00,19.2h / 0.0h,4276.97,1000.00,38.5h / 0.0h,7626.75,12000.00
46 12,张先生,0.0h / 0.0h,0.00,0.00,4.9h / 0.0h,2233.65,0.00,0.0h / 0.0h,0.00,0.00
47 13,歌神,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.0h / 0.0h,361.38,0.00
48 14,夏,0.0h / 0.0h,0.00,0.00,2.0h / 0.0h,455.03,0.00,5.8h / 0.0h,2595.54,1000.00
49 15,小熊,0.0h / 0.0h,0.00,0.00,6.4h / 0.0h,2072.54,3000.00,6.8h / 0.0h,1213.06,1000.00
50 16,蔡总,0.0h / 0.0h,0.00,0.00,4.5h / 0.0h,9696.89,0.00,0.0h / 0.0h,0.00,0.00
51 17,吕先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.7h / 0.0h,337.17,0.00
52 18,贺斌,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.0h / 0.0h,247.34,0.00
53 19,陶,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,4.1h / 0.0h,714.20,0.00

View File

@@ -0,0 +1,196 @@
# 助教详情佳怡2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础425.2h附加23.0h客户流水¥156229.68充值归因¥47000.00;头部客户(12月)Top3罗先生、周周、轩哥。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,55 @@
助教详情千千2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础77.2h附加5.0h客户流水¥34297.90充值归因¥0.00;头部客户(12月)Top3张先生、周先生、陈腾鑫。
一、基础课业绩
说明评价基础77.2h附加5.0h客户流水¥34297.90充值归因¥0.00;头部客户(12月)Top3张先生、周先生、陈腾鑫。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,38.88h,14,-15.59h,0.00h
12月,38.28h,12,-6.53h,-2.81h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,0.00h,,0.00h,0.00h
12月,5.00h,6,-5.27h,-3.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,0.00,,0.00,0.00
11月,24684.71,17,-19569.68,-8641.61
12月,9613.19,16,-11117.34,-4027.46
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,0.00,,0.00,0.00
11月,0.00,,0.00,0.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1,张先生,10.0h / 0.0h,2622.05,0.00,4.4h / 0.0h,1623.68,0.00,0.0h / 0.0h,0.00,0.00
2,周先生,8.6h / 0.0h,1577.94,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
3,陈腾鑫,4.8h / 0.0h,1375.20,0.00,2.9h / 0.0h,2418.94,0.00,0.0h / 0.0h,0.00,0.00
4,,3.3h / 5.0h,1356.34,0.00,5.8h / 0.0h,2007.81,0.00,0.0h / 0.0h,0.00,0.00
5,,3.0h / 0.0h,1128.06,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
6,黄先生,6.2h / 0.0h,1048.14,0.00,6.8h / 0.0h,1251.92,0.00,0.0h / 0.0h,0.00,0.00
7,,2.2h / 0.0h,505.46,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
8,葛先生,0.0h / 0.0h,0.00,0.00,14.4h / 0.0h,7500.34,0.00,0.0h / 0.0h,0.00,0.00
9,林先生,0.0h / 0.0h,0.00,0.00,2.7h / 0.0h,499.11,0.00,0.0h / 0.0h,0.00,0.00
10,轩哥,0.0h / 0.0h,0.00,0.00,1.2h / 0.0h,415.60,0.00,0.0h / 0.0h,0.00,0.00
11,蔡总,0.0h / 0.0h,0.00,0.00,0.7h / 0.0h,8967.31,0.00,0.0h / 0.0h,0.00,0.00
1 助教详情:千千(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础77.2h,附加5.0h;客户流水¥34297.90,充值归因¥0.00;头部客户(12月)Top3:张先生、周先生、陈腾鑫。
3 一、基础课业绩
4 说明:评价:基础77.2h,附加5.0h;客户流水¥34297.90,充值归因¥0.00;头部客户(12月)Top3:张先生、周先生、陈腾鑫。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,0.00h,,0.00h,0.00h
8 11月,38.88h,14,-15.59h,0.00h
9 12月,38.28h,12,-6.53h,-2.81h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,0.00h,,0.00h,0.00h
15 11月,0.00h,,0.00h,0.00h
16 12月,5.00h,6,-5.27h,-3.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,0.00,,0.00,0.00
22 11月,24684.71,17,-19569.68,-8641.61
23 12月,9613.19,16,-11117.34,-4027.46
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,0.00,,0.00,0.00
29 11月,0.00,,0.00,0.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
35 1,张先生,10.0h / 0.0h,2622.05,0.00,4.4h / 0.0h,1623.68,0.00,0.0h / 0.0h,0.00,0.00
36 2,周先生,8.6h / 0.0h,1577.94,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
37 3,陈腾鑫,4.8h / 0.0h,1375.20,0.00,2.9h / 0.0h,2418.94,0.00,0.0h / 0.0h,0.00,0.00
38 4,梅,3.3h / 5.0h,1356.34,0.00,5.8h / 0.0h,2007.81,0.00,0.0h / 0.0h,0.00,0.00
39 5,清,3.0h / 0.0h,1128.06,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
40 6,黄先生,6.2h / 0.0h,1048.14,0.00,6.8h / 0.0h,1251.92,0.00,0.0h / 0.0h,0.00,0.00
41 7,游,2.2h / 0.0h,505.46,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
42 8,葛先生,0.0h / 0.0h,0.00,0.00,14.4h / 0.0h,7500.34,0.00,0.0h / 0.0h,0.00,0.00
43 9,林先生,0.0h / 0.0h,0.00,0.00,2.7h / 0.0h,499.11,0.00,0.0h / 0.0h,0.00,0.00
44 10,轩哥,0.0h / 0.0h,0.00,0.00,1.2h / 0.0h,415.60,0.00,0.0h / 0.0h,0.00,0.00
45 11,蔡总,0.0h / 0.0h,0.00,0.00,0.7h / 0.0h,8967.31,0.00,0.0h / 0.0h,0.00,0.00

View File

@@ -0,0 +1,196 @@
# 助教详情千千2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础77.2h附加5.0h客户流水¥34297.90充值归因¥0.00;头部客户(12月)Top3张先生、周先生、陈腾鑫。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,66 @@
助教详情周周2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础172.6h附加33.0h客户流水¥80429.10充值归因¥20000.00;头部客户(12月)Top3周周、明哥、T。
一、基础课业绩
说明评价基础172.6h附加33.0h客户流水¥80429.10充值归因¥20000.00;头部客户(12月)Top3周周、明哥、T。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,41.33h,9,-3.08h,4.81h
11月,71.27h,10,16.79h,32.38h
12月,60.02h,6,15.21h,18.92h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,25.00h,1,16.20h,18.00h
12月,8.00h,5,-2.27h,0.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,27375.91,11,-1903.62,-3273.92
11月,31436.74,15,-12817.65,-1889.58
12月,21616.45,7,885.92,7975.80
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,11000.00,9,-3466.67,-2000.00
11月,9000.00,4,1230.77,0.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1,周周,28.8h / 8.0h,8105.19,0.00,0.0h / 20.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
2,明哥,0.4h / 0.0h,4190.45,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
3,T,10.1h / 0.0h,2968.13,0.00,0.0h / 0.0h,0.00,0.00,4.5h / 0.0h,1300.23,0.00
4,大G,14.8h / 0.0h,2724.15,0.00,2.8h / 0.0h,1783.61,0.00,0.0h / 0.0h,0.00,0.00
5,罗先生,2.6h / 0.0h,1584.22,0.00,9.0h / 0.0h,2415.09,0.00,0.0h / 0.0h,0.00,0.00
6,,2.4h / 0.0h,1307.16,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
7,张先生,0.0h / 0.0h,449.03,0.00,6.3h / 0.0h,2092.46,0.00,4.1h / 0.0h,1650.08,0.00
8,轩哥,0.7h / 0.0h,288.12,0.00,5.0h / 3.0h,2175.94,5000.00,20.2h / 0.0h,16154.38,10000.00
9,江先生,0.0h / 0.0h,0.00,0.00,4.3h / 0.0h,3588.88,0.00,0.0h / 0.0h,0.00,0.00
10,罗超杰,0.0h / 0.0h,0.00,0.00,1.2h / 0.0h,255.63,0.00,0.0h / 0.0h,0.00,0.00
11,陈腾鑫,0.0h / 0.0h,0.00,0.00,4.6h / 0.0h,1210.78,0.00,0.0h / 0.0h,197.60,1000.00
12,林总,0.0h / 0.0h,0.00,0.00,2.2h / 0.0h,439.96,0.00,0.0h / 0.0h,0.00,0.00
13,林先生,0.0h / 0.0h,0.00,0.00,0.7h / 0.0h,747.44,0.00,0.0h / 0.0h,0.00,0.00
14,葛先生,0.0h / 0.0h,0.00,0.00,11.0h / 0.0h,3073.27,0.00,0.0h / 0.0h,0.00,0.00
15,,0.0h / 0.0h,0.00,0.00,1.4h / 0.0h,602.50,0.00,0.0h / 0.0h,0.00,0.00
16,小熊,0.0h / 0.0h,0.00,0.00,10.7h / 0.0h,2612.37,4000.00,0.0h / 0.0h,0.00,0.00
17,陈德韩,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,4.3h / 0.0h,5714.01,0.00
18,蔡总,0.0h / 0.0h,0.00,0.00,8.2h / 0.0h,9385.22,0.00,0.0h / 0.0h,0.00,0.00
19,万先生,0.0h / 0.0h,0.00,0.00,0.0h / 2.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
20,吕先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,3.7h / 0.0h,1080.89,0.00
21,林先生,0.0h / 0.0h,0.00,0.00,4.0h / 0.0h,1053.59,0.00,0.0h / 0.0h,0.00,0.00
22,,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,4.4h / 0.0h,1278.72,0.00
1 助教详情:周周(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础172.6h,附加33.0h;客户流水¥80429.10,充值归因¥20000.00;头部客户(12月)Top3:周周、明哥、T。
3 一、基础课业绩
4 说明:评价:基础172.6h,附加33.0h;客户流水¥80429.10,充值归因¥20000.00;头部客户(12月)Top3:周周、明哥、T。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,41.33h,9,-3.08h,4.81h
8 11月,71.27h,10,16.79h,32.38h
9 12月,60.02h,6,15.21h,18.92h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,0.00h,,0.00h,0.00h
15 11月,25.00h,1,16.20h,18.00h
16 12月,8.00h,5,-2.27h,0.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,27375.91,11,-1903.62,-3273.92
22 11月,31436.74,15,-12817.65,-1889.58
23 12月,21616.45,7,885.92,7975.80
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,11000.00,9,-3466.67,-2000.00
29 11月,9000.00,4,1230.77,0.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
35 1,周周,28.8h / 8.0h,8105.19,0.00,0.0h / 20.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
36 2,明哥,0.4h / 0.0h,4190.45,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
37 3,T,10.1h / 0.0h,2968.13,0.00,0.0h / 0.0h,0.00,0.00,4.5h / 0.0h,1300.23,0.00
38 4,大G,14.8h / 0.0h,2724.15,0.00,2.8h / 0.0h,1783.61,0.00,0.0h / 0.0h,0.00,0.00
39 5,罗先生,2.6h / 0.0h,1584.22,0.00,9.0h / 0.0h,2415.09,0.00,0.0h / 0.0h,0.00,0.00
40 6,游,2.4h / 0.0h,1307.16,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
41 7,张先生,0.0h / 0.0h,449.03,0.00,6.3h / 0.0h,2092.46,0.00,4.1h / 0.0h,1650.08,0.00
42 8,轩哥,0.7h / 0.0h,288.12,0.00,5.0h / 3.0h,2175.94,5000.00,20.2h / 0.0h,16154.38,10000.00
43 9,江先生,0.0h / 0.0h,0.00,0.00,4.3h / 0.0h,3588.88,0.00,0.0h / 0.0h,0.00,0.00
44 10,罗超杰,0.0h / 0.0h,0.00,0.00,1.2h / 0.0h,255.63,0.00,0.0h / 0.0h,0.00,0.00
45 11,陈腾鑫,0.0h / 0.0h,0.00,0.00,4.6h / 0.0h,1210.78,0.00,0.0h / 0.0h,197.60,1000.00
46 12,林总,0.0h / 0.0h,0.00,0.00,2.2h / 0.0h,439.96,0.00,0.0h / 0.0h,0.00,0.00
47 13,林先生,0.0h / 0.0h,0.00,0.00,0.7h / 0.0h,747.44,0.00,0.0h / 0.0h,0.00,0.00
48 14,葛先生,0.0h / 0.0h,0.00,0.00,11.0h / 0.0h,3073.27,0.00,0.0h / 0.0h,0.00,0.00
49 15,羊,0.0h / 0.0h,0.00,0.00,1.4h / 0.0h,602.50,0.00,0.0h / 0.0h,0.00,0.00
50 16,小熊,0.0h / 0.0h,0.00,0.00,10.7h / 0.0h,2612.37,4000.00,0.0h / 0.0h,0.00,0.00
51 17,陈德韩,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,4.3h / 0.0h,5714.01,0.00
52 18,蔡总,0.0h / 0.0h,0.00,0.00,8.2h / 0.0h,9385.22,0.00,0.0h / 0.0h,0.00,0.00
53 19,万先生,0.0h / 0.0h,0.00,0.00,0.0h / 2.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
54 20,吕先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,3.7h / 0.0h,1080.89,0.00
55 21,林先生,0.0h / 0.0h,0.00,0.00,4.0h / 0.0h,1053.59,0.00,0.0h / 0.0h,0.00,0.00
56 22,陶,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,4.4h / 0.0h,1278.72,0.00

View File

@@ -0,0 +1,196 @@
# 助教详情周周2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础172.6h附加33.0h客户流水¥80429.10充值归因¥20000.00;头部客户(12月)Top3周周、明哥、T。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,58 @@
助教详情奈千2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础59.0h附加0.0h客户流水¥107484.78充值归因¥18000.00;头部客户(12月)Top3轩哥、黎先生、陈先生。
一、基础课业绩
说明评价基础59.0h附加0.0h客户流水¥107484.78充值归因¥18000.00;头部客户(12月)Top3轩哥、黎先生、陈先生。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,23.62h,13,-20.79h,-12.91h
11月,32.83h,19,-21.64h,-6.05h
12月,2.58h,21,-42.23h,-38.51h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,0.00h,,0.00h,0.00h
12月,0.00h,,0.00h,0.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,38653.58,7,9374.05,8003.75
11月,68543.08,7,24288.69,35216.76
12月,288.12,22,-20442.41,-13352.52
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,18000.00,6,3533.33,5000.00
11月,0.00,,0.00,0.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1,轩哥,0.7h / 0.0h,288.12,0.00,4.3h / 0.0h,14349.45,0.00,6.2h / 0.0h,22341.76,13000.00
2,黎先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.7h / 0.0h,470.19,0.00
3,陈先生,0.0h / 0.0h,0.00,0.00,5.1h / 0.0h,1150.83,0.00,0.0h / 0.0h,0.00,0.00
4,,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.4h / 0.0h,3620.75,0.00
5,陈腾鑫,0.0h / 0.0h,0.00,0.00,2.6h / 0.0h,441.39,0.00,2.1h / 0.0h,1084.69,1000.00
6,张先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.2h / 0.0h,474.93,0.00
7,,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.0h / 0.0h,2595.54,1000.00
8,罗超,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.5h / 0.0h,1013.51,0.00
9,罗先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,1143.87,3000.00
10,陈德韩,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,4.4h / 0.0h,5714.01,0.00
11,阿亮,0.0h / 0.0h,0.00,0.00,2.9h / 0.0h,493.02,0.00,0.0h / 0.0h,0.00,0.00
12,曾先生,0.0h / 0.0h,0.00,0.00,1.0h / 0.0h,206.16,0.00,0.0h / 0.0h,0.00,0.00
13,蔡总,1.8h / 0.0h,0.00,0.00,17.0h / 0.0h,51902.23,0.00,0.0h / 0.0h,0.00,0.00
14,T,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.2h / 0.0h,194.33,0.00
1 助教详情:奈千(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础59.0h,附加0.0h;客户流水¥107484.78,充值归因¥18000.00;头部客户(12月)Top3:轩哥、黎先生、陈先生。
3 一、基础课业绩
4 说明:评价:基础59.0h,附加0.0h;客户流水¥107484.78,充值归因¥18000.00;头部客户(12月)Top3:轩哥、黎先生、陈先生。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,23.62h,13,-20.79h,-12.91h
8 11月,32.83h,19,-21.64h,-6.05h
9 12月,2.58h,21,-42.23h,-38.51h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,0.00h,,0.00h,0.00h
15 11月,0.00h,,0.00h,0.00h
16 12月,0.00h,,0.00h,0.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,38653.58,7,9374.05,8003.75
22 11月,68543.08,7,24288.69,35216.76
23 12月,288.12,22,-20442.41,-13352.52
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,18000.00,6,3533.33,5000.00
29 11月,0.00,,0.00,0.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
35 1,轩哥,0.7h / 0.0h,288.12,0.00,4.3h / 0.0h,14349.45,0.00,6.2h / 0.0h,22341.76,13000.00
36 2,黎先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.7h / 0.0h,470.19,0.00
37 3,陈先生,0.0h / 0.0h,0.00,0.00,5.1h / 0.0h,1150.83,0.00,0.0h / 0.0h,0.00,0.00
38 4,羊,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.4h / 0.0h,3620.75,0.00
39 5,陈腾鑫,0.0h / 0.0h,0.00,0.00,2.6h / 0.0h,441.39,0.00,2.1h / 0.0h,1084.69,1000.00
40 6,张先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.2h / 0.0h,474.93,0.00
41 7,夏,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.0h / 0.0h,2595.54,1000.00
42 8,罗超,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.5h / 0.0h,1013.51,0.00
43 9,罗先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,1143.87,3000.00
44 10,陈德韩,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,4.4h / 0.0h,5714.01,0.00
45 11,阿亮,0.0h / 0.0h,0.00,0.00,2.9h / 0.0h,493.02,0.00,0.0h / 0.0h,0.00,0.00
46 12,曾先生,0.0h / 0.0h,0.00,0.00,1.0h / 0.0h,206.16,0.00,0.0h / 0.0h,0.00,0.00
47 13,蔡总,1.8h / 0.0h,0.00,0.00,17.0h / 0.0h,51902.23,0.00,0.0h / 0.0h,0.00,0.00
48 14,T,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.2h / 0.0h,194.33,0.00

View File

@@ -0,0 +1,196 @@
# 助教详情奈千2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础59.0h附加0.0h客户流水¥107484.78充值归因¥18000.00;头部客户(12月)Top3轩哥、黎先生、陈先生。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,46 @@
助教详情姜姜2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础6.6h附加3.0h客户流水¥2333.94充值归因¥4000.00;头部客户(12月)Top3罗先生、汪先生。
一、基础课业绩
说明评价基础6.6h附加3.0h客户流水¥2333.94充值归因¥4000.00;头部客户(12月)Top3罗先生、汪先生。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,6.60h,18,-37.81h,-29.93h
11月,0.00h,,0.00h,0.00h
12月,0.00h,,0.00h,0.00h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,3.00h,5,-3.57h,-5.00h
11月,0.00h,,0.00h,0.00h
12月,0.00h,,0.00h,0.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,2333.94,20,-26945.59,-28315.89
11月,0.00,,0.00,0.00
12月,0.00,,0.00,0.00
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,4000.00,12,-10466.67,-9000.00
11月,0.00,,0.00,0.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1,罗先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.5h / 0.0h,1143.87,3000.00
2,汪先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,5.1h / 3.0h,1190.07,1000.00
1 助教详情:姜姜(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础6.6h,附加3.0h;客户流水¥2333.94,充值归因¥4000.00;头部客户(12月)Top3:罗先生、汪先生。
3 一、基础课业绩
4 说明:评价:基础6.6h,附加3.0h;客户流水¥2333.94,充值归因¥4000.00;头部客户(12月)Top3:罗先生、汪先生。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,6.60h,18,-37.81h,-29.93h
8 11月,0.00h,,0.00h,0.00h
9 12月,0.00h,,0.00h,0.00h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,3.00h,5,-3.57h,-5.00h
15 11月,0.00h,,0.00h,0.00h
16 12月,0.00h,,0.00h,0.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,2333.94,20,-26945.59,-28315.89
22 11月,0.00,,0.00,0.00
23 12月,0.00,,0.00,0.00
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,4000.00,12,-10466.67,-9000.00
29 11月,0.00,,0.00,0.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
35 1,罗先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.5h / 0.0h,1143.87,3000.00
36 2,汪先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,5.1h / 3.0h,1190.07,1000.00

View File

@@ -0,0 +1,196 @@
# 助教详情姜姜2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础6.6h附加3.0h客户流水¥2333.94充值归因¥4000.00;头部客户(12月)Top3罗先生、汪先生。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,65 @@
助教详情婉婉2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础154.6h附加34.0h客户流水¥106476.37充值归因¥33000.00;头部客户(12月)Top3江先生、明哥、候。
一、基础课业绩
说明评价基础154.6h附加34.0h客户流水¥106476.37充值归因¥33000.00;头部客户(12月)Top3江先生、明哥、候。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,90.68h,3,46.27h,54.16h
11月,46.03h,12,-8.44h,7.15h
12月,17.83h,17,-26.98h,-23.26h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,4.00h,4,-2.57h,-4.00h
11月,15.00h,2,6.20h,8.00h
12月,15.00h,3,4.73h,7.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,62187.64,2,32908.11,31537.81
11月,33326.32,14,-10928.07,0.00
12月,10962.41,15,-9768.12,-2678.24
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,24000.00,4,9533.33,11000.00
11月,9000.00,4,1230.77,0.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1,江先生,4.7h / 0.0h,5889.30,0.00,9.4h / 0.0h,6947.07,5000.00,2.7h / 0.0h,1538.09,0.00
2,明哥,11.7h / 10.0h,4822.90,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
3,,1.1h / 0.0h,195.75,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
4,刘哥,0.3h / 0.0h,54.46,0.00,5.0h / 0.0h,2982.34,0.00,0.0h / 0.0h,0.00,0.00
5,林总,0.0h / 0.0h,0.00,0.00,0.9h / 0.0h,244.48,0.00,0.0h / 0.0h,0.00,0.00
6,,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,4.3h / 0.0h,3620.75,0.00
7,叶先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,3.7h / 0.0h,1278.01,0.00
8,邓飛,0.0h / 0.0h,0.00,0.00,0.8h / 0.0h,925.47,1000.00,0.0h / 4.0h,0.00,0.00
9,歌神,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,6.7h / 0.0h,4718.40,0.00
10,,0.0h / 0.0h,0.00,0.00,5.4h / 4.0h,2991.13,0.00,18.2h / 0.0h,11826.32,1000.00
11,轩哥,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,45.2h / 0.0h,33043.15,16000.00
12,罗先生,0.0h / 5.0h,0.00,0.00,7.9h / 0.0h,2086.94,0.00,3.4h / 0.0h,1143.87,3000.00
13,蔡总,0.0h / 0.0h,0.00,0.00,0.0h / 3.0h,6196.43,0.00,0.0h / 0.0h,0.00,0.00
14,吕先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.8h / 0.0h,3924.18,3000.00
15,万先生,0.0h / 0.0h,0.00,0.00,0.0h / 4.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
16,老宋,0.0h / 0.0h,0.00,0.00,1.0h / 0.0h,465.98,0.00,0.0h / 0.0h,0.00,0.00
17,黎先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,0.8h / 0.0h,470.19,0.00
18,君姐,0.0h / 0.0h,0.00,0.00,4.2h / 0.0h,1864.86,0.00,0.0h / 0.0h,0.00,0.00
19,林先生,0.0h / 0.0h,0.00,0.00,6.0h / 4.0h,2690.52,0.00,0.0h / 0.0h,0.00,0.00
20,婉婉,0.0h / 0.0h,0.00,0.00,1.6h / 0.0h,242.81,0.00,2.8h / 0.0h,624.68,1000.00
21,胡先生,0.0h / 0.0h,0.00,0.00,3.8h / 0.0h,5688.29,3000.00,0.0h / 0.0h,0.00,0.00
1 助教详情:婉婉(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础154.6h,附加34.0h;客户流水¥106476.37,充值归因¥33000.00;头部客户(12月)Top3:江先生、明哥、候。
3 一、基础课业绩
4 说明:评价:基础154.6h,附加34.0h;客户流水¥106476.37,充值归因¥33000.00;头部客户(12月)Top3:江先生、明哥、候。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,90.68h,3,46.27h,54.16h
8 11月,46.03h,12,-8.44h,7.15h
9 12月,17.83h,17,-26.98h,-23.26h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,4.00h,4,-2.57h,-4.00h
15 11月,15.00h,2,6.20h,8.00h
16 12月,15.00h,3,4.73h,7.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,62187.64,2,32908.11,31537.81
22 11月,33326.32,14,-10928.07,0.00
23 12月,10962.41,15,-9768.12,-2678.24
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,24000.00,4,9533.33,11000.00
29 11月,9000.00,4,1230.77,0.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
35 1,江先生,4.7h / 0.0h,5889.30,0.00,9.4h / 0.0h,6947.07,5000.00,2.7h / 0.0h,1538.09,0.00
36 2,明哥,11.7h / 10.0h,4822.90,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
37 3,候,1.1h / 0.0h,195.75,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
38 4,刘哥,0.3h / 0.0h,54.46,0.00,5.0h / 0.0h,2982.34,0.00,0.0h / 0.0h,0.00,0.00
39 5,林总,0.0h / 0.0h,0.00,0.00,0.9h / 0.0h,244.48,0.00,0.0h / 0.0h,0.00,0.00
40 6,羊,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,4.3h / 0.0h,3620.75,0.00
41 7,叶先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,3.7h / 0.0h,1278.01,0.00
42 8,邓飛,0.0h / 0.0h,0.00,0.00,0.8h / 0.0h,925.47,1000.00,0.0h / 4.0h,0.00,0.00
43 9,歌神,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,6.7h / 0.0h,4718.40,0.00
44 10,夏,0.0h / 0.0h,0.00,0.00,5.4h / 4.0h,2991.13,0.00,18.2h / 0.0h,11826.32,1000.00
45 11,轩哥,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,45.2h / 0.0h,33043.15,16000.00
46 12,罗先生,0.0h / 5.0h,0.00,0.00,7.9h / 0.0h,2086.94,0.00,3.4h / 0.0h,1143.87,3000.00
47 13,蔡总,0.0h / 0.0h,0.00,0.00,0.0h / 3.0h,6196.43,0.00,0.0h / 0.0h,0.00,0.00
48 14,吕先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.8h / 0.0h,3924.18,3000.00
49 15,万先生,0.0h / 0.0h,0.00,0.00,0.0h / 4.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
50 16,老宋,0.0h / 0.0h,0.00,0.00,1.0h / 0.0h,465.98,0.00,0.0h / 0.0h,0.00,0.00
51 17,黎先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,0.8h / 0.0h,470.19,0.00
52 18,君姐,0.0h / 0.0h,0.00,0.00,4.2h / 0.0h,1864.86,0.00,0.0h / 0.0h,0.00,0.00
53 19,林先生,0.0h / 0.0h,0.00,0.00,6.0h / 4.0h,2690.52,0.00,0.0h / 0.0h,0.00,0.00
54 20,婉婉,0.0h / 0.0h,0.00,0.00,1.6h / 0.0h,242.81,0.00,2.8h / 0.0h,624.68,1000.00
55 21,胡先生,0.0h / 0.0h,0.00,0.00,3.8h / 0.0h,5688.29,3000.00,0.0h / 0.0h,0.00,0.00

View File

@@ -0,0 +1,196 @@
# 助教详情婉婉2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础154.6h附加34.0h客户流水¥106476.37充值归因¥33000.00;头部客户(12月)Top3江先生、明哥、候。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,57 @@
助教详情小侯2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础92.2h附加0.0h客户流水¥41280.98充值归因¥0.00;头部客户(12月)Top3张先生、陈腾鑫、李先生。
一、基础课业绩
说明评价基础92.2h附加0.0h客户流水¥41280.98充值归因¥0.00;头部客户(12月)Top3张先生、陈腾鑫、李先生。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,42.58h,13,-11.89h,3.70h
12月,49.57h,8,4.76h,8.47h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,0.00h,,0.00h,0.00h
12月,0.00h,,0.00h,0.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,0.00,,0.00,0.00
11月,27313.21,16,-16941.18,-6013.11
12月,13967.77,11,-6762.76,327.12
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,0.00,,0.00,0.00
11月,0.00,,0.00,0.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1,张先生,14.4h / 0.0h,4161.57,0.00,5.8h / 0.0h,1583.86,0.00,0.0h / 0.0h,0.00,0.00
2,陈腾鑫,12.1h / 0.0h,3984.45,0.00,7.0h / 0.0h,2965.62,0.00,0.0h / 0.0h,0.00,0.00
3,李先生,9.3h / 0.0h,1729.57,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
4,,3.3h / 0.0h,1356.34,0.00,1.4h / 0.0h,1573.10,0.00,0.0h / 0.0h,0.00,0.00
5,,3.0h / 0.0h,1128.06,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
6,T,3.9h / 0.0h,938.16,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
7,,3.4h / 0.0h,669.62,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
8,林志铭,0.0h / 0.0h,0.00,0.00,1.2h / 0.0h,220.15,0.00,0.0h / 0.0h,0.00,0.00
9,林先生,0.0h / 0.0h,0.00,0.00,9.7h / 0.0h,3619.37,0.00,0.0h / 0.0h,0.00,0.00
10,艾宇民,0.0h / 0.0h,0.00,0.00,7.6h / 0.0h,3872.24,0.00,0.0h / 0.0h,0.00,0.00
11,蔡总,0.0h / 0.0h,0.00,0.00,2.6h / 0.0h,10419.30,0.00,0.0h / 0.0h,0.00,0.00
12,钟智豪,0.0h / 0.0h,0.00,0.00,1.8h / 0.0h,274.34,0.00,0.0h / 0.0h,0.00,0.00
13,李先生,0.0h / 0.0h,0.00,0.00,5.6h / 0.0h,2785.23,0.00,0.0h / 0.0h,0.00,0.00
1 助教详情:小侯(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础92.2h,附加0.0h;客户流水¥41280.98,充值归因¥0.00;头部客户(12月)Top3:张先生、陈腾鑫、李先生。
3 一、基础课业绩
4 说明:评价:基础92.2h,附加0.0h;客户流水¥41280.98,充值归因¥0.00;头部客户(12月)Top3:张先生、陈腾鑫、李先生。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,0.00h,,0.00h,0.00h
8 11月,42.58h,13,-11.89h,3.70h
9 12月,49.57h,8,4.76h,8.47h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,0.00h,,0.00h,0.00h
15 11月,0.00h,,0.00h,0.00h
16 12月,0.00h,,0.00h,0.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,0.00,,0.00,0.00
22 11月,27313.21,16,-16941.18,-6013.11
23 12月,13967.77,11,-6762.76,327.12
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,0.00,,0.00,0.00
29 11月,0.00,,0.00,0.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
35 1,张先生,14.4h / 0.0h,4161.57,0.00,5.8h / 0.0h,1583.86,0.00,0.0h / 0.0h,0.00,0.00
36 2,陈腾鑫,12.1h / 0.0h,3984.45,0.00,7.0h / 0.0h,2965.62,0.00,0.0h / 0.0h,0.00,0.00
37 3,李先生,9.3h / 0.0h,1729.57,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
38 4,梅,3.3h / 0.0h,1356.34,0.00,1.4h / 0.0h,1573.10,0.00,0.0h / 0.0h,0.00,0.00
39 5,清,3.0h / 0.0h,1128.06,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
40 6,T,3.9h / 0.0h,938.16,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
41 7,候,3.4h / 0.0h,669.62,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
42 8,林志铭,0.0h / 0.0h,0.00,0.00,1.2h / 0.0h,220.15,0.00,0.0h / 0.0h,0.00,0.00
43 9,林先生,0.0h / 0.0h,0.00,0.00,9.7h / 0.0h,3619.37,0.00,0.0h / 0.0h,0.00,0.00
44 10,艾宇民,0.0h / 0.0h,0.00,0.00,7.6h / 0.0h,3872.24,0.00,0.0h / 0.0h,0.00,0.00
45 11,蔡总,0.0h / 0.0h,0.00,0.00,2.6h / 0.0h,10419.30,0.00,0.0h / 0.0h,0.00,0.00
46 12,钟智豪,0.0h / 0.0h,0.00,0.00,1.8h / 0.0h,274.34,0.00,0.0h / 0.0h,0.00,0.00
47 13,李先生,0.0h / 0.0h,0.00,0.00,5.6h / 0.0h,2785.23,0.00,0.0h / 0.0h,0.00,0.00

View File

@@ -0,0 +1,196 @@
# 助教详情小侯2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础92.2h附加0.0h客户流水¥41280.98充值归因¥0.00;头部客户(12月)Top3张先生、陈腾鑫、李先生。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,55 @@
助教详情小敌2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础135.1h附加3.0h客户流水¥93760.82充值归因¥29000.00;头部客户(12月)Top3郑先生、张先生、轩哥。
一、基础课业绩
说明评价基础135.1h附加3.0h客户流水¥93760.82充值归因¥29000.00;头部客户(12月)Top3郑先生、张先生、轩哥。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,55.82h,7,11.41h,19.29h
11月,72.90h,9,18.42h,34.02h
12月,6.40h,20,-38.41h,-34.69h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,3.00h,5,-3.57h,-5.00h
11月,0.00h,,0.00h,0.00h
12月,0.00h,,0.00h,0.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,44510.29,4,15230.76,13860.46
11月,47986.57,9,3732.18,14660.25
12月,1263.96,20,-19466.57,-12376.68
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,21000.00,5,6533.33,8000.00
11月,8000.00,5,230.77,-1000.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1,郑先生,4.9h / 0.0h,814.93,0.00,27.3h / 0.0h,4745.90,0.00,0.0h / 0.0h,0.00,0.00
2,张先生,1.5h / 0.0h,449.03,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
3,轩哥,0.0h / 0.0h,0.00,0.00,11.2h / 0.0h,15962.93,0.00,43.1h / 0.0h,32148.10,21000.00
4,,0.0h / 0.0h,0.00,0.00,3.6h / 0.0h,3791.20,0.00,0.0h / 0.0h,0.00,0.00
5,叶先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.1h / 0.0h,3922.17,0.00
6,李先生,0.0h / 0.0h,0.00,0.00,11.8h / 0.0h,2997.53,3000.00,0.0h / 0.0h,0.00,0.00
7,周先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,6.6h / 0.0h,2726.01,0.00
8,陈德韩,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,4.0h / 0.0h,5714.01,0.00
9,蔡总,0.0h / 0.0h,0.00,0.00,17.2h / 0.0h,19881.95,5000.00,0.0h / 0.0h,0.00,0.00
10,林先生,0.0h / 0.0h,0.00,0.00,1.9h / 0.0h,607.06,0.00,0.0h / 0.0h,0.00,0.00
11,邓飛,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 3.0h,0.00,0.00
1 助教详情:小敌(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础135.1h,附加3.0h;客户流水¥93760.82,充值归因¥29000.00;头部客户(12月)Top3:郑先生、张先生、轩哥。
3 一、基础课业绩
4 说明:评价:基础135.1h,附加3.0h;客户流水¥93760.82,充值归因¥29000.00;头部客户(12月)Top3:郑先生、张先生、轩哥。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,55.82h,7,11.41h,19.29h
8 11月,72.90h,9,18.42h,34.02h
9 12月,6.40h,20,-38.41h,-34.69h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,3.00h,5,-3.57h,-5.00h
15 11月,0.00h,,0.00h,0.00h
16 12月,0.00h,,0.00h,0.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,44510.29,4,15230.76,13860.46
22 11月,47986.57,9,3732.18,14660.25
23 12月,1263.96,20,-19466.57,-12376.68
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,21000.00,5,6533.33,8000.00
29 11月,8000.00,5,230.77,-1000.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
35 1,郑先生,4.9h / 0.0h,814.93,0.00,27.3h / 0.0h,4745.90,0.00,0.0h / 0.0h,0.00,0.00
36 2,张先生,1.5h / 0.0h,449.03,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
37 3,轩哥,0.0h / 0.0h,0.00,0.00,11.2h / 0.0h,15962.93,0.00,43.1h / 0.0h,32148.10,21000.00
38 4,游,0.0h / 0.0h,0.00,0.00,3.6h / 0.0h,3791.20,0.00,0.0h / 0.0h,0.00,0.00
39 5,叶先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.1h / 0.0h,3922.17,0.00
40 6,李先生,0.0h / 0.0h,0.00,0.00,11.8h / 0.0h,2997.53,3000.00,0.0h / 0.0h,0.00,0.00
41 7,周先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,6.6h / 0.0h,2726.01,0.00
42 8,陈德韩,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,4.0h / 0.0h,5714.01,0.00
43 9,蔡总,0.0h / 0.0h,0.00,0.00,17.2h / 0.0h,19881.95,5000.00,0.0h / 0.0h,0.00,0.00
44 10,林先生,0.0h / 0.0h,0.00,0.00,1.9h / 0.0h,607.06,0.00,0.0h / 0.0h,0.00,0.00
45 11,邓飛,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 3.0h,0.00,0.00

View File

@@ -0,0 +1,196 @@
# 助教详情小敌2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础135.1h附加3.0h客户流水¥93760.82充值归因¥29000.00;头部客户(12月)Top3郑先生、张先生、轩哥。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,66 @@
助教详情小柔2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础207.4h附加22.0h客户流水¥209918.77充值归因¥42700.00;头部客户(12月)Top3蔡总、轩哥、明哥。
一、基础课业绩
说明评价基础207.4h附加22.0h客户流水¥209918.77充值归因¥42700.00;头部客户(12月)Top3蔡总、轩哥、明哥。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,63.87h,5,19.46h,27.34h
11月,88.65h,6,34.17h,49.77h
12月,54.93h,7,10.12h,13.84h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,7.00h,4,-1.80h,0.00h
12月,15.00h,3,4.73h,7.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,52623.85,3,23344.32,21974.02
11月,110137.94,3,65883.55,76811.62
12月,47156.98,3,26426.45,33516.34
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,31700.00,2,17233.33,18700.00
11月,11000.00,2,3230.77,2000.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1,蔡总,30.2h / 0.0h,25658.77,0.00,62.2h / 3.0h,88451.79,5000.00,0.0h / 0.0h,0.00,0.00
2,轩哥,8.4h / 0.0h,13202.16,0.00,2.0h / 0.0h,4130.37,0.00,35.2h / 0.0h,33211.31,23000.00
3,明哥,7.7h / 12.0h,4190.45,0.00,5.8h / 0.0h,2258.14,0.00,0.0h / 0.0h,0.00,0.00
4,江先生,3.2h / 0.0h,3042.99,0.00,6.1h / 0.0h,7578.00,5000.00,2.7h / 0.0h,1538.09,0.00
5,T,2.0h / 0.0h,434.21,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
6,昌哥,1.8h / 0.0h,318.40,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
7,陈腾鑫,1.6h / 0.0h,310.00,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
8,罗先生,0.0h / 0.0h,0.00,0.00,4.1h / 0.0h,722.25,0.00,0.0h / 0.0h,0.00,0.00
9,邓飛,0.0h / 0.0h,0.00,0.00,1.2h / 0.0h,925.47,1000.00,0.0h / 0.0h,0.00,0.00
10,吴生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.8h / 0.0h,685.89,0.00
11,歌神,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,3.8h / 0.0h,2789.21,0.00
12,,0.0h / 0.0h,0.00,0.00,1.6h / 0.0h,383.40,0.00,0.0h / 0.0h,0.00,0.00
13,张先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,3.3h / 0.0h,568.87,0.00
14,,0.0h / 0.0h,0.00,0.00,2.2h / 0.0h,935.84,0.00,0.0h / 0.0h,0.00,0.00
15,陈德韩,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,3.0h / 0.0h,5714.01,0.00
16,吕先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,7.5h / 0.0h,2750.70,3000.00
17,罗先生,0.0h / 3.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
18,万先生,0.0h / 0.0h,0.00,0.00,0.0h / 4.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
19,林先生,0.0h / 0.0h,0.00,0.00,3.2h / 0.0h,2398.29,0.00,0.0h / 0.0h,0.00,0.00
20,,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.7h / 0.0h,362.17,0.00
21,叶总,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,3.8h / 0.0h,5003.60,5700.00
22,胡先生,0.0h / 0.0h,0.00,0.00,0.1h / 0.0h,2354.39,0.00,0.0h / 0.0h,0.00,0.00
1 助教详情:小柔(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础207.4h,附加22.0h;客户流水¥209918.77,充值归因¥42700.00;头部客户(12月)Top3:蔡总、轩哥、明哥。
3 一、基础课业绩
4 说明:评价:基础207.4h,附加22.0h;客户流水¥209918.77,充值归因¥42700.00;头部客户(12月)Top3:蔡总、轩哥、明哥。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,63.87h,5,19.46h,27.34h
8 11月,88.65h,6,34.17h,49.77h
9 12月,54.93h,7,10.12h,13.84h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,0.00h,,0.00h,0.00h
15 11月,7.00h,4,-1.80h,0.00h
16 12月,15.00h,3,4.73h,7.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,52623.85,3,23344.32,21974.02
22 11月,110137.94,3,65883.55,76811.62
23 12月,47156.98,3,26426.45,33516.34
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,31700.00,2,17233.33,18700.00
29 11月,11000.00,2,3230.77,2000.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
35 1,蔡总,30.2h / 0.0h,25658.77,0.00,62.2h / 3.0h,88451.79,5000.00,0.0h / 0.0h,0.00,0.00
36 2,轩哥,8.4h / 0.0h,13202.16,0.00,2.0h / 0.0h,4130.37,0.00,35.2h / 0.0h,33211.31,23000.00
37 3,明哥,7.7h / 12.0h,4190.45,0.00,5.8h / 0.0h,2258.14,0.00,0.0h / 0.0h,0.00,0.00
38 4,江先生,3.2h / 0.0h,3042.99,0.00,6.1h / 0.0h,7578.00,5000.00,2.7h / 0.0h,1538.09,0.00
39 5,T,2.0h / 0.0h,434.21,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
40 6,昌哥,1.8h / 0.0h,318.40,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
41 7,陈腾鑫,1.6h / 0.0h,310.00,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
42 8,罗先生,0.0h / 0.0h,0.00,0.00,4.1h / 0.0h,722.25,0.00,0.0h / 0.0h,0.00,0.00
43 9,邓飛,0.0h / 0.0h,0.00,0.00,1.2h / 0.0h,925.47,1000.00,0.0h / 0.0h,0.00,0.00
44 10,吴生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.8h / 0.0h,685.89,0.00
45 11,歌神,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,3.8h / 0.0h,2789.21,0.00
46 12,羊,0.0h / 0.0h,0.00,0.00,1.6h / 0.0h,383.40,0.00,0.0h / 0.0h,0.00,0.00
47 13,张先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,3.3h / 0.0h,568.87,0.00
48 14,游,0.0h / 0.0h,0.00,0.00,2.2h / 0.0h,935.84,0.00,0.0h / 0.0h,0.00,0.00
49 15,陈德韩,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,3.0h / 0.0h,5714.01,0.00
50 16,吕先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,7.5h / 0.0h,2750.70,3000.00
51 17,罗先生,0.0h / 3.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
52 18,万先生,0.0h / 0.0h,0.00,0.00,0.0h / 4.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
53 19,林先生,0.0h / 0.0h,0.00,0.00,3.2h / 0.0h,2398.29,0.00,0.0h / 0.0h,0.00,0.00
54 20,陶,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.7h / 0.0h,362.17,0.00
55 21,叶总,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,3.8h / 0.0h,5003.60,5700.00
56 22,胡先生,0.0h / 0.0h,0.00,0.00,0.1h / 0.0h,2354.39,0.00,0.0h / 0.0h,0.00,0.00

View File

@@ -0,0 +1,196 @@
# 助教详情小柔2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础207.4h附加22.0h客户流水¥209918.77充值归因¥42700.00;头部客户(12月)Top3蔡总、轩哥、明哥。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,44 @@
助教详情小柳2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础0.0h附加0.0h客户流水¥0.00充值归因¥0.00;头部客户(12月)Top3无。
一、基础课业绩
说明评价基础0.0h附加0.0h客户流水¥0.00充值归因¥0.00;头部客户(12月)Top3无。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,0.00h,,0.00h,0.00h
12月,0.00h,,0.00h,0.00h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,0.00h,,0.00h,0.00h
12月,0.00h,,0.00h,0.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,0.00,,0.00,0.00
11月,0.00,,0.00,0.00
12月,0.00,,0.00,0.00
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,0.00,,0.00,0.00
11月,0.00,,0.00,0.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1 助教详情:小柳(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础0.0h,附加0.0h;客户流水¥0.00,充值归因¥0.00;头部客户(12月)Top3:无。
3 一、基础课业绩
4 说明:评价:基础0.0h,附加0.0h;客户流水¥0.00,充值归因¥0.00;头部客户(12月)Top3:无。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,0.00h,,0.00h,0.00h
8 11月,0.00h,,0.00h,0.00h
9 12月,0.00h,,0.00h,0.00h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,0.00h,,0.00h,0.00h
15 11月,0.00h,,0.00h,0.00h
16 12月,0.00h,,0.00h,0.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,0.00,,0.00,0.00
22 11月,0.00,,0.00,0.00
23 12月,0.00,,0.00,0.00
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,0.00,,0.00,0.00
29 11月,0.00,,0.00,0.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)

View File

@@ -0,0 +1,196 @@
# 助教详情小柳2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础0.0h附加0.0h客户流水¥0.00充值归因¥0.00;头部客户(12月)Top3无。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,48 @@
助教详情小燕2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础268.3h附加23.0h客户流水¥77172.28充值归因¥0.00;头部客户(12月)Top3葛先生、小燕、梅。
一、基础课业绩
说明评价基础268.3h附加23.0h客户流水¥77172.28充值归因¥0.00;头部客户(12月)Top3葛先生、小燕、梅。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,109.28h,3,54.81h,70.40h
12月,159.02h,1,114.21h,117.92h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,2.00h,6,-6.80h,-5.00h
12月,21.00h,2,10.73h,13.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,0.00,,0.00,0.00
11月,39426.42,12,-4827.97,6100.10
12月,37745.86,5,17015.33,24105.22
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,0.00,,0.00,0.00
11月,0.00,,0.00,0.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1,葛先生,80.8h / 16.0h,22323.38,0.00,53.5h / 0.0h,17941.19,0.00,0.0h / 0.0h,0.00,0.00
2,小燕,78.2h / 5.0h,15422.48,0.00,51.4h / 2.0h,10944.82,0.00,0.0h / 0.0h,0.00,0.00
3,,0.0h / 0.0h,0.00,0.00,3.8h / 0.0h,1573.10,0.00,0.0h / 0.0h,0.00,0.00
4,蔡总,0.0h / 0.0h,0.00,0.00,0.7h / 0.0h,8967.31,0.00,0.0h / 0.0h,0.00,0.00
1 助教详情:小燕(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础268.3h,附加23.0h;客户流水¥77172.28,充值归因¥0.00;头部客户(12月)Top3:葛先生、小燕、梅。
3 一、基础课业绩
4 说明:评价:基础268.3h,附加23.0h;客户流水¥77172.28,充值归因¥0.00;头部客户(12月)Top3:葛先生、小燕、梅。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,0.00h,,0.00h,0.00h
8 11月,109.28h,3,54.81h,70.40h
9 12月,159.02h,1,114.21h,117.92h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,0.00h,,0.00h,0.00h
15 11月,2.00h,6,-6.80h,-5.00h
16 12月,21.00h,2,10.73h,13.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,0.00,,0.00,0.00
22 11月,39426.42,12,-4827.97,6100.10
23 12月,37745.86,5,17015.33,24105.22
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,0.00,,0.00,0.00
29 11月,0.00,,0.00,0.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
35 1,葛先生,80.8h / 16.0h,22323.38,0.00,53.5h / 0.0h,17941.19,0.00,0.0h / 0.0h,0.00,0.00
36 2,小燕,78.2h / 5.0h,15422.48,0.00,51.4h / 2.0h,10944.82,0.00,0.0h / 0.0h,0.00,0.00
37 3,梅,0.0h / 0.0h,0.00,0.00,3.8h / 0.0h,1573.10,0.00,0.0h / 0.0h,0.00,0.00
38 4,蔡总,0.0h / 0.0h,0.00,0.00,0.7h / 0.0h,8967.31,0.00,0.0h / 0.0h,0.00,0.00

View File

@@ -0,0 +1,196 @@
# 助教详情小燕2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础268.3h附加23.0h客户流水¥77172.28充值归因¥0.00;头部客户(12月)Top3葛先生、小燕、梅。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,47 @@
助教详情希希2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础6.6h附加0.0h客户流水¥3367.56充值归因¥0.00;头部客户(12月)Top3陈腾鑫、歌神、郭先生。
一、基础课业绩
说明评价基础6.6h附加0.0h客户流水¥3367.56充值归因¥0.00;头部客户(12月)Top3陈腾鑫、歌神、郭先生。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,5.02h,19,-39.39h,-31.51h
11月,1.58h,27,-52.89h,-37.30h
12月,0.00h,,0.00h,0.00h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,0.00h,,0.00h,0.00h
12月,0.00h,,0.00h,0.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,3086.34,18,-26193.19,-27563.49
11月,281.22,27,-43973.17,-33045.10
12月,0.00,,0.00,0.00
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,0.00,,0.00,0.00
11月,0.00,,0.00,0.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1,陈腾鑫,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.0h / 0.0h,359.28,0.00
2,歌神,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,4.0h / 0.0h,2727.06,0.00
3,郭先生,0.0h / 0.0h,0.00,0.00,1.6h / 0.0h,281.22,0.00,0.0h / 0.0h,0.00,0.00
1 助教详情:希希(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础6.6h,附加0.0h;客户流水¥3367.56,充值归因¥0.00;头部客户(12月)Top3:陈腾鑫、歌神、郭先生。
3 一、基础课业绩
4 说明:评价:基础6.6h,附加0.0h;客户流水¥3367.56,充值归因¥0.00;头部客户(12月)Top3:陈腾鑫、歌神、郭先生。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,5.02h,19,-39.39h,-31.51h
8 11月,1.58h,27,-52.89h,-37.30h
9 12月,0.00h,,0.00h,0.00h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,0.00h,,0.00h,0.00h
15 11月,0.00h,,0.00h,0.00h
16 12月,0.00h,,0.00h,0.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,3086.34,18,-26193.19,-27563.49
22 11月,281.22,27,-43973.17,-33045.10
23 12月,0.00,,0.00,0.00
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,0.00,,0.00,0.00
29 11月,0.00,,0.00,0.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
35 1,陈腾鑫,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.0h / 0.0h,359.28,0.00
36 2,歌神,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,4.0h / 0.0h,2727.06,0.00
37 3,郭先生,0.0h / 0.0h,0.00,0.00,1.6h / 0.0h,281.22,0.00,0.0h / 0.0h,0.00,0.00

View File

@@ -0,0 +1,196 @@
# 助教详情希希2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础6.6h附加0.0h客户流水¥3367.56充值归因¥0.00;头部客户(12月)Top3陈腾鑫、歌神、郭先生。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,63 @@
助教详情年糕2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础82.6h附加7.0h客户流水¥59830.16充值归因¥9000.00;头部客户(12月)Top3葛先生、明哥、蔡总。
一、基础课业绩
说明评价基础82.6h附加7.0h客户流水¥59830.16充值归因¥9000.00;头部客户(12月)Top3葛先生、明哥、蔡总。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,21.23h,14,-23.18h,-15.29h
11月,35.80h,15,-18.68h,-3.08h
12月,25.62h,14,-19.19h,-15.48h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,7.00h,4,-1.80h,0.00h
12月,0.00h,,0.00h,0.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,26289.89,12,-2989.64,-4359.94
11月,15696.08,20,-28558.31,-17630.24
12月,17844.19,9,-2886.34,4203.54
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,9000.00,10,-5466.67,-4000.00
11月,0.00,,0.00,0.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1,葛先生,2.6h / 0.0h,5551.79,0.00,6.7h / 0.0h,3777.09,0.00,0.0h / 0.0h,0.00,0.00
2,明哥,4.6h / 0.0h,4190.45,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
3,蔡总,6.0h / 0.0h,2130.39,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
4,叶先生,2.6h / 0.0h,1558.40,0.00,1.8h / 0.0h,711.79,0.00,5.3h / 0.0h,3607.02,3000.00
5,君姐,2.2h / 0.0h,1414.23,0.00,6.0h / 0.0h,1864.86,0.00,0.0h / 0.0h,0.00,0.00
6,林先生,0.9h / 0.0h,1369.51,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
7,张先生,2.5h / 0.0h,540.07,0.00,4.2h / 0.0h,1007.52,0.00,2.1h / 0.0h,596.24,0.00
8,潘先生,2.0h / 0.0h,516.93,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
9,常总,1.7h / 0.0h,460.52,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
10,小燕,0.5h / 0.0h,111.90,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
11,谢俊,0.0h / 0.0h,0.00,0.00,4.5h / 0.0h,794.53,0.00,0.0h / 0.0h,0.00,0.00
12,歌神,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.6h / 0.0h,1929.19,0.00
13,,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.2h / 0.0h,4670.88,0.00
14,轩哥,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,7.2h / 0.0h,12643.27,3000.00
15,罗先生,0.0h / 0.0h,0.00,0.00,7.6h / 0.0h,2400.67,0.00,0.0h / 0.0h,0.00,0.00
16,吕先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.8h / 0.0h,2843.29,3000.00
17,万先生,0.0h / 0.0h,0.00,0.00,0.0h / 7.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
18,胡先生,0.0h / 0.0h,0.00,0.00,0.8h / 0.0h,2354.39,0.00,0.0h / 0.0h,0.00,0.00
19,李先生,0.0h / 0.0h,0.00,0.00,4.2h / 0.0h,2785.23,0.00,0.0h / 0.0h,0.00,0.00
1 助教详情:年糕(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础82.6h,附加7.0h;客户流水¥59830.16,充值归因¥9000.00;头部客户(12月)Top3:葛先生、明哥、蔡总。
3 一、基础课业绩
4 说明:评价:基础82.6h,附加7.0h;客户流水¥59830.16,充值归因¥9000.00;头部客户(12月)Top3:葛先生、明哥、蔡总。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,21.23h,14,-23.18h,-15.29h
8 11月,35.80h,15,-18.68h,-3.08h
9 12月,25.62h,14,-19.19h,-15.48h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,0.00h,,0.00h,0.00h
15 11月,7.00h,4,-1.80h,0.00h
16 12月,0.00h,,0.00h,0.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,26289.89,12,-2989.64,-4359.94
22 11月,15696.08,20,-28558.31,-17630.24
23 12月,17844.19,9,-2886.34,4203.54
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,9000.00,10,-5466.67,-4000.00
29 11月,0.00,,0.00,0.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
35 1,葛先生,2.6h / 0.0h,5551.79,0.00,6.7h / 0.0h,3777.09,0.00,0.0h / 0.0h,0.00,0.00
36 2,明哥,4.6h / 0.0h,4190.45,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
37 3,蔡总,6.0h / 0.0h,2130.39,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
38 4,叶先生,2.6h / 0.0h,1558.40,0.00,1.8h / 0.0h,711.79,0.00,5.3h / 0.0h,3607.02,3000.00
39 5,君姐,2.2h / 0.0h,1414.23,0.00,6.0h / 0.0h,1864.86,0.00,0.0h / 0.0h,0.00,0.00
40 6,林先生,0.9h / 0.0h,1369.51,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
41 7,张先生,2.5h / 0.0h,540.07,0.00,4.2h / 0.0h,1007.52,0.00,2.1h / 0.0h,596.24,0.00
42 8,潘先生,2.0h / 0.0h,516.93,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
43 9,常总,1.7h / 0.0h,460.52,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
44 10,小燕,0.5h / 0.0h,111.90,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
45 11,谢俊,0.0h / 0.0h,0.00,0.00,4.5h / 0.0h,794.53,0.00,0.0h / 0.0h,0.00,0.00
46 12,歌神,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.6h / 0.0h,1929.19,0.00
47 13,夏,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.2h / 0.0h,4670.88,0.00
48 14,轩哥,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,7.2h / 0.0h,12643.27,3000.00
49 15,罗先生,0.0h / 0.0h,0.00,0.00,7.6h / 0.0h,2400.67,0.00,0.0h / 0.0h,0.00,0.00
50 16,吕先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.8h / 0.0h,2843.29,3000.00
51 17,万先生,0.0h / 0.0h,0.00,0.00,0.0h / 7.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
52 18,胡先生,0.0h / 0.0h,0.00,0.00,0.8h / 0.0h,2354.39,0.00,0.0h / 0.0h,0.00,0.00
53 19,李先生,0.0h / 0.0h,0.00,0.00,4.2h / 0.0h,2785.23,0.00,0.0h / 0.0h,0.00,0.00

View File

@@ -0,0 +1,196 @@
# 助教详情年糕2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础82.6h附加7.0h客户流水¥59830.16充值归因¥9000.00;头部客户(12月)Top3葛先生、明哥、蔡总。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,46 @@
助教详情悦悦2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础2.3h附加0.0h客户流水¥2970.96充值归因¥3000.00;头部客户(12月)Top3小宇、轩哥。
一、基础课业绩
说明评价基础2.3h附加0.0h客户流水¥2970.96充值归因¥3000.00;头部客户(12月)Top3小宇、轩哥。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,2.30h,20,-42.11h,-34.23h
11月,0.00h,,0.00h,0.00h
12月,0.00h,,0.00h,0.00h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,0.00h,,0.00h,0.00h
12月,0.00h,,0.00h,0.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,2970.96,19,-26308.57,-27678.87
11月,0.00,,0.00,0.00
12月,0.00,,0.00,0.00
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,3000.00,13,-11466.67,-10000.00
11月,0.00,,0.00,0.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1,小宇,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,0.4h / 0.0h,78.52,0.00
2,轩哥,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.9h / 0.0h,2892.44,3000.00
1 助教详情:悦悦(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础2.3h,附加0.0h;客户流水¥2970.96,充值归因¥3000.00;头部客户(12月)Top3:小宇、轩哥。
3 一、基础课业绩
4 说明:评价:基础2.3h,附加0.0h;客户流水¥2970.96,充值归因¥3000.00;头部客户(12月)Top3:小宇、轩哥。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,2.30h,20,-42.11h,-34.23h
8 11月,0.00h,,0.00h,0.00h
9 12月,0.00h,,0.00h,0.00h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,0.00h,,0.00h,0.00h
15 11月,0.00h,,0.00h,0.00h
16 12月,0.00h,,0.00h,0.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,2970.96,19,-26308.57,-27678.87
22 11月,0.00,,0.00,0.00
23 12月,0.00,,0.00,0.00
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,3000.00,13,-11466.67,-10000.00
29 11月,0.00,,0.00,0.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
35 1,小宇,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,0.4h / 0.0h,78.52,0.00
36 2,轩哥,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.9h / 0.0h,2892.44,3000.00

View File

@@ -0,0 +1,196 @@
# 助教详情悦悦2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础2.3h附加0.0h客户流水¥2970.96充值归因¥3000.00;头部客户(12月)Top3小宇、轩哥。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,56 @@
助教详情柚子2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础35.4h附加10.0h客户流水¥23234.98充值归因¥3000.00;头部客户(12月)Top3陈先生、羊、葛先生。
一、基础课业绩
说明评价基础35.4h附加10.0h客户流水¥23234.98充值归因¥3000.00;头部客户(12月)Top3陈先生、羊、葛先生。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,35.40h,16,-19.08h,-3.48h
12月,0.00h,,0.00h,0.00h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,10.00h,3,1.20h,3.00h
12月,0.00h,,0.00h,0.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,0.00,,0.00,0.00
11月,23234.98,18,-21019.41,-10091.34
12月,0.00,,0.00,0.00
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,0.00,,0.00,0.00
11月,3000.00,8,-4769.23,-6000.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1,陈先生,0.0h / 0.0h,0.00,0.00,4.4h / 0.0h,1150.83,0.00,0.0h / 0.0h,0.00,0.00
2,,0.0h / 0.0h,0.00,0.00,1.6h / 0.0h,429.33,0.00,0.0h / 0.0h,0.00,0.00
3,葛先生,0.0h / 0.0h,0.00,0.00,3.4h / 0.0h,3052.28,0.00,0.0h / 0.0h,0.00,0.00
4,陈腾鑫,0.0h / 0.0h,0.00,0.00,0.8h / 0.0h,472.03,0.00,0.0h / 0.0h,0.00,0.00
5,张先生,0.0h / 0.0h,0.00,0.00,3.2h / 0.0h,941.37,0.00,0.0h / 0.0h,0.00,0.00
6,,0.0h / 0.0h,0.00,0.00,0.2h / 7.0h,2991.13,0.00,0.0h / 0.0h,0.00,0.00
7,轩哥,0.0h / 0.0h,0.00,0.00,0.2h / 0.0h,4484.68,0.00,0.0h / 0.0h,0.00,0.00
8,胡先生,0.0h / 0.0h,0.00,0.00,1.0h / 0.0h,5688.29,3000.00,0.0h / 0.0h,0.00,0.00
9,李先生,0.0h / 0.0h,0.00,0.00,7.8h / 0.0h,1712.78,0.00,0.0h / 0.0h,0.00,0.00
10,牛先生,0.0h / 0.0h,0.00,0.00,10.4h / 0.0h,1887.48,0.00,0.0h / 0.0h,0.00,0.00
11,阿亮,0.0h / 0.0h,0.00,0.00,2.4h / 0.0h,424.78,0.00,0.0h / 0.0h,0.00,0.00
12,万先生,0.0h / 0.0h,0.00,0.00,0.0h / 3.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
1 助教详情:柚子(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础35.4h,附加10.0h;客户流水¥23234.98,充值归因¥3000.00;头部客户(12月)Top3:陈先生、羊、葛先生。
3 一、基础课业绩
4 说明:评价:基础35.4h,附加10.0h;客户流水¥23234.98,充值归因¥3000.00;头部客户(12月)Top3:陈先生、羊、葛先生。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,0.00h,,0.00h,0.00h
8 11月,35.40h,16,-19.08h,-3.48h
9 12月,0.00h,,0.00h,0.00h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,0.00h,,0.00h,0.00h
15 11月,10.00h,3,1.20h,3.00h
16 12月,0.00h,,0.00h,0.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,0.00,,0.00,0.00
22 11月,23234.98,18,-21019.41,-10091.34
23 12月,0.00,,0.00,0.00
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,0.00,,0.00,0.00
29 11月,3000.00,8,-4769.23,-6000.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
35 1,陈先生,0.0h / 0.0h,0.00,0.00,4.4h / 0.0h,1150.83,0.00,0.0h / 0.0h,0.00,0.00
36 2,羊,0.0h / 0.0h,0.00,0.00,1.6h / 0.0h,429.33,0.00,0.0h / 0.0h,0.00,0.00
37 3,葛先生,0.0h / 0.0h,0.00,0.00,3.4h / 0.0h,3052.28,0.00,0.0h / 0.0h,0.00,0.00
38 4,陈腾鑫,0.0h / 0.0h,0.00,0.00,0.8h / 0.0h,472.03,0.00,0.0h / 0.0h,0.00,0.00
39 5,张先生,0.0h / 0.0h,0.00,0.00,3.2h / 0.0h,941.37,0.00,0.0h / 0.0h,0.00,0.00
40 6,夏,0.0h / 0.0h,0.00,0.00,0.2h / 7.0h,2991.13,0.00,0.0h / 0.0h,0.00,0.00
41 7,轩哥,0.0h / 0.0h,0.00,0.00,0.2h / 0.0h,4484.68,0.00,0.0h / 0.0h,0.00,0.00
42 8,胡先生,0.0h / 0.0h,0.00,0.00,1.0h / 0.0h,5688.29,3000.00,0.0h / 0.0h,0.00,0.00
43 9,李先生,0.0h / 0.0h,0.00,0.00,7.8h / 0.0h,1712.78,0.00,0.0h / 0.0h,0.00,0.00
44 10,牛先生,0.0h / 0.0h,0.00,0.00,10.4h / 0.0h,1887.48,0.00,0.0h / 0.0h,0.00,0.00
45 11,阿亮,0.0h / 0.0h,0.00,0.00,2.4h / 0.0h,424.78,0.00,0.0h / 0.0h,0.00,0.00
46 12,万先生,0.0h / 0.0h,0.00,0.00,0.0h / 3.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00

View File

@@ -0,0 +1,196 @@
# 助教详情柚子2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础35.4h附加10.0h客户流水¥23234.98充值归因¥3000.00;头部客户(12月)Top3陈先生、羊、葛先生。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,51 @@
助教详情梦梦2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础35.7h附加1.0h客户流水¥45991.89充值归因¥0.00;头部客户(12月)Top3葛先生、阿亮、蔡总。
一、基础课业绩
说明评价基础35.7h附加1.0h客户流水¥45991.89充值归因¥0.00;头部客户(12月)Top3葛先生、阿亮、蔡总。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,19.60h,22,-34.88h,-19.28h
12月,16.08h,18,-28.73h,-25.01h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,1.00h,7,-7.80h,-6.00h
12月,0.00h,,0.00h,0.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,0.00,,0.00,0.00
11月,39768.09,11,-4486.30,6441.77
12月,6223.80,18,-14506.73,-7416.84
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,0.00,,0.00,0.00
11月,0.00,,0.00,0.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1,葛先生,2.9h / 0.0h,5551.79,0.00,4.4h / 0.0h,1884.66,0.00,0.0h / 0.0h,0.00,0.00
2,阿亮,2.7h / 0.0h,495.46,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
3,蔡总,10.5h / 0.0h,176.55,0.00,7.0h / 1.0h,34274.25,0.00,0.0h / 0.0h,0.00,0.00
4,轩哥,0.0h / 0.0h,0.00,0.00,1.0h / 0.0h,363.25,0.00,0.0h / 0.0h,0.00,0.00
5,,0.0h / 0.0h,0.00,0.00,0.6h / 0.0h,104.77,0.00,0.0h / 0.0h,0.00,0.00
6,林先生,0.0h / 0.0h,0.00,0.00,4.3h / 0.0h,2461.85,0.00,0.0h / 0.0h,0.00,0.00
7,张先生,0.0h / 0.0h,0.00,0.00,2.3h / 0.0h,679.31,0.00,0.0h / 0.0h,0.00,0.00
1 助教详情:梦梦(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础35.7h,附加1.0h;客户流水¥45991.89,充值归因¥0.00;头部客户(12月)Top3:葛先生、阿亮、蔡总。
3 一、基础课业绩
4 说明:评价:基础35.7h,附加1.0h;客户流水¥45991.89,充值归因¥0.00;头部客户(12月)Top3:葛先生、阿亮、蔡总。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,0.00h,,0.00h,0.00h
8 11月,19.60h,22,-34.88h,-19.28h
9 12月,16.08h,18,-28.73h,-25.01h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,0.00h,,0.00h,0.00h
15 11月,1.00h,7,-7.80h,-6.00h
16 12月,0.00h,,0.00h,0.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,0.00,,0.00,0.00
22 11月,39768.09,11,-4486.30,6441.77
23 12月,6223.80,18,-14506.73,-7416.84
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,0.00,,0.00,0.00
29 11月,0.00,,0.00,0.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
35 1,葛先生,2.9h / 0.0h,5551.79,0.00,4.4h / 0.0h,1884.66,0.00,0.0h / 0.0h,0.00,0.00
36 2,阿亮,2.7h / 0.0h,495.46,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
37 3,蔡总,10.5h / 0.0h,176.55,0.00,7.0h / 1.0h,34274.25,0.00,0.0h / 0.0h,0.00,0.00
38 4,轩哥,0.0h / 0.0h,0.00,0.00,1.0h / 0.0h,363.25,0.00,0.0h / 0.0h,0.00,0.00
39 5,羊,0.0h / 0.0h,0.00,0.00,0.6h / 0.0h,104.77,0.00,0.0h / 0.0h,0.00,0.00
40 6,林先生,0.0h / 0.0h,0.00,0.00,4.3h / 0.0h,2461.85,0.00,0.0h / 0.0h,0.00,0.00
41 7,张先生,0.0h / 0.0h,0.00,0.00,2.3h / 0.0h,679.31,0.00,0.0h / 0.0h,0.00,0.00

View File

@@ -0,0 +1,196 @@
# 助教详情梦梦2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础35.7h附加1.0h客户流水¥45991.89充值归因¥0.00;头部客户(12月)Top3葛先生、阿亮、蔡总。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,44 @@
助教详情楚楚2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础0.0h附加0.0h客户流水¥0.00充值归因¥0.00;头部客户(12月)Top3无。
一、基础课业绩
说明评价基础0.0h附加0.0h客户流水¥0.00充值归因¥0.00;头部客户(12月)Top3无。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,0.00h,,0.00h,0.00h
12月,0.00h,,0.00h,0.00h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,0.00h,,0.00h,0.00h
12月,0.00h,,0.00h,0.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,0.00,,0.00,0.00
11月,0.00,,0.00,0.00
12月,0.00,,0.00,0.00
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,0.00,,0.00,0.00
11月,0.00,,0.00,0.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1 助教详情:楚楚(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础0.0h,附加0.0h;客户流水¥0.00,充值归因¥0.00;头部客户(12月)Top3:无。
3 一、基础课业绩
4 说明:评价:基础0.0h,附加0.0h;客户流水¥0.00,充值归因¥0.00;头部客户(12月)Top3:无。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,0.00h,,0.00h,0.00h
8 11月,0.00h,,0.00h,0.00h
9 12月,0.00h,,0.00h,0.00h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,0.00h,,0.00h,0.00h
15 11月,0.00h,,0.00h,0.00h
16 12月,0.00h,,0.00h,0.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,0.00,,0.00,0.00
22 11月,0.00,,0.00,0.00
23 12月,0.00,,0.00,0.00
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,0.00,,0.00,0.00
29 11月,0.00,,0.00,0.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)

View File

@@ -0,0 +1,196 @@
# 助教详情楚楚2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础0.0h附加0.0h客户流水¥0.00充值归因¥0.00;头部客户(12月)Top3无。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,52 @@
助教详情欣怡2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础29.8h附加0.0h客户流水¥9981.98充值归因¥7000.00;头部客户(12月)Top3老宋、张先生、轩哥。
一、基础课业绩
说明评价基础29.8h附加0.0h客户流水¥9981.98充值归因¥7000.00;头部客户(12月)Top3老宋、张先生、轩哥。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,19.50h,15,-24.91h,-17.03h
11月,10.33h,24,-44.14h,-28.55h
12月,0.00h,,0.00h,0.00h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,0.00h,,0.00h,0.00h
12月,0.00h,,0.00h,0.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,4824.69,17,-24454.84,-25825.14
11月,5157.29,24,-39097.10,-28169.03
12月,0.00,,0.00,0.00
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,3000.00,13,-11466.67,-10000.00
11月,4000.00,7,-3769.23,-5000.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1,老宋,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,0.5h / 0.0h,75.99,0.00
2,张先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.4h / 0.0h,570.76,0.00
3,轩哥,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.4h / 0.0h,408.24,0.00
4,,0.0h / 0.0h,0.00,0.00,2.0h / 0.0h,364.70,0.00,0.0h / 0.0h,0.00,0.00
5,小熊,0.0h / 0.0h,0.00,0.00,7.8h / 0.0h,2438.20,4000.00,0.0h / 0.0h,0.00,0.00
6,,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,4.9h / 0.0h,904.50,0.00
7,T,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,10.3h / 0.0h,2865.20,3000.00
8,胡先生,0.0h / 0.0h,0.00,0.00,0.4h / 0.0h,2354.39,0.00,0.0h / 0.0h,0.00,0.00
1 助教详情:欣怡(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础29.8h,附加0.0h;客户流水¥9981.98,充值归因¥7000.00;头部客户(12月)Top3:老宋、张先生、轩哥。
3 一、基础课业绩
4 说明:评价:基础29.8h,附加0.0h;客户流水¥9981.98,充值归因¥7000.00;头部客户(12月)Top3:老宋、张先生、轩哥。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,19.50h,15,-24.91h,-17.03h
8 11月,10.33h,24,-44.14h,-28.55h
9 12月,0.00h,,0.00h,0.00h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,0.00h,,0.00h,0.00h
15 11月,0.00h,,0.00h,0.00h
16 12月,0.00h,,0.00h,0.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,4824.69,17,-24454.84,-25825.14
22 11月,5157.29,24,-39097.10,-28169.03
23 12月,0.00,,0.00,0.00
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,3000.00,13,-11466.67,-10000.00
29 11月,4000.00,7,-3769.23,-5000.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
35 1,老宋,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,0.5h / 0.0h,75.99,0.00
36 2,张先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.4h / 0.0h,570.76,0.00
37 3,轩哥,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.4h / 0.0h,408.24,0.00
38 4,羊,0.0h / 0.0h,0.00,0.00,2.0h / 0.0h,364.70,0.00,0.0h / 0.0h,0.00,0.00
39 5,小熊,0.0h / 0.0h,0.00,0.00,7.8h / 0.0h,2438.20,4000.00,0.0h / 0.0h,0.00,0.00
40 6,陶,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,4.9h / 0.0h,904.50,0.00
41 7,T,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,10.3h / 0.0h,2865.20,3000.00
42 8,胡先生,0.0h / 0.0h,0.00,0.00,0.4h / 0.0h,2354.39,0.00,0.0h / 0.0h,0.00,0.00

View File

@@ -0,0 +1,196 @@
# 助教详情欣怡2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础29.8h附加0.0h客户流水¥9981.98充值归因¥7000.00;头部客户(12月)Top3老宋、张先生、轩哥。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,48 @@
助教详情泡芙2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础21.4h附加3.0h客户流水¥8323.03充值归因¥0.00;头部客户(12月)Top3夏、艾宇民、羊。
一、基础课业绩
说明评价基础21.4h附加3.0h客户流水¥8323.03充值归因¥0.00;头部客户(12月)Top3夏、艾宇民、羊。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,21.38h,21,-33.09h,-17.50h
12月,0.00h,,0.00h,0.00h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,3.00h,5,-5.80h,-4.00h
12月,0.00h,,0.00h,0.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,0.00,,0.00,0.00
11月,8323.03,23,-35931.36,-25003.29
12月,0.00,,0.00,0.00
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,0.00,,0.00,0.00
11月,0.00,,0.00,0.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1,,0.0h / 0.0h,0.00,0.00,2.4h / 0.0h,501.87,0.00,0.0h / 0.0h,0.00,0.00
2,艾宇民,0.0h / 0.0h,0.00,0.00,17.5h / 3.0h,5037.44,0.00,0.0h / 0.0h,0.00,0.00
3,,0.0h / 0.0h,0.00,0.00,0.8h / 0.0h,429.33,0.00,0.0h / 0.0h,0.00,0.00
4,胡先生,0.0h / 0.0h,0.00,0.00,0.8h / 0.0h,2354.39,0.00,0.0h / 0.0h,0.00,0.00
1 助教详情:泡芙(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础21.4h,附加3.0h;客户流水¥8323.03,充值归因¥0.00;头部客户(12月)Top3:夏、艾宇民、羊。
3 一、基础课业绩
4 说明:评价:基础21.4h,附加3.0h;客户流水¥8323.03,充值归因¥0.00;头部客户(12月)Top3:夏、艾宇民、羊。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,0.00h,,0.00h,0.00h
8 11月,21.38h,21,-33.09h,-17.50h
9 12月,0.00h,,0.00h,0.00h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,0.00h,,0.00h,0.00h
15 11月,3.00h,5,-5.80h,-4.00h
16 12月,0.00h,,0.00h,0.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,0.00,,0.00,0.00
22 11月,8323.03,23,-35931.36,-25003.29
23 12月,0.00,,0.00,0.00
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,0.00,,0.00,0.00
29 11月,0.00,,0.00,0.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
35 1,夏,0.0h / 0.0h,0.00,0.00,2.4h / 0.0h,501.87,0.00,0.0h / 0.0h,0.00,0.00
36 2,艾宇民,0.0h / 0.0h,0.00,0.00,17.5h / 3.0h,5037.44,0.00,0.0h / 0.0h,0.00,0.00
37 3,羊,0.0h / 0.0h,0.00,0.00,0.8h / 0.0h,429.33,0.00,0.0h / 0.0h,0.00,0.00
38 4,胡先生,0.0h / 0.0h,0.00,0.00,0.8h / 0.0h,2354.39,0.00,0.0h / 0.0h,0.00,0.00

View File

@@ -0,0 +1,196 @@
# 助教详情泡芙2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础21.4h附加3.0h客户流水¥8323.03充值归因¥0.00;头部客户(12月)Top3夏、艾宇民、羊。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,60 @@
助教详情涛涛2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础168.6h附加3.0h客户流水¥166962.41充值归因¥26000.00;头部客户(12月)Top3蔡总、轩哥、葛先生。
一、基础课业绩
说明评价基础168.6h附加3.0h客户流水¥166962.41充值归因¥26000.00;头部客户(12月)Top3蔡总、轩哥、葛先生。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,50.13h,8,5.72h,13.61h
11月,74.40h,7,19.92h,35.52h
12月,44.08h,10,-0.73h,2.99h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,3.00h,5,-5.80h,-4.00h
12月,0.00h,,0.00h,0.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,35940.84,8,6661.31,5291.01
11月,88677.55,4,44423.16,55351.23
12月,42344.02,4,21613.49,28703.38
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,21000.00,5,6533.33,8000.00
11月,5000.00,6,-2769.23,-4000.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1,蔡总,15.1h / 0.0h,18914.63,0.00,28.4h / 0.0h,57785.21,0.00,0.0h / 0.0h,0.00,0.00
2,轩哥,10.8h / 0.0h,14490.25,0.00,21.8h / 0.0h,22186.78,0.00,40.1h / 0.0h,30415.18,15000.00
3,葛先生,5.8h / 0.0h,5551.79,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
4,君姐,2.2h / 0.0h,1414.23,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
5,,3.1h / 0.0h,563.70,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
6,阿亮,2.9h / 0.0h,538.07,0.00,1.7h / 3.0h,300.53,0.00,0.0h / 0.0h,0.00,0.00
7,罗先生,2.3h / 0.0h,524.41,0.00,2.3h / 0.0h,844.76,0.00,6.0h / 0.0h,1773.80,3000.00
8,张先生,1.9h / 0.0h,346.94,0.00,1.8h / 0.0h,325.27,0.00,0.0h / 0.0h,0.00,0.00
9,江先生,0.0h / 0.0h,0.00,0.00,1.8h / 0.0h,2095.41,5000.00,0.0h / 0.0h,0.00,0.00
10,叶先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,3.1h / 0.0h,3607.02,3000.00
11,吴生,0.0h / 0.0h,0.00,0.00,2.2h / 0.0h,537.96,0.00,0.0h / 0.0h,0.00,0.00
12,陈淑涛,0.0h / 0.0h,0.00,0.00,4.4h / 0.0h,1176.77,0.00,0.0h / 0.0h,0.00,0.00
13,李先生,0.0h / 0.0h,0.00,0.00,2.0h / 0.0h,779.48,0.00,0.0h / 0.0h,0.00,0.00
14,明哥,0.0h / 0.0h,0.00,0.00,5.4h / 0.0h,2258.14,0.00,0.0h / 0.0h,0.00,0.00
15,冯先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,0.9h / 0.0h,144.84,0.00
16,胡先生,0.0h / 0.0h,0.00,0.00,2.7h / 0.0h,387.24,0.00,0.0h / 0.0h,0.00,0.00
1 助教详情:涛涛(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础168.6h,附加3.0h;客户流水¥166962.41,充值归因¥26000.00;头部客户(12月)Top3:蔡总、轩哥、葛先生。
3 一、基础课业绩
4 说明:评价:基础168.6h,附加3.0h;客户流水¥166962.41,充值归因¥26000.00;头部客户(12月)Top3:蔡总、轩哥、葛先生。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,50.13h,8,5.72h,13.61h
8 11月,74.40h,7,19.92h,35.52h
9 12月,44.08h,10,-0.73h,2.99h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,0.00h,,0.00h,0.00h
15 11月,3.00h,5,-5.80h,-4.00h
16 12月,0.00h,,0.00h,0.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,35940.84,8,6661.31,5291.01
22 11月,88677.55,4,44423.16,55351.23
23 12月,42344.02,4,21613.49,28703.38
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,21000.00,5,6533.33,8000.00
29 11月,5000.00,6,-2769.23,-4000.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
35 1,蔡总,15.1h / 0.0h,18914.63,0.00,28.4h / 0.0h,57785.21,0.00,0.0h / 0.0h,0.00,0.00
36 2,轩哥,10.8h / 0.0h,14490.25,0.00,21.8h / 0.0h,22186.78,0.00,40.1h / 0.0h,30415.18,15000.00
37 3,葛先生,5.8h / 0.0h,5551.79,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
38 4,君姐,2.2h / 0.0h,1414.23,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
39 5,候,3.1h / 0.0h,563.70,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
40 6,阿亮,2.9h / 0.0h,538.07,0.00,1.7h / 3.0h,300.53,0.00,0.0h / 0.0h,0.00,0.00
41 7,罗先生,2.3h / 0.0h,524.41,0.00,2.3h / 0.0h,844.76,0.00,6.0h / 0.0h,1773.80,3000.00
42 8,张先生,1.9h / 0.0h,346.94,0.00,1.8h / 0.0h,325.27,0.00,0.0h / 0.0h,0.00,0.00
43 9,江先生,0.0h / 0.0h,0.00,0.00,1.8h / 0.0h,2095.41,5000.00,0.0h / 0.0h,0.00,0.00
44 10,叶先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,3.1h / 0.0h,3607.02,3000.00
45 11,吴生,0.0h / 0.0h,0.00,0.00,2.2h / 0.0h,537.96,0.00,0.0h / 0.0h,0.00,0.00
46 12,陈淑涛,0.0h / 0.0h,0.00,0.00,4.4h / 0.0h,1176.77,0.00,0.0h / 0.0h,0.00,0.00
47 13,李先生,0.0h / 0.0h,0.00,0.00,2.0h / 0.0h,779.48,0.00,0.0h / 0.0h,0.00,0.00
48 14,明哥,0.0h / 0.0h,0.00,0.00,5.4h / 0.0h,2258.14,0.00,0.0h / 0.0h,0.00,0.00
49 15,冯先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,0.9h / 0.0h,144.84,0.00
50 16,胡先生,0.0h / 0.0h,0.00,0.00,2.7h / 0.0h,387.24,0.00,0.0h / 0.0h,0.00,0.00

View File

@@ -0,0 +1,196 @@
# 助教详情涛涛2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础168.6h附加3.0h客户流水¥166962.41充值归因¥26000.00;头部客户(12月)Top3蔡总、轩哥、葛先生。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,74 @@
助教详情球球2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础172.5h附加41.0h客户流水¥95647.82充值归因¥24000.00;头部客户(12月)Top3葛先生、周周、T。
一、基础课业绩
说明评价基础172.5h附加41.0h客户流水¥95647.82充值归因¥24000.00;头部客户(12月)Top3葛先生、周周、T。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,57.45h,6,13.04h,20.92h
11月,66.50h,11,12.02h,27.62h
12月,48.58h,9,3.77h,7.49h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,11.00h,1,4.43h,3.00h
11月,25.00h,1,16.20h,18.00h
12月,5.00h,6,-5.27h,-3.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,33923.75,10,4644.22,3273.92
11月,41907.39,10,-2347.00,8581.07
12月,19816.68,8,-913.85,6176.04
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,15000.00,8,533.33,2000.00
11月,9000.00,4,1230.77,0.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1,葛先生,1.1h / 0.0h,5551.79,0.00,0.9h / 0.0h,3052.28,0.00,0.0h / 0.0h,0.00,0.00
2,周周,15.2h / 0.0h,4161.75,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
3,T,10.7h / 0.0h,3327.26,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
4,蔡总,8.5h / 0.0h,2130.39,0.00,3.4h / 0.0h,6196.43,0.00,0.0h / 0.0h,0.00,0.00
5,罗先生,2.3h / 0.0h,1584.22,0.00,0.0h / 0.0h,0.00,0.00,1.4h / 0.0h,514.68,0.00
6,,5.3h / 0.0h,926.59,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
7,张先生,3.0h / 0.0h,876.46,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
8,李先生,0.0h / 0.0h,703.83,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
9,大G,1.8h / 0.0h,467.10,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
10,黄先生,0.6h / 5.0h,87.29,0.00,4.4h / 18.0h,828.62,0.00,11.0h / 9.0h,1608.13,0.00
11,邓飛,0.0h / 0.0h,0.00,0.00,0.8h / 0.0h,925.47,1000.00,0.0h / 0.0h,0.00,0.00
12,罗超杰,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,0.8h / 0.0h,176.14,0.00
13,陈腾鑫,0.0h / 0.0h,0.00,0.00,25.1h / 0.0h,5150.83,0.00,6.1h / 2.0h,980.14,0.00
14,叶先生,0.0h / 0.0h,0.00,0.00,6.7h / 0.0h,3013.86,0.00,0.0h / 0.0h,0.00,0.00
15,歌神,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.6h / 0.0h,1929.19,0.00
16,,0.0h / 0.0h,0.00,0.00,2.2h / 0.0h,383.40,0.00,3.1h / 0.0h,3620.75,0.00
17,,0.0h / 0.0h,0.00,0.00,2.0h / 4.0h,370.12,0.00,2.5h / 0.0h,455.12,0.00
18,轩哥,0.0h / 0.0h,0.00,0.00,11.2h / 0.0h,12063.93,5000.00,9.1h / 0.0h,9207.48,6000.00
19,罗超,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.9h / 0.0h,2385.30,3000.00
20,小熊,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,4.4h / 0.0h,709.18,0.00
21,陈德韩,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.8h / 0.0h,5714.01,0.00
22,刘哥,0.0h / 0.0h,0.00,0.00,2.0h / 0.0h,2982.34,0.00,0.0h / 0.0h,0.00,0.00
23,桂先生,0.0h / 0.0h,0.00,0.00,2.6h / 0.0h,826.02,0.00,0.0h / 0.0h,0.00,0.00
24,万先生,0.0h / 0.0h,0.00,0.00,0.0h / 3.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
25,吕先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.8h / 0.0h,2843.29,3000.00
26,胡先生,0.0h / 0.0h,0.00,0.00,3.9h / 0.0h,5688.29,3000.00,0.0h / 0.0h,0.00,0.00
27,江先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.7h / 0.0h,2740.35,3000.00
28,小宇,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.5h / 0.0h,318.98,0.00
29,,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,4.7h / 0.0h,721.01,0.00
30,小燕,0.0h / 0.0h,0.00,0.00,1.4h / 0.0h,425.80,0.00,0.0h / 0.0h,0.00,0.00
1 助教详情:球球(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础172.5h,附加41.0h;客户流水¥95647.82,充值归因¥24000.00;头部客户(12月)Top3:葛先生、周周、T。
3 一、基础课业绩
4 说明:评价:基础172.5h,附加41.0h;客户流水¥95647.82,充值归因¥24000.00;头部客户(12月)Top3:葛先生、周周、T。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,57.45h,6,13.04h,20.92h
8 11月,66.50h,11,12.02h,27.62h
9 12月,48.58h,9,3.77h,7.49h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,11.00h,1,4.43h,3.00h
15 11月,25.00h,1,16.20h,18.00h
16 12月,5.00h,6,-5.27h,-3.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,33923.75,10,4644.22,3273.92
22 11月,41907.39,10,-2347.00,8581.07
23 12月,19816.68,8,-913.85,6176.04
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,15000.00,8,533.33,2000.00
29 11月,9000.00,4,1230.77,0.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
35 1,葛先生,1.1h / 0.0h,5551.79,0.00,0.9h / 0.0h,3052.28,0.00,0.0h / 0.0h,0.00,0.00
36 2,周周,15.2h / 0.0h,4161.75,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
37 3,T,10.7h / 0.0h,3327.26,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
38 4,蔡总,8.5h / 0.0h,2130.39,0.00,3.4h / 0.0h,6196.43,0.00,0.0h / 0.0h,0.00,0.00
39 5,罗先生,2.3h / 0.0h,1584.22,0.00,0.0h / 0.0h,0.00,0.00,1.4h / 0.0h,514.68,0.00
40 6,候,5.3h / 0.0h,926.59,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
41 7,张先生,3.0h / 0.0h,876.46,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
42 8,李先生,0.0h / 0.0h,703.83,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
43 9,大G,1.8h / 0.0h,467.10,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
44 10,黄先生,0.6h / 5.0h,87.29,0.00,4.4h / 18.0h,828.62,0.00,11.0h / 9.0h,1608.13,0.00
45 11,邓飛,0.0h / 0.0h,0.00,0.00,0.8h / 0.0h,925.47,1000.00,0.0h / 0.0h,0.00,0.00
46 12,罗超杰,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,0.8h / 0.0h,176.14,0.00
47 13,陈腾鑫,0.0h / 0.0h,0.00,0.00,25.1h / 0.0h,5150.83,0.00,6.1h / 2.0h,980.14,0.00
48 14,叶先生,0.0h / 0.0h,0.00,0.00,6.7h / 0.0h,3013.86,0.00,0.0h / 0.0h,0.00,0.00
49 15,歌神,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.6h / 0.0h,1929.19,0.00
50 16,羊,0.0h / 0.0h,0.00,0.00,2.2h / 0.0h,383.40,0.00,3.1h / 0.0h,3620.75,0.00
51 17,夏,0.0h / 0.0h,0.00,0.00,2.0h / 4.0h,370.12,0.00,2.5h / 0.0h,455.12,0.00
52 18,轩哥,0.0h / 0.0h,0.00,0.00,11.2h / 0.0h,12063.93,5000.00,9.1h / 0.0h,9207.48,6000.00
53 19,罗超,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.9h / 0.0h,2385.30,3000.00
54 20,小熊,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,4.4h / 0.0h,709.18,0.00
55 21,陈德韩,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.8h / 0.0h,5714.01,0.00
56 22,刘哥,0.0h / 0.0h,0.00,0.00,2.0h / 0.0h,2982.34,0.00,0.0h / 0.0h,0.00,0.00
57 23,桂先生,0.0h / 0.0h,0.00,0.00,2.6h / 0.0h,826.02,0.00,0.0h / 0.0h,0.00,0.00
58 24,万先生,0.0h / 0.0h,0.00,0.00,0.0h / 3.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
59 25,吕先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.8h / 0.0h,2843.29,3000.00
60 26,胡先生,0.0h / 0.0h,0.00,0.00,3.9h / 0.0h,5688.29,3000.00,0.0h / 0.0h,0.00,0.00
61 27,江先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.7h / 0.0h,2740.35,3000.00
62 28,小宇,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.5h / 0.0h,318.98,0.00
63 29,陶,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,4.7h / 0.0h,721.01,0.00
64 30,小燕,0.0h / 0.0h,0.00,0.00,1.4h / 0.0h,425.80,0.00,0.0h / 0.0h,0.00,0.00

View File

@@ -0,0 +1,196 @@
# 助教详情球球2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础172.5h附加41.0h客户流水¥95647.82充值归因¥24000.00;头部客户(12月)Top3葛先生、周周、T。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,49 @@
助教详情瑶瑶2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础53.7h附加3.0h客户流水¥72216.91充值归因¥0.00;头部客户(12月)Top3蔡总、轩哥、陈世。
一、基础课业绩
说明评价基础53.7h附加3.0h客户流水¥72216.91充值归因¥0.00;头部客户(12月)Top3蔡总、轩哥、陈世。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,34.25h,18,-20.23h,-4.63h
12月,19.48h,15,-25.33h,-21.61h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,3.00h,5,-5.80h,-4.00h
12月,0.00h,,0.00h,0.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,0.00,,0.00,0.00
11月,65924.36,8,21669.97,32598.04
12月,6292.55,17,-14437.98,-7348.10
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,0.00,,0.00,0.00
11月,0.00,,0.00,0.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1,蔡总,19.5h / 0.0h,6292.55,0.00,20.3h / 2.0h,53735.58,0.00,0.0h / 0.0h,0.00,0.00
2,轩哥,0.0h / 0.0h,0.00,0.00,9.3h / 1.0h,8137.22,0.00,0.0h / 0.0h,0.00,0.00
3,陈世,0.0h / 0.0h,0.00,0.00,0.8h / 0.0h,139.15,0.00,0.0h / 0.0h,0.00,0.00
4,,0.0h / 0.0h,0.00,0.00,2.0h / 0.0h,3544.42,0.00,0.0h / 0.0h,0.00,0.00
5,林先生,0.0h / 0.0h,0.00,0.00,1.9h / 0.0h,367.99,0.00,0.0h / 0.0h,0.00,0.00
1 助教详情:瑶瑶(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础53.7h,附加3.0h;客户流水¥72216.91,充值归因¥0.00;头部客户(12月)Top3:蔡总、轩哥、陈世。
3 一、基础课业绩
4 说明:评价:基础53.7h,附加3.0h;客户流水¥72216.91,充值归因¥0.00;头部客户(12月)Top3:蔡总、轩哥、陈世。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,0.00h,,0.00h,0.00h
8 11月,34.25h,18,-20.23h,-4.63h
9 12月,19.48h,15,-25.33h,-21.61h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,0.00h,,0.00h,0.00h
15 11月,3.00h,5,-5.80h,-4.00h
16 12月,0.00h,,0.00h,0.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,0.00,,0.00,0.00
22 11月,65924.36,8,21669.97,32598.04
23 12月,6292.55,17,-14437.98,-7348.10
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,0.00,,0.00,0.00
29 11月,0.00,,0.00,0.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
35 1,蔡总,19.5h / 0.0h,6292.55,0.00,20.3h / 2.0h,53735.58,0.00,0.0h / 0.0h,0.00,0.00
36 2,轩哥,0.0h / 0.0h,0.00,0.00,9.3h / 1.0h,8137.22,0.00,0.0h / 0.0h,0.00,0.00
37 3,陈世,0.0h / 0.0h,0.00,0.00,0.8h / 0.0h,139.15,0.00,0.0h / 0.0h,0.00,0.00
38 4,游,0.0h / 0.0h,0.00,0.00,2.0h / 0.0h,3544.42,0.00,0.0h / 0.0h,0.00,0.00
39 5,林先生,0.0h / 0.0h,0.00,0.00,1.9h / 0.0h,367.99,0.00,0.0h / 0.0h,0.00,0.00

View File

@@ -0,0 +1,196 @@
# 助教详情瑶瑶2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础53.7h附加3.0h客户流水¥72216.91充值归因¥0.00;头部客户(12月)Top3蔡总、轩哥、陈世。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,56 @@
助教详情璇子2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础358.9h附加32.0h客户流水¥301070.23充值归因¥44700.00;头部客户(12月)Top3轩哥、蔡总、江先生。
一、基础课业绩
说明评价基础358.9h附加32.0h客户流水¥301070.23充值归因¥44700.00;头部客户(12月)Top3轩哥、蔡总、江先生。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,120.20h,2,75.79h,83.67h
11月,147.92h,2,93.44h,109.03h
12月,90.75h,3,45.94h,49.66h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,8.00h,3,1.43h,0.00h
11月,10.00h,3,1.20h,3.00h
12月,14.00h,4,3.73h,6.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,80804.14,1,51524.61,50154.31
11月,154486.83,1,110232.44,121160.51
12月,65779.26,1,45048.73,52138.62
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,34700.00,1,20233.33,21700.00
11月,10000.00,3,2230.77,1000.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1,轩哥,37.7h / 0.0h,28122.15,0.00,50.3h / 0.0h,46514.85,0.00,64.6h / 0.0h,53866.23,23000.00
2,蔡总,18.3h / 0.0h,21216.97,0.00,49.9h / 0.0h,84757.28,5000.00,0.0h / 0.0h,0.00,0.00
3,江先生,17.7h / 14.0h,10018.73,0.00,29.6h / 10.0h,14700.83,5000.00,15.2h / 8.0h,5637.50,3000.00
4,林先生,9.6h / 0.0h,3351.61,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
5,罗先生,5.2h / 0.0h,1655.57,0.00,5.1h / 0.0h,1718.68,0.00,2.8h / 0.0h,1087.21,0.00
6,君姐,2.2h / 0.0h,1414.23,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
7,,0.0h / 0.0h,0.00,0.00,3.1h / 0.0h,3544.42,0.00,0.0h / 0.0h,0.00,0.00
8,,0.0h / 0.0h,0.00,0.00,5.0h / 0.0h,1017.12,0.00,0.0h / 0.0h,0.00,0.00
9,张先生,0.0h / 0.0h,0.00,0.00,4.9h / 0.0h,2233.65,0.00,5.4h / 0.0h,3211.91,0.00
10,,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,7.6h / 0.0h,6452.71,0.00
11,罗超,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.6h / 0.0h,2385.30,3000.00
12,叶总,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,22.0h / 0.0h,8163.28,5700.00
1 助教详情:璇子(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础358.9h,附加32.0h;客户流水¥301070.23,充值归因¥44700.00;头部客户(12月)Top3:轩哥、蔡总、江先生。
3 一、基础课业绩
4 说明:评价:基础358.9h,附加32.0h;客户流水¥301070.23,充值归因¥44700.00;头部客户(12月)Top3:轩哥、蔡总、江先生。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,120.20h,2,75.79h,83.67h
8 11月,147.92h,2,93.44h,109.03h
9 12月,90.75h,3,45.94h,49.66h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,8.00h,3,1.43h,0.00h
15 11月,10.00h,3,1.20h,3.00h
16 12月,14.00h,4,3.73h,6.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,80804.14,1,51524.61,50154.31
22 11月,154486.83,1,110232.44,121160.51
23 12月,65779.26,1,45048.73,52138.62
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,34700.00,1,20233.33,21700.00
29 11月,10000.00,3,2230.77,1000.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
35 1,轩哥,37.7h / 0.0h,28122.15,0.00,50.3h / 0.0h,46514.85,0.00,64.6h / 0.0h,53866.23,23000.00
36 2,蔡总,18.3h / 0.0h,21216.97,0.00,49.9h / 0.0h,84757.28,5000.00,0.0h / 0.0h,0.00,0.00
37 3,江先生,17.7h / 14.0h,10018.73,0.00,29.6h / 10.0h,14700.83,5000.00,15.2h / 8.0h,5637.50,3000.00
38 4,林先生,9.6h / 0.0h,3351.61,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
39 5,罗先生,5.2h / 0.0h,1655.57,0.00,5.1h / 0.0h,1718.68,0.00,2.8h / 0.0h,1087.21,0.00
40 6,君姐,2.2h / 0.0h,1414.23,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
41 7,游,0.0h / 0.0h,0.00,0.00,3.1h / 0.0h,3544.42,0.00,0.0h / 0.0h,0.00,0.00
42 8,羊,0.0h / 0.0h,0.00,0.00,5.0h / 0.0h,1017.12,0.00,0.0h / 0.0h,0.00,0.00
43 9,张先生,0.0h / 0.0h,0.00,0.00,4.9h / 0.0h,2233.65,0.00,5.4h / 0.0h,3211.91,0.00
44 10,夏,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,7.6h / 0.0h,6452.71,0.00
45 11,罗超,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.6h / 0.0h,2385.30,3000.00
46 12,叶总,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,22.0h / 0.0h,8163.28,5700.00

View File

@@ -0,0 +1,196 @@
# 助教详情璇子2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础358.9h附加32.0h客户流水¥301070.23充值归因¥44700.00;头部客户(12月)Top3轩哥、蔡总、江先生。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,64 @@
助教详情素素2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础85.5h附加10.0h客户流水¥55755.41充值归因¥7000.00;头部客户(12月)Top3叶先生、周先生、轩哥。
一、基础课业绩
说明评价基础85.5h附加10.0h客户流水¥55755.41充值归因¥7000.00;头部客户(12月)Top3叶先生、周先生、轩哥。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,40.45h,10,-3.96h,3.92h
11月,35.03h,17,-19.44h,-3.85h
12月,9.98h,19,-34.83h,-31.11h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,10.00h,3,1.20h,3.00h
12月,0.00h,,0.00h,0.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,34135.89,9,4856.36,3486.06
11月,18707.30,19,-25547.09,-14619.02
12月,2912.22,19,-17818.31,-10728.42
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,6000.00,11,-8466.67,-7000.00
11月,1000.00,9,-6769.23,-8000.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1,叶先生,3.0h / 0.0h,1558.40,0.00,7.0h / 3.0h,3725.65,0.00,15.1h / 0.0h,8807.20,3000.00
2,周先生,6.2h / 0.0h,1065.70,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
3,轩哥,0.8h / 0.0h,288.12,0.00,0.0h / 0.0h,0.00,0.00,3.6h / 0.0h,8972.50,0.00
4,邓飛,0.0h / 0.0h,0.00,0.00,0.8h / 0.0h,925.47,1000.00,0.0h / 0.0h,0.00,0.00
5,罗超杰,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.9h / 0.0h,396.94,0.00
6,陈腾鑫,0.0h / 0.0h,0.00,0.00,0.4h / 0.0h,152.18,0.00,2.1h / 0.0h,542.06,0.00
7,谢俊,0.0h / 0.0h,0.00,0.00,2.4h / 0.0h,417.75,0.00,0.0h / 0.0h,0.00,0.00
8,罗先生,0.0h / 0.0h,0.00,0.00,4.7h / 0.0h,861.57,0.00,0.0h / 0.0h,0.00,0.00
9,葛先生,0.0h / 0.0h,0.00,0.00,9.1h / 0.0h,4668.26,0.00,0.0h / 0.0h,0.00,0.00
10,歌神,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,3.9h / 0.0h,2789.21,0.00
11,,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,4.3h / 0.0h,3620.75,0.00
12,张先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.1h / 0.0h,449.93,0.00
13,都先生,0.0h / 0.0h,0.00,0.00,1.6h / 0.0h,269.64,0.00,0.0h / 0.0h,0.00,0.00
14,,0.0h / 0.0h,0.00,0.00,0.8h / 4.0h,2991.13,0.00,0.0h / 0.0h,0.00,0.00
15,罗先生,0.0h / 0.0h,0.00,0.00,4.3h / 0.0h,1856.86,0.00,0.0h / 0.0h,0.00,0.00
16,陈德韩,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,5.5h / 0.0h,5714.01,0.00
17,吕先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.8h / 0.0h,2843.29,3000.00
18,万先生,0.0h / 0.0h,0.00,0.00,0.0h / 3.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
19,阿亮,0.0h / 0.0h,0.00,0.00,3.1h / 0.0h,484.40,0.00,0.0h / 0.0h,0.00,0.00
20,胡先生,0.0h / 0.0h,0.00,0.00,0.8h / 0.0h,2354.39,0.00,0.0h / 0.0h,0.00,0.00
1 助教详情:素素(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础85.5h,附加10.0h;客户流水¥55755.41,充值归因¥7000.00;头部客户(12月)Top3:叶先生、周先生、轩哥。
3 一、基础课业绩
4 说明:评价:基础85.5h,附加10.0h;客户流水¥55755.41,充值归因¥7000.00;头部客户(12月)Top3:叶先生、周先生、轩哥。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,40.45h,10,-3.96h,3.92h
8 11月,35.03h,17,-19.44h,-3.85h
9 12月,9.98h,19,-34.83h,-31.11h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,0.00h,,0.00h,0.00h
15 11月,10.00h,3,1.20h,3.00h
16 12月,0.00h,,0.00h,0.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,34135.89,9,4856.36,3486.06
22 11月,18707.30,19,-25547.09,-14619.02
23 12月,2912.22,19,-17818.31,-10728.42
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,6000.00,11,-8466.67,-7000.00
29 11月,1000.00,9,-6769.23,-8000.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
35 1,叶先生,3.0h / 0.0h,1558.40,0.00,7.0h / 3.0h,3725.65,0.00,15.1h / 0.0h,8807.20,3000.00
36 2,周先生,6.2h / 0.0h,1065.70,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
37 3,轩哥,0.8h / 0.0h,288.12,0.00,0.0h / 0.0h,0.00,0.00,3.6h / 0.0h,8972.50,0.00
38 4,邓飛,0.0h / 0.0h,0.00,0.00,0.8h / 0.0h,925.47,1000.00,0.0h / 0.0h,0.00,0.00
39 5,罗超杰,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.9h / 0.0h,396.94,0.00
40 6,陈腾鑫,0.0h / 0.0h,0.00,0.00,0.4h / 0.0h,152.18,0.00,2.1h / 0.0h,542.06,0.00
41 7,谢俊,0.0h / 0.0h,0.00,0.00,2.4h / 0.0h,417.75,0.00,0.0h / 0.0h,0.00,0.00
42 8,罗先生,0.0h / 0.0h,0.00,0.00,4.7h / 0.0h,861.57,0.00,0.0h / 0.0h,0.00,0.00
43 9,葛先生,0.0h / 0.0h,0.00,0.00,9.1h / 0.0h,4668.26,0.00,0.0h / 0.0h,0.00,0.00
44 10,歌神,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,3.9h / 0.0h,2789.21,0.00
45 11,羊,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,4.3h / 0.0h,3620.75,0.00
46 12,张先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,1.1h / 0.0h,449.93,0.00
47 13,都先生,0.0h / 0.0h,0.00,0.00,1.6h / 0.0h,269.64,0.00,0.0h / 0.0h,0.00,0.00
48 14,夏,0.0h / 0.0h,0.00,0.00,0.8h / 4.0h,2991.13,0.00,0.0h / 0.0h,0.00,0.00
49 15,罗先生,0.0h / 0.0h,0.00,0.00,4.3h / 0.0h,1856.86,0.00,0.0h / 0.0h,0.00,0.00
50 16,陈德韩,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,5.5h / 0.0h,5714.01,0.00
51 17,吕先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.8h / 0.0h,2843.29,3000.00
52 18,万先生,0.0h / 0.0h,0.00,0.00,0.0h / 3.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
53 19,阿亮,0.0h / 0.0h,0.00,0.00,3.1h / 0.0h,484.40,0.00,0.0h / 0.0h,0.00,0.00
54 20,胡先生,0.0h / 0.0h,0.00,0.00,0.8h / 0.0h,2354.39,0.00,0.0h / 0.0h,0.00,0.00

View File

@@ -0,0 +1,196 @@
# 助教详情素素2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础85.5h附加10.0h客户流水¥55755.41充值归因¥7000.00;头部客户(12月)Top3叶先生、周先生、轩哥。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,58 @@
助教详情苏苏2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础82.6h附加9.0h客户流水¥33952.79充值归因¥6000.00;头部客户(12月)Top3罗先生、T、林先生。
一、基础课业绩
说明评价基础82.6h附加9.0h客户流水¥33952.79充值归因¥6000.00;头部客户(12月)Top3罗先生、T、林先生。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,25.15h,12,-19.26h,-11.38h
11月,13.52h,23,-40.96h,-25.37h
12月,43.90h,11,-0.91h,2.81h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,8.00h,3,1.43h,0.00h
11月,0.00h,,0.00h,0.00h
12月,1.00h,9,-9.27h,-7.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,11236.84,15,-18042.69,-19412.99
11月,10254.59,22,-33999.80,-23071.73
12月,12461.36,14,-8269.17,-1179.28
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,6000.00,11,-8466.67,-7000.00
11月,0.00,,0.00,0.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1,罗先生,19.6h / 0.0h,6061.87,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
2,T,4.5h / 0.0h,1429.89,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
3,林先生,4.9h / 0.0h,1369.86,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
4,黄先生,8.1h / 1.0h,1357.90,0.00,4.0h / 0.0h,674.36,0.00,11.2h / 4.0h,1960.96,0.00
5,张先生,3.9h / 0.0h,1163.40,0.00,0.0h / 0.0h,0.00,0.00,6.4h / 0.0h,3604.02,0.00
6,葛先生,2.5h / 0.0h,1004.77,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
7,,0.4h / 0.0h,73.67,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
8,罗超,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.6h / 0.0h,2385.30,3000.00
9,罗超杰,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.1h / 0.0h,443.27,0.00
10,蔡总,0.0h / 0.0h,0.00,0.00,4.7h / 0.0h,6557.92,0.00,0.0h / 0.0h,0.00,0.00
11,吕先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.8h / 0.0h,2843.29,3000.00
12,林先生,0.0h / 0.0h,0.00,0.00,3.1h / 0.0h,2398.29,0.00,0.0h / 0.0h,0.00,0.00
13,邓飛,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 4.0h,0.00,0.00
14,昌哥,0.0h / 0.0h,0.00,0.00,1.6h / 0.0h,624.02,0.00,0.0h / 0.0h,0.00,0.00
1 助教详情:苏苏(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础82.6h,附加9.0h;客户流水¥33952.79,充值归因¥6000.00;头部客户(12月)Top3:罗先生、T、林先生。
3 一、基础课业绩
4 说明:评价:基础82.6h,附加9.0h;客户流水¥33952.79,充值归因¥6000.00;头部客户(12月)Top3:罗先生、T、林先生。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,25.15h,12,-19.26h,-11.38h
8 11月,13.52h,23,-40.96h,-25.37h
9 12月,43.90h,11,-0.91h,2.81h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,8.00h,3,1.43h,0.00h
15 11月,0.00h,,0.00h,0.00h
16 12月,1.00h,9,-9.27h,-7.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,11236.84,15,-18042.69,-19412.99
22 11月,10254.59,22,-33999.80,-23071.73
23 12月,12461.36,14,-8269.17,-1179.28
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,6000.00,11,-8466.67,-7000.00
29 11月,0.00,,0.00,0.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
35 1,罗先生,19.6h / 0.0h,6061.87,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
36 2,T,4.5h / 0.0h,1429.89,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
37 3,林先生,4.9h / 0.0h,1369.86,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
38 4,黄先生,8.1h / 1.0h,1357.90,0.00,4.0h / 0.0h,674.36,0.00,11.2h / 4.0h,1960.96,0.00
39 5,张先生,3.9h / 0.0h,1163.40,0.00,0.0h / 0.0h,0.00,0.00,6.4h / 0.0h,3604.02,0.00
40 6,葛先生,2.5h / 0.0h,1004.77,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
41 7,候,0.4h / 0.0h,73.67,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
42 8,罗超,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.6h / 0.0h,2385.30,3000.00
43 9,罗超杰,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.1h / 0.0h,443.27,0.00
44 10,蔡总,0.0h / 0.0h,0.00,0.00,4.7h / 0.0h,6557.92,0.00,0.0h / 0.0h,0.00,0.00
45 11,吕先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,2.8h / 0.0h,2843.29,3000.00
46 12,林先生,0.0h / 0.0h,0.00,0.00,3.1h / 0.0h,2398.29,0.00,0.0h / 0.0h,0.00,0.00
47 13,邓飛,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 4.0h,0.00,0.00
48 14,昌哥,0.0h / 0.0h,0.00,0.00,1.6h / 0.0h,624.02,0.00,0.0h / 0.0h,0.00,0.00

View File

@@ -0,0 +1,196 @@
# 助教详情苏苏2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础82.6h附加9.0h客户流水¥33952.79充值归因¥6000.00;头部客户(12月)Top3罗先生、T、林先生。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,45 @@
助教详情西子2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础1.8h附加0.0h客户流水¥303.51充值归因¥0.00;头部客户(12月)Top3张先生。
一、基础课业绩
说明评价基础1.8h附加0.0h客户流水¥303.51充值归因¥0.00;头部客户(12月)Top3张先生。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,1.82h,26,-52.66h,-37.07h
12月,0.00h,,0.00h,0.00h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,0.00h,,0.00h,0.00h
12月,0.00h,,0.00h,0.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,0.00,,0.00,0.00
11月,303.51,26,-43950.88,-33022.81
12月,0.00,,0.00,0.00
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,0.00,,0.00,0.00
11月,0.00,,0.00,0.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1,张先生,0.0h / 0.0h,0.00,0.00,1.8h / 0.0h,303.51,0.00,0.0h / 0.0h,0.00,0.00
1 助教详情:西子(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础1.8h,附加0.0h;客户流水¥303.51,充值归因¥0.00;头部客户(12月)Top3:张先生。
3 一、基础课业绩
4 说明:评价:基础1.8h,附加0.0h;客户流水¥303.51,充值归因¥0.00;头部客户(12月)Top3:张先生。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,0.00h,,0.00h,0.00h
8 11月,1.82h,26,-52.66h,-37.07h
9 12月,0.00h,,0.00h,0.00h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,0.00h,,0.00h,0.00h
15 11月,0.00h,,0.00h,0.00h
16 12月,0.00h,,0.00h,0.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,0.00,,0.00,0.00
22 11月,303.51,26,-43950.88,-33022.81
23 12月,0.00,,0.00,0.00
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,0.00,,0.00,0.00
29 11月,0.00,,0.00,0.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
35 1,张先生,0.0h / 0.0h,0.00,0.00,1.8h / 0.0h,303.51,0.00,0.0h / 0.0h,0.00,0.00

View File

@@ -0,0 +1,196 @@
# 助教详情西子2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础1.8h附加0.0h客户流水¥303.51充值归因¥0.00;头部客户(12月)Top3张先生。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,55 @@
助教详情阿清2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础139.9h附加0.0h客户流水¥53805.04充值归因¥0.00;头部客户(12月)Top3陈腾鑫、葛先生、梅。
一、基础课业绩
说明评价基础139.9h附加0.0h客户流水¥53805.04充值归因¥0.00;头部客户(12月)Top3陈腾鑫、葛先生、梅。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,73.48h,8,19.01h,34.60h
12月,66.45h,5,21.64h,25.36h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,0.00h,,0.00h,0.00h
12月,0.00h,,0.00h,0.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,0.00,,0.00,0.00
11月,37302.04,13,-6952.35,3975.72
12月,16503.00,10,-4227.53,2862.36
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,0.00,,0.00,0.00
11月,0.00,,0.00,0.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1,陈腾鑫,34.9h / 0.0h,7428.12,0.00,44.4h / 0.0h,10029.58,0.00,0.0h / 0.0h,0.00,0.00
2,葛先生,7.9h / 0.0h,2831.40,0.00,19.7h / 0.0h,7141.04,0.00,0.0h / 0.0h,0.00,0.00
3,,7.5h / 0.0h,2086.99,0.00,3.3h / 0.0h,1573.10,0.00,0.0h / 0.0h,0.00,0.00
4,张先生,7.2h / 0.0h,1794.40,0.00,1.0h / 0.0h,679.31,0.00,0.0h / 0.0h,0.00,0.00
5,,3.0h / 0.0h,1128.06,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
6,,4.2h / 0.0h,773.51,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
7,常总,1.7h / 0.0h,460.52,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
8,轩哥,0.0h / 0.0h,0.00,0.00,1.0h / 0.0h,10078.85,0.00,0.0h / 0.0h,0.00,0.00
9,黄先生,0.0h / 0.0h,0.00,0.00,0.7h / 0.0h,382.08,0.00,0.0h / 0.0h,0.00,0.00
10,蔡总,0.0h / 0.0h,0.00,0.00,1.5h / 0.0h,6557.92,0.00,0.0h / 0.0h,0.00,0.00
11,小燕,0.0h / 0.0h,0.00,0.00,2.0h / 0.0h,860.16,0.00,0.0h / 0.0h,0.00,0.00
1 助教详情:阿清(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础139.9h,附加0.0h;客户流水¥53805.04,充值归因¥0.00;头部客户(12月)Top3:陈腾鑫、葛先生、梅。
3 一、基础课业绩
4 说明:评价:基础139.9h,附加0.0h;客户流水¥53805.04,充值归因¥0.00;头部客户(12月)Top3:陈腾鑫、葛先生、梅。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,0.00h,,0.00h,0.00h
8 11月,73.48h,8,19.01h,34.60h
9 12月,66.45h,5,21.64h,25.36h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,0.00h,,0.00h,0.00h
15 11月,0.00h,,0.00h,0.00h
16 12月,0.00h,,0.00h,0.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,0.00,,0.00,0.00
22 11月,37302.04,13,-6952.35,3975.72
23 12月,16503.00,10,-4227.53,2862.36
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,0.00,,0.00,0.00
29 11月,0.00,,0.00,0.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
35 1,陈腾鑫,34.9h / 0.0h,7428.12,0.00,44.4h / 0.0h,10029.58,0.00,0.0h / 0.0h,0.00,0.00
36 2,葛先生,7.9h / 0.0h,2831.40,0.00,19.7h / 0.0h,7141.04,0.00,0.0h / 0.0h,0.00,0.00
37 3,梅,7.5h / 0.0h,2086.99,0.00,3.3h / 0.0h,1573.10,0.00,0.0h / 0.0h,0.00,0.00
38 4,张先生,7.2h / 0.0h,1794.40,0.00,1.0h / 0.0h,679.31,0.00,0.0h / 0.0h,0.00,0.00
39 5,清,3.0h / 0.0h,1128.06,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
40 6,候,4.2h / 0.0h,773.51,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
41 7,常总,1.7h / 0.0h,460.52,0.00,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00
42 8,轩哥,0.0h / 0.0h,0.00,0.00,1.0h / 0.0h,10078.85,0.00,0.0h / 0.0h,0.00,0.00
43 9,黄先生,0.0h / 0.0h,0.00,0.00,0.7h / 0.0h,382.08,0.00,0.0h / 0.0h,0.00,0.00
44 10,蔡总,0.0h / 0.0h,0.00,0.00,1.5h / 0.0h,6557.92,0.00,0.0h / 0.0h,0.00,0.00
45 11,小燕,0.0h / 0.0h,0.00,0.00,2.0h / 0.0h,860.16,0.00,0.0h / 0.0h,0.00,0.00

View File

@@ -0,0 +1,196 @@
# 助教详情阿清2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础139.9h附加0.0h客户流水¥53805.04充值归因¥0.00;头部客户(12月)Top3陈腾鑫、葛先生、梅。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,46 @@
助教详情饭团2025年10-12月
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入故汇总可能大于门店总额。评价基础16.0h附加0.0h客户流水¥7955.28充值归因¥0.00;头部客户(12月)Top3轩哥、张先生。
一、基础课业绩
说明评价基础16.0h附加0.0h客户流水¥7955.28充值归因¥0.00;头部客户(12月)Top3轩哥、张先生。
月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,16.00h,16,-28.41h,-20.53h
11月,0.00h,,0.00h,0.00h
12月,0.00h,,0.00h,0.00h
二、附加课业绩
说明:附加课=order_assistant_type=2。
月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
月份,小时数,排名,平均值差值小时数,中位数值差值小时数
10月,0.00h,,0.00h,0.00h
11月,0.00h,,0.00h,0.00h
12月,0.00h,,0.00h,0.00h
三、客户消费业绩
说明:订单台费+助教+商品应付金额全额计入订单内助教。
月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,7955.28,16,-21324.25,-22694.55
11月,0.00,,0.00,0.00
12月,0.00,,0.00,0.00
四、客户充值业绩
说明充值命中消费窗口±30分钟且有助教则归因全额复制。
月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
月份,合计元,排名,平均值差值元,中位数值差值元
10月,0.00,,0.00,0.00
11月,0.00,,0.00,0.00
12月,0.00,,0.00,0.00
五、头部客户按12月消费业绩排序Top100
说明:基础/附加课时=基础h/附加h。
排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
1,轩哥,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,6.9h / 0.0h,5089.50,0.00
2,张先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,9.1h / 0.0h,2865.78,0.00
1 助教详情:饭团(2025年10-12月)
2 本表包含5个部分:基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。评价:基础16.0h,附加0.0h;客户流水¥7955.28,充值归因¥0.00;头部客户(12月)Top3:轩哥、张先生。
3 一、基础课业绩
4 说明:评价:基础16.0h,附加0.0h;客户流水¥7955.28,充值归因¥0.00;头部客户(12月)Top3:轩哥、张先生。
5 月份,基础课业绩,基础课业绩,基础课业绩,基础课业绩
6 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
7 10月,16.00h,16,-28.41h,-20.53h
8 11月,0.00h,,0.00h,0.00h
9 12月,0.00h,,0.00h,0.00h
10 二、附加课业绩
11 说明:附加课=order_assistant_type=2。
12 月份,附加课业绩,附加课业绩,附加课业绩,附加课业绩
13 月份,小时数,排名,平均值差值小时数,中位数值差值小时数
14 10月,0.00h,,0.00h,0.00h
15 11月,0.00h,,0.00h,0.00h
16 12月,0.00h,,0.00h,0.00h
17 三、客户消费业绩
18 说明:订单台费+助教+商品应付金额全额计入订单内助教。
19 月份,客户消费业绩,客户消费业绩,客户消费业绩,客户消费业绩
20 月份,合计元,排名,平均值差值元,中位数值差值元
21 10月,7955.28,16,-21324.25,-22694.55
22 11月,0.00,,0.00,0.00
23 12月,0.00,,0.00,0.00
24 四、客户充值业绩
25 说明:充值命中消费窗口±30分钟且有助教则归因;全额复制。
26 月份,客户充值业绩,客户充值业绩,客户充值业绩,客户充值业绩
27 月份,合计元,排名,平均值差值元,中位数值差值元
28 10月,0.00,,0.00,0.00
29 11月,0.00,,0.00,0.00
30 12月,0.00,,0.00,0.00
31 五、头部客户(按12月消费业绩排序,Top100)
32 说明:基础/附加课时=基础h/附加h。
33 排名,客户名称,12月,12月,12月,11月,11月,11月,10月,10月,10月
34 排名,客户名称,基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元),基础/附加课时,消费业绩(元),客户充值(元)
35 1,轩哥,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,6.9h / 0.0h,5089.50,0.00
36 2,张先生,0.0h / 0.0h,0.00,0.00,0.0h / 0.0h,0.00,0.00,9.1h / 0.0h,2865.78,0.00

View File

@@ -0,0 +1,196 @@
# 助教详情饭团2025年10-12月
## 思考过程
按模板拆分5部分输出月度排名采用dense_rank均值/中位数在当月该指标>0助教集合上计算。
## 查询说明
本表包含5个部分基础课业绩、附加课业绩、客户消费业绩、客户充值业绩、头部客户情况。均值/中位数差值对比集合为当月该指标>0的助教。充值/客户流水多助教与多订单命中均按全额复制计入,故汇总可能大于门店总额。
评价基础16.0h附加0.0h客户流水¥7955.28充值归因¥0.00;头部客户(12月)Top3轩哥、张先生。
## SQL
### 服务时长(助教-客户-月份)
```sql
with raw as (
select
asl.nickname as assistant,
asl.tenant_member_id as member_id,
case when asl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when asl.start_use_time >= '2025-11-01 00:00:00+08'::timestamptz and asl.start_use_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
asl.order_assistant_type,
asl.income_seconds
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
and asl.tenant_member_id is not null and asl.tenant_member_id<>0
)
select
assistant,
member_id,
month_key,
sum(case when order_assistant_type=1 then income_seconds else 0 end)/3600.0 as base_hours,
sum(case when order_assistant_type=2 then income_seconds else 0 end)/3600.0 as extra_hours
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 客户流水(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_amount as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
bo.order_start_time,
bo.order_end_time,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_amount a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
raw as (
select
ao.assistant,
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
join assistant_orders ao on ao.order_settle_id=o.order_settle_id
where o.member_id is not null and o.member_id<>0
)
select
assistant,
member_id,
month_key,
sum(order_amount) as revenue_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```
### 充值归因(助教-客户-月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as table_start_time,
max(tfl.ledger_end_time) as table_end_time
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
assistant_time as (
select
asl.order_settle_id,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id=asl.order_settle_id
where asl.site_id=%(site_id)s and coalesce(asl.is_delete,0)=0
group by asl.order_settle_id
),
order_windows as (
select
bo.order_settle_id,
bo.member_id,
least(bo.table_start_time, coalesce(at.assistant_start_time, bo.table_start_time)) as win_start,
greatest(bo.table_end_time, coalesce(at.assistant_end_time, bo.table_end_time)) as win_end
from base_orders bo
left join assistant_time at on at.order_settle_id=bo.order_settle_id
where bo.member_id is not null and bo.member_id<>0
),
assistant_orders as (
select distinct order_settle_id, nickname as assistant
from billiards_dwd.dwd_assistant_service_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz
and start_use_time < %(window_end)s::timestamptz
),
recharge_pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id=p.relate_id
where p.site_id=%(site_id)s
and p.relate_type=5
and p.pay_status=2
and p.pay_amount>0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
),
matched as (
select
rp.pay_time,
ow.order_settle_id,
ow.member_id,
rp.pay_amount
from recharge_pay rp
join order_windows ow
on ow.member_id=rp.member_id
and rp.pay_time >= ow.win_start - interval '30 minutes'
and rp.pay_time <= ow.win_end + interval '30 minutes'
),
raw as (
select
ao.assistant,
m.member_id,
case when m.pay_time >= '2025-10-01 00:00:00+08'::timestamptz and m.pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when m.pay_time >= '2025-11-01 00:00:00+08'::timestamptz and m.pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when m.pay_time >= '2025-12-01 00:00:00+08'::timestamptz and m.pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
m.pay_amount
from matched m
join assistant_orders ao on ao.order_settle_id=m.order_settle_id
)
select
assistant,
member_id,
month_key,
sum(pay_amount) as recharge_amount
from raw
where month_key is not null
group by assistant, member_id, month_key;
```

View File

@@ -0,0 +1,105 @@
2025年10-12月 客户消费能力Top100分表
与总表同口径分表仅计算12月喜爱助教Top5并展示10-12月各月消费/充值。
排名,客户名称,电话号码,12月,12月,12月,11月,11月,10月,10月
排名,客户名称,电话号码,喜爱助教昵称,消费(元),充值(元),消费(元),充值(元),消费(元),充值(元)
1,轩哥,188****7530,七七(65.8h)、璇子(37.7h)、涛涛(10.8h)、Amy(8.8h)、小柔(8.4h),29170.33,0.00,51318.11,13000.00,72647.61,53000.00
2,蔡总,159****8893,小柔(30.2h)、七七(26.7h)、瑶瑶(19.5h)、璇子(18.3h)、涛涛(15.1h),34327.09,0.00,115512.37,5000.00,0.00,0.00
3,葛先生,138****8071,小燕(104.8h)、阿清(7.9h)、涛涛(5.9h)、梦梦(2.9h)、年糕(2.6h),23237.78,0.00,24991.55,0.00,0.00,0.00
4,罗先生,139****6996,佳怡(73.8h)、苏苏(19.6h)、璇子(5.3h)、周周(2.6h)、球球(2.3h),17515.75,0.00,16177.44,0.00,12880.69,10000.00
5,陈腾鑫,178****8218,阿清(34.9h)、小侯(12.1h)、千千(4.9h)、小柔(1.7h),10701.83,0.00,19428.27,1000.00,9945.66,8000.00
6,江先生,188****4838,璇子(38.7h)、婉婉(4.7h)、小柔(3.2h)、七七(3.2h)、Amy(2.2h),10050.26,0.00,14700.83,5000.00,5721.32,6000.00
7,小燕,178****1334,小燕(85.7h)、Amy(1.0h)、年糕(0.5h),17306.66,0.00,12582.23,0.00,0.00,0.00
8,张先生,139****8852,小侯(14.5h)、千千(10.0h)、阿清(7.2h)、苏苏(3.9h)、乔西(3.3h),7533.67,0.00,8692.62,0.00,9878.04,0.00
9,曾巧明,186****1488,,6331.51,0.00,8821.59,0.00,9677.06,0.00
10,黄生,136****9719,,4181.24,0.00,6353.05,0.00,7871.94,0.00
11,,191****2851,,0.00,0.00,4318.15,6000.00,12281.44,11000.00
12,叶先生,138****9539,素素(3.1h)、年糕(2.6h),1658.40,0.00,3725.65,0.00,9107.20,6307.00
13,T,180****9962,球球(10.7h)、周周(10.1h)、乔西(6.9h)、苏苏(4.5h)、小侯(3.9h),6777.66,0.00,2490.70,0.00,4382.70,3000.00
14,林先生,133****1070,七七(14.0h)、璇子(9.6h)、苏苏(4.9h)、乔西(4.6h)、佳怡(4.5h),9468.05,0.00,3469.81,0.00,0.00,0.00
15,曾丹烨,139****3242,,2485.41,0.00,5168.56,0.00,4702.36,3000.00
16,胡先生,186****3391,佳怡(3.0h),522.45,0.00,10898.42,8000.00,0.00,0.00
17,艾宇民,150****9958,,1179.56,0.00,7185.78,0.00,2397.73,0.00
18,谢俊,186****5198,,969.66,0.00,4819.27,0.00,4193.93,0.00
19,周周,198****8725,周周(40.8h)、球球(15.2h)、佳怡(13.2h),8905.19,0.00,0.00,0.00,0.00,0.00
20,叶总,137****3287,,0.00,0.00,0.00,0.00,8163.28,5700.00
21,,187****5094,,0.00,0.00,4534.79,16000.00,3620.75,48000.00
22,,172****6666,佳怡(3.2h)、周周(2.4h)、千千(2.2h)、QQ(1.2h),2795.90,0.00,5001.47,0.00,0.00,0.00
23,桂先生,166****7275,,606.24,0.00,4788.94,0.00,2283.11,985.00
24,明哥,166****0999,婉婉(26.7h)、小柔(25.7h)、年糕(4.6h)、周周(0.4h)、Amy(0.1h),5322.90,0.00,2258.14,0.00,0.00,0.00
25,陈德韩,134****7864,,20.00,0.00,0.00,0.00,7282.92,5000.00
26,小熊,139****0145,,0.00,0.00,5213.64,4000.00,1922.24,1000.00
27,黄先生,135****3507,苏苏(9.6h)、千千(6.2h),2506.04,0.00,1926.28,0.00,2620.40,3000.00
28,吕先生,155****0663,,0.00,0.00,0.00,0.00,7012.05,6000.00
29,郑先生,159****4331,小敌(4.9h),1614.93,0.00,4823.14,0.00,0.00,0.00
30,歌神,188****2164,,0.00,0.00,0.00,0.00,5877.65,5000.00
31,罗先生,139****9222,婉婉(7.5h)、小柔(4.5h),0.00,0.00,4687.61,0.00,1143.87,3000.00
32,大G,186****4598,周周(14.9h)、佳怡(9.5h)、球球(1.9h),3591.07,0.00,1783.61,0.00,0.00,0.00
33,林先生,137****8785,,480.91,0.00,4486.47,0.00,0.00,0.00
34,,136****4552,千千(10.8h)、阿清(7.5h)、小侯(3.3h),2483.11,0.00,2107.81,0.00,0.00,0.00
35,李先生,134****4343,小侯(9.3h)、球球(0.0h),2395.25,0.00,2084.52,0.00,0.00,0.00
36,,189****2151,,0.00,0.00,0.00,0.00,4096.07,6000.00
37,陈先生,159****2829,,0.00,0.00,3717.58,3000.00,100.00,0.00
38,,131****0323,球球(5.3h)、阿清(4.3h)、小侯(3.4h)、涛涛(3.1h)、乔西(2.9h),3765.88,0.00,0.00,0.00,0.00,0.00
39,黄先生,158****2109,球球(8.1h)、QQ(4.5h),300.15,0.00,1660.64,0.00,1608.13,3000.00
40,孟紫龙,176****3741,,2888.95,0.00,603.78,0.00,0.00,0.00
41,罗超,137****0990,,0.00,0.00,0.00,0.00,3398.81,3000.00
42,君姐,166****4594,璇子(2.3h)、涛涛(2.2h)、年糕(2.2h),1414.23,0.00,1947.72,0.00,0.00,0.00
43,吴生,136****3341,,368.03,0.00,1721.17,0.00,1164.50,0.00
44,刘哥,135****0020,婉婉(0.3h),54.46,0.00,2982.34,0.00,0.00,0.00
45,李先生,131****4000,,0.00,0.00,2997.53,3000.00,0.00,0.00
46,阿亮,159****2628,涛涛(2.9h)、梦梦(2.7h),1133.53,0.00,1802.73,0.00,0.00,0.00
47,李先生,186****8308,,0.00,0.00,2785.23,0.00,0.00,0.00
48,周先生,173****7775,,0.00,0.00,0.00,0.00,2726.01,0.00
49,林先生,159****0021,,0.00,0.00,2690.52,0.00,0.00,0.00
50,周先生,193****6822,千千(8.6h)、素素(6.2h),2643.64,0.00,0.00,0.00,0.00,0.00
51,林先生,188****0332,,0.00,0.00,2612.01,0.00,0.00,0.00
52,牛先生,152****5159,,0.00,0.00,2187.48,0.00,0.00,0.00
53,孟紫龙(该会员已注销),176****37411,,0.00,0.00,300.00,0.00,1831.72,0.00
54,罗超杰,137****8012,,0.00,0.00,423.70,0.00,1160.35,0.00
55,汪先生,139****6339,,0.00,0.00,0.00,0.00,1390.07,1000.00
56,桂先生(该会员已注销),166****72751,,0.00,0.00,0.00,0.00,1370.81,0.00
57,方先生,153****3185,,0.00,0.00,414.57,0.00,898.73,1000.00
58,陈淑涛,132****5485,,0.00,0.00,1276.77,0.00,0.00,0.00
59,,130****3087,阿清(3.0h)、千千(3.0h)、小侯(3.0h),1128.06,0.00,0.00,0.00,0.00,0.00
60,amy,137****8221,Amy(4.8h),1105.90,0.00,0.00,0.00,0.00,0.00
61,曾先生,133****1235,,193.90,0.00,700.09,0.00,97.35,0.00
62,昌哥,137****1229,小柔(1.8h),318.40,0.00,624.02,0.00,0.00,0.00
63,,131****9882,,0.00,0.00,320.99,0.00,606.45,0.00
64,邓飛,136****9597,,0.00,0.00,925.47,1000.00,0.00,1345.00
65,陈世,134****1938,,0.00,0.00,502.07,0.00,419.02,0.00
66,婉婉,183****2742,,0.00,0.00,242.81,0.00,624.68,1000.00
67,贺斌,150****0885,,0.00,0.00,108.29,0.00,662.27,0.00
68,陈泽斌,132****6060,,100.00,0.00,500.00,0.00,100.00,0.00
69,林总,138****1180,,0.00,0.00,684.44,0.00,0.00,0.00
70,卢广贤,186****6220,,128.86,0.00,288.51,0.00,263.07,0.00
71,王龙,186****8011,,669.58,0.00,0.00,0.00,0.00,0.00
72,王先生,185****1125,,183.75,0.00,416.93,0.00,0.00,0.00
73,潘先生,186****0511,年糕(2.0h),564.93,0.00,0.00,0.00,0.00,0.00
74,老宋,138****4554,,0.00,0.00,465.98,0.00,75.99,0.00
75,郭先生,156****5001,,0.00,0.00,281.22,0.00,237.13,0.00
76,孙启明,137****6325,,0.00,0.00,200.00,0.00,300.00,0.00
77,王先生,136****0168,,100.00,0.00,400.00,0.00,0.00,0.00
78,黎先生,133****0983,,0.00,0.00,0.00,0.00,470.19,0.00
79,常总,185****7188,阿清(1.7h)、年糕(1.7h),460.52,0.00,0.00,0.00,0.00,0.00
80,张丹逸,136****6637,,100.00,0.00,0.00,0.00,339.36,0.00
81,陈先生,186****8238,,0.00,0.00,416.17,0.00,0.00,0.00
82,陈先生,138****3964,,100.00,0.00,0.00,0.00,300.00,0.00
83,张先生,136****4528,,298.35,0.00,100.00,0.00,0.00,0.00
84,小宇,187****8077,,0.00,0.00,0.00,0.00,397.50,0.00
85,黄先生,191****8219,,0.00,0.00,364.33,0.00,0.00,0.00
86,刘女士,177****7538,,0.00,0.00,0.00,0.00,362.58,0.00
87,魏先生,137****6862,,319.39,0.00,0.00,0.00,0.00,0.00
88,杜先生,188****4705,,0.00,0.00,207.47,0.00,100.00,0.00
89,刘先生,137****2930,,300.00,0.00,0.00,0.00,0.00,0.00
90,陈先生,133****6117,,0.00,0.00,300.00,0.00,0.00,0.00
91,潘先生,176****7964,,300.00,0.00,0.00,0.00,0.00,0.00
92,钟智豪,188****2803,,0.00,0.00,274.34,0.00,0.00,0.00
93,都先生,138****7796,,0.00,0.00,269.64,0.00,0.00,0.00
94,林志铭,135****4233,,0.00,0.00,267.96,0.00,0.00,0.00
95,方先生,158****6447,,148.00,0.00,100.00,0.00,0.00,0.00
96,李先生,176****5124,,0.00,0.00,0.00,0.00,244.00,0.00
97,钟先生,132****3438,,0.00,0.00,0.00,0.00,239.37,0.00
98,,130****5960,,232.00,0.00,0.00,0.00,0.00,0.00
99,黄国磊,131****3045,,100.00,0.00,100.00,0.00,25.33,0.00
100,周先生,159****9997,,100.00,0.00,100.00,0.00,0.00,0.00
1 2025年10-12月 客户消费能力Top100(分表)
2 与总表同口径;分表仅计算12月喜爱助教Top5,并展示10-12月各月消费/充值。
3 排名,客户名称,电话号码,12月,12月,12月,11月,11月,10月,10月
4 排名,客户名称,电话号码,喜爱助教昵称,消费(元),充值(元),消费(元),充值(元),消费(元),充值(元)
5 1,轩哥,188****7530,七七(65.8h)、璇子(37.7h)、涛涛(10.8h)、Amy(8.8h)、小柔(8.4h),29170.33,0.00,51318.11,13000.00,72647.61,53000.00
6 2,蔡总,159****8893,小柔(30.2h)、七七(26.7h)、瑶瑶(19.5h)、璇子(18.3h)、涛涛(15.1h),34327.09,0.00,115512.37,5000.00,0.00,0.00
7 3,葛先生,138****8071,小燕(104.8h)、阿清(7.9h)、涛涛(5.9h)、梦梦(2.9h)、年糕(2.6h),23237.78,0.00,24991.55,0.00,0.00,0.00
8 4,罗先生,139****6996,佳怡(73.8h)、苏苏(19.6h)、璇子(5.3h)、周周(2.6h)、球球(2.3h),17515.75,0.00,16177.44,0.00,12880.69,10000.00
9 5,陈腾鑫,178****8218,阿清(34.9h)、小侯(12.1h)、千千(4.9h)、小柔(1.7h),10701.83,0.00,19428.27,1000.00,9945.66,8000.00
10 6,江先生,188****4838,璇子(38.7h)、婉婉(4.7h)、小柔(3.2h)、七七(3.2h)、Amy(2.2h),10050.26,0.00,14700.83,5000.00,5721.32,6000.00
11 7,小燕,178****1334,小燕(85.7h)、Amy(1.0h)、年糕(0.5h),17306.66,0.00,12582.23,0.00,0.00,0.00
12 8,张先生,139****8852,小侯(14.5h)、千千(10.0h)、阿清(7.2h)、苏苏(3.9h)、乔西(3.3h),7533.67,0.00,8692.62,0.00,9878.04,0.00
13 9,曾巧明,186****1488,,6331.51,0.00,8821.59,0.00,9677.06,0.00
14 10,黄生,136****9719,,4181.24,0.00,6353.05,0.00,7871.94,0.00
15 11,夏,191****2851,,0.00,0.00,4318.15,6000.00,12281.44,11000.00
16 12,叶先生,138****9539,素素(3.1h)、年糕(2.6h),1658.40,0.00,3725.65,0.00,9107.20,6307.00
17 13,T,180****9962,球球(10.7h)、周周(10.1h)、乔西(6.9h)、苏苏(4.5h)、小侯(3.9h),6777.66,0.00,2490.70,0.00,4382.70,3000.00
18 14,林先生,133****1070,七七(14.0h)、璇子(9.6h)、苏苏(4.9h)、乔西(4.6h)、佳怡(4.5h),9468.05,0.00,3469.81,0.00,0.00,0.00
19 15,曾丹烨,139****3242,,2485.41,0.00,5168.56,0.00,4702.36,3000.00
20 16,胡先生,186****3391,佳怡(3.0h),522.45,0.00,10898.42,8000.00,0.00,0.00
21 17,艾宇民,150****9958,,1179.56,0.00,7185.78,0.00,2397.73,0.00
22 18,谢俊,186****5198,,969.66,0.00,4819.27,0.00,4193.93,0.00
23 19,周周,198****8725,周周(40.8h)、球球(15.2h)、佳怡(13.2h),8905.19,0.00,0.00,0.00,0.00,0.00
24 20,叶总,137****3287,,0.00,0.00,0.00,0.00,8163.28,5700.00
25 21,羊,187****5094,,0.00,0.00,4534.79,16000.00,3620.75,48000.00
26 22,游,172****6666,佳怡(3.2h)、周周(2.4h)、千千(2.2h)、QQ(1.2h),2795.90,0.00,5001.47,0.00,0.00,0.00
27 23,桂先生,166****7275,,606.24,0.00,4788.94,0.00,2283.11,985.00
28 24,明哥,166****0999,婉婉(26.7h)、小柔(25.7h)、年糕(4.6h)、周周(0.4h)、Amy(0.1h),5322.90,0.00,2258.14,0.00,0.00,0.00
29 25,陈德韩,134****7864,,20.00,0.00,0.00,0.00,7282.92,5000.00
30 26,小熊,139****0145,,0.00,0.00,5213.64,4000.00,1922.24,1000.00
31 27,黄先生,135****3507,苏苏(9.6h)、千千(6.2h),2506.04,0.00,1926.28,0.00,2620.40,3000.00
32 28,吕先生,155****0663,,0.00,0.00,0.00,0.00,7012.05,6000.00
33 29,郑先生,159****4331,小敌(4.9h),1614.93,0.00,4823.14,0.00,0.00,0.00
34 30,歌神,188****2164,,0.00,0.00,0.00,0.00,5877.65,5000.00
35 31,罗先生,139****9222,婉婉(7.5h)、小柔(4.5h),0.00,0.00,4687.61,0.00,1143.87,3000.00
36 32,大G,186****4598,周周(14.9h)、佳怡(9.5h)、球球(1.9h),3591.07,0.00,1783.61,0.00,0.00,0.00
37 33,林先生,137****8785,,480.91,0.00,4486.47,0.00,0.00,0.00
38 34,梅,136****4552,千千(10.8h)、阿清(7.5h)、小侯(3.3h),2483.11,0.00,2107.81,0.00,0.00,0.00
39 35,李先生,134****4343,小侯(9.3h)、球球(0.0h),2395.25,0.00,2084.52,0.00,0.00,0.00
40 36,陶,189****2151,,0.00,0.00,0.00,0.00,4096.07,6000.00
41 37,陈先生,159****2829,,0.00,0.00,3717.58,3000.00,100.00,0.00
42 38,候,131****0323,球球(5.3h)、阿清(4.3h)、小侯(3.4h)、涛涛(3.1h)、乔西(2.9h),3765.88,0.00,0.00,0.00,0.00,0.00
43 39,黄先生,158****2109,球球(8.1h)、QQ(4.5h),300.15,0.00,1660.64,0.00,1608.13,3000.00
44 40,孟紫龙,176****3741,,2888.95,0.00,603.78,0.00,0.00,0.00
45 41,罗超,137****0990,,0.00,0.00,0.00,0.00,3398.81,3000.00
46 42,君姐,166****4594,璇子(2.3h)、涛涛(2.2h)、年糕(2.2h),1414.23,0.00,1947.72,0.00,0.00,0.00
47 43,吴生,136****3341,,368.03,0.00,1721.17,0.00,1164.50,0.00
48 44,刘哥,135****0020,婉婉(0.3h),54.46,0.00,2982.34,0.00,0.00,0.00
49 45,李先生,131****4000,,0.00,0.00,2997.53,3000.00,0.00,0.00
50 46,阿亮,159****2628,涛涛(2.9h)、梦梦(2.7h),1133.53,0.00,1802.73,0.00,0.00,0.00
51 47,李先生,186****8308,,0.00,0.00,2785.23,0.00,0.00,0.00
52 48,周先生,173****7775,,0.00,0.00,0.00,0.00,2726.01,0.00
53 49,林先生,159****0021,,0.00,0.00,2690.52,0.00,0.00,0.00
54 50,周先生,193****6822,千千(8.6h)、素素(6.2h),2643.64,0.00,0.00,0.00,0.00,0.00
55 51,林先生,188****0332,,0.00,0.00,2612.01,0.00,0.00,0.00
56 52,牛先生,152****5159,,0.00,0.00,2187.48,0.00,0.00,0.00
57 53,孟紫龙(该会员已注销),176****37411,,0.00,0.00,300.00,0.00,1831.72,0.00
58 54,罗超杰,137****8012,,0.00,0.00,423.70,0.00,1160.35,0.00
59 55,汪先生,139****6339,,0.00,0.00,0.00,0.00,1390.07,1000.00
60 56,桂先生(该会员已注销),166****72751,,0.00,0.00,0.00,0.00,1370.81,0.00
61 57,方先生,153****3185,,0.00,0.00,414.57,0.00,898.73,1000.00
62 58,陈淑涛,132****5485,,0.00,0.00,1276.77,0.00,0.00,0.00
63 59,清,130****3087,阿清(3.0h)、千千(3.0h)、小侯(3.0h),1128.06,0.00,0.00,0.00,0.00,0.00
64 60,amy,137****8221,Amy(4.8h),1105.90,0.00,0.00,0.00,0.00,0.00
65 61,曾先生,133****1235,,193.90,0.00,700.09,0.00,97.35,0.00
66 62,昌哥,137****1229,小柔(1.8h),318.40,0.00,624.02,0.00,0.00,0.00
67 63,李,131****9882,,0.00,0.00,320.99,0.00,606.45,0.00
68 64,邓飛,136****9597,,0.00,0.00,925.47,1000.00,0.00,1345.00
69 65,陈世,134****1938,,0.00,0.00,502.07,0.00,419.02,0.00
70 66,婉婉,183****2742,,0.00,0.00,242.81,0.00,624.68,1000.00
71 67,贺斌,150****0885,,0.00,0.00,108.29,0.00,662.27,0.00
72 68,陈泽斌,132****6060,,100.00,0.00,500.00,0.00,100.00,0.00
73 69,林总,138****1180,,0.00,0.00,684.44,0.00,0.00,0.00
74 70,卢广贤,186****6220,,128.86,0.00,288.51,0.00,263.07,0.00
75 71,王龙,186****8011,,669.58,0.00,0.00,0.00,0.00,0.00
76 72,王先生,185****1125,,183.75,0.00,416.93,0.00,0.00,0.00
77 73,潘先生,186****0511,年糕(2.0h),564.93,0.00,0.00,0.00,0.00,0.00
78 74,老宋,138****4554,,0.00,0.00,465.98,0.00,75.99,0.00
79 75,郭先生,156****5001,,0.00,0.00,281.22,0.00,237.13,0.00
80 76,孙启明,137****6325,,0.00,0.00,200.00,0.00,300.00,0.00
81 77,王先生,136****0168,,100.00,0.00,400.00,0.00,0.00,0.00
82 78,黎先生,133****0983,,0.00,0.00,0.00,0.00,470.19,0.00
83 79,常总,185****7188,阿清(1.7h)、年糕(1.7h),460.52,0.00,0.00,0.00,0.00,0.00
84 80,张丹逸,136****6637,,100.00,0.00,0.00,0.00,339.36,0.00
85 81,陈先生,186****8238,,0.00,0.00,416.17,0.00,0.00,0.00
86 82,陈先生,138****3964,,100.00,0.00,0.00,0.00,300.00,0.00
87 83,张先生,136****4528,,298.35,0.00,100.00,0.00,0.00,0.00
88 84,小宇,187****8077,,0.00,0.00,0.00,0.00,397.50,0.00
89 85,黄先生,191****8219,,0.00,0.00,364.33,0.00,0.00,0.00
90 86,刘女士,177****7538,,0.00,0.00,0.00,0.00,362.58,0.00
91 87,魏先生,137****6862,,319.39,0.00,0.00,0.00,0.00,0.00
92 88,杜先生,188****4705,,0.00,0.00,207.47,0.00,100.00,0.00
93 89,刘先生,137****2930,,300.00,0.00,0.00,0.00,0.00,0.00
94 90,陈先生,133****6117,,0.00,0.00,300.00,0.00,0.00,0.00
95 91,潘先生,176****7964,,300.00,0.00,0.00,0.00,0.00,0.00
96 92,钟智豪,188****2803,,0.00,0.00,274.34,0.00,0.00,0.00
97 93,都先生,138****7796,,0.00,0.00,269.64,0.00,0.00,0.00
98 94,林志铭,135****4233,,0.00,0.00,267.96,0.00,0.00,0.00
99 95,方先生,158****6447,,148.00,0.00,100.00,0.00,0.00,0.00
100 96,李先生,176****5124,,0.00,0.00,0.00,0.00,244.00,0.00
101 97,钟先生,132****3438,,0.00,0.00,0.00,0.00,239.37,0.00
102 98,杨,130****5960,,232.00,0.00,0.00,0.00,0.00,0.00
103 99,黄国磊,131****3045,,100.00,0.00,100.00,0.00,25.33,0.00
104 100,周先生,159****9997,,100.00,0.00,100.00,0.00,0.00,0.00

View File

@@ -0,0 +1,199 @@
# 2025年10-12月 客户消费能力Top100分表
## 思考过程
以台费订单为基准汇总三类明细满足应付金额口径并输出Top100客户的消费/充值/助教偏好。按你的要求,先生成评价为空的版本,再在脚本末尾回填评价。
## 查询说明
与总表同口径分表仅计算12月喜爱助教Top5并展示10-12月各月消费/充值。
## SQL
### Top100按消费总额
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount,
sum(tfl.real_table_use_seconds) as table_use_seconds
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_info as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
least(bo.order_start_time, coalesce(a.assistant_start_time, bo.order_start_time)) as order_start_time,
greatest(bo.order_end_time, coalesce(a.assistant_end_time, bo.order_end_time)) as order_end_time,
bo.table_use_seconds,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_info a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
select
o.member_id,
sum(o.order_amount) as consume_total,
count(*) as order_cnt
from orders o
where o.member_id is not null and o.member_id <> 0
group by o.member_id
order by consume_total desc
limit 100;
```
### 按月消费汇总
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount,
sum(tfl.real_table_use_seconds) as table_use_seconds
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_info as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
least(bo.order_start_time, coalesce(a.assistant_start_time, bo.order_start_time)) as order_start_time,
greatest(bo.order_end_time, coalesce(a.assistant_end_time, bo.order_end_time)) as order_end_time,
bo.table_use_seconds,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_info a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, x as (
select
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
where o.member_id is not null and o.member_id <> 0
)
select
member_id,
month_key,
sum(order_amount) as consume_sum
from x
where month_key is not null
group by member_id, month_key;
```
### 按月充值汇总
```sql
with pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id = p.relate_id
where p.site_id = %(site_id)s
and p.relate_type = 5
and p.pay_status = 2
and p.pay_amount > 0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
)
, x as (
select
member_id,
case when pay_time >= '2025-10-01 00:00:00+08'::timestamptz and pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when pay_time >= '2025-11-01 00:00:00+08'::timestamptz and pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when pay_time >= '2025-12-01 00:00:00+08'::timestamptz and pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
pay_amount
from pay
)
select
member_id,
month_key,
sum(pay_amount) as recharge_sum
from x
where month_key is not null
group by member_id, month_key;
```
### 喜爱助教Top5仅12月
```sql
with x as (
select
asl.tenant_member_id as member_id,
asl.nickname as assistant_nickname,
sum(case when asl.order_assistant_type=1 then asl.income_seconds else asl.income_seconds*1.5 end) / 3600.0 as weighted_hours
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0)=0
and asl.tenant_member_id is not null and asl.tenant_member_id <> 0
and asl.start_use_time >= '2025-12-01 00:00:00+08'::timestamptz
and asl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by asl.tenant_member_id, asl.nickname
),
ranked as (
select *, row_number() over(partition by member_id order by weighted_hours desc) as rn
from x
)
select
member_id,
string_agg(assistant_nickname || '(' || to_char(round(weighted_hours::numeric, 1), 'FM999999990.0') || 'h)', '' order by weighted_hours desc) as fav5
from ranked
where rn <= 5
group by member_id;
```

View File

@@ -0,0 +1,105 @@
2025年10-12月 客户消费能力Top100总表
"消费=台费(dwd_table_fee_log.ledger_amount)+助教(dwd_assistant_service_log.ledger_amount)+商品(dwd_store_goods_sale.ledger_amount),均为应付金额(不扣优惠),以台费订单为基准串联;充值=充值支付流水(dwd_payment.relate_type=5, pay_status=2, pay_amount>0)按支付时间切月;储值卡未使用金额=当前有效储值卡余额之和(dim_member_card_account.balance, member_card_type_name='储值卡');喜爱助教=基础课时长+附加课时长*1.5income_seconds换算小时总表按10-12月汇总Top5。"
排名,客户名称,电话号码,10月-12月,10月-12月,10月-12月,当前,评价
排名,客户名称,电话号码,喜爱助教昵称,总消费(元),总充值(元),储值卡未使用金额(元),评价
1,轩哥,188****7530,璇子(152.6h)、七七(129.6h)、涛涛(72.7h)、小敌(54.3h)、佳怡(50.6h),153136.05,66000.00,6050.80,订单53单平均单次¥2889.36打球279.0h平均单次5.3h偏好666(54.4%)、发财(13.7%)、包厢(6.5%)、A区(5.9%)时间到店均值16:43 中位19:21离店均值22:31 中位次日01:03商品荷花双中支×56(¥3808.00)、细和天下×21(¥2625.00)、100 和成天下×13(¥1495.00)、农夫山泉苏打水×211(¥1266.00)、红牛×101(¥1010.00)、双中支中华×14(¥1008.00)商品合计¥26812.00 占比17.5%综合10-12月到店消费40天/53次到店周期中位#1消费排名#1在店时长#312月到店消费8天/9次到店周期中位#1消费排名#1在店时长#7最近到店2025-12-18趋势10-12月到店频次下降建议重点唤醒围客与客户运营建议重点维护包厢/团建需求,提前锁档与套餐化;商品贡献高,可做常购商品补货提醒与组合促销
2,蔡总,159****8893,小柔(97.0h)、七七(72.4h)、璇子(68.2h)、涛涛(43.5h)、瑶瑶(42.8h),149839.46,5000.00,2016.18,订单23单平均单次¥6514.76打球180.4h平均单次7.8h;偏好:发财(79.2%)、666(6.5%)、A区(4.3%)、补时长(2.8%)时间到店均值18:05 中位20:12离店均值次日02:58 中位次日04:48商品钻石荷花×100(¥4685.00)、细和天下×30(¥3750.00)、粗和天下×24(¥3000.00)、100 和成天下×20(¥2300.00)、双中支中华×31(¥2232.00)、荷花双中支×29(¥2008.00)商品合计¥37968.00 占比25.3%综合10-12月到店消费22天/23次到店周期中位#2消费排名#2在店时长#812月到店消费8天/8次到店周期中位#1消费排名#2在店时长#10最近到店2025-12-15趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议商品贡献高可做常购商品补货提醒与组合促销
3,葛先生,138****8071,小燕(158.3h)、阿清(27.6h)、千千(14.4h)、周周(11.0h)、年糕(9.4h),48229.33,0.00,9011.19,订单42单平均单次¥1148.32打球180.6h平均单次4.3h偏好TV台(43.8%)、A区(21.2%)、包厢(20.6%)、S区/斯诺克(6.7%)时间到店均值14:01 中位19:40离店均值18:19 中位21:54商品百威235毫升×72(¥1080.00)、卡士×33(¥726.00)、风花雪月×36(¥576.00)、细荷花×7(¥370.00)、蜂蜜水×36(¥360.00)、东方树叶×39(¥312.00)商品合计¥5432.00 占比11.3%综合10-12月到店消费25天/42次到店周期中位#1消费排名#3在店时长#712月到店消费11天/24次到店周期中位#1消费排名#3在店时长#2最近到店2025-12-19趋势10-12月到店频次上升12月更活跃围客与客户运营建议重点维护包厢/团建需求,提前锁档与套餐化;商品贡献高,可做常购商品补货提醒与组合促销
4,罗先生,139****6996,佳怡(205.2h)、苏苏(19.6h)、璇子(13.2h)、周周(11.6h)、涛涛(10.5h),46573.88,10000.00,585.35,订单86单平均单次¥541.56打球212.7h平均单次2.5h偏好TV台(39.2%)、C区(31.8%)、M7(7.8%)、麻将(5.8%)时间到店均值15:24 中位18:18离店均值18:05 中位20:27商品百威235毫升×94(¥1410.00)、东方树叶×39(¥312.00)、细荷花×6(¥300.00)、荷花双中支×4(¥276.00)、中支芙蓉王×6(¥228.00)、哇哈哈矿泉水×38(¥190.00)商品合计¥4390.00 占比9.4%综合10-12月到店消费59天/86次到店周期中位#1消费排名#4在店时长#512月到店消费17天/25次到店周期中位#1消费排名#4在店时长#5最近到店2025-12-18趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议商品贡献高可做常购商品补货提醒与组合促销
5,陈腾鑫,178****8218,阿清(79.2h)、佳怡(57.7h)、球球(34.2h)、小侯(19.1h)、千千(7.7h),40075.76,9000.00,0.00,订单93单平均单次¥430.92打球207.0h平均单次2.2h;偏好:麻将(25.0%)、C区(18.7%)、TV台(13.6%)、包厢(11.4%)时间到店均值17:33 中位20:09离店均值19:45 中位22:28商品百威235毫升×27(¥405.00)、东方树叶×50(¥400.00)、哇哈哈矿泉水×41(¥205.00)、荷花双中支×2(¥144.00)、地道肠×27(¥135.00)、哈啤×12(¥120.00)商品合计¥2468.00 占比6.2%综合10-12月到店消费49天/93次到店周期中位#1消费排名#5在店时长#612月到店消费11天/20次到店周期中位#1消费排名#5在店时长#8最近到店2025-12-13趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议关注是否为临时充值型建议引导储值梯度与权益重点维护包厢/团建需求,提前锁档与套餐化;商品贡献高,可做常购商品补货提醒与组合促销
6,江先生,188****4838,璇子(110.5h)、婉婉(16.8h)、小柔(12.0h)、Amy(6.7h)、周周(4.3h),30472.41,11000.00,0.00,订单24单平均单次¥1269.68打球65.6h平均单次2.7h;偏好:包厢(44.5%)、888(15.3%)、M8(12.8%)、B区(10.3%)时间到店均值16:05 中位19:47离店均值18:53 中位21:24商品百威235毫升×480(¥7200.00)、风花雪月×28(¥448.00)、钻石荷花×7(¥330.00)、东方树叶×11(¥88.00)、双中支中华×1(¥72.00)、荷花双中支×1(¥68.00)商品合计¥8943.00 占比29.3%综合10-12月到店消费21天/24次到店周期中位#3消费排名#6在店时长#1412月到店消费5天/6次到店周期中位#3消费排名#6在店时长#18最近到店2025-12-13趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议关注是否为临时充值型建议引导储值梯度与权益重点维护包厢/团建需求,提前锁档与套餐化;商品贡献高,可做常购商品补货提醒与组合促销
7,小燕,178****1334,小燕(140.1h)、阿清(2.0h)、球球(1.4h)、Amy(1.0h)、年糕(0.5h),29888.89,0.00,1802.64,订单62单平均单次¥482.08打球148.0h平均单次2.4h偏好A区(55.2%)、麻将(20.7%)、S区/斯诺克(14.7%)、补时长(4.3%)时间到店均值15:22 中位19:05离店均值17:50 中位21:43商品东方树叶×28(¥224.00)、双中支中华×2(¥144.00)、钻石荷花×2(¥90.00)、荷花双中支×1(¥68.00)、蜂蜜水×6(¥60.00)、百威235毫升×3(¥45.00)商品合计¥863.00 占比2.9%综合10-12月到店消费27天/62次到店周期中位#1消费排名#7在店时长#1012月到店消费15天/30次到店周期中位#1消费排名#7在店时长#3最近到店2025-12-18趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
8,张先生,139****8852,七七(25.1h)、小侯(20.2h)、千千(14.4h)、周周(10.4h)、璇子(10.3h),26104.33,0.00,1942.41,订单46单平均单次¥567.49打球105.7h平均单次2.3h偏好C区(76.3%)、666(8.8%)、麻将(5.7%)、补时长(4.8%)时间到店均值18:43 中位18:47离店均值21:25 中位21:12商品东方树叶×28(¥224.00)、哇哈哈矿泉水×41(¥205.00)、钻石荷花×3(¥135.00)、细和天下×1(¥125.00)、双中支中华×1(¥72.00)、农夫山泉苏打水×11(¥66.00)商品合计¥1205.00 占比4.6%综合10-12月到店消费40天/46次到店周期中位#1消费排名#8在店时长#1312月到店消费13天/13次到店周期中位#1消费排名#8在店时长#13最近到店2025-12-18趋势10-12月到店频次下降建议重点唤醒围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
9,曾巧明,186****1488,,24830.16,0.00,0.00,订单59单平均单次¥420.85打球404.3h平均单次6.9h偏好B区(66.4%)、C区(32.8%)、A区(0.8%)时间到店均值17:01 中位16:13离店均值23:52 中位次日00:12商品跨越贵烟×1(¥30.00)、地道肠×4(¥20.00)、东方树叶×2(¥16.00)、可乐×2(¥10.00)、哇哈哈矿泉水×2(¥10.00)商品合计¥86.00 占比0.3%综合10-12月到店消费54天/59次到店周期中位#1消费排名#9在店时长#112月到店消费15天/16次到店周期中位#1消费排名#9在店时长#1最近到店2025-12-18趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
10,黄生,136****9719,,18406.23,0.00,0.00,订单36单平均单次¥511.28打球298.2h平均单次8.3h偏好B区(64.4%)、C区(35.6%)时间到店均值13:13 中位12:53离店均值21:30 中位22:04商品地道肠×8(¥40.00)、可乐×2(¥10.00)商品合计¥50.00 占比0.3%综合10-12月到店消费36天/36次到店周期中位#1消费排名#10在店时长#212月到店消费7天/7次到店周期中位#3消费排名#10在店时长#4最近到店2025-12-18趋势10-12月到店频次下降建议重点唤醒围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
11,,191****2851,婉婉(29.7h)、柚子(10.7h)、球球(10.6h)、佳怡(7.8h)、璇子(7.6h),16599.59,17000.00,0.00,订单10单平均单次¥1659.96打球40.5h平均单次4.1h偏好888(72.1%)、TV台(22.1%)、包厢(5.8%)、补时长(0.0%)时间到店均值18:28 中位20:36离店均值22:43 中位次日01:10商品百威235毫升×247(¥3705.00)、细荷花×5(¥250.00)、荷花双中支×3(¥204.00)、清洁费150×1(¥150.00)、三只松鼠开心果×4(¥120.00)、鸡翅三个一份×6(¥108.00)商品合计¥5162.90 占比31.1%综合10-12月到店消费9天/10次到店周期中位#5消费排名#11在店时长#1912月到店消费0天/0次到店周期中位—消费排名#11在店时长—最近到店2025-11-06趋势10-12月到店频次下降建议重点唤醒围客与客户运营建议关注是否为临时充值型建议引导储值梯度与权益重点维护包厢/团建需求,提前锁档与套餐化;商品贡献高,可做常购商品补货提醒与组合促销
12,叶先生,138****9539,素素(29.7h)、年糕(9.7h)、Amy(7.4h)、球球(6.7h)、婉婉(3.7h),14491.25,6307.00,0.00,订单8单平均单次¥1811.41打球27.2h平均单次3.4h偏好B区(30.9%)、888(24.0%)、C区(17.8%)、包厢(16.3%)时间到店均值18:38 中位20:59离店均值次日00:04 中位次日02:12商品蓝妹×96(¥1728.00)、钻石荷花×9(¥405.00)、50 和成天下×6(¥390.00)、鸡翅三个一份×14(¥252.00)、100 和成天下×2(¥230.00)、透明袋无穷鸡翅×10(¥200.00)商品合计¥4880.00 占比33.7%综合10-12月到店消费8天/8次到店周期中位#2消费排名#12在店时长#2712月到店消费2天/2次到店周期中位#1消费排名#12在店时长#37最近到店2025-12-06趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议关注是否为临时充值型建议引导储值梯度与权益重点维护包厢/团建需求,提前锁档与套餐化;商品贡献高,可做常购商品补货提醒与组合促销
13,T,180****9962,佳怡(15.0h)、周周(14.7h)、乔西(11.2h)、球球(10.7h)、欣怡(10.3h),13651.06,3000.00,849.68,订单16单平均单次¥853.19打球55.6h平均单次3.5h;偏好:麻将(50.8%)、M8(17.0%)、包厢(16.0%)、A区(9.2%)时间到店均值18:05 中位19:34离店均值21:23 中位22:01商品荷花双中支×4(¥288.00)、钻石荷花×4(¥190.00)、软荷花×3(¥174.00)、哇哈哈矿泉水×26(¥130.00)、红牛×10(¥100.00)、跨越贵烟×3(¥86.00)商品合计¥1689.00 占比12.4%综合10-12月到店消费12天/16次到店周期中位#1消费排名#13在店时长#1612月到店消费5天/8次到店周期中位#1消费排名#13在店时长#14最近到店2025-12-17趋势12月为高峰月具备加深运营空间围客与客户运营建议重点维护包厢/团建需求,提前锁档与套餐化
14,林先生,133****1070,七七(19.4h)、佳怡(14.9h)、璇子(9.6h)、乔西(9.6h)、苏苏(4.9h),12937.86,0.00,158.79,订单14单平均单次¥924.13打球44.4h平均单次3.2h;偏好:麻将(33.6%)、M8(31.5%)、M7(21.5%)、补时长(11.4%)时间到店均值12:18 中位17:34离店均值15:50 中位次日01:15商品荷花双中支×5(¥360.00)、细荷花×5(¥260.00)、细和天下×2(¥250.00)、钻石荷花×5(¥250.00)、双中支中华×3(¥216.00)、粗和天下×1(¥125.00)商品合计¥2246.00 占比17.4%综合10-12月到店消费13天/14次到店周期中位#1消费排名#14在店时长#1712月到店消费10天/11次到店周期中位#1消费排名#14在店时长#12最近到店2025-12-13趋势10-12月到店频次上升12月更活跃围客与客户运营建议储值余额偏低建议在其常用时段做补能引导商品贡献高可做常购商品补货提醒与组合促销
15,曾丹烨,139****3242,,12356.33,3000.00,6639.14,订单54单平均单次¥228.82打球256.7h平均单次4.8h;偏好:麻将(100.0%)时间到店均值16:05 中位17:32离店均值20:29 中位22:06商品合味道泡面×1(¥12.00)、地道肠×2(¥10.00)、东鹏特饮×1(¥7.00)、喜之郎果冻×1(¥5.00)商品合计¥34.00 占比0.3%综合10-12月到店消费44天/54次到店周期中位#1消费排名#15在店时长#412月到店消费9天/11次到店周期中位#2消费排名#15在店时长#6最近到店2025-12-16趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
16,胡先生,186****3391,佳怡(29.4h)、七七(4.2h)、球球(3.9h)、婉婉(3.9h)、涛涛(2.7h),11420.87,8000.00,0.00,订单9单平均单次¥1268.99打球39.8h平均单次4.4h;偏好:包厢(44.2%)、A区(23.1%)、888(11.9%)、麻将(10.7%)时间到店均值13:36 中位17:09离店均值17:14 中位20:36商品百威235毫升×70(¥1050.00)、钻石荷花×5(¥225.00)、鸡翅三个一份×4(¥72.00)、蜂蜜水×7(¥70.00)、50 和成天下×1(¥65.00)、软荷花×1(¥58.00)商品合计¥1900.00 占比16.6%综合10-12月到店消费5天/9次到店周期中位#6消费排名#16在店时长#2012月到店消费1天/1次到店周期中位—消费排名#16在店时长#41最近到店2025-12-01趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议关注是否为临时充值型建议引导储值梯度与权益重点维护包厢/团建需求,提前锁档与套餐化
17,艾宇民,150****9958,泡芙(22.0h)、小侯(7.6h),10763.07,0.00,0.00,订单44单平均单次¥244.62打球112.4h平均单次2.6h偏好B区(82.1%)、C区(12.7%)、包厢(5.2%)时间到店均值16:20 中位16:06离店均值18:50 中位18:03商品百威235毫升×30(¥450.00)、地道肠×13(¥65.00)、细荷花×1(¥50.00)、中支芙蓉王×1(¥38.00)、乖媳妇山椒泡爪×1(¥25.00)、哇哈哈矿泉水×5(¥25.00)商品合计¥808.00 占比7.5%综合10-12月到店消费41天/44次到店周期中位#1消费排名#17在店时长#1212月到店消费8天/10次到店周期中位#2消费排名#17在店时长#16最近到店2025-12-17趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议重点维护包厢/团建需求,提前锁档与套餐化
18,谢俊,186****5198,年糕(4.5h)、素素(2.4h),9982.86,0.00,0.00,订单46单平均单次¥217.02打球159.5h平均单次3.5h偏好B区(100.0%)时间到店均值19:31 中位20:12离店均值22:59 中位23:48商品钻石荷花×1(¥45.00)商品合计¥45.00 占比0.5%综合10-12月到店消费43天/46次到店周期中位#1消费排名#18在店时长#912月到店消费4天/6次到店周期中位#5消费排名#18在店时长#19最近到店2025-12-17趋势10-12月到店频次下降建议重点唤醒围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
19,周周,198****8725,周周(70.8h)、球球(15.2h)、佳怡(13.2h),8905.19,0.00,0.00,订单10单平均单次¥890.52打球35.9h平均单次3.6h;偏好:麻将(59.3%)、M7(19.6%)、补时长(19.6%)、A区(1.5%)时间到店均值11:40 中位14:30离店均值17:04 中位次日00:34商品哇哈哈AD钙奶×13(¥104.00)、跨越贵烟×3(¥90.00)、细荷花×1(¥55.00)、红利群×2(¥52.00)、钻石荷花×1(¥50.00)、哇哈哈矿泉水×7(¥35.00)商品合计¥685.00 占比7.7%综合10-12月到店消费8天/10次到店周期中位#1消费排名#19在店时长#2212月到店消费8天/10次到店周期中位#1消费排名#19在店时长#11最近到店2025-12-17趋势10-12月到店频次上升12月更活跃围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
20,叶总,137****3287,璇子(22.0h)、小柔(3.8h)、七七(3.0h),8163.28,5700.00,0.00,订单5单平均单次¥1632.66打球23.4h平均单次4.7h;偏好:包厢(53.5%)、888(25.5%)、麻将(12.9%)、B区(8.2%)时间到店均值21:36 中位21:10离店均值次日02:18 中位次日02:08商品百威235毫升×132(¥1980.00)、荷花双中支×3(¥204.00)、软荷花×1(¥58.00)、跨越贵烟×2(¥56.00)、细荷花×1(¥50.00)、钻石荷花×1(¥45.00)商品合计¥2487.00 占比30.5%综合10-12月到店消费5天/5次到店周期中位#2消费排名#20在店时长#3112月到店消费0天/0次到店周期中位—消费排名#20在店时长—最近到店2025-10-27趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议关注是否为临时充值型建议引导储值梯度与权益重点维护包厢/团建需求,提前锁档与套餐化;商品贡献高,可做常购商品补货提醒与组合促销
21,,187****5094,球球(5.3h)、璇子(5.0h)、素素(4.3h)、婉婉(4.3h)、Amy(4.1h),8155.54,64000.00,0.00,订单13单平均单次¥627.35打球35.7h平均单次2.7h;偏好:麻将(64.8%)、TV台(14.7%)、B区(10.3%)、888(9.7%)时间到店均值18:13 中位19:52离店均值21:16 中位22:36商品蓝妹×54(¥972.00)、钻石荷花×4(¥180.00)、中支芙蓉王×2(¥76.00)、无穷烤小腿×3(¥60.00)、跨越贵烟×2(¥56.00)、鸡翅三个一份×3(¥54.00)商品合计¥2072.00 占比25.4%综合10-12月到店消费10天/13次到店周期中位#1消费排名#21在店时长#2312月到店消费0天/0次到店周期中位—消费排名#21在店时长—最近到店2025-11-23趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议关注是否为临时充值型建议引导储值梯度与权益商品贡献高可做常购商品补货提醒与组合促销
22,,172****6666,佳怡(13.5h)、小敌(3.6h)、璇子(3.1h)、周周(2.4h)、千千(2.2h),7797.37,0.00,0.00,订单13单平均单次¥599.80打球24.1h平均单次1.9h;偏好:包厢(52.1%)、666(31.7%)、补时长(8.5%)、S区/斯诺克(7.7%)时间到店均值19:13 中位18:51离店均值21:14 中位20:36商品双中支中华×3(¥216.00)、红牛×17(¥170.00)、跨越贵烟×5(¥140.00)、荷花双中支×2(¥136.00)、50枸杞槟榔×2(¥130.00)、100 和成天下×1(¥115.00)商品合计¥1406.00 占比18.0%综合10-12月到店消费9天/13次到店周期中位#2消费排名#22在店时长#2912月到店消费6天/9次到店周期中位#1消费排名#22在店时长#27最近到店2025-12-13趋势10-12月到店频次上升12月更活跃围客与客户运营建议重点维护包厢/团建需求,提前锁档与套餐化
23,桂先生,166****7275,球球(2.6h),7678.29,985.00,0.00,订单21单平均单次¥365.63打球117.4h平均单次5.6h偏好B区(79.3%)、C区(20.7%)时间到店均值18:37 中位19:01离店均值次日00:12 中位次日00:13商品地道肠×17(¥85.00)、哇哈哈矿泉水×15(¥75.00)、可乐×13(¥65.00)、红牛×4(¥40.00)、蜂蜜水×3(¥30.00)、东方树叶×3(¥24.00)商品合计¥373.00 占比4.9%综合10-12月到店消费21天/21次到店周期中位#2消费排名#23在店时长#1112月到店消费2天/2次到店周期中位#9消费排名#23在店时长#26最近到店2025-12-16趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议关注是否为临时充值型建议引导储值梯度与权益
24,明哥,166****0999,小柔(31.6h)、婉婉(26.7h)、涛涛(5.4h)、年糕(4.6h)、周周(0.4h),7581.04,0.00,954.64,订单4单平均单次¥1895.26打球21.1h平均单次5.3h;偏好:包厢(43.0%)、A区(26.0%)、补时长(23.8%)、C区(5.2%)时间到店均值10:22 中位10:15离店均值13:40 中位13:49商品百威235毫升×78(¥1170.00)、硬中华×2(¥100.00)、地道肠×9(¥45.00)、东方树叶×4(¥32.00)、鱼蛋×6(¥30.00)、蜂蜜水×2(¥20.00)商品合计¥1447.00 占比19.1%综合10-12月到店消费4天/4次到店周期中位#5消费排名#24在店时长#3512月到店消费3天/3次到店周期中位#5消费排名#24在店时长#20最近到店2025-12-10趋势10-12月到店频次上升12月更活跃围客与客户运营建议重点维护包厢/团建需求,提前锁档与套餐化
25,陈德韩,134****7864,乔西(9.1h)、素素(5.5h)、奈千(4.4h)、周周(4.3h)、小敌(4.0h),7302.92,5000.00,20.11,订单4单平均单次¥1825.73打球19.6h平均单次4.9h;偏好:包厢(66.6%)、888(21.3%)、麻将(12.1%)、补时长(0.0%)时间到店均值18:53 中位18:48离店均值21:23 中位21:56商品百威235毫升×85(¥1275.00)、卡士×9(¥198.00)、无穷爱辣烤鸡爪×3(¥60.00)、鸡翅三个一份×2(¥36.00)、鱼蛋×6(¥30.00)、鱼豆腐×2(¥30.00)商品合计¥1898.00 占比26.0%综合10-12月到店消费4天/4次到店周期中位#15消费排名#25在店时长#3812月到店消费1天/1次到店周期中位—消费排名#25在店时长—最近到店2025-12-01趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议储值余额偏低建议在其常用时段做补能引导重点维护包厢/团建需求,提前锁档与套餐化
26,小熊,139****0145,佳怡(13.2h)、周周(10.7h)、欣怡(7.9h)、球球(4.4h)、七七(1.3h),7135.88,5000.00,0.00,订单9单平均单次¥792.88打球32.7h平均单次3.6h;偏好:麻将(82.3%)、包厢(9.2%)、TV台(8.5%)、补时长(0.0%)时间到店均值14:59 中位18:25离店均值19:25 中位23:36商品软荷花×3(¥174.00)、100 和成天下×1(¥115.00)、中支芙蓉王×3(¥114.00)、钻石荷花×2(¥90.00)、炫赫门小南京×3(¥78.00)、荷花双中支×1(¥68.00)商品合计¥1223.00 占比17.1%综合10-12月到店消费6天/9次到店周期中位#2消费排名#26在店时长#2512月到店消费0天/0次到店周期中位—消费排名#26在店时长—最近到店2025-11-05趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议关注是否为临时充值型建议引导储值梯度与权益重点维护包厢/团建需求,提前锁档与套餐化
27,黄先生,135****3507,苏苏(30.8h)、千千(13.1h)、乔西(1.6h)、阿清(0.7h),7052.72,3000.00,1639.43,订单22单平均单次¥320.58打球39.4h平均单次1.8h偏好B区(80.5%)、A区(17.0%)、C区(2.2%)、补时长(0.4%)时间到店均值18:32 中位19:27离店均值20:30 中位21:28商品东方树叶×6(¥48.00)、钻石荷花×1(¥45.00)、哇哈哈AD钙奶×4(¥32.00)、东鹏特饮×3(¥21.00)、无穷烤小腿×1(¥20.00)、综合蔬果干×1(¥15.00)商品合计¥225.00 占比3.2%综合10-12月到店消费20天/22次到店周期中位#3消费排名#27在店时长#2112月到店消费7天/7次到店周期中位#2消费排名#27在店时长#22最近到店2025-12-16趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
28,吕先生,155****0663,小柔(7.5h)、周周(3.7h)、素素(2.8h)、婉婉(2.8h)、苏苏(2.8h),7012.05,6000.00,0.00,订单4单平均单次¥1753.01打球17.0h平均单次4.2h偏好666(66.5%)、888(18.2%)、麻将(15.3%)时间到店均值14:20 中位18:05离店均值18:34 中位21:28商品蓝妹×35(¥630.00)、软中华×3(¥210.00)、红牛×17(¥170.00)、软荷花×2(¥116.00)、鸡翅三个一份×4(¥72.00)、地道肠×10(¥50.00)商品合计¥1819.00 占比25.9%综合10-12月到店消费4天/4次到店周期中位#1消费排名#28在店时长#4112月到店消费0天/0次到店周期中位—消费排名#28在店时长—最近到店2025-10-20趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议关注是否为临时充值型建议引导储值梯度与权益
29,郑先生,159****4331,小敌(32.1h),6438.07,0.00,0.00,订单16单平均单次¥402.38打球42.2h平均单次2.6h偏好C区(63.7%)、补时长(14.4%)、B区(12.9%)、A区(9.0%)时间到店均值15:29 中位20:24离店均值19:22 中位次日00:03商品农夫山泉苏打水×8(¥48.00)、蜂蜜水×4(¥40.00)、地道肠×7(¥35.00)、一次性手套×5(¥10.00)、东方树叶×1(¥8.00)、哇哈哈矿泉水×1(¥5.00)商品合计¥156.00 占比2.4%综合10-12月到店消费13天/16次到店周期中位#1消费排名#29在店时长#1812月到店消费5天/7次到店周期中位#1消费排名#29在店时长#25最近到店2025-12-12趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
30,歌神,188****2164,婉婉(6.7h)、希希(4.0h)、素素(3.9h)、小柔(3.8h)、年糕(2.6h),5877.65,5000.00,0.00,订单4单平均单次¥1469.41打球12.8h平均单次3.2h偏好888(43.0%)、包厢(41.0%)、麻将(16.0%)时间到店均值22:20 中位22:39离店均值次日01:34 中位次日01:19商品百威235毫升×90(¥1350.00)、鸡翅三个一份×5(¥90.00)、焦糖瓜子×3(¥45.00)、鱼蛋×9(¥45.00)、三只松鼠开心果×1(¥30.00)、地道肠×6(¥30.00)商品合计¥1687.00 占比28.7%综合10-12月到店消费4天/4次到店周期中位#4消费排名#30在店时长#4612月到店消费0天/0次到店周期中位—消费排名#30在店时长—最近到店2025-10-24趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议关注是否为临时充值型建议引导储值梯度与权益重点维护包厢/团建需求,提前锁档与套餐化
31,罗先生,139****9222,婉婉(18.8h)、年糕(7.7h)、小柔(4.5h)、素素(4.3h)、姜姜(1.5h),5831.48,3000.00,310.31,订单5单平均单次¥1166.30打球20.0h平均单次4.0h;偏好:包厢(72.1%)、888(17.8%)、补时长(10.2%)时间到店均值16:46 中位21:04离店均值次日01:10 中位次日00:07商品科罗娜啤酒275ml×26(¥468.00)、蓝妹×18(¥324.00)、鸡翅三个一份×2(¥36.00)、三只松鼠开心果×1(¥30.00)、地道肠×5(¥25.00)、焦糖瓜子×1(¥15.00)商品合计¥924.00 占比15.8%综合10-12月到店消费5天/5次到店周期中位#14消费排名#31在店时长#3712月到店消费0天/0次到店周期中位—消费排名#31在店时长—最近到店2025-11-27趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议储值余额偏低建议在其常用时段做补能引导重点维护包厢/团建需求,提前锁档与套餐化
32,大G,186****4598,周周(17.7h)、佳怡(9.5h)、球球(1.9h),5374.68,0.00,0.00,订单5单平均单次¥1074.94打球21.6h平均单次4.3h;偏好:麻将(47.3%)、M7(33.2%)、A区(19.4%)、补时长(0.1%)时间到店均值17:16 中位20:28离店均值21:48 中位次日00:04商品荷花双中支×2(¥144.00)、哇哈哈AD钙奶×9(¥72.00)、无穷烤小腿×3(¥60.00)、芙蓉王×2(¥56.00)、红利群×2(¥52.00)、蜂蜜水×4(¥40.00)商品合计¥748.00 占比13.9%综合10-12月到店消费5天/5次到店周期中位#1消费排名#32在店时长#3412月到店消费4天/4次到店周期中位#1消费排名#32在店时长#24最近到店2025-12-07趋势10-12月到店频次上升12月更活跃围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
33,林先生,137****8785,小侯(9.7h)、梦梦(4.3h)、千千(2.7h)、瑶瑶(1.9h)、周周(0.7h),4967.38,0.00,0.00,订单7单平均单次¥709.63打球18.7h平均单次2.7h偏好C区(76.5%)、包厢(23.4%)、补时长(0.0%)时间到店均值17:58 中位19:48离店均值20:49 中位23:39商品百威235毫升×30(¥450.00)、50枸杞槟榔×1(¥65.00)、东方树叶×5(¥40.00)、蜂蜜水×4(¥40.00)、哇哈哈矿泉水×7(¥35.00)、酒鬼花生×4(¥32.00)商品合计¥887.00 占比17.9%综合10-12月到店消费6天/7次到店周期中位#3消费排名#33在店时长#4012月到店消费2天/2次到店周期中位#4消费排名#33在店时长#34最近到店2025-12-06趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议重点维护包厢/团建需求,提前锁档与套餐化
34,,136****4552,千千(16.6h)、阿清(10.8h)、小侯(4.7h)、小燕(3.8h),4590.92,0.00,2050.00,订单8单平均单次¥573.86打球20.4h平均单次2.5h;偏好:麻将(77.0%)、C区(12.1%)、补时长(10.8%)时间到店均值14:47 中位20:54离店均值20:02 中位23:31商品硬中华×1(¥50.00)、轻上椰子水×2(¥24.00)、哇哈哈矿泉水×2(¥10.00)商品合计¥84.00 占比1.8%综合10-12月到店消费7天/8次到店周期中位#5消费排名#34在店时长#3612月到店消费5天/5次到店周期中位#5消费排名#34在店时长#23最近到店2025-12-19趋势10-12月到店频次上升12月更活跃围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
35,李先生,134****4343,小侯(9.3h)、柚子(7.8h)、球球(0.0h),4479.77,0.00,2433.01,订单8单平均单次¥559.97打球32.1h平均单次4.0h偏好C区(73.4%)、包厢(26.6%)时间到店均值19:34 中位20:19离店均值23:35 中位23:13商品热水可续杯×13(¥39.00)、农夫山泉苏打水×5(¥30.00)、水果脆×1(¥30.00)、跨越贵烟×1(¥30.00)、哇哈哈矿泉水×4(¥20.00)、水溶C×1(¥8.00)商品合计¥185.00 占比4.1%综合10-12月到店消费8天/8次到店周期中位#3消费排名#35在店时长#2612月到店消费5天/5次到店周期中位#3消费排名#35在店时长#17最近到店2025-12-18趋势10-12月到店频次上升12月更活跃围客与客户运营建议重点维护包厢/团建需求,提前锁档与套餐化
36,,189****2151,欣怡(4.9h)、球球(4.7h)、周周(4.4h)、七七(4.2h)、佳怡(4.1h),4096.07,6000.00,8.82,订单7单平均单次¥585.15打球21.7h平均单次3.1h;偏好:麻将(61.0%)、A区(13.3%)、包厢(9.7%)、C区(8.1%)时间到店均值20:49 中位21:49离店均值23:55 中位次日01:19商品荷花双中支×1(¥68.00)、红牛×5(¥50.00)、轻上椰子水×4(¥48.00)、哇哈哈矿泉水×8(¥40.00)、软玉溪×1(¥28.00)、炫赫门小南京×1(¥26.00)商品合计¥399.00 占比9.7%综合10-12月到店消费6天/7次到店周期中位#2消费排名#36在店时长#3312月到店消费0天/0次到店周期中位—消费排名#36在店时长—最近到店2025-10-26趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议储值余额偏低建议在其常用时段做补能引导重点维护包厢/团建需求,提前锁档与套餐化
37,陈先生,159****2829,佳怡(7.6h)、奈千(5.1h)、柚子(4.4h)、乔西(4.2h)、Amy(4.2h),3817.58,3000.00,0.55,订单3单平均单次¥1272.53打球7.6h平均单次2.5h;偏好:麻将(54.5%)、TV台(45.4%)、补时长(0.1%)、A区(0.0%)时间到店均值13:21 中位19:06离店均值18:07 中位次日00:40商品百威235毫升×10(¥150.00)、钻石荷花×1(¥45.00)、跨越贵烟×1(¥28.00)、无穷爱辣烤鸡爪×1(¥20.00)、白桦树汁×1(¥12.00)、椰汁×1(¥8.00)商品合计¥277.00 占比7.3%综合10-12月到店消费3天/3次到店周期中位#19消费排名#37在店时长#5712月到店消费0天/0次到店周期中位—消费排名#37在店时长—最近到店2025-11-07趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议储值余额偏低建议在其常用时段做补能引导
38,,131****0323,球球(5.3h)、阿清(4.3h)、小侯(3.4h)、涛涛(3.1h)、乔西(2.9h),3765.88,0.00,0.00,订单8单平均单次¥470.74打球22.0h平均单次2.7h偏好TV台(66.3%)、A区(28.3%)、C区(5.4%)时间到店均值20:08 中位19:43离店均值22:53 中位22:54商品冰红茶×8(¥48.00)、地道肠×4(¥20.00)、鱼蛋×4(¥20.00)、可乐×2(¥10.00)、哇米诺豆奶×1(¥10.00)、红牛×1(¥10.00)商品合计¥161.00 占比4.3%综合10-12月到店消费5天/8次到店周期中位#1消费排名#38在店时长#3212月到店消费5天/8次到店周期中位#1消费排名#38在店时长#15最近到店2025-12-17趋势10-12月到店频次上升12月更活跃围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
39,黄先生,158****2109,球球(64.0h)、QQ(6.9h),3568.92,3000.00,420.01,订单10单平均单次¥356.89打球23.4h平均单次2.3h偏好A区(60.1%)、包厢(27.0%)、补时长(12.9%)时间到店均值04:58 中位01:43离店均值06:06 中位03:20商品蓝妹×4(¥72.00)、跨越贵烟×1(¥28.00)、火腿肠×2(¥10.00)、东方树叶×1(¥8.00)、卫龙魔芋爽×1(¥8.00)、农夫山泉苏打水×1(¥6.00)商品合计¥142.00 占比4.0%综合10-12月到店消费8天/10次到店周期中位#4消费排名#39在店时长#3012月到店消费3天/4次到店周期中位#8消费排名#39在店时长#45最近到店2025-12-17趋势12月为高峰月具备加深运营空间围客与客户运营建议储值余额偏低建议在其常用时段做补能引导重点维护包厢/团建需求,提前锁档与套餐化
40,孟紫龙,176****3741,,3492.73,0.00,0.00,订单13单平均单次¥268.67打球57.6h平均单次4.4h偏好B区(100.0%)时间到店均值18:44 中位18:50离店均值23:10 中位23:35商品哇哈哈矿泉水×9(¥45.00)、东方树叶×5(¥40.00)、地道肠×7(¥35.00)、可乐×2(¥10.00)、维他柠檬茶×1(¥8.00)、脉动×1(¥8.00)商品合计¥153.00 占比4.4%综合10-12月到店消费12天/13次到店周期中位#1消费排名#40在店时长#1512月到店消费10天/11次到店周期中位#1消费排名#40在店时长#9最近到店2025-12-18趋势10-12月到店频次上升12月更活跃围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
41,罗超,137****0990,球球(2.9h)、璇子(2.7h)、苏苏(2.6h)、奈千(2.5h),3398.81,3000.00,101.19,订单2单平均单次¥1699.40打球7.3h平均单次3.7h偏好888(78.8%)、麻将(21.2%)时间到店均值20:57 中位20:57离店均值次日00:37 中位次日00:37商品科罗娜啤酒275ml×49(¥882.00)、荷花双中支×1(¥68.00)、百威235毫升×3(¥45.00)、掼蛋扑克×4(¥32.00)、跨越贵烟×1(¥28.00)、东方树叶×3(¥24.00)商品合计¥1115.00 占比32.8%综合10-12月到店消费2天/2次到店周期中位#16消费排名#41在店时长#5912月到店消费0天/0次到店周期中位—消费排名#41在店时长—最近到店2025-10-24趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议储值余额偏低建议在其常用时段做补能引导
42,君姐,166****4594,年糕(8.2h)、婉婉(4.3h)、璇子(2.3h)、涛涛(2.2h),3361.95,0.00,272.15,订单3单平均单次¥1120.65打球12.5h平均单次4.2h偏好666(30.5%)、M8(25.3%)、M7(17.7%)、包厢(13.9%)时间到店均值15:38 中位16:21离店均值20:33 中位21:15商品哇哈哈矿泉水×20(¥100.00)、卡士×2(¥44.00)、东方树叶×5(¥40.00)、麻将房茶位费×1(¥40.00)、小果盘×1(¥37.90)、软玉溪×1(¥28.00)商品合计¥319.90 占比9.5%综合10-12月到店消费3天/3次到店周期中位#5消费排名#42在店时长#4712月到店消费1天/1次到店周期中位—消费排名#42在店时长#31最近到店2025-12-02趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议储值余额偏低建议在其常用时段做补能引导重点维护包厢/团建需求,提前锁档与套餐化
43,吴生,136****3341,小柔(2.8h)、涛涛(2.2h),3253.70,0.00,3680.65,订单15单平均单次¥216.91打球34.3h平均单次2.3h偏好C区(86.1%)、B区(7.0%)、包厢(6.7%)、补时长(0.1%)时间到店均值19:01 中位18:43离店均值21:14 中位21:25商品哇哈哈矿泉水×18(¥90.00)、双中支中华×1(¥72.00)、阿萨姆×1(¥8.00)商品合计¥170.00 占比5.2%综合10-12月到店消费12天/15次到店周期中位#6消费排名#43在店时长#2412月到店消费2天/3次到店周期中位#5消费排名#43在店时长#35最近到店2025-12-16趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议重点维护包厢/团建需求,提前锁档与套餐化
44,刘哥,135****0020,婉婉(5.3h)、球球(2.1h),3036.80,0.00,371.51,订单2单平均单次¥1518.40打球5.0h平均单次2.5h;偏好:包厢(93.4%)、S区/斯诺克(6.6%)、补时长(0.0%)时间到店均值11:33 中位11:33离店均值12:15 中位12:15商品百威235毫升×79(¥1185.00)、中支芙蓉王×2(¥76.00)、地道肠×6(¥30.00)、鱼蛋×6(¥30.00)、红利群×1(¥26.00)、红烧牛肉面×2(¥24.00)商品合计¥1417.00 占比46.7%综合10-12月到店消费2天/2次到店周期中位#20消费排名#44在店时长#6612月到店消费1天/1次到店周期中位—消费排名#44在店时长#49最近到店2025-12-17趋势12月为高峰月具备加深运营空间围客与客户运营建议储值余额偏低建议在其常用时段做补能引导重点维护包厢/团建需求,提前锁档与套餐化
45,李先生,131****4000,小敌(11.8h)、涛涛(2.1h)、Amy(1.1h),2997.53,3000.00,563.47,订单4单平均单次¥749.38打球11.8h平均单次3.0h;偏好:包厢(100.0%)时间到店均值16:24 中位20:21离店均值19:21 中位23:11商品轻上椰子水×10(¥120.00)、科罗娜啤酒275ml×6(¥108.00)、跨越贵烟×1(¥28.00)、地道肠×2(¥10.00)、海之言×1(¥8.00)、茶兀×1(¥8.00)商品合计¥298.00 占比9.9%综合10-12月到店消费3天/4次到店周期中位#5消费排名#45在店时长#4812月到店消费0天/0次到店周期中位—消费排名#45在店时长—最近到店2025-11-07趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议重点维护包厢/团建需求,提前锁档与套餐化
46,阿亮,159****2628,涛涛(9.1h)、素素(3.1h)、奈千(2.9h)、梦梦(2.7h)、柚子(2.4h),2936.26,0.00,612.33,订单8单平均单次¥367.03打球16.8h平均单次2.1h偏好B区(65.3%)、S区/斯诺克(34.5%)、补时长(0.2%)时间到店均值21:06 中位20:32离店均值23:26 中位23:29商品哇哈哈矿泉水×4(¥20.00)、香飘飘果汁茶×1(¥10.00)、茶兀×1(¥8.00)商品合计¥38.00 占比1.3%综合10-12月到店消费6天/8次到店周期中位#1消费排名#46在店时长#4312月到店消费2天/3次到店周期中位#1消费排名#46在店时长#29最近到店2025-12-04趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
47,李先生,186****8308,小侯(5.6h)、年糕(4.2h),2785.23,0.00,0.00,订单1单平均单次¥2785.23打球8.3h平均单次8.3h;偏好:包厢(100.0%)时间到店均值23:15 中位23:15离店均值次日07:32 中位次日07:32商品清洁费150×1(¥150.00)、卡士×1(¥22.00)、合味道泡面×1(¥12.00)、轻上椰子水×1(¥12.00)、雪碧×2(¥10.00)、哇哈哈矿泉水×1(¥5.00)商品合计¥216.00 占比7.8%综合10-12月到店消费1天/1次到店周期中位—消费排名#47在店时长#5512月到店消费0天/0次到店周期中位—消费排名#47在店时长—最近到店2025-11-28趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议重点维护包厢/团建需求,提前锁档与套餐化
48,周先生,173****7775,乔西(7.5h)、小敌(6.6h),2726.01,0.00,0.00,订单1单平均单次¥2726.01打球7.5h平均单次7.5h偏好666(100.0%)时间到店均值15:40 中位15:40离店均值23:11 中位23:11商品哇哈哈矿泉水×1(¥5.00)商品合计¥5.00 占比0.2%综合10-12月到店消费1天/1次到店周期中位—消费排名#48在店时长#5812月到店消费0天/0次到店周期中位—消费排名#48在店时长—最近到店2025-10-25趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
49,林先生,159****0021,婉婉(12.0h)、小柔(3.2h)、苏苏(3.1h),2690.52,0.00,49.48,订单2单平均单次¥1345.26打球6.0h平均单次3.0h;偏好:包厢(66.7%)、A区(33.3%)时间到店均值10:13 中位10:13离店均值12:14 中位12:14商品百威235毫升×24(¥360.00)、中支芙蓉王×2(¥76.00)、绿茶×4(¥24.00)、无穷爱辣烤鸡爪×1(¥20.00)、透明袋无穷鸡翅×1(¥20.00)、益达×1(¥18.00)商品合计¥597.00 占比22.2%综合10-12月到店消费2天/2次到店周期中位#6消费排名#49在店时长#6212月到店消费0天/0次到店周期中位—消费排名#49在店时长—最近到店2025-11-25趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议储值余额偏低建议在其常用时段做补能引导重点维护包厢/团建需求,提前锁档与套餐化
50,周先生,193****6822,千千(8.6h)、素素(6.2h),2643.64,0.00,2092.01,订单3单平均单次¥881.21打球14.9h平均单次5.0h偏好C区(100.0%)时间到店均值21:06 中位22:21离店均值次日02:04 中位次日02:07商品哇哈哈矿泉水×5(¥25.00)、卡士×1(¥22.00)、东方树叶×2(¥16.00)、王老吉×1(¥8.00)、美汁源果粒橙×1(¥8.00)、一次性拖鞋×1(¥5.00)商品合计¥89.00 占比3.4%综合10-12月到店消费3天/3次到店周期中位#4消费排名#50在店时长#4412月到店消费3天/3次到店周期中位#4消费排名#50在店时长#21最近到店2025-12-13趋势10-12月到店频次上升12月更活跃围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
51,林先生,188****0332,周周(4.0h)、小敌(1.9h),2612.01,0.00,0.00,订单8单平均单次¥326.50打球16.9h平均单次2.1h偏好666(25.1%)、麻将(22.3%)、M7(20.7%)、S区/斯诺克(12.8%)时间到店均值14:55 中位17:06离店均值17:17 中位19:13商品钻石荷花×3(¥135.00)、50枸杞槟榔×1(¥65.00)、跨越贵烟×1(¥28.00)、哇哈哈矿泉水×5(¥25.00)、红牛×2(¥20.00)、蜂蜜水×2(¥20.00)商品合计¥330.00 占比12.6%综合10-12月到店消费6天/8次到店周期中位#1消费排名#51在店时长#4212月到店消费0天/0次到店周期中位—消费排名#51在店时长—最近到店2025-11-28趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
52,牛先生,152****5159,柚子(10.4h),2187.48,0.00,0.00,订单5单平均单次¥437.50打球10.4h平均单次2.1h偏好C区(99.8%)、补时长(0.2%)、A区(0.0%)、B区(0.0%)时间到店均值19:00 中位19:37离店均值21:29 中位20:52商品地道肠×6(¥30.00)、东方树叶×2(¥16.00)、美汁源果粒橙×2(¥16.00)商品合计¥62.00 占比2.8%综合10-12月到店消费3天/5次到店周期中位#1消费排名#52在店时长#5112月到店消费0天/0次到店周期中位—消费排名#52在店时长—最近到店2025-11-24趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
53,孟紫龙(该会员已注销),176****37411,,2131.72,0.00,0.00,订单7单平均单次¥304.53打球26.3h平均单次3.8h偏好C区(99.9%)、补时长(0.1%)时间到店均值19:17 中位19:34离店均值23:32 中位23:56商品可乐×5(¥25.00)、东鹏特饮×2(¥14.00)、鱼蛋×1(¥5.00)、一次性手套×1(¥2.00)商品合计¥46.00 占比2.2%综合10-12月到店消费7天/7次到店周期中位#4消费排名#53在店时长#2812月到店消费0天/0次到店周期中位—消费排名#53在店时长—最近到店2025-11-28趋势10-12月到店频次下降建议重点唤醒围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
54,罗超杰,137****8012,苏苏(2.1h)、素素(1.9h)、周周(1.2h)、球球(0.8h),1584.05,0.00,3037.00,订单8单平均单次¥198.01打球8.4h平均单次1.0h;偏好:包厢(74.8%)、B区(14.0%)、A区(10.9%)、补时长(0.2%)时间到店均值18:55 中位22:56离店均值20:06 中位23:23商品雪碧×4(¥20.00)、可乐×3(¥15.00)、维他柠檬茶×1(¥8.00)、打火机×1(¥2.00)商品合计¥45.00 占比2.8%综合10-12月到店消费6天/8次到店周期中位#3消费排名#54在店时长#5412月到店消费0天/0次到店周期中位—消费排名#54在店时长—最近到店2025-11-05趋势10-12月到店频次下降建议重点唤醒围客与客户运营建议重点维护包厢/团建需求,提前锁档与套餐化
55,汪先生,139****6339,姜姜(9.6h),1390.07,1000.00,11.99,订单4单平均单次¥347.52打球5.1h平均单次1.3h;偏好:包厢(82.3%)、A区(17.4%)、补时长(0.4%)时间到店均值21:16 中位22:01离店均值23:26 中位23:25商品轻上椰子水×1(¥12.00)、三得利×1(¥8.00)、巧乐兹伊利×1(¥8.00)商品合计¥28.00 占比2.0%综合10-12月到店消费3天/4次到店周期中位#1消费排名#55在店时长#6512月到店消费0天/0次到店周期中位—消费排名#55在店时长—最近到店2025-10-09趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议储值余额偏低建议在其常用时段做补能引导重点维护包厢/团建需求,提前锁档与套餐化
56,桂先生(该会员已注销),166****72751,,1370.81,0.00,0.00,订单5单平均单次¥274.16打球19.0h平均单次3.8h偏好C区(100.0%)时间到店均值19:20 中位19:37离店均值23:08 中位23:57商品红牛×4(¥40.00)、东鹏特饮×2(¥14.00)、可乐×2(¥10.00)、地道肠×2(¥10.00)、普通扑克×1(¥5.00)商品合计¥79.00 占比5.8%综合10-12月到店消费5天/5次到店周期中位#2消费排名#56在店时长#3912月到店消费0天/0次到店周期中位—消费排名#56在店时长—最近到店2025-10-16趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
57,方先生,153****3185,乔西(3.2h),1313.30,1000.00,0.00,订单3单平均单次¥437.77打球10.2h平均单次3.4h;偏好:麻将(69.0%)、666(31.0%)时间到店均值17:32 中位17:19离店均值21:01 中位20:30商品农夫山泉苏打水×5(¥30.00)、掼蛋扑克×2(¥16.00)、可乐×3(¥15.00)、普通扑克×2(¥10.00)、红牛×1(¥10.00)、椰汁×1(¥8.00)商品合计¥100.00 占比7.6%综合10-12月到店消费3天/3次到店周期中位#10消费排名#57在店时长#5212月到店消费0天/0次到店周期中位—消费排名#57在店时长—最近到店2025-11-17趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议关注是否为临时充值型建议引导储值梯度与权益
58,陈淑涛,132****5485,涛涛(4.4h)、乔西(3.4h),1276.77,0.00,0.00,订单3单平均单次¥425.59打球4.4h平均单次1.5h;偏好:麻将(77.1%)、A区(22.9%)、补时长(0.0%)时间到店均值12:52 中位09:40离店均值14:39 中位10:40商品细荷花×1(¥50.00)、轻上椰子水×1(¥12.00)、哇哈哈矿泉水×2(¥10.00)、火鸡面×1(¥10.00)、茶兀×1(¥8.00)、火腿肠×1(¥5.00)商品合计¥99.00 占比7.8%综合10-12月到店消费2天/3次到店周期中位#7消费排名#58在店时长#6912月到店消费0天/0次到店周期中位—消费排名#58在店时长—最近到店2025-11-22趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
59,,130****3087,小侯(3.0h)、阿清(3.0h)、千千(3.0h),1128.06,0.00,1944.76,订单1单平均单次¥1128.06打球3.0h平均单次3.0h;偏好:麻将(100.0%)时间到店均值21:18 中位21:18离店均值次日02:00 中位次日02:00综合10-12月到店消费1天/1次到店周期中位—消费排名#59在店时长#7312月到店消费1天/1次到店周期中位—消费排名#59在店时长#38最近到店2025-12-08趋势10-12月到店频次上升12月更活跃围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
60,amy,137****8221,Amy(4.8h),1105.90,0.00,0.38,订单1单平均单次¥1105.90打球4.8h平均单次4.8h;偏好:麻将(100.0%)时间到店均值22:47 中位22:47离店均值次日03:37 中位次日03:37商品跨越贵烟×2(¥60.00)、掼蛋扑克×2(¥16.00)、热水可续杯×4(¥12.00)、可乐×2(¥10.00)、蜂蜜水×1(¥10.00)商品合计¥108.00 占比9.8%综合10-12月到店消费1天/1次到店周期中位—消费排名#60在店时长#6712月到店消费1天/1次到店周期中位—消费排名#60在店时长#32最近到店2025-12-06趋势10-12月到店频次上升12月更活跃围客与客户运营建议储值余额偏低建议在其常用时段做补能引导
61,曾先生,133****1235,奈千(1.0h),991.34,0.00,303.19,订单7单平均单次¥141.62打球13.0h平均单次1.9h偏好S区/斯诺克(63.2%)、A区(36.8%)时间到店均值13:58 中位12:19离店均值15:49 中位14:10商品咖啡代购×3(¥45.00)、东方树叶×3(¥24.00)、屈臣氏苏打水×1(¥8.00)、阿萨姆×1(¥8.00)、绿茶×1(¥6.00)、哇哈哈矿泉水×1(¥5.00)商品合计¥98.00 占比9.9%综合10-12月到店消费7天/7次到店周期中位#6消费排名#61在店时长#4512月到店消费2天/2次到店周期中位#6消费排名#61在店时长#36最近到店2025-12-10趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议储值余额偏低建议在其常用时段做补能引导
62,昌哥,137****1229,Amy(2.0h)、小柔(1.8h)、苏苏(1.7h),942.42,0.00,2471.98,订单2单平均单次¥471.21打球4.5h平均单次2.3h偏好A区(100.0%)时间到店均值20:05 中位20:05离店均值22:21 中位22:21商品农夫山泉苏打水×3(¥18.00)、麻辣王子×1(¥12.00)、哇哈哈矿泉水×2(¥10.00)、营养快线×1(¥8.00)、阿萨姆×1(¥8.00)商品合计¥56.00 占比5.9%综合10-12月到店消费2天/2次到店周期中位#15消费排名#62在店时长#6812月到店消费1天/1次到店周期中位—消费排名#62在店时长#44最近到店2025-12-07趋势12月为高峰月具备加深运营空间围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
63,,131****9882,,927.44,0.00,0.00,订单11单平均单次¥84.31打球11.1h平均单次1.0h偏好B区(68.7%)、A区(30.9%)、补时长(0.4%)时间到店均值13:13 中位13:14离店均值14:13 中位14:00商品哇哈哈矿泉水×4(¥20.00)商品合计¥20.00 占比2.2%综合10-12月到店消费6天/11次到店周期中位#8消费排名#63在店时长#4912月到店消费0天/0次到店周期中位—消费排名#63在店时长—最近到店2025-11-24趋势10-12月到店频次下降建议重点唤醒围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
64,邓飛,136****9597,婉婉(6.8h)、苏苏(6.0h)、小敌(4.5h)、小柔(1.2h)、球球(0.8h),925.47,2345.00,74.77,订单1单平均单次¥925.47打球1.9h平均单次1.9h;偏好:包厢(100.0%)时间到店均值01:56 中位01:56离店均值03:48 中位03:48商品百威235毫升×12(¥180.00)、卡士×1(¥22.00)、农夫山泉苏打水×3(¥18.00)、一次性拖鞋×1(¥5.00)、哇哈哈矿泉水×1(¥5.00)商品合计¥230.00 占比24.9%综合10-12月到店消费1天/1次到店周期中位—消费排名#64在店时长#8512月到店消费0天/0次到店周期中位—消费排名#64在店时长—最近到店2025-11-09趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议储值余额偏低建议在其常用时段做补能引导重点维护包厢/团建需求,提前锁档与套餐化
65,陈世,134****1938,瑶瑶(0.8h),921.09,0.00,0.00,订单6单平均单次¥153.52打球6.5h平均单次1.1h偏好C区(49.7%)、S区/斯诺克(49.6%)、补时长(0.7%)时间到店均值20:42 中位21:08离店均值22:16 中位22:24综合10-12月到店消费3天/6次到店周期中位#24消费排名#65在店时长#6112月到店消费0天/0次到店周期中位—消费排名#65在店时长—最近到店2025-11-20趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
66,婉婉,183****2742,婉婉(4.3h),867.49,1000.00,514.08,订单2单平均单次¥433.74打球4.4h平均单次2.2h偏好B区(36.5%)、A区(35.9%)、888(27.6%)时间到店均值15:41 中位15:41离店均值18:01 中位18:01商品旺仔牛奶×2(¥20.00)、红牛×1(¥10.00)、王老吉×1(¥8.00)、哇哈哈矿泉水×1(¥5.00)、喜之郎果冻×1(¥5.00)商品合计¥48.00 占比5.5%综合10-12月到店消费2天/2次到店周期中位#23消费排名#66在店时长#7012月到店消费0天/0次到店周期中位—消费排名#66在店时长—最近到店2025-11-21趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
67,贺斌,150****0885,佳怡(1.0h),770.56,0.00,0.00,订单4单平均单次¥192.64打球9.6h平均单次2.4h偏好A区(50.1%)、C区(49.9%)时间到店均值17:30 中位17:55离店均值19:53 中位19:54商品细荷花×1(¥50.00)、可乐×5(¥25.00)、哇哈哈矿泉水×2(¥10.00)、地道肠×2(¥10.00)、东方树叶×1(¥8.00)商品合计¥103.00 占比13.4%综合10-12月到店消费3天/4次到店周期中位#4消费排名#67在店时长#5312月到店消费0天/0次到店周期中位—消费排名#67在店时长—最近到店2025-11-03趋势10-12月到店频次下降建议重点唤醒围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
68,陈泽斌,132****6060,,700.00,0.00,0.00,订单6单平均单次¥116.67打球0.1h平均单次0.0h;偏好:补时长(100.0%)时间到店均值17:51 中位20:40离店均值18:50 中位21:39综合10-12月到店消费6天/6次到店周期中位#10消费排名#68在店时长#9712月到店消费1天/1次到店周期中位—消费排名#68在店时长#51最近到店2025-12-11趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
69,林总,138****1180,周周(2.2h)、婉婉(0.9h),684.44,0.00,16729.21,订单2单平均单次¥342.22打球3.7h平均单次1.9h;偏好:包厢(100.0%)时间到店均值18:28 中位18:28离店均值20:20 中位20:20商品东方树叶×1(¥8.00)、哇哈哈AD钙奶×1(¥8.00)商品合计¥16.00 占比2.3%综合10-12月到店消费2天/2次到店周期中位#2消费排名#69在店时长#7212月到店消费0天/0次到店周期中位—消费排名#69在店时长—最近到店2025-11-25趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议储值余额充足可提供包厢/团建档期与专属权益;重点维护包厢/团建需求,提前锁档与套餐化
70,卢广贤,186****6220,,680.44,0.00,0.00,订单4单平均单次¥170.11打球10.4h平均单次2.6h偏好B区(62.8%)、C区(37.2%)时间到店均值18:15 中位18:45离店均值20:51 中位20:41商品轻上椰子水×1(¥12.00)、三得利×1(¥8.00)、东鹏特饮×1(¥7.00)、冰红茶×1(¥6.00)、普通扑克×1(¥5.00)商品合计¥38.00 占比5.6%综合10-12月到店消费4天/4次到店周期中位#18消费排名#70在店时长#5012月到店消费1天/1次到店周期中位—消费排名#70在店时长#46最近到店2025-12-13趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
71,王龙,186****8011,,669.58,0.00,95.20,订单4单平均单次¥167.40打球7.8h平均单次2.0h;偏好:麻将(99.7%)、补时长(0.3%)时间到店均值20:56 中位21:02离店均值23:28 中位23:28商品麻将房茶位费×2(¥80.00)、东方树叶×2(¥16.00)商品合计¥96.00 占比14.3%综合10-12月到店消费2天/4次到店周期中位#9消费排名#71在店时长#5612月到店消费2天/4次到店周期中位#7消费排名#71在店时长#28最近到店2025-12-12趋势10-12月到店频次上升12月更活跃围客与客户运营建议储值余额偏低建议在其常用时段做补能引导
72,王先生,185****1125,,600.68,0.00,0.00,订单4单平均单次¥150.17打球5.9h平均单次1.5h偏好S区/斯诺克(99.4%)、补时长(0.6%)时间到店均值18:13 中位18:31离店均值20:09 中位19:30商品哇哈哈矿泉水×1(¥5.00)商品合计¥5.00 占比0.8%综合10-12月到店消费4天/4次到店周期中位#6消费排名#72在店时长#6312月到店消费1天/1次到店周期中位—消费排名#72在店时长#43最近到店2025-12-02趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
73,潘先生,186****0511,年糕(2.0h),564.93,0.00,0.00,订单2单平均单次¥282.46打球3.0h平均单次1.5h偏好666(66.7%)、A区(33.3%)时间到店均值18:28 中位18:28离店均值19:29 中位19:29商品农夫山泉苏打水×1(¥6.00)商品合计¥6.00 占比1.1%综合10-12月到店消费2天/2次到店周期中位#11消费排名#73在店时长#7512月到店消费2天/2次到店周期中位#8消费排名#73在店时长#40最近到店2025-12-13趋势10-12月到店频次上升12月更活跃围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
74,老宋,138****4554,婉婉(1.0h)、欣怡(0.5h),541.97,0.00,2126.14,订单2单平均单次¥270.98打球1.5h平均单次0.7h偏好888(66.9%)、A区(33.1%)时间到店均值19:24 中位19:24离店均值20:02 中位20:02商品百威235毫升×12(¥180.00)商品合计¥180.00 占比33.2%综合10-12月到店消费2天/2次到店周期中位#13消费排名#74在店时长#9112月到店消费0天/0次到店周期中位—消费排名#74在店时长—最近到店2025-11-07趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
75,郭先生,156****5001,希希(1.6h),518.35,0.00,2.57,订单2单平均单次¥259.18打球7.1h平均单次3.5h偏好A区(100.0%)时间到店均值20:53 中位20:53离店均值次日00:32 中位次日00:32商品可乐×2(¥10.00)、普通扑克×2(¥10.00)、一次性手套×2(¥4.00)商品合计¥24.00 占比4.6%综合10-12月到店消费2天/2次到店周期中位#7消费排名#75在店时长#6012月到店消费0天/0次到店周期中位—消费排名#75在店时长—最近到店2025-11-01趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议储值余额偏低建议在其常用时段做补能引导
76,孙启明,137****6325,,500.00,0.00,0.00,订单4单平均单次¥125.00打球2.0h平均单次0.5h;偏好:补时长(100.0%)时间到店均值10:50 中位09:58离店均值11:49 中位10:57综合10-12月到店消费4天/4次到店周期中位#16消费排名#76在店时长#8312月到店消费0天/0次到店周期中位—消费排名#76在店时长—最近到店2025-11-19趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
77,王先生,136****0168,,500.00,0.00,0.00,订单5单平均单次¥100.00打球0.1h平均单次0.0h;偏好:补时长(100.0%)时间到店均值19:45 中位19:22离店均值20:44 中位20:21综合10-12月到店消费4天/5次到店周期中位#5消费排名#77在店时长#9812月到店消费1天/1次到店周期中位—消费排名#77在店时长#53最近到店2025-12-03趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
78,黎先生,133****0983,奈千(1.7h)、婉婉(0.8h),470.19,0.00,0.00,订单1单平均单次¥470.19打球1.7h平均单次1.7h;偏好:包厢(100.0%)时间到店均值19:17 中位19:17离店均值21:01 中位21:01商品王老吉×2(¥16.00)、普通茶位×1(¥10.00)、香飘飘果汁茶×1(¥10.00)商品合计¥36.00 占比7.7%综合10-12月到店消费1天/1次到店周期中位—消费排名#78在店时长#8912月到店消费0天/0次到店周期中位—消费排名#78在店时长—最近到店2025-10-10趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议重点维护包厢/团建需求,提前锁档与套餐化
79,常总,185****7188,年糕(1.7h)、阿清(1.7h),460.52,0.00,5000.00,订单1单平均单次¥460.52打球1.8h平均单次1.8h偏好A区(100.0%)时间到店均值19:13 中位19:13离店均值20:58 中位20:58商品哇哈哈矿泉水×2(¥10.00)、脉动×1(¥8.00)商品合计¥18.00 占比3.9%综合10-12月到店消费1天/1次到店周期中位—消费排名#79在店时长#8812月到店消费1天/1次到店周期中位—消费排名#79在店时长#47最近到店2025-12-14趋势10-12月到店频次上升12月更活跃围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
80,张丹逸,136****6637,,439.36,0.00,0.00,订单4单平均单次¥109.84打球2.4h平均单次0.6h偏好B区(99.0%)、补时长(1.0%)时间到店均值11:15 中位10:29离店均值12:36 中位11:29综合10-12月到店消费4天/4次到店周期中位#1消费排名#80在店时长#8012月到店消费1天/1次到店周期中位—消费排名#80在店时长#55最近到店2025-12-03趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
81,陈先生,186****8238,乔西(1.8h),416.17,0.00,497.83,订单1单平均单次¥416.17打球1.8h平均单次1.8h;偏好:包厢(100.0%)时间到店均值21:15 中位21:15离店均值23:04 中位23:04商品普通茶位×3(¥30.00)商品合计¥30.00 占比7.2%综合10-12月到店消费1天/1次到店周期中位—消费排名#81在店时长#8612月到店消费0天/0次到店周期中位—消费排名#81在店时长—最近到店2025-11-20趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议储值余额偏低建议在其常用时段做补能引导重点维护包厢/团建需求,提前锁档与套餐化
82,陈先生,138****3964,,400.00,0.00,0.00,订单3单平均单次¥133.33打球2.5h平均单次0.8h;偏好:补时长(100.0%)时间到店均值15:17 中位21:41离店均值15:57 中位22:40综合10-12月到店消费3天/3次到店周期中位#24消费排名#82在店时长#7912月到店消费1天/1次到店周期中位—消费排名#82在店时长#52最近到店2025-12-04趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
83,张先生,136****4528,,398.35,0.00,0.00,订单3单平均单次¥132.78打球2.9h平均单次1.0h偏好S区/斯诺克(98.8%)、补时长(1.2%)时间到店均值21:05 中位20:51离店均值22:41 中位22:13商品农夫山泉苏打水×1(¥6.00)商品合计¥6.00 占比1.5%综合10-12月到店消费3天/3次到店周期中位#15消费排名#83在店时长#7612月到店消费2天/2次到店周期中位#10消费排名#83在店时长#42最近到店2025-12-17趋势10-12月到店频次上升12月更活跃围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
84,小宇,187****8077,球球(1.5h)、悦悦(0.4h),397.50,0.00,936.07,订单2单平均单次¥198.75打球2.1h平均单次1.0h;偏好:包厢(80.9%)、TV台(19.1%)时间到店均值18:07 中位18:07离店均值19:09 中位19:09商品哇哈哈AD钙奶×1(¥8.00)、农夫山泉苏打水×1(¥6.00)、哇哈哈矿泉水×1(¥5.00)商品合计¥19.00 占比4.8%综合10-12月到店消费2天/2次到店周期中位#9消费排名#84在店时长#8212月到店消费0天/0次到店周期中位—消费排名#84在店时长—最近到店2025-10-13趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议重点维护包厢/团建需求,提前锁档与套餐化
85,黄先生,191****8219,,364.33,0.00,0.00,订单4单平均单次¥91.08打球1.2h平均单次0.3h偏好B区(95.4%)、补时长(4.6%)时间到店均值22:45 中位22:43离店均值23:46 中位23:45综合10-12月到店消费3天/4次到店周期中位#4消费排名#85在店时长#9312月到店消费0天/0次到店周期中位—消费排名#85在店时长—最近到店2025-11-29趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
86,刘女士,177****7538,,362.58,0.00,0.00,订单4单平均单次¥90.64打球2.8h平均单次0.7h偏好B区(99.3%)、补时长(0.7%)时间到店均值15:53 中位15:44离店均值17:04 中位17:04综合10-12月到店消费1天/4次到店周期中位—消费排名#86在店时长#7712月到店消费0天/0次到店周期中位—消费排名#86在店时长—最近到店2025-10-14趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
87,魏先生,137****6862,,319.39,0.00,84.51,订单1单平均单次¥319.39打球5.4h平均单次5.4h偏好A区(66.1%)、S区/斯诺克(33.9%)、B区(0.0%)时间到店均值18:44 中位18:44离店均值次日00:08 中位次日00:08商品维他柠檬茶×2(¥16.00)、东方树叶×1(¥8.00)商品合计¥24.00 占比7.5%综合10-12月到店消费1天/1次到店周期中位—消费排名#87在店时长#6412月到店消费1天/1次到店周期中位—消费排名#87在店时长#30最近到店2025-12-05趋势10-12月到店频次上升12月更活跃围客与客户运营建议储值余额偏低建议在其常用时段做补能引导
88,杜先生,188****4705,,307.47,0.00,0.00,订单3单平均单次¥102.49打球2.1h平均单次0.7h偏好A区(98.3%)、补时长(1.7%)时间到店均值21:25 中位21:44离店均值22:45 中位22:43商品哇哈哈矿泉水×2(¥10.00)商品合计¥10.00 占比3.3%综合10-12月到店消费2天/3次到店周期中位#21消费排名#88在店时长#8112月到店消费0天/0次到店周期中位—消费排名#88在店时长—最近到店2025-11-02趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
89,刘先生,137****2930,,300.00,0.00,1.27,订单1单平均单次¥300.00打球0.0h平均单次0.0h;偏好:补时长(100.0%)时间到店均值23:47 中位23:47离店均值次日00:48 中位次日00:48综合10-12月到店消费1天/1次到店周期中位—消费排名#89在店时长#10012月到店消费1天/1次到店周期中位—消费排名#89在店时长#54最近到店2025-12-07趋势10-12月到店频次上升12月更活跃围客与客户运营建议储值余额偏低建议在其常用时段做补能引导
90,陈先生,133****6117,,300.00,0.00,0.00,订单2单平均单次¥150.00打球0.0h平均单次0.0h;偏好:补时长(100.0%)时间到店均值20:50 中位20:50离店均值21:49 中位21:49综合10-12月到店消费2天/2次到店周期中位#2消费排名#90在店时长#9912月到店消费0天/0次到店周期中位—消费排名#90在店时长—最近到店2025-11-21趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
91,潘先生,176****7964,,300.00,0.00,0.00,订单1单平均单次¥300.00打球3.0h平均单次3.0h;偏好:补时长(100.0%)时间到店均值00:03 中位00:03离店均值00:03 中位00:03综合10-12月到店消费1天/1次到店周期中位—消费排名#91在店时长#7412月到店消费1天/1次到店周期中位—消费排名#91在店时长#39最近到店2025-12-19趋势10-12月到店频次上升12月更活跃围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
92,钟智豪,188****2803,小侯(1.8h),274.34,0.00,0.00,订单1单平均单次¥274.34打球1.8h平均单次1.8h偏好A区(100.0%)时间到店均值23:50 中位23:50离店均值次日01:36 中位次日01:36综合10-12月到店消费1天/1次到店周期中位—消费排名#92在店时长#8712月到店消费0天/0次到店周期中位—消费排名#92在店时长—最近到店2025-11-28趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
93,都先生,138****7796,素素(1.6h),269.64,0.00,0.00,订单1单平均单次¥269.64打球1.6h平均单次1.6h偏好B区(100.0%)时间到店均值15:17 中位15:17离店均值16:56 中位16:56商品东方树叶×1(¥8.00)、哇哈哈AD钙奶×1(¥8.00)商品合计¥16.00 占比5.9%综合10-12月到店消费1天/1次到店周期中位—消费排名#93在店时长#9012月到店消费0天/0次到店周期中位—消费排名#93在店时长—最近到店2025-11-13趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
94,林志铭,135****4233,小侯(1.2h),267.96,0.00,795.66,订单3单平均单次¥89.32打球2.0h平均单次0.7h偏好TV台(75.2%)、S区/斯诺克(24.8%)时间到店均值19:45 中位20:54离店均值20:24 中位21:40综合10-12月到店消费2天/3次到店周期中位#12消费排名#94在店时长#8412月到店消费0天/0次到店周期中位—消费排名#94在店时长—最近到店2025-11-30趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
95,方先生,158****6447,,248.00,0.00,0.00,订单3单平均单次¥82.67打球1.0h平均单次0.3h偏好A区(97.2%)、补时长(2.8%)时间到店均值15:35 中位22:11离店均值16:15 中位23:11综合10-12月到店消费3天/3次到店周期中位#17消费排名#95在店时长#9412月到店消费2天/2次到店周期中位#2消费排名#95在店时长#48最近到店2025-12-18趋势10-12月到店频次上升12月更活跃围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
96,李先生,176****5124,,244.00,0.00,0.00,订单3单平均单次¥81.33打球0.9h平均单次0.3h偏好A区(97.8%)、补时长(2.2%)时间到店均值20:59 中位21:28离店均值21:39 中位21:28综合10-12月到店消费3天/3次到店周期中位#5消费排名#96在店时长#9512月到店消费0天/0次到店周期中位—消费排名#96在店时长—最近到店2025-10-13趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
97,钟先生,132****3438,,239.37,0.00,0.00,订单1单平均单次¥239.37打球2.6h平均单次2.6h;偏好:麻将(100.0%)时间到店均值19:32 中位19:32离店均值22:10 中位22:10商品50枸杞槟榔×1(¥65.00)、地道肠×3(¥15.00)、哇哈哈矿泉水×2(¥10.00)、蜂蜜水×1(¥10.00)、屈臣氏苏打水×1(¥8.00)、芬达×1(¥5.00)商品合计¥113.00 占比47.2%综合10-12月到店消费1天/1次到店周期中位—消费排名#97在店时长#7812月到店消费0天/0次到店周期中位—消费排名#97在店时长—最近到店2025-10-20趋势到店频次波动建议按常用时段做稳定触达围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
98,,130****5960,,232.00,0.00,287.50,订单2单平均单次¥116.00打球4.0h平均单次2.0h偏好B区(100.0%)时间到店均值18:09 中位18:09离店均值20:11 中位20:11综合10-12月到店消费2天/2次到店周期中位#2消费排名#98在店时长#7112月到店消费2天/2次到店周期中位#2消费排名#98在店时长#33最近到店2025-12-05趋势10-12月到店频次上升12月更活跃围客与客户运营建议储值余额偏低建议在其常用时段做补能引导
99,黄国磊,131****3045,,225.33,0.00,0.22,订单3单平均单次¥75.11打球0.1h平均单次0.0h偏好A区(85.5%)、补时长(14.5%)时间到店均值17:56 中位18:02离店均值18:36 中位18:19商品蜂蜜水×2(¥20.00)商品合计¥20.00 占比8.9%综合10-12月到店消费3天/3次到店周期中位#22消费排名#99在店时长#9612月到店消费1天/1次到店周期中位—消费排名#99在店时长#55最近到店2025-12-12趋势12月为高峰月具备加深运营空间围客与客户运营建议储值余额偏低建议在其常用时段做补能引导
100,周先生,159****9997,,200.00,0.00,0.00,订单2单平均单次¥100.00打球1.2h平均单次0.6h;偏好:补时长(100.0%)时间到店均值02:54 中位02:54离店均值03:19 中位03:19综合10-12月到店消费2天/2次到店周期中位#2消费排名#100在店时长#9212月到店消费1天/1次到店周期中位—消费排名#100在店时长#50最近到店2025-12-01趋势12月为高峰月具备加深运营空间围客与客户运营建议保持常用时段的稳定服务供给提升复购粘性
1 2025年10-12月 客户消费能力Top100(总表)
2 消费=台费(dwd_table_fee_log.ledger_amount)+助教(dwd_assistant_service_log.ledger_amount)+商品(dwd_store_goods_sale.ledger_amount),均为应付金额(不扣优惠),以台费订单为基准串联;充值=充值支付流水(dwd_payment.relate_type=5, pay_status=2, pay_amount>0)按支付时间切月;储值卡未使用金额=当前有效储值卡余额之和(dim_member_card_account.balance, member_card_type_name='储值卡');喜爱助教=基础课时长+附加课时长*1.5(income_seconds换算小时),总表按10-12月汇总Top5。
3 排名,客户名称,电话号码,10月-12月,10月-12月,10月-12月,当前,评价
4 排名,客户名称,电话号码,喜爱助教昵称,总消费(元),总充值(元),储值卡未使用金额(元),评价
5 1,轩哥,188****7530,璇子(152.6h)、七七(129.6h)、涛涛(72.7h)、小敌(54.3h)、佳怡(50.6h),153136.05,66000.00,6050.80,订单:53单,平均单次¥2889.36;打球:279.0h,平均单次5.3h;偏好:666(54.4%)、发财(13.7%)、包厢(6.5%)、A区(5.9%);时间:到店均值16:43 中位19:21;离店均值22:31 中位次日01:03;商品:荷花双中支×56(¥3808.00)、细和天下×21(¥2625.00)、100 和成天下×13(¥1495.00)、农夫山泉苏打水×211(¥1266.00)、红牛×101(¥1010.00)、双中支中华×14(¥1008.00)(商品合计¥26812.00 占比17.5%);综合:10-12月到店消费40天/53次,到店周期中位#1,消费排名#1,在店时长#3;12月到店消费8天/9次,到店周期中位#1,消费排名#1,在店时长#7;最近到店2025-12-18;趋势:10-12月到店频次下降,建议重点唤醒;围客与客户运营建议:重点维护包厢/团建需求,提前锁档与套餐化;商品贡献高,可做常购商品补货提醒与组合促销
6 2,蔡总,159****8893,小柔(97.0h)、七七(72.4h)、璇子(68.2h)、涛涛(43.5h)、瑶瑶(42.8h),149839.46,5000.00,2016.18,订单:23单,平均单次¥6514.76;打球:180.4h,平均单次7.8h;偏好:发财(79.2%)、666(6.5%)、A区(4.3%)、补时长(2.8%);时间:到店均值18:05 中位20:12;离店均值次日02:58 中位次日04:48;商品:钻石荷花×100(¥4685.00)、细和天下×30(¥3750.00)、粗和天下×24(¥3000.00)、100 和成天下×20(¥2300.00)、双中支中华×31(¥2232.00)、荷花双中支×29(¥2008.00)(商品合计¥37968.00 占比25.3%);综合:10-12月到店消费22天/23次,到店周期中位#2,消费排名#2,在店时长#8;12月到店消费8天/8次,到店周期中位#1,消费排名#2,在店时长#10;最近到店2025-12-15;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:商品贡献高,可做常购商品补货提醒与组合促销
7 3,葛先生,138****8071,小燕(158.3h)、阿清(27.6h)、千千(14.4h)、周周(11.0h)、年糕(9.4h),48229.33,0.00,9011.19,订单:42单,平均单次¥1148.32;打球:180.6h,平均单次4.3h;偏好:TV台(43.8%)、A区(21.2%)、包厢(20.6%)、S区/斯诺克(6.7%);时间:到店均值14:01 中位19:40;离店均值18:19 中位21:54;商品:百威235毫升×72(¥1080.00)、卡士×33(¥726.00)、风花雪月×36(¥576.00)、细荷花×7(¥370.00)、蜂蜜水×36(¥360.00)、东方树叶×39(¥312.00)(商品合计¥5432.00 占比11.3%);综合:10-12月到店消费25天/42次,到店周期中位#1,消费排名#3,在店时长#7;12月到店消费11天/24次,到店周期中位#1,消费排名#3,在店时长#2;最近到店2025-12-19;趋势:10-12月到店频次上升,12月更活跃;围客与客户运营建议:重点维护包厢/团建需求,提前锁档与套餐化;商品贡献高,可做常购商品补货提醒与组合促销
8 4,罗先生,139****6996,佳怡(205.2h)、苏苏(19.6h)、璇子(13.2h)、周周(11.6h)、涛涛(10.5h),46573.88,10000.00,585.35,订单:86单,平均单次¥541.56;打球:212.7h,平均单次2.5h;偏好:TV台(39.2%)、C区(31.8%)、M7(7.8%)、麻将(5.8%);时间:到店均值15:24 中位18:18;离店均值18:05 中位20:27;商品:百威235毫升×94(¥1410.00)、东方树叶×39(¥312.00)、细荷花×6(¥300.00)、荷花双中支×4(¥276.00)、中支芙蓉王×6(¥228.00)、哇哈哈矿泉水×38(¥190.00)(商品合计¥4390.00 占比9.4%);综合:10-12月到店消费59天/86次,到店周期中位#1,消费排名#4,在店时长#5;12月到店消费17天/25次,到店周期中位#1,消费排名#4,在店时长#5;最近到店2025-12-18;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:商品贡献高,可做常购商品补货提醒与组合促销
9 5,陈腾鑫,178****8218,阿清(79.2h)、佳怡(57.7h)、球球(34.2h)、小侯(19.1h)、千千(7.7h),40075.76,9000.00,0.00,订单:93单,平均单次¥430.92;打球:207.0h,平均单次2.2h;偏好:麻将(25.0%)、C区(18.7%)、TV台(13.6%)、包厢(11.4%);时间:到店均值17:33 中位20:09;离店均值19:45 中位22:28;商品:百威235毫升×27(¥405.00)、东方树叶×50(¥400.00)、哇哈哈矿泉水×41(¥205.00)、荷花双中支×2(¥144.00)、地道肠×27(¥135.00)、哈啤×12(¥120.00)(商品合计¥2468.00 占比6.2%);综合:10-12月到店消费49天/93次,到店周期中位#1,消费排名#5,在店时长#6;12月到店消费11天/20次,到店周期中位#1,消费排名#5,在店时长#8;最近到店2025-12-13;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:关注是否为临时充值型,建议引导储值梯度与权益;重点维护包厢/团建需求,提前锁档与套餐化;商品贡献高,可做常购商品补货提醒与组合促销
10 6,江先生,188****4838,璇子(110.5h)、婉婉(16.8h)、小柔(12.0h)、Amy(6.7h)、周周(4.3h),30472.41,11000.00,0.00,订单:24单,平均单次¥1269.68;打球:65.6h,平均单次2.7h;偏好:包厢(44.5%)、888(15.3%)、M8(12.8%)、B区(10.3%);时间:到店均值16:05 中位19:47;离店均值18:53 中位21:24;商品:百威235毫升×480(¥7200.00)、风花雪月×28(¥448.00)、钻石荷花×7(¥330.00)、东方树叶×11(¥88.00)、双中支中华×1(¥72.00)、荷花双中支×1(¥68.00)(商品合计¥8943.00 占比29.3%);综合:10-12月到店消费21天/24次,到店周期中位#3,消费排名#6,在店时长#14;12月到店消费5天/6次,到店周期中位#3,消费排名#6,在店时长#18;最近到店2025-12-13;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:关注是否为临时充值型,建议引导储值梯度与权益;重点维护包厢/团建需求,提前锁档与套餐化;商品贡献高,可做常购商品补货提醒与组合促销
11 7,小燕,178****1334,小燕(140.1h)、阿清(2.0h)、球球(1.4h)、Amy(1.0h)、年糕(0.5h),29888.89,0.00,1802.64,订单:62单,平均单次¥482.08;打球:148.0h,平均单次2.4h;偏好:A区(55.2%)、麻将(20.7%)、S区/斯诺克(14.7%)、补时长(4.3%);时间:到店均值15:22 中位19:05;离店均值17:50 中位21:43;商品:东方树叶×28(¥224.00)、双中支中华×2(¥144.00)、钻石荷花×2(¥90.00)、荷花双中支×1(¥68.00)、蜂蜜水×6(¥60.00)、百威235毫升×3(¥45.00)(商品合计¥863.00 占比2.9%);综合:10-12月到店消费27天/62次,到店周期中位#1,消费排名#7,在店时长#10;12月到店消费15天/30次,到店周期中位#1,消费排名#7,在店时长#3;最近到店2025-12-18;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
12 8,张先生,139****8852,七七(25.1h)、小侯(20.2h)、千千(14.4h)、周周(10.4h)、璇子(10.3h),26104.33,0.00,1942.41,订单:46单,平均单次¥567.49;打球:105.7h,平均单次2.3h;偏好:C区(76.3%)、666(8.8%)、麻将(5.7%)、补时长(4.8%);时间:到店均值18:43 中位18:47;离店均值21:25 中位21:12;商品:东方树叶×28(¥224.00)、哇哈哈矿泉水×41(¥205.00)、钻石荷花×3(¥135.00)、细和天下×1(¥125.00)、双中支中华×1(¥72.00)、农夫山泉苏打水×11(¥66.00)(商品合计¥1205.00 占比4.6%);综合:10-12月到店消费40天/46次,到店周期中位#1,消费排名#8,在店时长#13;12月到店消费13天/13次,到店周期中位#1,消费排名#8,在店时长#13;最近到店2025-12-18;趋势:10-12月到店频次下降,建议重点唤醒;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
13 9,曾巧明,186****1488,,24830.16,0.00,0.00,订单:59单,平均单次¥420.85;打球:404.3h,平均单次6.9h;偏好:B区(66.4%)、C区(32.8%)、A区(0.8%);时间:到店均值17:01 中位16:13;离店均值23:52 中位次日00:12;商品:跨越贵烟×1(¥30.00)、地道肠×4(¥20.00)、东方树叶×2(¥16.00)、可乐×2(¥10.00)、哇哈哈矿泉水×2(¥10.00)(商品合计¥86.00 占比0.3%);综合:10-12月到店消费54天/59次,到店周期中位#1,消费排名#9,在店时长#1;12月到店消费15天/16次,到店周期中位#1,消费排名#9,在店时长#1;最近到店2025-12-18;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
14 10,黄生,136****9719,,18406.23,0.00,0.00,订单:36单,平均单次¥511.28;打球:298.2h,平均单次8.3h;偏好:B区(64.4%)、C区(35.6%);时间:到店均值13:13 中位12:53;离店均值21:30 中位22:04;商品:地道肠×8(¥40.00)、可乐×2(¥10.00)(商品合计¥50.00 占比0.3%);综合:10-12月到店消费36天/36次,到店周期中位#1,消费排名#10,在店时长#2;12月到店消费7天/7次,到店周期中位#3,消费排名#10,在店时长#4;最近到店2025-12-18;趋势:10-12月到店频次下降,建议重点唤醒;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
15 11,夏,191****2851,婉婉(29.7h)、柚子(10.7h)、球球(10.6h)、佳怡(7.8h)、璇子(7.6h),16599.59,17000.00,0.00,订单:10单,平均单次¥1659.96;打球:40.5h,平均单次4.1h;偏好:888(72.1%)、TV台(22.1%)、包厢(5.8%)、补时长(0.0%);时间:到店均值18:28 中位20:36;离店均值22:43 中位次日01:10;商品:百威235毫升×247(¥3705.00)、细荷花×5(¥250.00)、荷花双中支×3(¥204.00)、清洁费150×1(¥150.00)、三只松鼠开心果×4(¥120.00)、鸡翅三个一份×6(¥108.00)(商品合计¥5162.90 占比31.1%);综合:10-12月到店消费9天/10次,到店周期中位#5,消费排名#11,在店时长#19;12月到店消费0天/0次,到店周期中位—,消费排名#11,在店时长—;最近到店2025-11-06;趋势:10-12月到店频次下降,建议重点唤醒;围客与客户运营建议:关注是否为临时充值型,建议引导储值梯度与权益;重点维护包厢/团建需求,提前锁档与套餐化;商品贡献高,可做常购商品补货提醒与组合促销
16 12,叶先生,138****9539,素素(29.7h)、年糕(9.7h)、Amy(7.4h)、球球(6.7h)、婉婉(3.7h),14491.25,6307.00,0.00,订单:8单,平均单次¥1811.41;打球:27.2h,平均单次3.4h;偏好:B区(30.9%)、888(24.0%)、C区(17.8%)、包厢(16.3%);时间:到店均值18:38 中位20:59;离店均值次日00:04 中位次日02:12;商品:蓝妹×96(¥1728.00)、钻石荷花×9(¥405.00)、50 和成天下×6(¥390.00)、鸡翅三个一份×14(¥252.00)、100 和成天下×2(¥230.00)、透明袋无穷鸡翅×10(¥200.00)(商品合计¥4880.00 占比33.7%);综合:10-12月到店消费8天/8次,到店周期中位#2,消费排名#12,在店时长#27;12月到店消费2天/2次,到店周期中位#1,消费排名#12,在店时长#37;最近到店2025-12-06;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:关注是否为临时充值型,建议引导储值梯度与权益;重点维护包厢/团建需求,提前锁档与套餐化;商品贡献高,可做常购商品补货提醒与组合促销
17 13,T,180****9962,佳怡(15.0h)、周周(14.7h)、乔西(11.2h)、球球(10.7h)、欣怡(10.3h),13651.06,3000.00,849.68,订单:16单,平均单次¥853.19;打球:55.6h,平均单次3.5h;偏好:麻将(50.8%)、M8(17.0%)、包厢(16.0%)、A区(9.2%);时间:到店均值18:05 中位19:34;离店均值21:23 中位22:01;商品:荷花双中支×4(¥288.00)、钻石荷花×4(¥190.00)、软荷花×3(¥174.00)、哇哈哈矿泉水×26(¥130.00)、红牛×10(¥100.00)、跨越贵烟×3(¥86.00)(商品合计¥1689.00 占比12.4%);综合:10-12月到店消费12天/16次,到店周期中位#1,消费排名#13,在店时长#16;12月到店消费5天/8次,到店周期中位#1,消费排名#13,在店时长#14;最近到店2025-12-17;趋势:12月为高峰月,具备加深运营空间;围客与客户运营建议:重点维护包厢/团建需求,提前锁档与套餐化
18 14,林先生,133****1070,七七(19.4h)、佳怡(14.9h)、璇子(9.6h)、乔西(9.6h)、苏苏(4.9h),12937.86,0.00,158.79,订单:14单,平均单次¥924.13;打球:44.4h,平均单次3.2h;偏好:麻将(33.6%)、M8(31.5%)、M7(21.5%)、补时长(11.4%);时间:到店均值12:18 中位17:34;离店均值15:50 中位次日01:15;商品:荷花双中支×5(¥360.00)、细荷花×5(¥260.00)、细和天下×2(¥250.00)、钻石荷花×5(¥250.00)、双中支中华×3(¥216.00)、粗和天下×1(¥125.00)(商品合计¥2246.00 占比17.4%);综合:10-12月到店消费13天/14次,到店周期中位#1,消费排名#14,在店时长#17;12月到店消费10天/11次,到店周期中位#1,消费排名#14,在店时长#12;最近到店2025-12-13;趋势:10-12月到店频次上升,12月更活跃;围客与客户运营建议:储值余额偏低,建议在其常用时段做补能引导;商品贡献高,可做常购商品补货提醒与组合促销
19 15,曾丹烨,139****3242,,12356.33,3000.00,6639.14,订单:54单,平均单次¥228.82;打球:256.7h,平均单次4.8h;偏好:麻将(100.0%);时间:到店均值16:05 中位17:32;离店均值20:29 中位22:06;商品:合味道泡面×1(¥12.00)、地道肠×2(¥10.00)、东鹏特饮×1(¥7.00)、喜之郎果冻×1(¥5.00)(商品合计¥34.00 占比0.3%);综合:10-12月到店消费44天/54次,到店周期中位#1,消费排名#15,在店时长#4;12月到店消费9天/11次,到店周期中位#2,消费排名#15,在店时长#6;最近到店2025-12-16;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
20 16,胡先生,186****3391,佳怡(29.4h)、七七(4.2h)、球球(3.9h)、婉婉(3.9h)、涛涛(2.7h),11420.87,8000.00,0.00,订单:9单,平均单次¥1268.99;打球:39.8h,平均单次4.4h;偏好:包厢(44.2%)、A区(23.1%)、888(11.9%)、麻将(10.7%);时间:到店均值13:36 中位17:09;离店均值17:14 中位20:36;商品:百威235毫升×70(¥1050.00)、钻石荷花×5(¥225.00)、鸡翅三个一份×4(¥72.00)、蜂蜜水×7(¥70.00)、50 和成天下×1(¥65.00)、软荷花×1(¥58.00)(商品合计¥1900.00 占比16.6%);综合:10-12月到店消费5天/9次,到店周期中位#6,消费排名#16,在店时长#20;12月到店消费1天/1次,到店周期中位—,消费排名#16,在店时长#41;最近到店2025-12-01;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:关注是否为临时充值型,建议引导储值梯度与权益;重点维护包厢/团建需求,提前锁档与套餐化
21 17,艾宇民,150****9958,泡芙(22.0h)、小侯(7.6h),10763.07,0.00,0.00,订单:44单,平均单次¥244.62;打球:112.4h,平均单次2.6h;偏好:B区(82.1%)、C区(12.7%)、包厢(5.2%);时间:到店均值16:20 中位16:06;离店均值18:50 中位18:03;商品:百威235毫升×30(¥450.00)、地道肠×13(¥65.00)、细荷花×1(¥50.00)、中支芙蓉王×1(¥38.00)、乖媳妇山椒泡爪×1(¥25.00)、哇哈哈矿泉水×5(¥25.00)(商品合计¥808.00 占比7.5%);综合:10-12月到店消费41天/44次,到店周期中位#1,消费排名#17,在店时长#12;12月到店消费8天/10次,到店周期中位#2,消费排名#17,在店时长#16;最近到店2025-12-17;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:重点维护包厢/团建需求,提前锁档与套餐化
22 18,谢俊,186****5198,年糕(4.5h)、素素(2.4h),9982.86,0.00,0.00,订单:46单,平均单次¥217.02;打球:159.5h,平均单次3.5h;偏好:B区(100.0%);时间:到店均值19:31 中位20:12;离店均值22:59 中位23:48;商品:钻石荷花×1(¥45.00)(商品合计¥45.00 占比0.5%);综合:10-12月到店消费43天/46次,到店周期中位#1,消费排名#18,在店时长#9;12月到店消费4天/6次,到店周期中位#5,消费排名#18,在店时长#19;最近到店2025-12-17;趋势:10-12月到店频次下降,建议重点唤醒;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
23 19,周周,198****8725,周周(70.8h)、球球(15.2h)、佳怡(13.2h),8905.19,0.00,0.00,订单:10单,平均单次¥890.52;打球:35.9h,平均单次3.6h;偏好:麻将(59.3%)、M7(19.6%)、补时长(19.6%)、A区(1.5%);时间:到店均值11:40 中位14:30;离店均值17:04 中位次日00:34;商品:哇哈哈AD钙奶×13(¥104.00)、跨越贵烟×3(¥90.00)、细荷花×1(¥55.00)、红利群×2(¥52.00)、钻石荷花×1(¥50.00)、哇哈哈矿泉水×7(¥35.00)(商品合计¥685.00 占比7.7%);综合:10-12月到店消费8天/10次,到店周期中位#1,消费排名#19,在店时长#22;12月到店消费8天/10次,到店周期中位#1,消费排名#19,在店时长#11;最近到店2025-12-17;趋势:10-12月到店频次上升,12月更活跃;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
24 20,叶总,137****3287,璇子(22.0h)、小柔(3.8h)、七七(3.0h),8163.28,5700.00,0.00,订单:5单,平均单次¥1632.66;打球:23.4h,平均单次4.7h;偏好:包厢(53.5%)、888(25.5%)、麻将(12.9%)、B区(8.2%);时间:到店均值21:36 中位21:10;离店均值次日02:18 中位次日02:08;商品:百威235毫升×132(¥1980.00)、荷花双中支×3(¥204.00)、软荷花×1(¥58.00)、跨越贵烟×2(¥56.00)、细荷花×1(¥50.00)、钻石荷花×1(¥45.00)(商品合计¥2487.00 占比30.5%);综合:10-12月到店消费5天/5次,到店周期中位#2,消费排名#20,在店时长#31;12月到店消费0天/0次,到店周期中位—,消费排名#20,在店时长—;最近到店2025-10-27;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:关注是否为临时充值型,建议引导储值梯度与权益;重点维护包厢/团建需求,提前锁档与套餐化;商品贡献高,可做常购商品补货提醒与组合促销
25 21,羊,187****5094,球球(5.3h)、璇子(5.0h)、素素(4.3h)、婉婉(4.3h)、Amy(4.1h),8155.54,64000.00,0.00,订单:13单,平均单次¥627.35;打球:35.7h,平均单次2.7h;偏好:麻将(64.8%)、TV台(14.7%)、B区(10.3%)、888(9.7%);时间:到店均值18:13 中位19:52;离店均值21:16 中位22:36;商品:蓝妹×54(¥972.00)、钻石荷花×4(¥180.00)、中支芙蓉王×2(¥76.00)、无穷烤小腿×3(¥60.00)、跨越贵烟×2(¥56.00)、鸡翅三个一份×3(¥54.00)(商品合计¥2072.00 占比25.4%);综合:10-12月到店消费10天/13次,到店周期中位#1,消费排名#21,在店时长#23;12月到店消费0天/0次,到店周期中位—,消费排名#21,在店时长—;最近到店2025-11-23;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:关注是否为临时充值型,建议引导储值梯度与权益;商品贡献高,可做常购商品补货提醒与组合促销
26 22,游,172****6666,佳怡(13.5h)、小敌(3.6h)、璇子(3.1h)、周周(2.4h)、千千(2.2h),7797.37,0.00,0.00,订单:13单,平均单次¥599.80;打球:24.1h,平均单次1.9h;偏好:包厢(52.1%)、666(31.7%)、补时长(8.5%)、S区/斯诺克(7.7%);时间:到店均值19:13 中位18:51;离店均值21:14 中位20:36;商品:双中支中华×3(¥216.00)、红牛×17(¥170.00)、跨越贵烟×5(¥140.00)、荷花双中支×2(¥136.00)、50枸杞槟榔×2(¥130.00)、100 和成天下×1(¥115.00)(商品合计¥1406.00 占比18.0%);综合:10-12月到店消费9天/13次,到店周期中位#2,消费排名#22,在店时长#29;12月到店消费6天/9次,到店周期中位#1,消费排名#22,在店时长#27;最近到店2025-12-13;趋势:10-12月到店频次上升,12月更活跃;围客与客户运营建议:重点维护包厢/团建需求,提前锁档与套餐化
27 23,桂先生,166****7275,球球(2.6h),7678.29,985.00,0.00,订单:21单,平均单次¥365.63;打球:117.4h,平均单次5.6h;偏好:B区(79.3%)、C区(20.7%);时间:到店均值18:37 中位19:01;离店均值次日00:12 中位次日00:13;商品:地道肠×17(¥85.00)、哇哈哈矿泉水×15(¥75.00)、可乐×13(¥65.00)、红牛×4(¥40.00)、蜂蜜水×3(¥30.00)、东方树叶×3(¥24.00)(商品合计¥373.00 占比4.9%);综合:10-12月到店消费21天/21次,到店周期中位#2,消费排名#23,在店时长#11;12月到店消费2天/2次,到店周期中位#9,消费排名#23,在店时长#26;最近到店2025-12-16;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:关注是否为临时充值型,建议引导储值梯度与权益
28 24,明哥,166****0999,小柔(31.6h)、婉婉(26.7h)、涛涛(5.4h)、年糕(4.6h)、周周(0.4h),7581.04,0.00,954.64,订单:4单,平均单次¥1895.26;打球:21.1h,平均单次5.3h;偏好:包厢(43.0%)、A区(26.0%)、补时长(23.8%)、C区(5.2%);时间:到店均值10:22 中位10:15;离店均值13:40 中位13:49;商品:百威235毫升×78(¥1170.00)、硬中华×2(¥100.00)、地道肠×9(¥45.00)、东方树叶×4(¥32.00)、鱼蛋×6(¥30.00)、蜂蜜水×2(¥20.00)(商品合计¥1447.00 占比19.1%);综合:10-12月到店消费4天/4次,到店周期中位#5,消费排名#24,在店时长#35;12月到店消费3天/3次,到店周期中位#5,消费排名#24,在店时长#20;最近到店2025-12-10;趋势:10-12月到店频次上升,12月更活跃;围客与客户运营建议:重点维护包厢/团建需求,提前锁档与套餐化
29 25,陈德韩,134****7864,乔西(9.1h)、素素(5.5h)、奈千(4.4h)、周周(4.3h)、小敌(4.0h),7302.92,5000.00,20.11,订单:4单,平均单次¥1825.73;打球:19.6h,平均单次4.9h;偏好:包厢(66.6%)、888(21.3%)、麻将(12.1%)、补时长(0.0%);时间:到店均值18:53 中位18:48;离店均值21:23 中位21:56;商品:百威235毫升×85(¥1275.00)、卡士×9(¥198.00)、无穷爱辣烤鸡爪×3(¥60.00)、鸡翅三个一份×2(¥36.00)、鱼蛋×6(¥30.00)、鱼豆腐×2(¥30.00)(商品合计¥1898.00 占比26.0%);综合:10-12月到店消费4天/4次,到店周期中位#15,消费排名#25,在店时长#38;12月到店消费1天/1次,到店周期中位—,消费排名#25,在店时长—;最近到店2025-12-01;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:储值余额偏低,建议在其常用时段做补能引导;重点维护包厢/团建需求,提前锁档与套餐化
30 26,小熊,139****0145,佳怡(13.2h)、周周(10.7h)、欣怡(7.9h)、球球(4.4h)、七七(1.3h),7135.88,5000.00,0.00,订单:9单,平均单次¥792.88;打球:32.7h,平均单次3.6h;偏好:麻将(82.3%)、包厢(9.2%)、TV台(8.5%)、补时长(0.0%);时间:到店均值14:59 中位18:25;离店均值19:25 中位23:36;商品:软荷花×3(¥174.00)、100 和成天下×1(¥115.00)、中支芙蓉王×3(¥114.00)、钻石荷花×2(¥90.00)、炫赫门小南京×3(¥78.00)、荷花双中支×1(¥68.00)(商品合计¥1223.00 占比17.1%);综合:10-12月到店消费6天/9次,到店周期中位#2,消费排名#26,在店时长#25;12月到店消费0天/0次,到店周期中位—,消费排名#26,在店时长—;最近到店2025-11-05;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:关注是否为临时充值型,建议引导储值梯度与权益;重点维护包厢/团建需求,提前锁档与套餐化
31 27,黄先生,135****3507,苏苏(30.8h)、千千(13.1h)、乔西(1.6h)、阿清(0.7h),7052.72,3000.00,1639.43,订单:22单,平均单次¥320.58;打球:39.4h,平均单次1.8h;偏好:B区(80.5%)、A区(17.0%)、C区(2.2%)、补时长(0.4%);时间:到店均值18:32 中位19:27;离店均值20:30 中位21:28;商品:东方树叶×6(¥48.00)、钻石荷花×1(¥45.00)、哇哈哈AD钙奶×4(¥32.00)、东鹏特饮×3(¥21.00)、无穷烤小腿×1(¥20.00)、综合蔬果干×1(¥15.00)(商品合计¥225.00 占比3.2%);综合:10-12月到店消费20天/22次,到店周期中位#3,消费排名#27,在店时长#21;12月到店消费7天/7次,到店周期中位#2,消费排名#27,在店时长#22;最近到店2025-12-16;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
32 28,吕先生,155****0663,小柔(7.5h)、周周(3.7h)、素素(2.8h)、婉婉(2.8h)、苏苏(2.8h),7012.05,6000.00,0.00,订单:4单,平均单次¥1753.01;打球:17.0h,平均单次4.2h;偏好:666(66.5%)、888(18.2%)、麻将(15.3%);时间:到店均值14:20 中位18:05;离店均值18:34 中位21:28;商品:蓝妹×35(¥630.00)、软中华×3(¥210.00)、红牛×17(¥170.00)、软荷花×2(¥116.00)、鸡翅三个一份×4(¥72.00)、地道肠×10(¥50.00)(商品合计¥1819.00 占比25.9%);综合:10-12月到店消费4天/4次,到店周期中位#1,消费排名#28,在店时长#41;12月到店消费0天/0次,到店周期中位—,消费排名#28,在店时长—;最近到店2025-10-20;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:关注是否为临时充值型,建议引导储值梯度与权益
33 29,郑先生,159****4331,小敌(32.1h),6438.07,0.00,0.00,订单:16单,平均单次¥402.38;打球:42.2h,平均单次2.6h;偏好:C区(63.7%)、补时长(14.4%)、B区(12.9%)、A区(9.0%);时间:到店均值15:29 中位20:24;离店均值19:22 中位次日00:03;商品:农夫山泉苏打水×8(¥48.00)、蜂蜜水×4(¥40.00)、地道肠×7(¥35.00)、一次性手套×5(¥10.00)、东方树叶×1(¥8.00)、哇哈哈矿泉水×1(¥5.00)(商品合计¥156.00 占比2.4%);综合:10-12月到店消费13天/16次,到店周期中位#1,消费排名#29,在店时长#18;12月到店消费5天/7次,到店周期中位#1,消费排名#29,在店时长#25;最近到店2025-12-12;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
34 30,歌神,188****2164,婉婉(6.7h)、希希(4.0h)、素素(3.9h)、小柔(3.8h)、年糕(2.6h),5877.65,5000.00,0.00,订单:4单,平均单次¥1469.41;打球:12.8h,平均单次3.2h;偏好:888(43.0%)、包厢(41.0%)、麻将(16.0%);时间:到店均值22:20 中位22:39;离店均值次日01:34 中位次日01:19;商品:百威235毫升×90(¥1350.00)、鸡翅三个一份×5(¥90.00)、焦糖瓜子×3(¥45.00)、鱼蛋×9(¥45.00)、三只松鼠开心果×1(¥30.00)、地道肠×6(¥30.00)(商品合计¥1687.00 占比28.7%);综合:10-12月到店消费4天/4次,到店周期中位#4,消费排名#30,在店时长#46;12月到店消费0天/0次,到店周期中位—,消费排名#30,在店时长—;最近到店2025-10-24;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:关注是否为临时充值型,建议引导储值梯度与权益;重点维护包厢/团建需求,提前锁档与套餐化
35 31,罗先生,139****9222,婉婉(18.8h)、年糕(7.7h)、小柔(4.5h)、素素(4.3h)、姜姜(1.5h),5831.48,3000.00,310.31,订单:5单,平均单次¥1166.30;打球:20.0h,平均单次4.0h;偏好:包厢(72.1%)、888(17.8%)、补时长(10.2%);时间:到店均值16:46 中位21:04;离店均值次日01:10 中位次日00:07;商品:科罗娜啤酒275ml×26(¥468.00)、蓝妹×18(¥324.00)、鸡翅三个一份×2(¥36.00)、三只松鼠开心果×1(¥30.00)、地道肠×5(¥25.00)、焦糖瓜子×1(¥15.00)(商品合计¥924.00 占比15.8%);综合:10-12月到店消费5天/5次,到店周期中位#14,消费排名#31,在店时长#37;12月到店消费0天/0次,到店周期中位—,消费排名#31,在店时长—;最近到店2025-11-27;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:储值余额偏低,建议在其常用时段做补能引导;重点维护包厢/团建需求,提前锁档与套餐化
36 32,大G,186****4598,周周(17.7h)、佳怡(9.5h)、球球(1.9h),5374.68,0.00,0.00,订单:5单,平均单次¥1074.94;打球:21.6h,平均单次4.3h;偏好:麻将(47.3%)、M7(33.2%)、A区(19.4%)、补时长(0.1%);时间:到店均值17:16 中位20:28;离店均值21:48 中位次日00:04;商品:荷花双中支×2(¥144.00)、哇哈哈AD钙奶×9(¥72.00)、无穷烤小腿×3(¥60.00)、芙蓉王×2(¥56.00)、红利群×2(¥52.00)、蜂蜜水×4(¥40.00)(商品合计¥748.00 占比13.9%);综合:10-12月到店消费5天/5次,到店周期中位#1,消费排名#32,在店时长#34;12月到店消费4天/4次,到店周期中位#1,消费排名#32,在店时长#24;最近到店2025-12-07;趋势:10-12月到店频次上升,12月更活跃;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
37 33,林先生,137****8785,小侯(9.7h)、梦梦(4.3h)、千千(2.7h)、瑶瑶(1.9h)、周周(0.7h),4967.38,0.00,0.00,订单:7单,平均单次¥709.63;打球:18.7h,平均单次2.7h;偏好:C区(76.5%)、包厢(23.4%)、补时长(0.0%);时间:到店均值17:58 中位19:48;离店均值20:49 中位23:39;商品:百威235毫升×30(¥450.00)、50枸杞槟榔×1(¥65.00)、东方树叶×5(¥40.00)、蜂蜜水×4(¥40.00)、哇哈哈矿泉水×7(¥35.00)、酒鬼花生×4(¥32.00)(商品合计¥887.00 占比17.9%);综合:10-12月到店消费6天/7次,到店周期中位#3,消费排名#33,在店时长#40;12月到店消费2天/2次,到店周期中位#4,消费排名#33,在店时长#34;最近到店2025-12-06;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:重点维护包厢/团建需求,提前锁档与套餐化
38 34,梅,136****4552,千千(16.6h)、阿清(10.8h)、小侯(4.7h)、小燕(3.8h),4590.92,0.00,2050.00,订单:8单,平均单次¥573.86;打球:20.4h,平均单次2.5h;偏好:麻将(77.0%)、C区(12.1%)、补时长(10.8%);时间:到店均值14:47 中位20:54;离店均值20:02 中位23:31;商品:硬中华×1(¥50.00)、轻上椰子水×2(¥24.00)、哇哈哈矿泉水×2(¥10.00)(商品合计¥84.00 占比1.8%);综合:10-12月到店消费7天/8次,到店周期中位#5,消费排名#34,在店时长#36;12月到店消费5天/5次,到店周期中位#5,消费排名#34,在店时长#23;最近到店2025-12-19;趋势:10-12月到店频次上升,12月更活跃;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
39 35,李先生,134****4343,小侯(9.3h)、柚子(7.8h)、球球(0.0h),4479.77,0.00,2433.01,订单:8单,平均单次¥559.97;打球:32.1h,平均单次4.0h;偏好:C区(73.4%)、包厢(26.6%);时间:到店均值19:34 中位20:19;离店均值23:35 中位23:13;商品:热水可续杯×13(¥39.00)、农夫山泉苏打水×5(¥30.00)、水果脆×1(¥30.00)、跨越贵烟×1(¥30.00)、哇哈哈矿泉水×4(¥20.00)、水溶C×1(¥8.00)(商品合计¥185.00 占比4.1%);综合:10-12月到店消费8天/8次,到店周期中位#3,消费排名#35,在店时长#26;12月到店消费5天/5次,到店周期中位#3,消费排名#35,在店时长#17;最近到店2025-12-18;趋势:10-12月到店频次上升,12月更活跃;围客与客户运营建议:重点维护包厢/团建需求,提前锁档与套餐化
40 36,陶,189****2151,欣怡(4.9h)、球球(4.7h)、周周(4.4h)、七七(4.2h)、佳怡(4.1h),4096.07,6000.00,8.82,订单:7单,平均单次¥585.15;打球:21.7h,平均单次3.1h;偏好:麻将(61.0%)、A区(13.3%)、包厢(9.7%)、C区(8.1%);时间:到店均值20:49 中位21:49;离店均值23:55 中位次日01:19;商品:荷花双中支×1(¥68.00)、红牛×5(¥50.00)、轻上椰子水×4(¥48.00)、哇哈哈矿泉水×8(¥40.00)、软玉溪×1(¥28.00)、炫赫门小南京×1(¥26.00)(商品合计¥399.00 占比9.7%);综合:10-12月到店消费6天/7次,到店周期中位#2,消费排名#36,在店时长#33;12月到店消费0天/0次,到店周期中位—,消费排名#36,在店时长—;最近到店2025-10-26;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:储值余额偏低,建议在其常用时段做补能引导;重点维护包厢/团建需求,提前锁档与套餐化
41 37,陈先生,159****2829,佳怡(7.6h)、奈千(5.1h)、柚子(4.4h)、乔西(4.2h)、Amy(4.2h),3817.58,3000.00,0.55,订单:3单,平均单次¥1272.53;打球:7.6h,平均单次2.5h;偏好:麻将(54.5%)、TV台(45.4%)、补时长(0.1%)、A区(0.0%);时间:到店均值13:21 中位19:06;离店均值18:07 中位次日00:40;商品:百威235毫升×10(¥150.00)、钻石荷花×1(¥45.00)、跨越贵烟×1(¥28.00)、无穷爱辣烤鸡爪×1(¥20.00)、白桦树汁×1(¥12.00)、椰汁×1(¥8.00)(商品合计¥277.00 占比7.3%);综合:10-12月到店消费3天/3次,到店周期中位#19,消费排名#37,在店时长#57;12月到店消费0天/0次,到店周期中位—,消费排名#37,在店时长—;最近到店2025-11-07;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:储值余额偏低,建议在其常用时段做补能引导
42 38,候,131****0323,球球(5.3h)、阿清(4.3h)、小侯(3.4h)、涛涛(3.1h)、乔西(2.9h),3765.88,0.00,0.00,订单:8单,平均单次¥470.74;打球:22.0h,平均单次2.7h;偏好:TV台(66.3%)、A区(28.3%)、C区(5.4%);时间:到店均值20:08 中位19:43;离店均值22:53 中位22:54;商品:冰红茶×8(¥48.00)、地道肠×4(¥20.00)、鱼蛋×4(¥20.00)、可乐×2(¥10.00)、哇米诺豆奶×1(¥10.00)、红牛×1(¥10.00)(商品合计¥161.00 占比4.3%);综合:10-12月到店消费5天/8次,到店周期中位#1,消费排名#38,在店时长#32;12月到店消费5天/8次,到店周期中位#1,消费排名#38,在店时长#15;最近到店2025-12-17;趋势:10-12月到店频次上升,12月更活跃;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
43 39,黄先生,158****2109,球球(64.0h)、QQ(6.9h),3568.92,3000.00,420.01,订单:10单,平均单次¥356.89;打球:23.4h,平均单次2.3h;偏好:A区(60.1%)、包厢(27.0%)、补时长(12.9%);时间:到店均值04:58 中位01:43;离店均值06:06 中位03:20;商品:蓝妹×4(¥72.00)、跨越贵烟×1(¥28.00)、火腿肠×2(¥10.00)、东方树叶×1(¥8.00)、卫龙魔芋爽×1(¥8.00)、农夫山泉苏打水×1(¥6.00)(商品合计¥142.00 占比4.0%);综合:10-12月到店消费8天/10次,到店周期中位#4,消费排名#39,在店时长#30;12月到店消费3天/4次,到店周期中位#8,消费排名#39,在店时长#45;最近到店2025-12-17;趋势:12月为高峰月,具备加深运营空间;围客与客户运营建议:储值余额偏低,建议在其常用时段做补能引导;重点维护包厢/团建需求,提前锁档与套餐化
44 40,孟紫龙,176****3741,,3492.73,0.00,0.00,订单:13单,平均单次¥268.67;打球:57.6h,平均单次4.4h;偏好:B区(100.0%);时间:到店均值18:44 中位18:50;离店均值23:10 中位23:35;商品:哇哈哈矿泉水×9(¥45.00)、东方树叶×5(¥40.00)、地道肠×7(¥35.00)、可乐×2(¥10.00)、维他柠檬茶×1(¥8.00)、脉动×1(¥8.00)(商品合计¥153.00 占比4.4%);综合:10-12月到店消费12天/13次,到店周期中位#1,消费排名#40,在店时长#15;12月到店消费10天/11次,到店周期中位#1,消费排名#40,在店时长#9;最近到店2025-12-18;趋势:10-12月到店频次上升,12月更活跃;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
45 41,罗超,137****0990,球球(2.9h)、璇子(2.7h)、苏苏(2.6h)、奈千(2.5h),3398.81,3000.00,101.19,订单:2单,平均单次¥1699.40;打球:7.3h,平均单次3.7h;偏好:888(78.8%)、麻将(21.2%);时间:到店均值20:57 中位20:57;离店均值次日00:37 中位次日00:37;商品:科罗娜啤酒275ml×49(¥882.00)、荷花双中支×1(¥68.00)、百威235毫升×3(¥45.00)、掼蛋扑克×4(¥32.00)、跨越贵烟×1(¥28.00)、东方树叶×3(¥24.00)(商品合计¥1115.00 占比32.8%);综合:10-12月到店消费2天/2次,到店周期中位#16,消费排名#41,在店时长#59;12月到店消费0天/0次,到店周期中位—,消费排名#41,在店时长—;最近到店2025-10-24;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:储值余额偏低,建议在其常用时段做补能引导
46 42,君姐,166****4594,年糕(8.2h)、婉婉(4.3h)、璇子(2.3h)、涛涛(2.2h),3361.95,0.00,272.15,订单:3单,平均单次¥1120.65;打球:12.5h,平均单次4.2h;偏好:666(30.5%)、M8(25.3%)、M7(17.7%)、包厢(13.9%);时间:到店均值15:38 中位16:21;离店均值20:33 中位21:15;商品:哇哈哈矿泉水×20(¥100.00)、卡士×2(¥44.00)、东方树叶×5(¥40.00)、麻将房茶位费×1(¥40.00)、小果盘×1(¥37.90)、软玉溪×1(¥28.00)(商品合计¥319.90 占比9.5%);综合:10-12月到店消费3天/3次,到店周期中位#5,消费排名#42,在店时长#47;12月到店消费1天/1次,到店周期中位—,消费排名#42,在店时长#31;最近到店2025-12-02;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:储值余额偏低,建议在其常用时段做补能引导;重点维护包厢/团建需求,提前锁档与套餐化
47 43,吴生,136****3341,小柔(2.8h)、涛涛(2.2h),3253.70,0.00,3680.65,订单:15单,平均单次¥216.91;打球:34.3h,平均单次2.3h;偏好:C区(86.1%)、B区(7.0%)、包厢(6.7%)、补时长(0.1%);时间:到店均值19:01 中位18:43;离店均值21:14 中位21:25;商品:哇哈哈矿泉水×18(¥90.00)、双中支中华×1(¥72.00)、阿萨姆×1(¥8.00)(商品合计¥170.00 占比5.2%);综合:10-12月到店消费12天/15次,到店周期中位#6,消费排名#43,在店时长#24;12月到店消费2天/3次,到店周期中位#5,消费排名#43,在店时长#35;最近到店2025-12-16;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:重点维护包厢/团建需求,提前锁档与套餐化
48 44,刘哥,135****0020,婉婉(5.3h)、球球(2.1h),3036.80,0.00,371.51,订单:2单,平均单次¥1518.40;打球:5.0h,平均单次2.5h;偏好:包厢(93.4%)、S区/斯诺克(6.6%)、补时长(0.0%);时间:到店均值11:33 中位11:33;离店均值12:15 中位12:15;商品:百威235毫升×79(¥1185.00)、中支芙蓉王×2(¥76.00)、地道肠×6(¥30.00)、鱼蛋×6(¥30.00)、红利群×1(¥26.00)、红烧牛肉面×2(¥24.00)(商品合计¥1417.00 占比46.7%);综合:10-12月到店消费2天/2次,到店周期中位#20,消费排名#44,在店时长#66;12月到店消费1天/1次,到店周期中位—,消费排名#44,在店时长#49;最近到店2025-12-17;趋势:12月为高峰月,具备加深运营空间;围客与客户运营建议:储值余额偏低,建议在其常用时段做补能引导;重点维护包厢/团建需求,提前锁档与套餐化
49 45,李先生,131****4000,小敌(11.8h)、涛涛(2.1h)、Amy(1.1h),2997.53,3000.00,563.47,订单:4单,平均单次¥749.38;打球:11.8h,平均单次3.0h;偏好:包厢(100.0%);时间:到店均值16:24 中位20:21;离店均值19:21 中位23:11;商品:轻上椰子水×10(¥120.00)、科罗娜啤酒275ml×6(¥108.00)、跨越贵烟×1(¥28.00)、地道肠×2(¥10.00)、海之言×1(¥8.00)、茶兀×1(¥8.00)(商品合计¥298.00 占比9.9%);综合:10-12月到店消费3天/4次,到店周期中位#5,消费排名#45,在店时长#48;12月到店消费0天/0次,到店周期中位—,消费排名#45,在店时长—;最近到店2025-11-07;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:重点维护包厢/团建需求,提前锁档与套餐化
50 46,阿亮,159****2628,涛涛(9.1h)、素素(3.1h)、奈千(2.9h)、梦梦(2.7h)、柚子(2.4h),2936.26,0.00,612.33,订单:8单,平均单次¥367.03;打球:16.8h,平均单次2.1h;偏好:B区(65.3%)、S区/斯诺克(34.5%)、补时长(0.2%);时间:到店均值21:06 中位20:32;离店均值23:26 中位23:29;商品:哇哈哈矿泉水×4(¥20.00)、香飘飘果汁茶×1(¥10.00)、茶兀×1(¥8.00)(商品合计¥38.00 占比1.3%);综合:10-12月到店消费6天/8次,到店周期中位#1,消费排名#46,在店时长#43;12月到店消费2天/3次,到店周期中位#1,消费排名#46,在店时长#29;最近到店2025-12-04;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
51 47,李先生,186****8308,小侯(5.6h)、年糕(4.2h),2785.23,0.00,0.00,订单:1单,平均单次¥2785.23;打球:8.3h,平均单次8.3h;偏好:包厢(100.0%);时间:到店均值23:15 中位23:15;离店均值次日07:32 中位次日07:32;商品:清洁费150×1(¥150.00)、卡士×1(¥22.00)、合味道泡面×1(¥12.00)、轻上椰子水×1(¥12.00)、雪碧×2(¥10.00)、哇哈哈矿泉水×1(¥5.00)(商品合计¥216.00 占比7.8%);综合:10-12月到店消费1天/1次,到店周期中位—,消费排名#47,在店时长#55;12月到店消费0天/0次,到店周期中位—,消费排名#47,在店时长—;最近到店2025-11-28;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:重点维护包厢/团建需求,提前锁档与套餐化
52 48,周先生,173****7775,乔西(7.5h)、小敌(6.6h),2726.01,0.00,0.00,订单:1单,平均单次¥2726.01;打球:7.5h,平均单次7.5h;偏好:666(100.0%);时间:到店均值15:40 中位15:40;离店均值23:11 中位23:11;商品:哇哈哈矿泉水×1(¥5.00)(商品合计¥5.00 占比0.2%);综合:10-12月到店消费1天/1次,到店周期中位—,消费排名#48,在店时长#58;12月到店消费0天/0次,到店周期中位—,消费排名#48,在店时长—;最近到店2025-10-25;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
53 49,林先生,159****0021,婉婉(12.0h)、小柔(3.2h)、苏苏(3.1h),2690.52,0.00,49.48,订单:2单,平均单次¥1345.26;打球:6.0h,平均单次3.0h;偏好:包厢(66.7%)、A区(33.3%);时间:到店均值10:13 中位10:13;离店均值12:14 中位12:14;商品:百威235毫升×24(¥360.00)、中支芙蓉王×2(¥76.00)、绿茶×4(¥24.00)、无穷爱辣烤鸡爪×1(¥20.00)、透明袋无穷鸡翅×1(¥20.00)、益达×1(¥18.00)(商品合计¥597.00 占比22.2%);综合:10-12月到店消费2天/2次,到店周期中位#6,消费排名#49,在店时长#62;12月到店消费0天/0次,到店周期中位—,消费排名#49,在店时长—;最近到店2025-11-25;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:储值余额偏低,建议在其常用时段做补能引导;重点维护包厢/团建需求,提前锁档与套餐化
54 50,周先生,193****6822,千千(8.6h)、素素(6.2h),2643.64,0.00,2092.01,订单:3单,平均单次¥881.21;打球:14.9h,平均单次5.0h;偏好:C区(100.0%);时间:到店均值21:06 中位22:21;离店均值次日02:04 中位次日02:07;商品:哇哈哈矿泉水×5(¥25.00)、卡士×1(¥22.00)、东方树叶×2(¥16.00)、王老吉×1(¥8.00)、美汁源果粒橙×1(¥8.00)、一次性拖鞋×1(¥5.00)(商品合计¥89.00 占比3.4%);综合:10-12月到店消费3天/3次,到店周期中位#4,消费排名#50,在店时长#44;12月到店消费3天/3次,到店周期中位#4,消费排名#50,在店时长#21;最近到店2025-12-13;趋势:10-12月到店频次上升,12月更活跃;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
55 51,林先生,188****0332,周周(4.0h)、小敌(1.9h),2612.01,0.00,0.00,订单:8单,平均单次¥326.50;打球:16.9h,平均单次2.1h;偏好:666(25.1%)、麻将(22.3%)、M7(20.7%)、S区/斯诺克(12.8%);时间:到店均值14:55 中位17:06;离店均值17:17 中位19:13;商品:钻石荷花×3(¥135.00)、50枸杞槟榔×1(¥65.00)、跨越贵烟×1(¥28.00)、哇哈哈矿泉水×5(¥25.00)、红牛×2(¥20.00)、蜂蜜水×2(¥20.00)(商品合计¥330.00 占比12.6%);综合:10-12月到店消费6天/8次,到店周期中位#1,消费排名#51,在店时长#42;12月到店消费0天/0次,到店周期中位—,消费排名#51,在店时长—;最近到店2025-11-28;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
56 52,牛先生,152****5159,柚子(10.4h),2187.48,0.00,0.00,订单:5单,平均单次¥437.50;打球:10.4h,平均单次2.1h;偏好:C区(99.8%)、补时长(0.2%)、A区(0.0%)、B区(0.0%);时间:到店均值19:00 中位19:37;离店均值21:29 中位20:52;商品:地道肠×6(¥30.00)、东方树叶×2(¥16.00)、美汁源果粒橙×2(¥16.00)(商品合计¥62.00 占比2.8%);综合:10-12月到店消费3天/5次,到店周期中位#1,消费排名#52,在店时长#51;12月到店消费0天/0次,到店周期中位—,消费排名#52,在店时长—;最近到店2025-11-24;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
57 53,孟紫龙(该会员已注销),176****37411,,2131.72,0.00,0.00,订单:7单,平均单次¥304.53;打球:26.3h,平均单次3.8h;偏好:C区(99.9%)、补时长(0.1%);时间:到店均值19:17 中位19:34;离店均值23:32 中位23:56;商品:可乐×5(¥25.00)、东鹏特饮×2(¥14.00)、鱼蛋×1(¥5.00)、一次性手套×1(¥2.00)(商品合计¥46.00 占比2.2%);综合:10-12月到店消费7天/7次,到店周期中位#4,消费排名#53,在店时长#28;12月到店消费0天/0次,到店周期中位—,消费排名#53,在店时长—;最近到店2025-11-28;趋势:10-12月到店频次下降,建议重点唤醒;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
58 54,罗超杰,137****8012,苏苏(2.1h)、素素(1.9h)、周周(1.2h)、球球(0.8h),1584.05,0.00,3037.00,订单:8单,平均单次¥198.01;打球:8.4h,平均单次1.0h;偏好:包厢(74.8%)、B区(14.0%)、A区(10.9%)、补时长(0.2%);时间:到店均值18:55 中位22:56;离店均值20:06 中位23:23;商品:雪碧×4(¥20.00)、可乐×3(¥15.00)、维他柠檬茶×1(¥8.00)、打火机×1(¥2.00)(商品合计¥45.00 占比2.8%);综合:10-12月到店消费6天/8次,到店周期中位#3,消费排名#54,在店时长#54;12月到店消费0天/0次,到店周期中位—,消费排名#54,在店时长—;最近到店2025-11-05;趋势:10-12月到店频次下降,建议重点唤醒;围客与客户运营建议:重点维护包厢/团建需求,提前锁档与套餐化
59 55,汪先生,139****6339,姜姜(9.6h),1390.07,1000.00,11.99,订单:4单,平均单次¥347.52;打球:5.1h,平均单次1.3h;偏好:包厢(82.3%)、A区(17.4%)、补时长(0.4%);时间:到店均值21:16 中位22:01;离店均值23:26 中位23:25;商品:轻上椰子水×1(¥12.00)、三得利×1(¥8.00)、巧乐兹伊利×1(¥8.00)(商品合计¥28.00 占比2.0%);综合:10-12月到店消费3天/4次,到店周期中位#1,消费排名#55,在店时长#65;12月到店消费0天/0次,到店周期中位—,消费排名#55,在店时长—;最近到店2025-10-09;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:储值余额偏低,建议在其常用时段做补能引导;重点维护包厢/团建需求,提前锁档与套餐化
60 56,桂先生(该会员已注销),166****72751,,1370.81,0.00,0.00,订单:5单,平均单次¥274.16;打球:19.0h,平均单次3.8h;偏好:C区(100.0%);时间:到店均值19:20 中位19:37;离店均值23:08 中位23:57;商品:红牛×4(¥40.00)、东鹏特饮×2(¥14.00)、可乐×2(¥10.00)、地道肠×2(¥10.00)、普通扑克×1(¥5.00)(商品合计¥79.00 占比5.8%);综合:10-12月到店消费5天/5次,到店周期中位#2,消费排名#56,在店时长#39;12月到店消费0天/0次,到店周期中位—,消费排名#56,在店时长—;最近到店2025-10-16;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
61 57,方先生,153****3185,乔西(3.2h),1313.30,1000.00,0.00,订单:3单,平均单次¥437.77;打球:10.2h,平均单次3.4h;偏好:麻将(69.0%)、666(31.0%);时间:到店均值17:32 中位17:19;离店均值21:01 中位20:30;商品:农夫山泉苏打水×5(¥30.00)、掼蛋扑克×2(¥16.00)、可乐×3(¥15.00)、普通扑克×2(¥10.00)、红牛×1(¥10.00)、椰汁×1(¥8.00)(商品合计¥100.00 占比7.6%);综合:10-12月到店消费3天/3次,到店周期中位#10,消费排名#57,在店时长#52;12月到店消费0天/0次,到店周期中位—,消费排名#57,在店时长—;最近到店2025-11-17;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:关注是否为临时充值型,建议引导储值梯度与权益
62 58,陈淑涛,132****5485,涛涛(4.4h)、乔西(3.4h),1276.77,0.00,0.00,订单:3单,平均单次¥425.59;打球:4.4h,平均单次1.5h;偏好:麻将(77.1%)、A区(22.9%)、补时长(0.0%);时间:到店均值12:52 中位09:40;离店均值14:39 中位10:40;商品:细荷花×1(¥50.00)、轻上椰子水×1(¥12.00)、哇哈哈矿泉水×2(¥10.00)、火鸡面×1(¥10.00)、茶兀×1(¥8.00)、火腿肠×1(¥5.00)(商品合计¥99.00 占比7.8%);综合:10-12月到店消费2天/3次,到店周期中位#7,消费排名#58,在店时长#69;12月到店消费0天/0次,到店周期中位—,消费排名#58,在店时长—;最近到店2025-11-22;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
63 59,清,130****3087,小侯(3.0h)、阿清(3.0h)、千千(3.0h),1128.06,0.00,1944.76,订单:1单,平均单次¥1128.06;打球:3.0h,平均单次3.0h;偏好:麻将(100.0%);时间:到店均值21:18 中位21:18;离店均值次日02:00 中位次日02:00;综合:10-12月到店消费1天/1次,到店周期中位—,消费排名#59,在店时长#73;12月到店消费1天/1次,到店周期中位—,消费排名#59,在店时长#38;最近到店2025-12-08;趋势:10-12月到店频次上升,12月更活跃;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
64 60,amy,137****8221,Amy(4.8h),1105.90,0.00,0.38,订单:1单,平均单次¥1105.90;打球:4.8h,平均单次4.8h;偏好:麻将(100.0%);时间:到店均值22:47 中位22:47;离店均值次日03:37 中位次日03:37;商品:跨越贵烟×2(¥60.00)、掼蛋扑克×2(¥16.00)、热水可续杯×4(¥12.00)、可乐×2(¥10.00)、蜂蜜水×1(¥10.00)(商品合计¥108.00 占比9.8%);综合:10-12月到店消费1天/1次,到店周期中位—,消费排名#60,在店时长#67;12月到店消费1天/1次,到店周期中位—,消费排名#60,在店时长#32;最近到店2025-12-06;趋势:10-12月到店频次上升,12月更活跃;围客与客户运营建议:储值余额偏低,建议在其常用时段做补能引导
65 61,曾先生,133****1235,奈千(1.0h),991.34,0.00,303.19,订单:7单,平均单次¥141.62;打球:13.0h,平均单次1.9h;偏好:S区/斯诺克(63.2%)、A区(36.8%);时间:到店均值13:58 中位12:19;离店均值15:49 中位14:10;商品:咖啡代购×3(¥45.00)、东方树叶×3(¥24.00)、屈臣氏苏打水×1(¥8.00)、阿萨姆×1(¥8.00)、绿茶×1(¥6.00)、哇哈哈矿泉水×1(¥5.00)(商品合计¥98.00 占比9.9%);综合:10-12月到店消费7天/7次,到店周期中位#6,消费排名#61,在店时长#45;12月到店消费2天/2次,到店周期中位#6,消费排名#61,在店时长#36;最近到店2025-12-10;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:储值余额偏低,建议在其常用时段做补能引导
66 62,昌哥,137****1229,Amy(2.0h)、小柔(1.8h)、苏苏(1.7h),942.42,0.00,2471.98,订单:2单,平均单次¥471.21;打球:4.5h,平均单次2.3h;偏好:A区(100.0%);时间:到店均值20:05 中位20:05;离店均值22:21 中位22:21;商品:农夫山泉苏打水×3(¥18.00)、麻辣王子×1(¥12.00)、哇哈哈矿泉水×2(¥10.00)、营养快线×1(¥8.00)、阿萨姆×1(¥8.00)(商品合计¥56.00 占比5.9%);综合:10-12月到店消费2天/2次,到店周期中位#15,消费排名#62,在店时长#68;12月到店消费1天/1次,到店周期中位—,消费排名#62,在店时长#44;最近到店2025-12-07;趋势:12月为高峰月,具备加深运营空间;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
67 63,李,131****9882,,927.44,0.00,0.00,订单:11单,平均单次¥84.31;打球:11.1h,平均单次1.0h;偏好:B区(68.7%)、A区(30.9%)、补时长(0.4%);时间:到店均值13:13 中位13:14;离店均值14:13 中位14:00;商品:哇哈哈矿泉水×4(¥20.00)(商品合计¥20.00 占比2.2%);综合:10-12月到店消费6天/11次,到店周期中位#8,消费排名#63,在店时长#49;12月到店消费0天/0次,到店周期中位—,消费排名#63,在店时长—;最近到店2025-11-24;趋势:10-12月到店频次下降,建议重点唤醒;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
68 64,邓飛,136****9597,婉婉(6.8h)、苏苏(6.0h)、小敌(4.5h)、小柔(1.2h)、球球(0.8h),925.47,2345.00,74.77,订单:1单,平均单次¥925.47;打球:1.9h,平均单次1.9h;偏好:包厢(100.0%);时间:到店均值01:56 中位01:56;离店均值03:48 中位03:48;商品:百威235毫升×12(¥180.00)、卡士×1(¥22.00)、农夫山泉苏打水×3(¥18.00)、一次性拖鞋×1(¥5.00)、哇哈哈矿泉水×1(¥5.00)(商品合计¥230.00 占比24.9%);综合:10-12月到店消费1天/1次,到店周期中位—,消费排名#64,在店时长#85;12月到店消费0天/0次,到店周期中位—,消费排名#64,在店时长—;最近到店2025-11-09;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:储值余额偏低,建议在其常用时段做补能引导;重点维护包厢/团建需求,提前锁档与套餐化
69 65,陈世,134****1938,瑶瑶(0.8h),921.09,0.00,0.00,订单:6单,平均单次¥153.52;打球:6.5h,平均单次1.1h;偏好:C区(49.7%)、S区/斯诺克(49.6%)、补时长(0.7%);时间:到店均值20:42 中位21:08;离店均值22:16 中位22:24;综合:10-12月到店消费3天/6次,到店周期中位#24,消费排名#65,在店时长#61;12月到店消费0天/0次,到店周期中位—,消费排名#65,在店时长—;最近到店2025-11-20;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
70 66,婉婉,183****2742,婉婉(4.3h),867.49,1000.00,514.08,订单:2单,平均单次¥433.74;打球:4.4h,平均单次2.2h;偏好:B区(36.5%)、A区(35.9%)、888(27.6%);时间:到店均值15:41 中位15:41;离店均值18:01 中位18:01;商品:旺仔牛奶×2(¥20.00)、红牛×1(¥10.00)、王老吉×1(¥8.00)、哇哈哈矿泉水×1(¥5.00)、喜之郎果冻×1(¥5.00)(商品合计¥48.00 占比5.5%);综合:10-12月到店消费2天/2次,到店周期中位#23,消费排名#66,在店时长#70;12月到店消费0天/0次,到店周期中位—,消费排名#66,在店时长—;最近到店2025-11-21;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
71 67,贺斌,150****0885,佳怡(1.0h),770.56,0.00,0.00,订单:4单,平均单次¥192.64;打球:9.6h,平均单次2.4h;偏好:A区(50.1%)、C区(49.9%);时间:到店均值17:30 中位17:55;离店均值19:53 中位19:54;商品:细荷花×1(¥50.00)、可乐×5(¥25.00)、哇哈哈矿泉水×2(¥10.00)、地道肠×2(¥10.00)、东方树叶×1(¥8.00)(商品合计¥103.00 占比13.4%);综合:10-12月到店消费3天/4次,到店周期中位#4,消费排名#67,在店时长#53;12月到店消费0天/0次,到店周期中位—,消费排名#67,在店时长—;最近到店2025-11-03;趋势:10-12月到店频次下降,建议重点唤醒;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
72 68,陈泽斌,132****6060,,700.00,0.00,0.00,订单:6单,平均单次¥116.67;打球:0.1h,平均单次0.0h;偏好:补时长(100.0%);时间:到店均值17:51 中位20:40;离店均值18:50 中位21:39;综合:10-12月到店消费6天/6次,到店周期中位#10,消费排名#68,在店时长#97;12月到店消费1天/1次,到店周期中位—,消费排名#68,在店时长#51;最近到店2025-12-11;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
73 69,林总,138****1180,周周(2.2h)、婉婉(0.9h),684.44,0.00,16729.21,订单:2单,平均单次¥342.22;打球:3.7h,平均单次1.9h;偏好:包厢(100.0%);时间:到店均值18:28 中位18:28;离店均值20:20 中位20:20;商品:东方树叶×1(¥8.00)、哇哈哈AD钙奶×1(¥8.00)(商品合计¥16.00 占比2.3%);综合:10-12月到店消费2天/2次,到店周期中位#2,消费排名#69,在店时长#72;12月到店消费0天/0次,到店周期中位—,消费排名#69,在店时长—;最近到店2025-11-25;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:储值余额充足,可提供包厢/团建档期与专属权益;重点维护包厢/团建需求,提前锁档与套餐化
74 70,卢广贤,186****6220,,680.44,0.00,0.00,订单:4单,平均单次¥170.11;打球:10.4h,平均单次2.6h;偏好:B区(62.8%)、C区(37.2%);时间:到店均值18:15 中位18:45;离店均值20:51 中位20:41;商品:轻上椰子水×1(¥12.00)、三得利×1(¥8.00)、东鹏特饮×1(¥7.00)、冰红茶×1(¥6.00)、普通扑克×1(¥5.00)(商品合计¥38.00 占比5.6%);综合:10-12月到店消费4天/4次,到店周期中位#18,消费排名#70,在店时长#50;12月到店消费1天/1次,到店周期中位—,消费排名#70,在店时长#46;最近到店2025-12-13;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
75 71,王龙,186****8011,,669.58,0.00,95.20,订单:4单,平均单次¥167.40;打球:7.8h,平均单次2.0h;偏好:麻将(99.7%)、补时长(0.3%);时间:到店均值20:56 中位21:02;离店均值23:28 中位23:28;商品:麻将房茶位费×2(¥80.00)、东方树叶×2(¥16.00)(商品合计¥96.00 占比14.3%);综合:10-12月到店消费2天/4次,到店周期中位#9,消费排名#71,在店时长#56;12月到店消费2天/4次,到店周期中位#7,消费排名#71,在店时长#28;最近到店2025-12-12;趋势:10-12月到店频次上升,12月更活跃;围客与客户运营建议:储值余额偏低,建议在其常用时段做补能引导
76 72,王先生,185****1125,,600.68,0.00,0.00,订单:4单,平均单次¥150.17;打球:5.9h,平均单次1.5h;偏好:S区/斯诺克(99.4%)、补时长(0.6%);时间:到店均值18:13 中位18:31;离店均值20:09 中位19:30;商品:哇哈哈矿泉水×1(¥5.00)(商品合计¥5.00 占比0.8%);综合:10-12月到店消费4天/4次,到店周期中位#6,消费排名#72,在店时长#63;12月到店消费1天/1次,到店周期中位—,消费排名#72,在店时长#43;最近到店2025-12-02;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
77 73,潘先生,186****0511,年糕(2.0h),564.93,0.00,0.00,订单:2单,平均单次¥282.46;打球:3.0h,平均单次1.5h;偏好:666(66.7%)、A区(33.3%);时间:到店均值18:28 中位18:28;离店均值19:29 中位19:29;商品:农夫山泉苏打水×1(¥6.00)(商品合计¥6.00 占比1.1%);综合:10-12月到店消费2天/2次,到店周期中位#11,消费排名#73,在店时长#75;12月到店消费2天/2次,到店周期中位#8,消费排名#73,在店时长#40;最近到店2025-12-13;趋势:10-12月到店频次上升,12月更活跃;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
78 74,老宋,138****4554,婉婉(1.0h)、欣怡(0.5h),541.97,0.00,2126.14,订单:2单,平均单次¥270.98;打球:1.5h,平均单次0.7h;偏好:888(66.9%)、A区(33.1%);时间:到店均值19:24 中位19:24;离店均值20:02 中位20:02;商品:百威235毫升×12(¥180.00)(商品合计¥180.00 占比33.2%);综合:10-12月到店消费2天/2次,到店周期中位#13,消费排名#74,在店时长#91;12月到店消费0天/0次,到店周期中位—,消费排名#74,在店时长—;最近到店2025-11-07;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
79 75,郭先生,156****5001,希希(1.6h),518.35,0.00,2.57,订单:2单,平均单次¥259.18;打球:7.1h,平均单次3.5h;偏好:A区(100.0%);时间:到店均值20:53 中位20:53;离店均值次日00:32 中位次日00:32;商品:可乐×2(¥10.00)、普通扑克×2(¥10.00)、一次性手套×2(¥4.00)(商品合计¥24.00 占比4.6%);综合:10-12月到店消费2天/2次,到店周期中位#7,消费排名#75,在店时长#60;12月到店消费0天/0次,到店周期中位—,消费排名#75,在店时长—;最近到店2025-11-01;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:储值余额偏低,建议在其常用时段做补能引导
80 76,孙启明,137****6325,,500.00,0.00,0.00,订单:4单,平均单次¥125.00;打球:2.0h,平均单次0.5h;偏好:补时长(100.0%);时间:到店均值10:50 中位09:58;离店均值11:49 中位10:57;综合:10-12月到店消费4天/4次,到店周期中位#16,消费排名#76,在店时长#83;12月到店消费0天/0次,到店周期中位—,消费排名#76,在店时长—;最近到店2025-11-19;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
81 77,王先生,136****0168,,500.00,0.00,0.00,订单:5单,平均单次¥100.00;打球:0.1h,平均单次0.0h;偏好:补时长(100.0%);时间:到店均值19:45 中位19:22;离店均值20:44 中位20:21;综合:10-12月到店消费4天/5次,到店周期中位#5,消费排名#77,在店时长#98;12月到店消费1天/1次,到店周期中位—,消费排名#77,在店时长#53;最近到店2025-12-03;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
82 78,黎先生,133****0983,奈千(1.7h)、婉婉(0.8h),470.19,0.00,0.00,订单:1单,平均单次¥470.19;打球:1.7h,平均单次1.7h;偏好:包厢(100.0%);时间:到店均值19:17 中位19:17;离店均值21:01 中位21:01;商品:王老吉×2(¥16.00)、普通茶位×1(¥10.00)、香飘飘果汁茶×1(¥10.00)(商品合计¥36.00 占比7.7%);综合:10-12月到店消费1天/1次,到店周期中位—,消费排名#78,在店时长#89;12月到店消费0天/0次,到店周期中位—,消费排名#78,在店时长—;最近到店2025-10-10;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:重点维护包厢/团建需求,提前锁档与套餐化
83 79,常总,185****7188,年糕(1.7h)、阿清(1.7h),460.52,0.00,5000.00,订单:1单,平均单次¥460.52;打球:1.8h,平均单次1.8h;偏好:A区(100.0%);时间:到店均值19:13 中位19:13;离店均值20:58 中位20:58;商品:哇哈哈矿泉水×2(¥10.00)、脉动×1(¥8.00)(商品合计¥18.00 占比3.9%);综合:10-12月到店消费1天/1次,到店周期中位—,消费排名#79,在店时长#88;12月到店消费1天/1次,到店周期中位—,消费排名#79,在店时长#47;最近到店2025-12-14;趋势:10-12月到店频次上升,12月更活跃;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
84 80,张丹逸,136****6637,,439.36,0.00,0.00,订单:4单,平均单次¥109.84;打球:2.4h,平均单次0.6h;偏好:B区(99.0%)、补时长(1.0%);时间:到店均值11:15 中位10:29;离店均值12:36 中位11:29;综合:10-12月到店消费4天/4次,到店周期中位#1,消费排名#80,在店时长#80;12月到店消费1天/1次,到店周期中位—,消费排名#80,在店时长#55;最近到店2025-12-03;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
85 81,陈先生,186****8238,乔西(1.8h),416.17,0.00,497.83,订单:1单,平均单次¥416.17;打球:1.8h,平均单次1.8h;偏好:包厢(100.0%);时间:到店均值21:15 中位21:15;离店均值23:04 中位23:04;商品:普通茶位×3(¥30.00)(商品合计¥30.00 占比7.2%);综合:10-12月到店消费1天/1次,到店周期中位—,消费排名#81,在店时长#86;12月到店消费0天/0次,到店周期中位—,消费排名#81,在店时长—;最近到店2025-11-20;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:储值余额偏低,建议在其常用时段做补能引导;重点维护包厢/团建需求,提前锁档与套餐化
86 82,陈先生,138****3964,,400.00,0.00,0.00,订单:3单,平均单次¥133.33;打球:2.5h,平均单次0.8h;偏好:补时长(100.0%);时间:到店均值15:17 中位21:41;离店均值15:57 中位22:40;综合:10-12月到店消费3天/3次,到店周期中位#24,消费排名#82,在店时长#79;12月到店消费1天/1次,到店周期中位—,消费排名#82,在店时长#52;最近到店2025-12-04;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
87 83,张先生,136****4528,,398.35,0.00,0.00,订单:3单,平均单次¥132.78;打球:2.9h,平均单次1.0h;偏好:S区/斯诺克(98.8%)、补时长(1.2%);时间:到店均值21:05 中位20:51;离店均值22:41 中位22:13;商品:农夫山泉苏打水×1(¥6.00)(商品合计¥6.00 占比1.5%);综合:10-12月到店消费3天/3次,到店周期中位#15,消费排名#83,在店时长#76;12月到店消费2天/2次,到店周期中位#10,消费排名#83,在店时长#42;最近到店2025-12-17;趋势:10-12月到店频次上升,12月更活跃;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
88 84,小宇,187****8077,球球(1.5h)、悦悦(0.4h),397.50,0.00,936.07,订单:2单,平均单次¥198.75;打球:2.1h,平均单次1.0h;偏好:包厢(80.9%)、TV台(19.1%);时间:到店均值18:07 中位18:07;离店均值19:09 中位19:09;商品:哇哈哈AD钙奶×1(¥8.00)、农夫山泉苏打水×1(¥6.00)、哇哈哈矿泉水×1(¥5.00)(商品合计¥19.00 占比4.8%);综合:10-12月到店消费2天/2次,到店周期中位#9,消费排名#84,在店时长#82;12月到店消费0天/0次,到店周期中位—,消费排名#84,在店时长—;最近到店2025-10-13;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:重点维护包厢/团建需求,提前锁档与套餐化
89 85,黄先生,191****8219,,364.33,0.00,0.00,订单:4单,平均单次¥91.08;打球:1.2h,平均单次0.3h;偏好:B区(95.4%)、补时长(4.6%);时间:到店均值22:45 中位22:43;离店均值23:46 中位23:45;综合:10-12月到店消费3天/4次,到店周期中位#4,消费排名#85,在店时长#93;12月到店消费0天/0次,到店周期中位—,消费排名#85,在店时长—;最近到店2025-11-29;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
90 86,刘女士,177****7538,,362.58,0.00,0.00,订单:4单,平均单次¥90.64;打球:2.8h,平均单次0.7h;偏好:B区(99.3%)、补时长(0.7%);时间:到店均值15:53 中位15:44;离店均值17:04 中位17:04;综合:10-12月到店消费1天/4次,到店周期中位—,消费排名#86,在店时长#77;12月到店消费0天/0次,到店周期中位—,消费排名#86,在店时长—;最近到店2025-10-14;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
91 87,魏先生,137****6862,,319.39,0.00,84.51,订单:1单,平均单次¥319.39;打球:5.4h,平均单次5.4h;偏好:A区(66.1%)、S区/斯诺克(33.9%)、B区(0.0%);时间:到店均值18:44 中位18:44;离店均值次日00:08 中位次日00:08;商品:维他柠檬茶×2(¥16.00)、东方树叶×1(¥8.00)(商品合计¥24.00 占比7.5%);综合:10-12月到店消费1天/1次,到店周期中位—,消费排名#87,在店时长#64;12月到店消费1天/1次,到店周期中位—,消费排名#87,在店时长#30;最近到店2025-12-05;趋势:10-12月到店频次上升,12月更活跃;围客与客户运营建议:储值余额偏低,建议在其常用时段做补能引导
92 88,杜先生,188****4705,,307.47,0.00,0.00,订单:3单,平均单次¥102.49;打球:2.1h,平均单次0.7h;偏好:A区(98.3%)、补时长(1.7%);时间:到店均值21:25 中位21:44;离店均值22:45 中位22:43;商品:哇哈哈矿泉水×2(¥10.00)(商品合计¥10.00 占比3.3%);综合:10-12月到店消费2天/3次,到店周期中位#21,消费排名#88,在店时长#81;12月到店消费0天/0次,到店周期中位—,消费排名#88,在店时长—;最近到店2025-11-02;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
93 89,刘先生,137****2930,,300.00,0.00,1.27,订单:1单,平均单次¥300.00;打球:0.0h,平均单次0.0h;偏好:补时长(100.0%);时间:到店均值23:47 中位23:47;离店均值次日00:48 中位次日00:48;综合:10-12月到店消费1天/1次,到店周期中位—,消费排名#89,在店时长#100;12月到店消费1天/1次,到店周期中位—,消费排名#89,在店时长#54;最近到店2025-12-07;趋势:10-12月到店频次上升,12月更活跃;围客与客户运营建议:储值余额偏低,建议在其常用时段做补能引导
94 90,陈先生,133****6117,,300.00,0.00,0.00,订单:2单,平均单次¥150.00;打球:0.0h,平均单次0.0h;偏好:补时长(100.0%);时间:到店均值20:50 中位20:50;离店均值21:49 中位21:49;综合:10-12月到店消费2天/2次,到店周期中位#2,消费排名#90,在店时长#99;12月到店消费0天/0次,到店周期中位—,消费排名#90,在店时长—;最近到店2025-11-21;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
95 91,潘先生,176****7964,,300.00,0.00,0.00,订单:1单,平均单次¥300.00;打球:3.0h,平均单次3.0h;偏好:补时长(100.0%);时间:到店均值00:03 中位00:03;离店均值00:03 中位00:03;综合:10-12月到店消费1天/1次,到店周期中位—,消费排名#91,在店时长#74;12月到店消费1天/1次,到店周期中位—,消费排名#91,在店时长#39;最近到店2025-12-19;趋势:10-12月到店频次上升,12月更活跃;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
96 92,钟智豪,188****2803,小侯(1.8h),274.34,0.00,0.00,订单:1单,平均单次¥274.34;打球:1.8h,平均单次1.8h;偏好:A区(100.0%);时间:到店均值23:50 中位23:50;离店均值次日01:36 中位次日01:36;综合:10-12月到店消费1天/1次,到店周期中位—,消费排名#92,在店时长#87;12月到店消费0天/0次,到店周期中位—,消费排名#92,在店时长—;最近到店2025-11-28;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
97 93,都先生,138****7796,素素(1.6h),269.64,0.00,0.00,订单:1单,平均单次¥269.64;打球:1.6h,平均单次1.6h;偏好:B区(100.0%);时间:到店均值15:17 中位15:17;离店均值16:56 中位16:56;商品:东方树叶×1(¥8.00)、哇哈哈AD钙奶×1(¥8.00)(商品合计¥16.00 占比5.9%);综合:10-12月到店消费1天/1次,到店周期中位—,消费排名#93,在店时长#90;12月到店消费0天/0次,到店周期中位—,消费排名#93,在店时长—;最近到店2025-11-13;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
98 94,林志铭,135****4233,小侯(1.2h),267.96,0.00,795.66,订单:3单,平均单次¥89.32;打球:2.0h,平均单次0.7h;偏好:TV台(75.2%)、S区/斯诺克(24.8%);时间:到店均值19:45 中位20:54;离店均值20:24 中位21:40;综合:10-12月到店消费2天/3次,到店周期中位#12,消费排名#94,在店时长#84;12月到店消费0天/0次,到店周期中位—,消费排名#94,在店时长—;最近到店2025-11-30;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
99 95,方先生,158****6447,,248.00,0.00,0.00,订单:3单,平均单次¥82.67;打球:1.0h,平均单次0.3h;偏好:A区(97.2%)、补时长(2.8%);时间:到店均值15:35 中位22:11;离店均值16:15 中位23:11;综合:10-12月到店消费3天/3次,到店周期中位#17,消费排名#95,在店时长#94;12月到店消费2天/2次,到店周期中位#2,消费排名#95,在店时长#48;最近到店2025-12-18;趋势:10-12月到店频次上升,12月更活跃;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
100 96,李先生,176****5124,,244.00,0.00,0.00,订单:3单,平均单次¥81.33;打球:0.9h,平均单次0.3h;偏好:A区(97.8%)、补时长(2.2%);时间:到店均值20:59 中位21:28;离店均值21:39 中位21:28;综合:10-12月到店消费3天/3次,到店周期中位#5,消费排名#96,在店时长#95;12月到店消费0天/0次,到店周期中位—,消费排名#96,在店时长—;最近到店2025-10-13;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
101 97,钟先生,132****3438,,239.37,0.00,0.00,订单:1单,平均单次¥239.37;打球:2.6h,平均单次2.6h;偏好:麻将(100.0%);时间:到店均值19:32 中位19:32;离店均值22:10 中位22:10;商品:50枸杞槟榔×1(¥65.00)、地道肠×3(¥15.00)、哇哈哈矿泉水×2(¥10.00)、蜂蜜水×1(¥10.00)、屈臣氏苏打水×1(¥8.00)、芬达×1(¥5.00)(商品合计¥113.00 占比47.2%);综合:10-12月到店消费1天/1次,到店周期中位—,消费排名#97,在店时长#78;12月到店消费0天/0次,到店周期中位—,消费排名#97,在店时长—;最近到店2025-10-20;趋势:到店频次波动,建议按常用时段做稳定触达;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性
102 98,杨,130****5960,,232.00,0.00,287.50,订单:2单,平均单次¥116.00;打球:4.0h,平均单次2.0h;偏好:B区(100.0%);时间:到店均值18:09 中位18:09;离店均值20:11 中位20:11;综合:10-12月到店消费2天/2次,到店周期中位#2,消费排名#98,在店时长#71;12月到店消费2天/2次,到店周期中位#2,消费排名#98,在店时长#33;最近到店2025-12-05;趋势:10-12月到店频次上升,12月更活跃;围客与客户运营建议:储值余额偏低,建议在其常用时段做补能引导
103 99,黄国磊,131****3045,,225.33,0.00,0.22,订单:3单,平均单次¥75.11;打球:0.1h,平均单次0.0h;偏好:A区(85.5%)、补时长(14.5%);时间:到店均值17:56 中位18:02;离店均值18:36 中位18:19;商品:蜂蜜水×2(¥20.00)(商品合计¥20.00 占比8.9%);综合:10-12月到店消费3天/3次,到店周期中位#22,消费排名#99,在店时长#96;12月到店消费1天/1次,到店周期中位—,消费排名#99,在店时长#55;最近到店2025-12-12;趋势:12月为高峰月,具备加深运营空间;围客与客户运营建议:储值余额偏低,建议在其常用时段做补能引导
104 100,周先生,159****9997,,200.00,0.00,0.00,订单:2单,平均单次¥100.00;打球:1.2h,平均单次0.6h;偏好:补时长(100.0%);时间:到店均值02:54 中位02:54;离店均值03:19 中位03:19;综合:10-12月到店消费2天/2次,到店周期中位#2,消费排名#100,在店时长#92;12月到店消费1天/1次,到店周期中位—,消费排名#100,在店时长#50;最近到店2025-12-01;趋势:12月为高峰月,具备加深运营空间;围客与客户运营建议:保持常用时段的稳定服务供给,提升复购粘性

View File

@@ -0,0 +1,459 @@
# 2025年10-12月 客户消费能力Top100总表
## 思考过程
以台费订单为基准汇总三类明细满足应付金额口径并输出Top100客户的消费/充值/助教偏好。按你的要求,先生成评价为空的版本,再在脚本末尾回填评价。
## 查询说明
消费=台费(dwd_table_fee_log.ledger_amount)+助教(dwd_assistant_service_log.ledger_amount)+商品(dwd_store_goods_sale.ledger_amount),均为应付金额(不扣优惠),以台费订单为基准串联;充值=充值支付流水(dwd_payment.relate_type=5, pay_status=2, pay_amount>0)按支付时间切月;储值卡未使用金额=当前有效储值卡余额之和(dim_member_card_account.balance, member_card_type_name='储值卡');喜爱助教=基础课时长+附加课时长*1.5income_seconds换算小时总表按10-12月汇总Top5。
## SQL
### Top100按消费总额
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount,
sum(tfl.real_table_use_seconds) as table_use_seconds
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_info as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
least(bo.order_start_time, coalesce(a.assistant_start_time, bo.order_start_time)) as order_start_time,
greatest(bo.order_end_time, coalesce(a.assistant_end_time, bo.order_end_time)) as order_end_time,
bo.table_use_seconds,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_info a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
select
o.member_id,
sum(o.order_amount) as consume_total,
count(*) as order_cnt
from orders o
where o.member_id is not null and o.member_id <> 0
group by o.member_id
order by consume_total desc
limit 100;
```
### 按月消费汇总
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount,
sum(tfl.real_table_use_seconds) as table_use_seconds
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_info as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
least(bo.order_start_time, coalesce(a.assistant_start_time, bo.order_start_time)) as order_start_time,
greatest(bo.order_end_time, coalesce(a.assistant_end_time, bo.order_end_time)) as order_end_time,
bo.table_use_seconds,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_info a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, x as (
select
o.member_id,
case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
o.order_amount
from orders o
where o.member_id is not null and o.member_id <> 0
)
select
member_id,
month_key,
sum(order_amount) as consume_sum
from x
where month_key is not null
group by member_id, month_key;
```
### 按月充值汇总
```sql
with pay as (
select
p.pay_time,
r.member_id,
p.pay_amount
from billiards_dwd.dwd_payment p
join billiards_dwd.dwd_recharge_order r on r.recharge_order_id = p.relate_id
where p.site_id = %(site_id)s
and p.relate_type = 5
and p.pay_status = 2
and p.pay_amount > 0
and p.pay_time >= %(window_start)s::timestamptz
and p.pay_time < %(window_end)s::timestamptz
)
, x as (
select
member_id,
case when pay_time >= '2025-10-01 00:00:00+08'::timestamptz and pay_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when pay_time >= '2025-11-01 00:00:00+08'::timestamptz and pay_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when pay_time >= '2025-12-01 00:00:00+08'::timestamptz and pay_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
pay_amount
from pay
)
select
member_id,
month_key,
sum(pay_amount) as recharge_sum
from x
where month_key is not null
group by member_id, month_key;
```
### 储值卡未使用金额(当前余额汇总)
```sql
select
tenant_member_id as member_id,
sum(balance) as stored_value_balance
from billiards_dwd.dim_member_card_account
where scd2_is_current=1
and coalesce(is_delete,0)=0
and member_card_type_name='储值卡'
and tenant_member_id = any(%(ids)s)
group by tenant_member_id;
```
### 喜爱助教Top510-12月
```sql
with x as (
select
asl.tenant_member_id as member_id,
asl.nickname as assistant_nickname,
sum(case when asl.order_assistant_type=1 then asl.income_seconds else asl.income_seconds*1.5 end) / 3600.0 as weighted_hours
from billiards_dwd.dwd_assistant_service_log asl
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0)=0
and asl.tenant_member_id is not null and asl.tenant_member_id <> 0
and asl.start_use_time >= %(window_start)s::timestamptz
and asl.start_use_time < %(window_end)s::timestamptz
group by asl.tenant_member_id, asl.nickname
),
ranked as (
select *, row_number() over(partition by member_id order by weighted_hours desc) as rn
from x
)
select
member_id,
string_agg(assistant_nickname || '(' || to_char(round(weighted_hours::numeric, 1), 'FM999999990.0') || 'h)', '' order by weighted_hours desc) as fav5
from ranked
where rn <= 5
group by member_id;
```
### 评价画像:订单/时长/到店日期
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount,
sum(tfl.real_table_use_seconds) as table_use_seconds
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_info as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
least(bo.order_start_time, coalesce(a.assistant_start_time, bo.order_start_time)) as order_start_time,
greatest(bo.order_end_time, coalesce(a.assistant_end_time, bo.order_end_time)) as order_end_time,
bo.table_use_seconds,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_info a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
select
o.member_id,
count(*) as orders,
avg(o.order_amount) as avg_order,
sum(o.table_use_seconds)/3600.0 as play_hours,
avg(o.table_use_seconds)/3600.0 as avg_play_hours,
min((o.order_start_time at time zone 'Asia/Shanghai')::date) as first_visit_day,
max((o.order_start_time at time zone 'Asia/Shanghai')::date) as last_visit_day,
count(distinct (o.order_start_time at time zone 'Asia/Shanghai')::date) as visit_days,
sum(case when o.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then 1 else 0 end) as orders_oct,
sum(case when o.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and o.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then 1 else 0 end) as orders_nov,
sum(case when o.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and o.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then 1 else 0 end) as orders_dec
from orders o
where o.member_id = any(%(ids)s)
group by o.member_id;
```
### 评价画像:到店/离店时间(小时)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount,
sum(tfl.real_table_use_seconds) as table_use_seconds
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_info as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
least(bo.order_start_time, coalesce(a.assistant_start_time, bo.order_start_time)) as order_start_time,
greatest(bo.order_end_time, coalesce(a.assistant_end_time, bo.order_end_time)) as order_end_time,
bo.table_use_seconds,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_info a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
, t as (
select
o.member_id,
extract(hour from (o.order_start_time at time zone 'Asia/Shanghai'))
+ extract(minute from (o.order_start_time at time zone 'Asia/Shanghai'))/60.0
+ extract(second from (o.order_start_time at time zone 'Asia/Shanghai'))/3600.0 as arrive_h,
extract(hour from (o.order_end_time at time zone 'Asia/Shanghai'))
+ extract(minute from (o.order_end_time at time zone 'Asia/Shanghai'))/60.0
+ extract(second from (o.order_end_time at time zone 'Asia/Shanghai'))/3600.0 as leave_h_raw
from orders o
where o.member_id = any(%(ids)s)
),
tt as (
select
member_id,
arrive_h,
case when leave_h_raw < arrive_h then leave_h_raw + 24 else leave_h_raw end as leave_h
from t
)
select
member_id,
avg(arrive_h) as arrive_avg_h,
percentile_cont(0.5) within group (order by arrive_h) as arrive_med_h,
avg(leave_h) as leave_avg_h,
percentile_cont(0.5) within group (order by leave_h) as leave_med_h
from tt
group by member_id;
```
### 评价画像:球台分区偏好(按时长)
```sql
select
tfl.member_id,
coalesce(tfl.site_table_area_name,'') as site_table_area_name,
sum(tfl.real_table_use_seconds)/3600.0 as hours
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id=%(site_id)s and coalesce(tfl.is_delete,0)=0
and tfl.start_use_time >= %(window_start)s::timestamptz and tfl.start_use_time < %(window_end)s::timestamptz
and tfl.member_id = any(%(ids)s)
group by tfl.member_id, site_table_area_name;
```
### 评价画像:商品明细(名称+数量)
```sql
with base_orders as (
select order_settle_id, max(member_id) as member_id
from billiards_dwd.dwd_table_fee_log
where site_id=%(site_id)s and coalesce(is_delete,0)=0
and start_use_time >= %(window_start)s::timestamptz and start_use_time < %(window_end)s::timestamptz
group by order_settle_id
)
select
bo.member_id,
g.ledger_name,
sum(g.ledger_count) as qty,
sum(g.ledger_amount) as amount
from base_orders bo
join billiards_dwd.dwd_store_goods_sale g on g.order_settle_id = bo.order_settle_id
where g.site_id=%(site_id)s and coalesce(g.is_delete,0)=0
and bo.member_id = any(%(ids)s)
group by bo.member_id, g.ledger_name;
```
### 评价画像:到店日期明细(用于周期/近期分析)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
max(tfl.ledger_end_time) as order_end_time,
sum(tfl.ledger_amount) as table_amount,
sum(tfl.real_table_use_seconds) as table_use_seconds
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= '2025-10-01 00:00:00+08'::timestamptz
and tfl.start_use_time < '2026-01-01 00:00:00+08'::timestamptz
group by tfl.order_settle_id
),
assistant_info as (
select
asl.order_settle_id,
sum(asl.ledger_amount) as assistant_amount,
min(asl.start_use_time) as assistant_start_time,
max(asl.last_use_time) as assistant_end_time
from billiards_dwd.dwd_assistant_service_log asl
join base_orders bo on bo.order_settle_id = asl.order_settle_id
where asl.site_id = %(site_id)s
and coalesce(asl.is_delete,0) = 0
group by asl.order_settle_id
),
goods_amount as (
select
g.order_settle_id,
sum(g.ledger_amount) as goods_amount
from billiards_dwd.dwd_store_goods_sale g
join base_orders bo on bo.order_settle_id = g.order_settle_id
where g.site_id = %(site_id)s
and coalesce(g.is_delete,0) = 0
group by g.order_settle_id
),
orders as (
select
bo.order_settle_id,
bo.member_id,
least(bo.order_start_time, coalesce(a.assistant_start_time, bo.order_start_time)) as order_start_time,
greatest(bo.order_end_time, coalesce(a.assistant_end_time, bo.order_end_time)) as order_end_time,
bo.table_use_seconds,
coalesce(bo.table_amount,0) + coalesce(a.assistant_amount,0) + coalesce(g.goods_amount,0) as order_amount
from base_orders bo
left join assistant_info a on a.order_settle_id = bo.order_settle_id
left join goods_amount g on g.order_settle_id = bo.order_settle_id
)
select
o.member_id,
(o.order_start_time at time zone 'Asia/Shanghai')::date as visit_date,
count(*) as orders,
sum(o.order_amount) as amount
from orders o
where o.member_id = any(%(ids)s)
group by o.member_id, visit_date
order by o.member_id, visit_date;
```

View File

@@ -0,0 +1,119 @@
2025年10-12月 财务优惠(会员折扣+台费调账)分布
优惠=会员折扣(dwd_table_fee_log.member_discount_amount)+台费调账(dwd_table_fee_adjust.ledger_amount),按订单归集后汇总到客户(member_id),按订单最早开台时间切月;不含团购抵扣等其它优惠。
客户名称,手机号(脱敏),VIP卡/等级,10月,10月,10月,11月,11月,11月,12月,12月,12月,10-12月
客户名称,手机号(脱敏),VIP卡/等级,会员折扣(元),台费调账(元),合计优惠(元),会员折扣(元),台费调账(元),合计优惠(元),会员折扣(元),台费调账(元),合计优惠(元),合计优惠(元)
轩哥,188****7530,储值卡,0.00,9212.40,9212.40,0.00,10685.47,10685.47,0.00,5331.76,5331.76,25229.63
曾巧明,186****1488,年卡,9649.06,0.00,9649.06,8811.59,0.00,8811.59,6283.51,0.00,6283.51,24744.16
黄生,136****9719,年卡,7821.94,0.00,7821.94,6353.05,0.00,6353.05,4181.24,0.00,4181.24,18356.23
蔡总,159****8893,台费卡,0.00,0.00,0.00,0.00,12274.20,12274.20,0.00,2587.28,2587.28,14861.48
罗先生,139****6996,年卡,3315.05,566.48,3881.53,4474.12,460.59,4934.71,2087.14,1320.22,3407.36,12223.60
陈腾鑫,178****8218,台费卡,0.00,2843.20,2843.20,0.00,4913.52,4913.52,0.00,1935.78,1935.78,9692.50
谢俊,186****5198,年卡,4193.93,0.00,4193.93,4089.12,0.00,4089.12,969.66,0.00,969.66,9252.71
桂先生,166****7275,月卡,2175.11,0.00,2175.11,4009.66,301.18,4310.84,0.00,568.24,568.24,7054.19
张先生,139****8852,年卡,1317.04,1307.13,2624.17,2114.89,168.51,2283.40,2007.34,0.00,2007.34,6914.91
艾宇民,150****9958,年卡,2342.73,0.00,2342.73,2543.78,545.12,3088.90,1179.56,0.00,1179.56,6611.19
曾丹烨,139****3242,储值卡,0.00,2348.26,2348.26,0.00,2573.25,2573.25,0.00,1240.20,1240.20,6161.71
葛先生,138****8071,储值卡,0.00,0.00,0.00,0.00,3548.54,3548.54,0.00,2593.02,2593.02,6141.56
小燕,178****1334,储值卡,0.00,0.00,0.00,0.00,2250.36,2250.36,0.00,2228.54,2228.54,4478.90
孟紫龙,176****3741,月卡,0.00,0.00,0.00,576.78,0.00,576.78,2762.95,0.00,2762.95,3339.73
江先生,188****4838,储值卡,0.00,344.54,344.54,0.00,1454.41,1454.41,0.00,405.54,405.54,2204.49
郑先生,159****4331,储值卡,0.00,0.00,0.00,0.00,1659.16,1659.16,0.00,463.02,463.02,2122.18
黄先生,135****3507,台费卡,0.00,631.08,631.08,0.00,631.56,631.56,0.00,810.48,810.48,2073.12
孟紫龙(该会员已注销),176****37411,月卡,1785.72,0.00,1785.72,0.00,164.00,164.00,0.00,0.00,0.00,1949.72
T,180****9962,储值卡,0.00,578.93,578.93,0.00,461.72,461.72,0.00,839.34,839.34,1879.99
林先生,133****1070,储值卡,0.00,0.00,0.00,0.00,199.95,199.95,0.00,1417.70,1417.70,1617.65
,172****6666,储值卡,0.00,0.00,0.00,0.00,921.43,921.43,0.00,600.85,600.85,1522.28
林先生,137****8785,储值卡,0.00,0.00,0.00,0.00,1114.20,1114.20,0.00,186.45,186.45,1300.65
桂先生(该会员已注销),166****72751,月卡,988.04,303.77,1291.81,0.00,0.00,0.00,0.00,0.00,0.00,1291.81
叶先生,138****9539,储值卡,0.00,703.64,703.64,0.00,341.29,341.29,0.00,99.41,99.41,1144.34
陈德韩,134****7864,台费卡,0.00,1091.02,1091.02,0.00,0.00,0.00,0.00,0.00,0.00,1091.02
周周,198****8725,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,1061.95,1061.95,1061.95
胡先生,186****3391,储值卡,0.00,0.00,0.00,0.00,785.20,785.20,0.00,100.59,100.59,885.79
小熊,139****0145,台费卡,0.00,297.01,297.01,0.00,530.45,530.45,0.00,0.00,0.00,827.46
,191****2851,储值卡,0.00,659.78,659.78,0.00,137.90,137.90,0.00,0.00,0.00,797.68
李先生,186****8308,储值卡,0.00,0.00,0.00,0.00,777.27,777.27,0.00,0.00,0.00,777.27
叶总,137****3287,储值卡,0.00,737.12,737.12,0.00,0.00,0.00,0.00,0.00,0.00,737.12
,187****5094,储值卡,0.00,38.64,38.64,0.00,647.57,647.57,0.00,0.00,0.00,686.21
黄先生,158****2109,储值卡,0.00,240.00,240.00,0.00,326.90,326.90,0.00,100.06,100.06,666.96
卢广贤,186****6220,年卡,263.07,0.00,263.07,250.51,0.00,250.51,128.86,0.00,128.86,642.44
,189****2151,储值卡,0.00,604.89,604.89,0.00,0.00,0.00,0.00,0.00,0.00,604.89
大G,186****4598,台费卡,0.00,0.00,0.00,0.00,245.70,245.70,0.00,356.31,356.31,602.01
明哥,166****0999,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,547.68,547.68,547.68
,136****4552,储值卡,0.00,0.00,0.00,0.00,99.02,99.02,0.00,372.66,372.66,471.68
阿亮,159****2628,储值卡,0.00,0.00,0.00,0.00,361.34,361.34,0.00,100.86,100.86,462.20
牛先生,152****5159,台费卡,0.00,0.00,0.00,0.00,424.31,424.31,0.00,0.00,0.00,424.31
罗超杰,137****8012,储值卡,0.00,245.95,245.95,0.00,164.54,164.54,0.00,0.00,0.00,410.49
陈世,134****1938,储值卡,0.00,199.51,199.51,0.00,198.89,198.89,0.00,0.00,0.00,398.40
曾先生,133****1235,储值卡,0.00,36.67,36.67,0.00,265.71,265.71,0.00,90.45,90.45,392.83
,131****9882,储值卡,0.00,254.13,254.13,0.00,138.12,138.12,0.00,0.00,0.00,392.25
陈泽斌,132****6060,储值卡,0.00,77.00,77.00,0.00,222.00,222.00,0.00,78.00,78.00,377.00
王先生,136****0168,台费卡,0.00,0.00,0.00,0.00,235.00,235.00,0.00,65.00,65.00,300.00
林先生,188****0332,储值卡,0.00,0.00,0.00,0.00,252.11,252.11,0.00,0.00,0.00,252.11
歌神,188****2164,储值卡,0.00,246.28,246.28,0.00,0.00,0.00,0.00,0.00,0.00,246.28
陈先生,159****2829,台费卡,0.00,21.00,21.00,0.00,218.13,218.13,0.00,0.00,0.00,239.13
黄先生,191****8219,台费卡,0.00,0.00,0.00,0.00,229.16,229.16,0.00,0.00,0.00,229.16
汪先生,139****6339,储值卡,0.00,228.07,228.07,0.00,0.00,0.00,0.00,0.00,0.00,228.07
王龙,186****8011,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,200.78,200.78,200.78
罗先生,139****9222,储值卡,0.00,0.00,0.00,0.00,199.17,199.17,0.00,0.00,0.00,199.17
吴生,136****3341,储值卡,0.00,0.00,0.00,0.00,99.23,99.23,0.00,99.92,99.92,199.15
刘女士,177****7538,储值卡,0.00,193.29,193.29,0.00,0.00,0.00,0.00,0.00,0.00,193.29
林总,138****1180,储值卡,0.00,0.00,0.00,0.00,183.25,183.25,0.00,0.00,0.00,183.25
陈淑涛,132****5485,储值卡,0.00,0.00,0.00,0.00,180.86,180.86,0.00,0.00,0.00,180.86
张丹逸,136****6637,储值卡,0.00,133.68,133.68,0.00,0.00,0.00,0.00,45.00,45.00,178.68
孙启明,137****6325,台费卡,0.00,90.00,90.00,0.00,85.00,85.00,0.00,0.00,0.00,175.00
陈先生,138****3964,储值卡,0.00,98.00,98.00,0.00,0.00,0.00,0.00,60.00,60.00,158.00
杜先生,188****4705,台费卡,0.00,48.00,48.00,0.00,99.73,99.73,0.00,0.00,0.00,147.73
周先生,193****6822,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,135.65,135.65,135.65
君姐,166****4594,储值卡,0.00,0.00,0.00,0.00,134.10,134.10,0.00,0.00,0.00,134.10
昌哥,137****1229,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,122.03,122.03,122.03
amy,137****8221,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,116.28,116.28,116.28
,130****5960,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,116.00,116.00,116.00
方先生,153****3185,储值卡,0.00,100.27,100.27,0.00,0.00,0.00,0.00,0.00,0.00,100.27
方先生,158****6447,台费卡,0.00,0.00,0.00,0.00,72.00,72.00,0.00,28.00,28.00,100.00
陈先生,133****6117,台费卡,0.00,0.00,0.00,0.00,100.00,100.00,0.00,0.00,0.00,100.00
周先生,159****9997,台费卡,0.00,0.00,0.00,0.00,61.00,61.00,0.00,37.00,37.00,98.00
王姐,158****8819,储值卡,0.00,97.40,97.40,0.00,0.00,0.00,0.00,0.00,0.00,97.40
老宋,138****4554,储值卡,0.00,0.00,0.00,0.00,93.95,93.95,0.00,0.00,0.00,93.95
李先生,176****5124,储值卡,0.00,90.00,90.00,0.00,0.00,0.00,0.00,0.00,0.00,90.00
曾先生,159****0492,储值卡,0.00,88.00,88.00,0.00,0.00,0.00,0.00,0.00,0.00,88.00
张先生,136****4528,台费卡,0.00,0.00,0.00,0.00,37.00,37.00,0.00,45.00,45.00,82.00
刘先生,137****2930,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,82.00,82.00,82.00
潘先生,176****7964,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,74.00,74.00,74.00
王先生,183****9763,台费卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,74.00,74.00,74.00
王先生,185****1125,台费卡,0.00,0.00,0.00,0.00,73.00,73.00,0.00,0.00,0.00,73.00
,130****3087,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,72.82,72.82,72.82
贺斌,150****0885,活动抵用券,0.00,71.27,71.27,0.00,0.00,0.00,0.00,0.00,0.00,71.27
李先生,186****9266,储值卡,0.00,0.00,0.00,0.00,69.00,69.00,0.00,0.00,0.00,69.00
林志铭,135****4233,储值卡,0.00,0.00,0.00,0.00,66.50,66.50,0.00,0.00,0.00,66.50
,131****0323,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,62.79,62.79,62.79
吕先生,155****0663,储值卡,0.00,62.54,62.54,0.00,0.00,0.00,0.00,0.00,0.00,62.54
梁先生,134****2609,台费卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,59.00,59.00,59.00
肖先生,156****6427,台费卡,0.00,0.00,0.00,0.00,7.00,7.00,0.00,50.00,50.00,57.00
婉婉,183****2742,储值卡,0.00,0.00,0.00,0.00,37.47,37.47,0.00,0.00,0.00,37.47
陈小姐,138****0778,储值卡,0.00,32.49,32.49,0.00,0.00,0.00,0.00,0.00,0.00,32.49
黄国磊,131****3045,台费卡,0.00,0.30,0.30,0.00,19.00,19.00,0.00,0.00,0.00,19.30
小宇,187****8077,储值卡,0.00,13.42,13.42,0.00,0.00,0.00,0.00,0.00,0.00,13.42
胡总,133****3091,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,1.00,1.00,1.00
李先生,131****4000,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
周先生,173****7775,台费卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
林先生,159****0021,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
魏先生,137****6862,台费卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
都先生,138****7796,活动抵用券,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
陈先生,188****8626,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
冯先生,155****0348,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
常总,185****7188,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
邓飛,136****9597,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
李先生,134****4343,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
谭先生,138****3185,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
黎先生,133****0983,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
刘哥,135****0020,台费卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
孙先生,135****3191,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
钟智豪,188****2803,活动抵用券,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
陈先生,186****8238,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
郭先生,156****5001,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
钟先生,132****3438,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
唐先生,135****0785,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
陈先生,139****0419,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
潘先生,186****0511,台费卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
罗超,137****0990,台费卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1 2025年10-12月 财务优惠(会员折扣+台费调账)分布
2 优惠=会员折扣(dwd_table_fee_log.member_discount_amount)+台费调账(dwd_table_fee_adjust.ledger_amount),按订单归集后汇总到客户(member_id),按订单最早开台时间切月;不含团购抵扣等其它优惠。
3 客户名称,手机号(脱敏),VIP卡/等级,10月,10月,10月,11月,11月,11月,12月,12月,12月,10-12月
4 客户名称,手机号(脱敏),VIP卡/等级,会员折扣(元),台费调账(元),合计优惠(元),会员折扣(元),台费调账(元),合计优惠(元),会员折扣(元),台费调账(元),合计优惠(元),合计优惠(元)
5 轩哥,188****7530,储值卡,0.00,9212.40,9212.40,0.00,10685.47,10685.47,0.00,5331.76,5331.76,25229.63
6 曾巧明,186****1488,年卡,9649.06,0.00,9649.06,8811.59,0.00,8811.59,6283.51,0.00,6283.51,24744.16
7 黄生,136****9719,年卡,7821.94,0.00,7821.94,6353.05,0.00,6353.05,4181.24,0.00,4181.24,18356.23
8 蔡总,159****8893,台费卡,0.00,0.00,0.00,0.00,12274.20,12274.20,0.00,2587.28,2587.28,14861.48
9 罗先生,139****6996,年卡,3315.05,566.48,3881.53,4474.12,460.59,4934.71,2087.14,1320.22,3407.36,12223.60
10 陈腾鑫,178****8218,台费卡,0.00,2843.20,2843.20,0.00,4913.52,4913.52,0.00,1935.78,1935.78,9692.50
11 谢俊,186****5198,年卡,4193.93,0.00,4193.93,4089.12,0.00,4089.12,969.66,0.00,969.66,9252.71
12 桂先生,166****7275,月卡,2175.11,0.00,2175.11,4009.66,301.18,4310.84,0.00,568.24,568.24,7054.19
13 张先生,139****8852,年卡,1317.04,1307.13,2624.17,2114.89,168.51,2283.40,2007.34,0.00,2007.34,6914.91
14 艾宇民,150****9958,年卡,2342.73,0.00,2342.73,2543.78,545.12,3088.90,1179.56,0.00,1179.56,6611.19
15 曾丹烨,139****3242,储值卡,0.00,2348.26,2348.26,0.00,2573.25,2573.25,0.00,1240.20,1240.20,6161.71
16 葛先生,138****8071,储值卡,0.00,0.00,0.00,0.00,3548.54,3548.54,0.00,2593.02,2593.02,6141.56
17 小燕,178****1334,储值卡,0.00,0.00,0.00,0.00,2250.36,2250.36,0.00,2228.54,2228.54,4478.90
18 孟紫龙,176****3741,月卡,0.00,0.00,0.00,576.78,0.00,576.78,2762.95,0.00,2762.95,3339.73
19 江先生,188****4838,储值卡,0.00,344.54,344.54,0.00,1454.41,1454.41,0.00,405.54,405.54,2204.49
20 郑先生,159****4331,储值卡,0.00,0.00,0.00,0.00,1659.16,1659.16,0.00,463.02,463.02,2122.18
21 黄先生,135****3507,台费卡,0.00,631.08,631.08,0.00,631.56,631.56,0.00,810.48,810.48,2073.12
22 孟紫龙(该会员已注销),176****37411,月卡,1785.72,0.00,1785.72,0.00,164.00,164.00,0.00,0.00,0.00,1949.72
23 T,180****9962,储值卡,0.00,578.93,578.93,0.00,461.72,461.72,0.00,839.34,839.34,1879.99
24 林先生,133****1070,储值卡,0.00,0.00,0.00,0.00,199.95,199.95,0.00,1417.70,1417.70,1617.65
25 游,172****6666,储值卡,0.00,0.00,0.00,0.00,921.43,921.43,0.00,600.85,600.85,1522.28
26 林先生,137****8785,储值卡,0.00,0.00,0.00,0.00,1114.20,1114.20,0.00,186.45,186.45,1300.65
27 桂先生(该会员已注销),166****72751,月卡,988.04,303.77,1291.81,0.00,0.00,0.00,0.00,0.00,0.00,1291.81
28 叶先生,138****9539,储值卡,0.00,703.64,703.64,0.00,341.29,341.29,0.00,99.41,99.41,1144.34
29 陈德韩,134****7864,台费卡,0.00,1091.02,1091.02,0.00,0.00,0.00,0.00,0.00,0.00,1091.02
30 周周,198****8725,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,1061.95,1061.95,1061.95
31 胡先生,186****3391,储值卡,0.00,0.00,0.00,0.00,785.20,785.20,0.00,100.59,100.59,885.79
32 小熊,139****0145,台费卡,0.00,297.01,297.01,0.00,530.45,530.45,0.00,0.00,0.00,827.46
33 夏,191****2851,储值卡,0.00,659.78,659.78,0.00,137.90,137.90,0.00,0.00,0.00,797.68
34 李先生,186****8308,储值卡,0.00,0.00,0.00,0.00,777.27,777.27,0.00,0.00,0.00,777.27
35 叶总,137****3287,储值卡,0.00,737.12,737.12,0.00,0.00,0.00,0.00,0.00,0.00,737.12
36 羊,187****5094,储值卡,0.00,38.64,38.64,0.00,647.57,647.57,0.00,0.00,0.00,686.21
37 黄先生,158****2109,储值卡,0.00,240.00,240.00,0.00,326.90,326.90,0.00,100.06,100.06,666.96
38 卢广贤,186****6220,年卡,263.07,0.00,263.07,250.51,0.00,250.51,128.86,0.00,128.86,642.44
39 陶,189****2151,储值卡,0.00,604.89,604.89,0.00,0.00,0.00,0.00,0.00,0.00,604.89
40 大G,186****4598,台费卡,0.00,0.00,0.00,0.00,245.70,245.70,0.00,356.31,356.31,602.01
41 明哥,166****0999,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,547.68,547.68,547.68
42 梅,136****4552,储值卡,0.00,0.00,0.00,0.00,99.02,99.02,0.00,372.66,372.66,471.68
43 阿亮,159****2628,储值卡,0.00,0.00,0.00,0.00,361.34,361.34,0.00,100.86,100.86,462.20
44 牛先生,152****5159,台费卡,0.00,0.00,0.00,0.00,424.31,424.31,0.00,0.00,0.00,424.31
45 罗超杰,137****8012,储值卡,0.00,245.95,245.95,0.00,164.54,164.54,0.00,0.00,0.00,410.49
46 陈世,134****1938,储值卡,0.00,199.51,199.51,0.00,198.89,198.89,0.00,0.00,0.00,398.40
47 曾先生,133****1235,储值卡,0.00,36.67,36.67,0.00,265.71,265.71,0.00,90.45,90.45,392.83
48 李,131****9882,储值卡,0.00,254.13,254.13,0.00,138.12,138.12,0.00,0.00,0.00,392.25
49 陈泽斌,132****6060,储值卡,0.00,77.00,77.00,0.00,222.00,222.00,0.00,78.00,78.00,377.00
50 王先生,136****0168,台费卡,0.00,0.00,0.00,0.00,235.00,235.00,0.00,65.00,65.00,300.00
51 林先生,188****0332,储值卡,0.00,0.00,0.00,0.00,252.11,252.11,0.00,0.00,0.00,252.11
52 歌神,188****2164,储值卡,0.00,246.28,246.28,0.00,0.00,0.00,0.00,0.00,0.00,246.28
53 陈先生,159****2829,台费卡,0.00,21.00,21.00,0.00,218.13,218.13,0.00,0.00,0.00,239.13
54 黄先生,191****8219,台费卡,0.00,0.00,0.00,0.00,229.16,229.16,0.00,0.00,0.00,229.16
55 汪先生,139****6339,储值卡,0.00,228.07,228.07,0.00,0.00,0.00,0.00,0.00,0.00,228.07
56 王龙,186****8011,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,200.78,200.78,200.78
57 罗先生,139****9222,储值卡,0.00,0.00,0.00,0.00,199.17,199.17,0.00,0.00,0.00,199.17
58 吴生,136****3341,储值卡,0.00,0.00,0.00,0.00,99.23,99.23,0.00,99.92,99.92,199.15
59 刘女士,177****7538,储值卡,0.00,193.29,193.29,0.00,0.00,0.00,0.00,0.00,0.00,193.29
60 林总,138****1180,储值卡,0.00,0.00,0.00,0.00,183.25,183.25,0.00,0.00,0.00,183.25
61 陈淑涛,132****5485,储值卡,0.00,0.00,0.00,0.00,180.86,180.86,0.00,0.00,0.00,180.86
62 张丹逸,136****6637,储值卡,0.00,133.68,133.68,0.00,0.00,0.00,0.00,45.00,45.00,178.68
63 孙启明,137****6325,台费卡,0.00,90.00,90.00,0.00,85.00,85.00,0.00,0.00,0.00,175.00
64 陈先生,138****3964,储值卡,0.00,98.00,98.00,0.00,0.00,0.00,0.00,60.00,60.00,158.00
65 杜先生,188****4705,台费卡,0.00,48.00,48.00,0.00,99.73,99.73,0.00,0.00,0.00,147.73
66 周先生,193****6822,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,135.65,135.65,135.65
67 君姐,166****4594,储值卡,0.00,0.00,0.00,0.00,134.10,134.10,0.00,0.00,0.00,134.10
68 昌哥,137****1229,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,122.03,122.03,122.03
69 amy,137****8221,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,116.28,116.28,116.28
70 杨,130****5960,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,116.00,116.00,116.00
71 方先生,153****3185,储值卡,0.00,100.27,100.27,0.00,0.00,0.00,0.00,0.00,0.00,100.27
72 方先生,158****6447,台费卡,0.00,0.00,0.00,0.00,72.00,72.00,0.00,28.00,28.00,100.00
73 陈先生,133****6117,台费卡,0.00,0.00,0.00,0.00,100.00,100.00,0.00,0.00,0.00,100.00
74 周先生,159****9997,台费卡,0.00,0.00,0.00,0.00,61.00,61.00,0.00,37.00,37.00,98.00
75 王姐,158****8819,储值卡,0.00,97.40,97.40,0.00,0.00,0.00,0.00,0.00,0.00,97.40
76 老宋,138****4554,储值卡,0.00,0.00,0.00,0.00,93.95,93.95,0.00,0.00,0.00,93.95
77 李先生,176****5124,储值卡,0.00,90.00,90.00,0.00,0.00,0.00,0.00,0.00,0.00,90.00
78 曾先生,159****0492,储值卡,0.00,88.00,88.00,0.00,0.00,0.00,0.00,0.00,0.00,88.00
79 张先生,136****4528,台费卡,0.00,0.00,0.00,0.00,37.00,37.00,0.00,45.00,45.00,82.00
80 刘先生,137****2930,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,82.00,82.00,82.00
81 潘先生,176****7964,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,74.00,74.00,74.00
82 王先生,183****9763,台费卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,74.00,74.00,74.00
83 王先生,185****1125,台费卡,0.00,0.00,0.00,0.00,73.00,73.00,0.00,0.00,0.00,73.00
84 清,130****3087,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,72.82,72.82,72.82
85 贺斌,150****0885,活动抵用券,0.00,71.27,71.27,0.00,0.00,0.00,0.00,0.00,0.00,71.27
86 李先生,186****9266,储值卡,0.00,0.00,0.00,0.00,69.00,69.00,0.00,0.00,0.00,69.00
87 林志铭,135****4233,储值卡,0.00,0.00,0.00,0.00,66.50,66.50,0.00,0.00,0.00,66.50
88 候,131****0323,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,62.79,62.79,62.79
89 吕先生,155****0663,储值卡,0.00,62.54,62.54,0.00,0.00,0.00,0.00,0.00,0.00,62.54
90 梁先生,134****2609,台费卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,59.00,59.00,59.00
91 肖先生,156****6427,台费卡,0.00,0.00,0.00,0.00,7.00,7.00,0.00,50.00,50.00,57.00
92 婉婉,183****2742,储值卡,0.00,0.00,0.00,0.00,37.47,37.47,0.00,0.00,0.00,37.47
93 陈小姐,138****0778,储值卡,0.00,32.49,32.49,0.00,0.00,0.00,0.00,0.00,0.00,32.49
94 黄国磊,131****3045,台费卡,0.00,0.30,0.30,0.00,19.00,19.00,0.00,0.00,0.00,19.30
95 小宇,187****8077,储值卡,0.00,13.42,13.42,0.00,0.00,0.00,0.00,0.00,0.00,13.42
96 胡总,133****3091,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,1.00,1.00,1.00
97 李先生,131****4000,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
98 周先生,173****7775,台费卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
99 林先生,159****0021,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
100 魏先生,137****6862,台费卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
101 都先生,138****7796,活动抵用券,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
102 陈先生,188****8626,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
103 冯先生,155****0348,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
104 常总,185****7188,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
105 邓飛,136****9597,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
106 李先生,134****4343,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
107 谭先生,138****3185,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
108 黎先生,133****0983,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
109 刘哥,135****0020,台费卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
110 孙先生,135****3191,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
111 钟智豪,188****2803,活动抵用券,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
112 陈先生,186****8238,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
113 郭先生,156****5001,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
114 钟先生,132****3438,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
115 唐先生,135****0785,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
116 陈先生,139****0419,储值卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
117 潘先生,186****0511,台费卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
118 罗超,137****0990,台费卡,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00

View File

@@ -0,0 +1,52 @@
# 2025年10-12月 财务优惠(会员折扣+台费调账)分布
## 思考过程
用台费订单为基准关联调账表,再按客户+月份汇总,输出“谁享受了优惠”及金额分布。
## 查询说明
优惠=会员折扣(dwd_table_fee_log.member_discount_amount)+台费调账(dwd_table_fee_adjust.ledger_amount),按订单归集后汇总到客户(member_id),按订单最早开台时间切月;不含团购抵扣等其它优惠。
## SQL
### 优惠分布(客户+月份)
```sql
with base_orders as (
select
tfl.order_settle_id,
max(tfl.member_id) as member_id,
min(tfl.start_use_time) as order_start_time,
sum(tfl.member_discount_amount) as member_discount_amount
from billiards_dwd.dwd_table_fee_log tfl
where tfl.site_id = %(site_id)s
and coalesce(tfl.is_delete,0) = 0
and tfl.start_use_time >= %(window_start)s::timestamptz
and tfl.start_use_time < %(window_end)s::timestamptz
group by tfl.order_settle_id
),
adjusts as (
select
tfa.order_settle_id,
sum(tfa.ledger_amount) as adjust_amount
from billiards_dwd.dwd_table_fee_adjust tfa
join base_orders bo on bo.order_settle_id = tfa.order_settle_id
where tfa.site_id = %(site_id)s
and coalesce(tfa.is_delete,0) = 0
group by tfa.order_settle_id
)
, x as (
select
bo.member_id,
case when bo.order_start_time >= '2025-10-01 00:00:00+08'::timestamptz and bo.order_start_time < '2025-11-01 00:00:00+08'::timestamptz then '2025-10' when bo.order_start_time >= '2025-11-01 00:00:00+08'::timestamptz and bo.order_start_time < '2025-12-01 00:00:00+08'::timestamptz then '2025-11' when bo.order_start_time >= '2025-12-01 00:00:00+08'::timestamptz and bo.order_start_time < '2026-01-01 00:00:00+08'::timestamptz then '2025-12' else null end as month_key,
coalesce(bo.member_discount_amount,0) as member_discount_amount,
coalesce(a.adjust_amount,0) as adjust_amount
from base_orders bo
left join adjusts a on a.order_settle_id = bo.order_settle_id
)
select
member_id,
month_key,
sum(member_discount_amount) as member_discount_sum,
sum(adjust_amount) as adjust_sum
from x
where month_key is not null
group by member_id, month_key;
```

View File

@@ -0,0 +1,34 @@
在线抓取更新ODS 然后将更新的ODS内容对应到DWD的更新。
可以按“两段定时”跑:先在线抓取+入库更新 ODS再跑 DWD_LOAD_FROM_ODS 把新增/变更同步到 DWD。CLI 用 python -m etl_billiards.cli.main。
1) ODS在线抓取 + 入库FULL
python -m etl_billiards.cli.main ^
--pipeline-flow FULL ^
--tasks PRODUCTS,TABLES,MEMBERS,ASSISTANTS,PACKAGES_DEF,ORDERS,PAYMENTS,REFUNDS,COUPON_USAGE,INVENTORY_CHANGE,TOPUPS,TABLE_DISCOUNT,ASSISTANT_ABOLISH,LEDGER ^
--pg-dsn "%PG_DSN%" ^
--store-id %STORE_ID% ^
--api-token "%API_TOKEN%"
(可选)指定落盘目录:加 --fetch-root "D:\etl\json";美化 JSON--write-pretty-json
2) DWDODS → DWD
python -m etl_billiards.cli.main ^
--pipeline-flow INGEST_ONLY ^
--tasks DWD_LOAD_FROM_ODS ^
--pg-dsn "%PG_DSN%" ^
--store-id %STORE_ID%
推荐的环境变量
PG_DSN=postgresql://user:pwd@host:5432/db
STORE_ID=...
API_TOKEN=...
可选JSON_FETCH_ROOT=... / FETCH_ROOT=...LOG_ROOT=...
如果你希望“一条命令顺序跑完 ODS+DWD”也可以直接
python -m etl_billiards.cli.main ^
--pipeline-flow FULL ^
--tasks PRODUCTS,TABLES,MEMBERS,ASSISTANTS,PACKAGES_DEF,ORDERS,PAYMENTS,REFUNDS,COUPON_USAGE,INVENTORY_CHANGE,TOPUPS,TABLE_DISCOUNT,ASSISTANT_ABOLISH,LEDGER,DWD_LOAD_FROM_ODS ^
--pg-dsn "%PG_DSN%" ^
--store-id %STORE_ID% ^
--api-token "%API_TOKEN%"
(这会对前半段任务走在线抓取+入库,对 DWD_LOAD_FROM_ODS 只做入库阶段,因为它没有抓取逻辑。)

View File

@@ -0,0 +1,692 @@
{
"generated_at": "2026-01-16T01:53:35.751172",
"tables": [
{
"dwd_table": "billiards_dwd.dim_site",
"ods_table": "billiards_ods.table_fee_transactions",
"count": {
"dwd": 1,
"ods": 17217,
"diff": -17216
},
"amounts": []
},
{
"dwd_table": "billiards_dwd.dim_site_ex",
"ods_table": "billiards_ods.table_fee_transactions",
"count": {
"dwd": 1,
"ods": 17217,
"diff": -17216
},
"amounts": []
},
{
"dwd_table": "billiards_dwd.dim_table",
"ods_table": "billiards_ods.site_tables_master",
"count": {
"dwd": 74,
"ods": 74,
"diff": 0
},
"amounts": []
},
{
"dwd_table": "billiards_dwd.dim_table_ex",
"ods_table": "billiards_ods.site_tables_master",
"count": {
"dwd": 74,
"ods": 74,
"diff": 0
},
"amounts": []
},
{
"dwd_table": "billiards_dwd.dim_assistant",
"ods_table": "billiards_ods.assistant_accounts_master",
"count": {
"dwd": 64,
"ods": 64,
"diff": 0
},
"amounts": []
},
{
"dwd_table": "billiards_dwd.dim_assistant_ex",
"ods_table": "billiards_ods.assistant_accounts_master",
"count": {
"dwd": 64,
"ods": 64,
"diff": 0
},
"amounts": []
},
{
"dwd_table": "billiards_dwd.dim_member",
"ods_table": "billiards_ods.member_profiles",
"count": {
"dwd": 552,
"ods": 552,
"diff": 0
},
"amounts": []
},
{
"dwd_table": "billiards_dwd.dim_member_ex",
"ods_table": "billiards_ods.member_profiles",
"count": {
"dwd": 552,
"ods": 552,
"diff": 0
},
"amounts": []
},
{
"dwd_table": "billiards_dwd.dim_member_card_account",
"ods_table": "billiards_ods.member_stored_value_cards",
"count": {
"dwd": 938,
"ods": 938,
"diff": 0
},
"amounts": [
{
"column": "balance",
"dwd_sum": 406040.3,
"ods_sum": 406040.3,
"diff": 0.0
}
]
},
{
"dwd_table": "billiards_dwd.dim_member_card_account_ex",
"ods_table": "billiards_ods.member_stored_value_cards",
"count": {
"dwd": 938,
"ods": 938,
"diff": 0
},
"amounts": [
{
"column": "deliveryfeededuct",
"dwd_sum": 0.0,
"ods_sum": 0.0,
"diff": 0.0
}
]
},
{
"dwd_table": "billiards_dwd.dim_tenant_goods",
"ods_table": "billiards_ods.tenant_goods_master",
"count": {
"dwd": 170,
"ods": 170,
"diff": 0
},
"amounts": []
},
{
"dwd_table": "billiards_dwd.dim_tenant_goods_ex",
"ods_table": "billiards_ods.tenant_goods_master",
"count": {
"dwd": 170,
"ods": 170,
"diff": 0
},
"amounts": []
},
{
"dwd_table": "billiards_dwd.dim_store_goods",
"ods_table": "billiards_ods.store_goods_master",
"count": {
"dwd": 169,
"ods": 169,
"diff": 0
},
"amounts": []
},
{
"dwd_table": "billiards_dwd.dim_store_goods_ex",
"ods_table": "billiards_ods.store_goods_master",
"count": {
"dwd": 169,
"ods": 169,
"diff": 0
},
"amounts": []
},
{
"dwd_table": "billiards_dwd.dim_goods_category",
"ods_table": "billiards_ods.stock_goods_category_tree",
"count": {
"dwd": 26,
"ods": 9,
"diff": 17
},
"amounts": []
},
{
"dwd_table": "billiards_dwd.dim_groupbuy_package",
"ods_table": "billiards_ods.group_buy_packages",
"count": {
"dwd": 34,
"ods": 34,
"diff": 0
},
"amounts": []
},
{
"dwd_table": "billiards_dwd.dim_groupbuy_package_ex",
"ods_table": "billiards_ods.group_buy_packages",
"count": {
"dwd": 34,
"ods": 34,
"diff": 0
},
"amounts": []
},
{
"dwd_table": "billiards_dwd.dwd_settlement_head",
"ods_table": "billiards_ods.settlement_records",
"count": {
"dwd": 22055,
"ods": 22055,
"diff": 0
},
"amounts": []
},
{
"dwd_table": "billiards_dwd.dwd_settlement_head_ex",
"ods_table": "billiards_ods.settlement_records",
"count": {
"dwd": 22055,
"ods": 22055,
"diff": 0
},
"amounts": []
},
{
"dwd_table": "billiards_dwd.dwd_table_fee_log",
"ods_table": "billiards_ods.table_fee_transactions",
"count": {
"dwd": 17217,
"ods": 17217,
"diff": 0
},
"amounts": [
{
"column": "adjust_amount",
"dwd_sum": 294914.58,
"ods_sum": 294914.58,
"diff": 0.0
},
{
"column": "coupon_promotion_amount",
"dwd_sum": 896198.51,
"ods_sum": 896198.51,
"diff": 0.0
},
{
"column": "ledger_amount",
"dwd_sum": 1961129.99,
"ods_sum": 1961129.99,
"diff": 0.0
},
{
"column": "member_discount_amount",
"dwd_sum": 186470.94,
"ods_sum": 186470.94,
"diff": 0.0
},
{
"column": "real_table_charge_money",
"dwd_sum": 775239.96,
"ods_sum": 775239.96,
"diff": 0.0
}
]
},
{
"dwd_table": "billiards_dwd.dwd_table_fee_log_ex",
"ods_table": "billiards_ods.table_fee_transactions",
"count": {
"dwd": 17217,
"ods": 17217,
"diff": 0
},
"amounts": [
{
"column": "fee_total",
"dwd_sum": 0.0,
"ods_sum": 0.0,
"diff": 0.0
},
{
"column": "mgmt_fee",
"dwd_sum": 0.0,
"ods_sum": 0.0,
"diff": 0.0
},
{
"column": "service_money",
"dwd_sum": 0.0,
"ods_sum": 0.0,
"diff": 0.0
},
{
"column": "used_card_amount",
"dwd_sum": 0.0,
"ods_sum": 0.0,
"diff": 0.0
}
]
},
{
"dwd_table": "billiards_dwd.dwd_table_fee_adjust",
"ods_table": "billiards_ods.table_fee_discount_records",
"count": {
"dwd": 2648,
"ods": 2648,
"diff": 0
},
"amounts": [
{
"column": "ledger_amount",
"dwd_sum": 303909.03,
"ods_sum": 303909.03,
"diff": 0.0
}
]
},
{
"dwd_table": "billiards_dwd.dwd_table_fee_adjust_ex",
"ods_table": "billiards_ods.table_fee_discount_records",
"count": {
"dwd": 2648,
"ods": 2648,
"diff": 0
},
"amounts": []
},
{
"dwd_table": "billiards_dwd.dwd_store_goods_sale",
"ods_table": "billiards_ods.store_goods_sales_records",
"count": {
"dwd": 17563,
"ods": 17563,
"diff": 0
},
"amounts": [
{
"column": "cost_money",
"dwd_sum": 3116.75,
"ods_sum": 3116.75,
"diff": 0.0
},
{
"column": "ledger_amount",
"dwd_sum": 373588.1,
"ods_sum": 373588.1,
"diff": 0.0
},
{
"column": "real_goods_money",
"dwd_sum": 351914.9,
"ods_sum": 351914.9,
"diff": 0.0
}
]
},
{
"dwd_table": "billiards_dwd.dwd_store_goods_sale_ex",
"ods_table": "billiards_ods.store_goods_sales_records",
"count": {
"dwd": 466588,
"ods": 17563,
"diff": 449025
},
"amounts": [
{
"column": "coupon_deduct_money",
"dwd_sum": 0.0,
"ods_sum": 0.0,
"diff": 0.0
},
{
"column": "discount_money",
"dwd_sum": 571932.5,
"ods_sum": 21673.2,
"diff": 550259.3
},
{
"column": "member_discount_amount",
"dwd_sum": 0.0,
"ods_sum": 0.0,
"diff": 0.0
},
{
"column": "option_coupon_deduct_money",
"dwd_sum": 0.0,
"ods_sum": 0.0,
"diff": 0.0
},
{
"column": "option_member_discount_money",
"dwd_sum": 0.0,
"ods_sum": 0.0,
"diff": 0.0
},
{
"column": "point_discount_money",
"dwd_sum": 0.0,
"ods_sum": 0.0,
"diff": 0.0
},
{
"column": "point_discount_money_cost",
"dwd_sum": 0.0,
"ods_sum": 0.0,
"diff": 0.0
},
{
"column": "push_money",
"dwd_sum": 0.0,
"ods_sum": 0.0,
"diff": 0.0
}
]
},
{
"dwd_table": "billiards_dwd.dwd_assistant_service_log",
"ods_table": "billiards_ods.assistant_service_records",
"count": {
"dwd": 4252,
"ods": 4666,
"diff": -414
},
"amounts": [
{
"column": "coupon_deduct_money",
"dwd_sum": 10489.93,
"ods_sum": 10879.86,
"diff": -389.9300000000003
},
{
"column": "ledger_amount",
"dwd_sum": 1336399.55,
"ods_sum": 1459374.61,
"diff": -122975.06000000006
}
]
},
{
"dwd_table": "billiards_dwd.dwd_assistant_service_log_ex",
"ods_table": "billiards_ods.assistant_service_records",
"count": {
"dwd": 4666,
"ods": 4666,
"diff": 0
},
"amounts": [
{
"column": "manual_discount_amount",
"dwd_sum": 414.17,
"ods_sum": 414.17,
"diff": 0.0
},
{
"column": "member_discount_amount",
"dwd_sum": 0.0,
"ods_sum": 0.0,
"diff": 0.0
},
{
"column": "service_money",
"dwd_sum": 0.0,
"ods_sum": 0.0,
"diff": 0.0
}
]
},
{
"dwd_table": "billiards_dwd.dwd_assistant_trash_event",
"ods_table": "billiards_ods.assistant_cancellation_records",
"count": {
"dwd": 88,
"ods": 88,
"diff": 0
},
"amounts": []
},
{
"dwd_table": "billiards_dwd.dwd_assistant_trash_event_ex",
"ods_table": "billiards_ods.assistant_cancellation_records",
"count": {
"dwd": 88,
"ods": 88,
"diff": 0
},
"amounts": []
},
{
"dwd_table": "billiards_dwd.dwd_member_balance_change",
"ods_table": "billiards_ods.member_balance_changes",
"count": {
"dwd": 4492,
"ods": 4492,
"diff": 0
},
"amounts": []
},
{
"dwd_table": "billiards_dwd.dwd_member_balance_change_ex",
"ods_table": "billiards_ods.member_balance_changes",
"count": {
"dwd": 4492,
"ods": 4492,
"diff": 0
},
"amounts": [
{
"column": "refund_amount",
"dwd_sum": 0.0,
"ods_sum": 0.0,
"diff": 0.0
}
]
},
{
"dwd_table": "billiards_dwd.dwd_groupbuy_redemption",
"ods_table": "billiards_ods.group_buy_redemption_records",
"count": {
"dwd": 10544,
"ods": 10544,
"diff": 0
},
"amounts": [
{
"column": "coupon_money",
"dwd_sum": 668774.0,
"ods_sum": 668774.0,
"diff": 0.0
},
{
"column": "ledger_amount",
"dwd_sum": 641028.09,
"ods_sum": 641028.09,
"diff": 0.0
}
]
},
{
"dwd_table": "billiards_dwd.dwd_groupbuy_redemption_ex",
"ods_table": "billiards_ods.group_buy_redemption_records",
"count": {
"dwd": 10544,
"ods": 10544,
"diff": 0
},
"amounts": [
{
"column": "assistant_promotion_money",
"dwd_sum": 7353.59,
"ods_sum": 7353.59,
"diff": 0.0
},
{
"column": "assistant_service_promotion_money",
"dwd_sum": 0.0,
"ods_sum": 0.0,
"diff": 0.0
},
{
"column": "goods_promotion_money",
"dwd_sum": 0.0,
"ods_sum": 0.0,
"diff": 0.0
},
{
"column": "recharge_promotion_money",
"dwd_sum": 0.0,
"ods_sum": 0.0,
"diff": 0.0
},
{
"column": "reward_promotion_money",
"dwd_sum": 0.0,
"ods_sum": 0.0,
"diff": 0.0
},
{
"column": "table_service_promotion_money",
"dwd_sum": 0.0,
"ods_sum": 0.0,
"diff": 0.0
}
]
},
{
"dwd_table": "billiards_dwd.dwd_platform_coupon_redemption",
"ods_table": "billiards_ods.platform_coupon_redemption_records",
"count": {
"dwd": 16086,
"ods": 16086,
"diff": 0
},
"amounts": [
{
"column": "coupon_money",
"dwd_sum": 1040212.0,
"ods_sum": 1040212.0,
"diff": 0.0
}
]
},
{
"dwd_table": "billiards_dwd.dwd_platform_coupon_redemption_ex",
"ods_table": "billiards_ods.platform_coupon_redemption_records",
"count": {
"dwd": 16086,
"ods": 16086,
"diff": 0
},
"amounts": []
},
{
"dwd_table": "billiards_dwd.dwd_recharge_order",
"ods_table": "billiards_ods.recharge_settlements",
"count": {
"dwd": 431,
"ods": 431,
"diff": 0
},
"amounts": []
},
{
"dwd_table": "billiards_dwd.dwd_recharge_order_ex",
"ods_table": "billiards_ods.recharge_settlements",
"count": {
"dwd": 431,
"ods": 431,
"diff": 0
},
"amounts": []
},
{
"dwd_table": "billiards_dwd.dwd_payment",
"ods_table": "billiards_ods.payment_transactions",
"count": {
"dwd": 21611,
"ods": 21611,
"diff": 0
},
"amounts": [
{
"column": "pay_amount",
"dwd_sum": 2073449.0,
"ods_sum": 2073449.0,
"diff": 0.0
}
]
},
{
"dwd_table": "billiards_dwd.dwd_refund",
"ods_table": "billiards_ods.refund_transactions",
"count": {
"dwd": 42,
"ods": 42,
"diff": 0
},
"amounts": [
{
"column": "channel_fee",
"dwd_sum": 0.0,
"ods_sum": 0.0,
"diff": 0.0
},
{
"column": "pay_amount",
"dwd_sum": -68958.0,
"ods_sum": -68958.0,
"diff": 0.0
}
]
},
{
"dwd_table": "billiards_dwd.dwd_refund_ex",
"ods_table": "billiards_ods.refund_transactions",
"count": {
"dwd": 42,
"ods": 42,
"diff": 0
},
"amounts": [
{
"column": "balance_frozen_amount",
"dwd_sum": 0.0,
"ods_sum": 0.0,
"diff": 0.0
},
{
"column": "card_frozen_amount",
"dwd_sum": 0.0,
"ods_sum": 0.0,
"diff": 0.0
},
{
"column": "refund_amount",
"dwd_sum": 0.0,
"ods_sum": 0.0,
"diff": 0.0
},
{
"column": "round_amount",
"dwd_sum": 0.0,
"ods_sum": 0.0,
"diff": 0.0
}
]
}
],
"note": "行数/金额核对,金额字段基于列名包含 amount/money/fee/balance 的数值列自动扫描。"
}

View File

@@ -0,0 +1,25 @@
# fetch-test
用于放置“接口联调/规则验证”的一次性脚本(不影响主流程)。
## 近期记录 vs 历史记录(Former) 对比
脚本:`fetch-test/compare_recent_former_endpoints.py`
默认对比窗口end 为次日 00:00:00与 ETL 窗口一致):
- 近期2025-12-01 ~ 2025-12-15
- 历史2025-08-01 ~ 2025-08-15
运行:
```bash
cd etl_billiards
python fetch-test/compare_recent_former_endpoints.py
```
输出:
- `etl_billiards/fetch-test/recent_vs_former_report.md`
- `etl_billiards/fetch-test/recent_vs_former_report.json`
依赖:
- `.env` 需配置 `API_TOKEN`(或 `FICOO_TOKEN`)与 `STORE_ID`,并保证 `API_BASE` 正确。

View File

@@ -0,0 +1,434 @@
# -*- coding: utf-8 -*-
"""
对比“近期记录”与“历史记录(Former)”接口:
- 是否能正确响应HTTP + API code==0
- 返回字段(基于 sample records 的 JSON path是否一致
默认时间窗口(与 ETL 窗口语义一致end 为次日 00:00:00
- 近期2025-12-01 ~ 2025-12-15end=2025-12-16 00:00:00
- 历史2025-08-01 ~ 2025-08-15end=2025-08-16 00:00:00
"""
from __future__ import annotations
import argparse
import json
import sys
from dataclasses import asdict, dataclass
from datetime import datetime, timedelta
from pathlib import Path
from typing import Any, Iterable
from dateutil import parser as dtparser
from zoneinfo import ZoneInfo
PROJECT_ROOT = Path(__file__).resolve().parents[1]
if str(PROJECT_ROOT) not in sys.path:
sys.path.insert(0, str(PROJECT_ROOT))
from api.client import APIClient
from api.endpoint_routing import derive_former_endpoint as derive_former_endpoint_shared
from config.settings import AppConfig
from models.parsers import TypeParser
from tasks.ods_json_archive_task import EndpointSpec, OdsJsonArchiveTask
CHINESE_NAMES: dict[str, str] = {
"/MemberProfile/GetMemberCardBalanceChange": "会员余额变动",
"/AssistantPerformance/GetOrderAssistantDetails": "助教服务记录",
"/AssistantPerformance/GetAbolitionAssistant": "助教撤销/作废记录",
"/TenantGoods/GetGoodsSalesList": "商品销售记录",
"/Site/GetSiteTableUseDetails": "团购核销记录",
"/Site/GetSiteTableOrderDetails": "台费订单明细",
"/Site/GetTaiFeeAdjustList": "台费调整/优惠记录",
"/GoodsStockManage/QueryGoodsOutboundReceipt": "出库单/出库记录",
"/Promotion/GetOfflineCouponConsumePageList": "平台券核销记录",
"/Order/GetRefundPayLogList": "退款记录",
"/Site/GetAllOrderSettleList": "结账记录",
"/Site/GetRechargeSettleList": "充值结算记录",
"/PayLog/GetPayLogListPage": "支付记录",
}
@dataclass
class EndpointCheckResult:
name_zh: str
recent_endpoint: str
recent_ok: bool
former_endpoint: str
former_ok: bool
has_schema_diff: str # "是" | "否" | "未知"
diff_detail: str
recent_records: int | None = None
former_records: int | None = None
recent_error: str | None = None
former_error: str | None = None
extracted_list_key: str | None = None
def _reconfigure_stdout_utf8():
try:
sys.stdout.reconfigure(encoding="utf-8")
except Exception:
pass
def derive_former_endpoint(endpoint: str) -> str | None:
# backward compatible wrapper: keep local name but delegate to shared router
return derive_former_endpoint_shared(endpoint)
def _parse_day_start(d: str, tz: ZoneInfo) -> datetime:
dt = dtparser.parse(d)
if dt.tzinfo is None:
dt = dt.replace(tzinfo=tz)
else:
dt = dt.astimezone(tz)
return dt.replace(hour=0, minute=0, second=0, microsecond=0)
def _window_from_dates(start_date: str, end_date_inclusive: str, tz: ZoneInfo) -> tuple[datetime, datetime]:
start = _parse_day_start(start_date, tz)
end_inclusive = _parse_day_start(end_date_inclusive, tz)
end_exclusive = end_inclusive + timedelta(days=1)
return start, end_exclusive
def _build_window_params(
window_style: str,
store_id: int,
window_start: datetime,
window_end: datetime,
tz: ZoneInfo,
) -> dict:
if window_style == "none":
return {}
if window_style == "site":
return {"siteId": store_id}
if window_style == "range":
return {
"siteId": store_id,
"rangeStartTime": TypeParser.format_timestamp(window_start, tz),
"rangeEndTime": TypeParser.format_timestamp(window_end, tz),
}
if window_style == "pay":
return {
"siteId": store_id,
"StartPayTime": TypeParser.format_timestamp(window_start, tz),
"EndPayTime": TypeParser.format_timestamp(window_end, tz),
}
return {
"siteId": store_id,
"startTime": TypeParser.format_timestamp(window_start, tz),
"endTime": TypeParser.format_timestamp(window_end, tz),
}
def _extract_records(payload: dict, spec: EndpointSpec) -> tuple[list, str | None]:
# 优先使用 spec.list_key若拿不到数据再尝试自动推断None
records_primary = APIClient._extract_list(payload, spec.data_path, spec.list_key)
if records_primary:
return records_primary, spec.list_key
records_fallback = APIClient._extract_list(payload, spec.data_path, None)
if records_fallback:
return records_fallback, None
return [], spec.list_key
def _walk_paths(obj: Any, prefix: str, out: set[str], max_depth: int, depth: int, sample_list_elems: int):
if depth > max_depth:
return
if isinstance(obj, dict):
for k, v in obj.items():
if not isinstance(k, str):
k = str(k)
p = f"{prefix}.{k}" if prefix else k
out.add(p)
_walk_paths(v, p, out, max_depth, depth + 1, sample_list_elems)
elif isinstance(obj, list):
p = f"{prefix}[]" if prefix else "[]"
out.add(p)
for v in obj[:sample_list_elems]:
_walk_paths(v, p, out, max_depth, depth + 1, sample_list_elems)
def _schema_from_records(records: list, max_records: int, max_depth: int) -> set[str]:
paths: set[str] = set()
for rec in (records or [])[:max_records]:
_walk_paths(rec, "", paths, max_depth=max_depth, depth=0, sample_list_elems=5)
return paths
def _schema_from_data(payload: dict, data_path: tuple[str, ...], max_depth: int) -> set[str]:
cur: Any = payload
for k in data_path:
if isinstance(cur, dict):
cur = cur.get(k)
else:
cur = None
if cur is None:
break
paths: set[str] = set()
_walk_paths(cur, "", paths, max_depth=max_depth, depth=0, sample_list_elems=5)
return paths
def _cell(text: str) -> str:
# markdown table cell escape
s = (text or "").replace("|", "\\|").replace("\n", "<br>")
return s
def _format_diff(recent_paths: set[str], former_paths: set[str], limit: int = 60) -> tuple[str, str]:
if recent_paths == former_paths:
return "", ""
only_recent = sorted(recent_paths - former_paths)
only_former = sorted(former_paths - recent_paths)
parts: list[str] = []
if only_recent:
truncated = only_recent[:limit]
suffix = "" if len(only_recent) <= limit else f" ...(+{len(only_recent) - limit})"
parts.append(f"仅近期({len(only_recent)}): " + ", ".join(truncated) + suffix)
if only_former:
truncated = only_former[:limit]
suffix = "" if len(only_former) <= limit else f" ...(+{len(only_former) - limit})"
parts.append(f"仅历史({len(only_former)}): " + ", ".join(truncated) + suffix)
return "", "\n".join(parts).strip()
def _post_first_page(
client: APIClient,
endpoint: str,
params: dict,
page_size: int,
spec: EndpointSpec,
) -> tuple[dict, list]:
# 只拉取第 1 页,用于“能否响应”与字段对比
payload: dict | None = None
records: list = []
for _, page_records, _, raw in client.iter_paginated(
endpoint=endpoint,
params=params,
page_size=page_size,
data_path=spec.data_path,
list_key=spec.list_key,
page_end=1,
):
payload = raw
records = page_records or []
break
return (payload or {}), (records or [])
def _load_specs_for_range_only() -> list[EndpointSpec]:
# 以 ODS_JSON_ARCHIVE 的 ENDPOINTS 为准,筛选出“可定义时间范围”的接口
specs: list[EndpointSpec] = []
for spec in OdsJsonArchiveTask.ENDPOINTS:
if spec.window_style in ("start_end", "range", "pay"):
specs.append(spec)
return specs
def main() -> int:
_reconfigure_stdout_utf8()
ap = argparse.ArgumentParser()
ap.add_argument("--recent-start", default="2025-12-01")
ap.add_argument("--recent-end", default="2025-12-15")
ap.add_argument("--former-start", default="2025-08-01")
ap.add_argument("--former-end", default="2025-08-15")
ap.add_argument("--page-size", type=int, default=50)
ap.add_argument("--max-records", type=int, default=50)
ap.add_argument("--max-depth", type=int, default=5)
ap.add_argument(
"--out",
default=str(Path(__file__).with_name("recent_vs_former_report.md")),
help="输出 markdown 路径",
)
ap.add_argument(
"--out-json",
default=str(Path(__file__).with_name("recent_vs_former_report.json")),
help="输出 json 路径(含错误信息与统计)",
)
args = ap.parse_args()
cfg = AppConfig.load().config
tz = ZoneInfo(cfg["app"]["timezone"])
store_id = int(cfg["app"]["store_id"])
recent_start, recent_end = _window_from_dates(args.recent_start, args.recent_end, tz)
former_start, former_end = _window_from_dates(args.former_start, args.former_end, tz)
if not cfg["api"].get("token"):
raise SystemExit("缺少 api.token请在 .env 配置 API_TOKEN 或 FICOO_TOKEN")
client = APIClient(
base_url=cfg["api"]["base_url"],
token=cfg["api"]["token"],
timeout=int(cfg["api"].get("timeout_sec") or 20),
retry_max=int(cfg["api"].get("retries", {}).get("max_attempts") or 3),
headers_extra=cfg["api"].get("headers_extra") or {},
)
common_params = cfg["api"].get("params", {}) or {}
if not isinstance(common_params, dict):
common_params = {}
results: list[EndpointCheckResult] = []
specs = _load_specs_for_range_only()
for spec in specs:
name_zh = CHINESE_NAMES.get(spec.endpoint) or Path(spec.endpoint).name
former_endpoint = derive_former_endpoint(spec.endpoint)
# recent
recent_params = dict(common_params)
recent_params.update(_build_window_params(spec.window_style, store_id, recent_start, recent_end, tz))
recent_ok = False
recent_records: list = []
recent_payload: dict = {}
recent_err: str | None = None
try:
recent_payload, recent_records = _post_first_page(
client=client,
endpoint=spec.endpoint,
params=recent_params,
page_size=args.page_size,
spec=spec,
)
recent_ok = True
except Exception as e:
recent_err = f"{type(e).__name__}: {e}"
# former
former_params = dict(common_params)
former_params.update(_build_window_params(spec.window_style, store_id, former_start, former_end, tz))
former_ok = False
former_records: list = []
former_payload: dict = {}
former_err: str | None = None
if not former_endpoint:
former_err = "未提供历史记录接口 path"
else:
try:
former_payload, former_records = _post_first_page(
client=client,
endpoint=former_endpoint,
params=former_params,
page_size=args.page_size,
spec=spec,
)
former_ok = True
except Exception as e:
former_err = f"{type(e).__name__}: {e}"
extracted_key: str | None = spec.list_key
if recent_ok and former_ok:
# 用“更能提取出 records 的方式”来做字段对比
recent_extracted, recent_key_used = _extract_records(recent_payload, spec)
former_extracted, former_key_used = _extract_records(former_payload, spec)
extracted_key = recent_key_used or former_key_used or spec.list_key
if recent_extracted and former_extracted:
recent_schema = _schema_from_records(recent_extracted, args.max_records, args.max_depth)
former_schema = _schema_from_records(former_extracted, args.max_records, args.max_depth)
has_diff, detail = _format_diff(recent_schema, former_schema)
elif (not recent_extracted) and (not former_extracted):
has_diff, detail = "未知", "两侧 records 均为空,无法判断字段差异"
else:
has_diff, detail = (
"未知",
f"一侧 records 为空(近期={len(recent_extracted)} 历史={len(former_extracted)}),无法判断字段差异",
)
else:
if former_endpoint is None:
has_diff, detail = "未知", "无历史记录接口,跳过字段对比"
else:
has_diff, detail = "未知", "请求失败,无法对比字段"
results.append(
EndpointCheckResult(
name_zh=name_zh,
recent_endpoint=spec.endpoint,
recent_ok=recent_ok,
former_endpoint=former_endpoint or "",
former_ok=former_ok,
has_schema_diff=has_diff,
diff_detail=detail,
recent_records=len(recent_records) if recent_ok else None,
former_records=len(former_records) if former_ok else None,
recent_error=recent_err,
former_error=former_err,
extracted_list_key=extracted_key,
)
)
# markdown report
out_md = Path(args.out)
out_json = Path(args.out_json)
out_md.parent.mkdir(parents=True, exist_ok=True)
header = [
"# 近期记录 vs 历史记录(Former) 接口对比报告",
"",
f"- 近期窗口: `{recent_start.isoformat()}` ~ `{recent_end.isoformat()}`end 为次日 00:00:00",
f"- 历史窗口: `{former_start.isoformat()}` ~ `{former_end.isoformat()}`end 为次日 00:00:00",
f"- store_id: `{store_id}`",
f"- base_url: `{cfg['api']['base_url']}`",
"",
"表头:接口名称(中文);近期记录接口 path近期记录是否返回历史记录接口 path历史记录是否返回是否存在返回字段差异差异字段详情。",
"",
"| 接口名称(中文) | 近期记录接口 path | 近期记录是否返回 | 历史记录接口 path | 历史记录是否返回 | 是否存在返回字段差异 | 差异字段详情 |",
"| --- | --- | --- | --- | --- | --- | --- |",
]
rows: list[str] = []
for r in results:
rows.append(
"| "
+ " | ".join(
[
_cell(r.name_zh),
_cell(r.recent_endpoint),
"" if r.recent_ok else "",
_cell(r.former_endpoint),
"" if r.former_ok else "",
_cell(r.has_schema_diff),
_cell(r.diff_detail or ""),
]
)
+ " |"
)
out_md.write_text("\n".join(header + rows) + "\n", encoding="utf-8")
out_json.write_text(
json.dumps(
{
"recent_window": {"start": recent_start.isoformat(), "end": recent_end.isoformat()},
"former_window": {"start": former_start.isoformat(), "end": former_end.isoformat()},
"store_id": store_id,
"base_url": cfg["api"]["base_url"],
"results": [asdict(r) for r in results],
},
ensure_ascii=False,
indent=2,
)
+ "\n",
encoding="utf-8",
)
print(f"OK: wrote {out_md}")
print(f"OK: wrote {out_json}")
return 0
if __name__ == "__main__":
raise SystemExit(main())

View File

@@ -0,0 +1,196 @@
{
"recent_window": {
"start": "2025-12-01T00:00:00+08:00",
"end": "2025-12-16T00:00:00+08:00"
},
"former_window": {
"start": "2025-08-01T00:00:00+08:00",
"end": "2025-08-16T00:00:00+08:00"
},
"store_id": 2790685415443269,
"base_url": "https://pc.ficoo.vip/apiprod/admin/v1/",
"results": [
{
"name_zh": "会员余额变动",
"recent_endpoint": "/MemberProfile/GetMemberCardBalanceChange",
"recent_ok": true,
"former_endpoint": "/MemberProfile/GetFormerMemberCardBalanceChange",
"former_ok": true,
"has_schema_diff": "否",
"diff_detail": "",
"recent_records": 50,
"former_records": 50,
"recent_error": null,
"former_error": null,
"extracted_list_key": null
},
{
"name_zh": "助教服务记录",
"recent_endpoint": "/AssistantPerformance/GetOrderAssistantDetails",
"recent_ok": true,
"former_endpoint": "/AssistantPerformance/GetFormerOrderAssistantDetails",
"former_ok": true,
"has_schema_diff": "否",
"diff_detail": "",
"recent_records": 50,
"former_records": 50,
"recent_error": null,
"former_error": null,
"extracted_list_key": "orderAssistantDetails"
},
{
"name_zh": "助教撤销/作废记录",
"recent_endpoint": "/AssistantPerformance/GetAbolitionAssistant",
"recent_ok": true,
"former_endpoint": "无",
"former_ok": false,
"has_schema_diff": "未知",
"diff_detail": "无历史记录接口,跳过字段对比",
"recent_records": 18,
"former_records": null,
"recent_error": null,
"former_error": "未提供历史记录接口 path",
"extracted_list_key": "abolitionAssistants"
},
{
"name_zh": "商品销售记录",
"recent_endpoint": "/TenantGoods/GetGoodsSalesList",
"recent_ok": true,
"former_endpoint": "/TenantGoods/GetFormerGoodsSalesList",
"former_ok": true,
"has_schema_diff": "否",
"diff_detail": "",
"recent_records": 50,
"former_records": 50,
"recent_error": null,
"former_error": null,
"extracted_list_key": "orderGoodsLedgers"
},
{
"name_zh": "团购核销记录",
"recent_endpoint": "/Site/GetSiteTableUseDetails",
"recent_ok": true,
"former_endpoint": "/Site/GetSiteTableUseDetails",
"former_ok": true,
"has_schema_diff": "未知",
"diff_detail": "一侧 records 为空(近期=50 历史=0无法判断字段差异",
"recent_records": 50,
"former_records": 0,
"recent_error": null,
"former_error": null,
"extracted_list_key": "siteTableUseDetailsList"
},
{
"name_zh": "台费订单明细",
"recent_endpoint": "/Site/GetSiteTableOrderDetails",
"recent_ok": true,
"former_endpoint": "/Site/GetFormerSiteTableOrderDetails",
"former_ok": true,
"has_schema_diff": "否",
"diff_detail": "",
"recent_records": 50,
"former_records": 50,
"recent_error": null,
"former_error": null,
"extracted_list_key": "siteTableUseDetailsList"
},
{
"name_zh": "台费调整/优惠记录",
"recent_endpoint": "/Site/GetTaiFeeAdjustList",
"recent_ok": true,
"former_endpoint": "/Site/GetFormerTaiFeeAdjustList",
"former_ok": true,
"has_schema_diff": "否",
"diff_detail": "",
"recent_records": 50,
"former_records": 50,
"recent_error": null,
"former_error": null,
"extracted_list_key": "taiFeeAdjustInfos"
},
{
"name_zh": "出库单/出库记录",
"recent_endpoint": "/GoodsStockManage/QueryGoodsOutboundReceipt",
"recent_ok": true,
"former_endpoint": "/GoodsStockManage/QueryFormerGoodsOutboundReceipt",
"former_ok": true,
"has_schema_diff": "否",
"diff_detail": "",
"recent_records": 50,
"former_records": 50,
"recent_error": null,
"former_error": null,
"extracted_list_key": "queryDeliveryRecordsList"
},
{
"name_zh": "平台券核销记录",
"recent_endpoint": "/Promotion/GetOfflineCouponConsumePageList",
"recent_ok": true,
"former_endpoint": "/Promotion/GetOfflineCouponConsumePageList",
"former_ok": true,
"has_schema_diff": "否",
"diff_detail": "",
"recent_records": 50,
"former_records": 50,
"recent_error": null,
"former_error": null,
"extracted_list_key": null
},
{
"name_zh": "退款记录",
"recent_endpoint": "/Order/GetRefundPayLogList",
"recent_ok": true,
"former_endpoint": "无",
"former_ok": false,
"has_schema_diff": "未知",
"diff_detail": "无历史记录接口,跳过字段对比",
"recent_records": 5,
"former_records": null,
"recent_error": null,
"former_error": "未提供历史记录接口 path",
"extracted_list_key": null
},
{
"name_zh": "结账记录",
"recent_endpoint": "/Site/GetAllOrderSettleList",
"recent_ok": true,
"former_endpoint": "/Site/GetFormerOrderSettleList",
"former_ok": true,
"has_schema_diff": "否",
"diff_detail": "",
"recent_records": 50,
"former_records": 50,
"recent_error": null,
"former_error": null,
"extracted_list_key": "settleList"
},
{
"name_zh": "充值结算记录",
"recent_endpoint": "/Site/GetRechargeSettleList",
"recent_ok": true,
"former_endpoint": "/Site/GetFormerRechargeSettleList",
"former_ok": true,
"has_schema_diff": "否",
"diff_detail": "",
"recent_records": 39,
"former_records": 47,
"recent_error": null,
"former_error": null,
"extracted_list_key": "settleList"
},
{
"name_zh": "支付记录",
"recent_endpoint": "/PayLog/GetPayLogListPage",
"recent_ok": true,
"former_endpoint": "/PayLog/GetFormerPayLogListPage",
"former_ok": true,
"has_schema_diff": "否",
"diff_detail": "",
"recent_records": 50,
"former_records": 50,
"recent_error": null,
"former_error": null,
"extracted_list_key": null
}
]
}

View File

@@ -0,0 +1,24 @@
# 近期记录 vs 历史记录(Former) 接口对比报告
- 近期窗口: `2025-12-01T00:00:00+08:00` ~ `2025-12-16T00:00:00+08:00`end 为次日 00:00:00
- 历史窗口: `2025-08-01T00:00:00+08:00` ~ `2025-08-16T00:00:00+08:00`end 为次日 00:00:00
- store_id: `2790685415443269`
- base_url: `https://pc.ficoo.vip/apiprod/admin/v1/`
表头:接口名称(中文);近期记录接口 path近期记录是否返回历史记录接口 path历史记录是否返回是否存在返回字段差异差异字段详情。
| 接口名称(中文) | 近期记录接口 path | 近期记录是否返回 | 历史记录接口 path | 历史记录是否返回 | 是否存在返回字段差异 | 差异字段详情 |
| --- | --- | --- | --- | --- | --- | --- |
| 会员余额变动 | /MemberProfile/GetMemberCardBalanceChange | 是 | /MemberProfile/GetFormerMemberCardBalanceChange | 是 | 否 | |
| 助教服务记录 | /AssistantPerformance/GetOrderAssistantDetails | 是 | /AssistantPerformance/GetFormerOrderAssistantDetails | 是 | 否 | |
| 助教撤销/作废记录 | /AssistantPerformance/GetAbolitionAssistant | 是 | 无 | 否 | 未知 | 无历史记录接口,跳过字段对比 |
| 商品销售记录 | /TenantGoods/GetGoodsSalesList | 是 | /TenantGoods/GetFormerGoodsSalesList | 是 | 否 | |
| 团购核销记录 | /Site/GetSiteTableUseDetails | 是 | /Site/GetSiteTableUseDetails | 是 | 未知 | 一侧 records 为空(近期=50 历史=0无法判断字段差异 |
| 台费订单明细 | /Site/GetSiteTableOrderDetails | 是 | /Site/GetFormerSiteTableOrderDetails | 是 | 否 | |
| 台费调整/优惠记录 | /Site/GetTaiFeeAdjustList | 是 | /Site/GetFormerTaiFeeAdjustList | 是 | 否 | |
| 出库单/出库记录 | /GoodsStockManage/QueryGoodsOutboundReceipt | 是 | /GoodsStockManage/QueryFormerGoodsOutboundReceipt | 是 | 否 | |
| 平台券核销记录 | /Promotion/GetOfflineCouponConsumePageList | 是 | /Promotion/GetOfflineCouponConsumePageList | 是 | 否 | |
| 退款记录 | /Order/GetRefundPayLogList | 是 | 无 | 否 | 未知 | 无历史记录接口,跳过字段对比 |
| 结账记录 | /Site/GetAllOrderSettleList | 是 | /Site/GetFormerOrderSettleList | 是 | 否 | |
| 充值结算记录 | /Site/GetRechargeSettleList | 是 | /Site/GetFormerRechargeSettleList | 是 | 否 | |
| 支付记录 | /PayLog/GetPayLogListPage | 是 | /PayLog/GetFormerPayLogListPage | 是 | 否 | |

View File

@@ -39,9 +39,18 @@ class RunTracker:
self.db.commit()
return run_id
def update_run(self, run_id: int, counts: dict, status: str,
ended_at: datetime = None, manifest: dict = None,
error_message: str = None):
def update_run(
self,
run_id: int,
counts: dict,
status: str,
ended_at: datetime = None,
manifest: dict = None,
error_message: str = None,
window: dict | None = None,
request_params: dict | None = None,
overlap_seconds: int | None = None,
):
"""更新运行记录"""
sql = """
UPDATE etl_admin.etl_run
@@ -54,17 +63,65 @@ class RunTracker:
status = %s,
ended_at = %s,
manifest = %s,
error_message = %s
error_message = %s,
window_start = COALESCE(%s, window_start),
window_end = COALESCE(%s, window_end),
window_minutes = COALESCE(%s, window_minutes),
overlap_seconds = COALESCE(%s, overlap_seconds),
request_params = CASE WHEN %s IS NULL THEN request_params ELSE %s::jsonb END
WHERE run_id = %s
"""
def _count(v, default: int = 0) -> int:
if v is None:
return default
if isinstance(v, bool):
return int(v)
if isinstance(v, int):
return int(v)
if isinstance(v, str):
try:
return int(v)
except Exception:
return default
if isinstance(v, (list, tuple, set, dict)):
try:
return len(v)
except Exception:
return default
return default
safe_counts = counts or {}
window_start = None
window_end = None
window_minutes = None
if isinstance(window, dict):
window_start = window.get("start") or window.get("window_start")
window_end = window.get("end") or window.get("window_end")
window_minutes = window.get("minutes") or window.get("window_minutes")
request_json = None if request_params is None else json.dumps(request_params or {}, ensure_ascii=False)
self.db.execute(
sql,
(counts.get("fetched", 0), counts.get("inserted", 0),
counts.get("updated", 0), counts.get("skipped", 0),
counts.get("errors", 0), counts.get("unknown_fields", 0),
status, ended_at,
json.dumps(manifest or {}, ensure_ascii=False),
error_message, run_id)
(
_count(safe_counts.get("fetched", 0)),
_count(safe_counts.get("inserted", 0)),
_count(safe_counts.get("updated", 0)),
_count(safe_counts.get("skipped", 0)),
_count(safe_counts.get("errors", 0)),
_count(safe_counts.get("unknown_fields", 0)),
status,
ended_at,
json.dumps(manifest or {}, ensure_ascii=False),
error_message,
window_start,
window_end,
window_minutes,
overlap_seconds,
request_json,
request_json,
run_id,
),
)
self.db.commit()

View File

@@ -1,7 +1,17 @@
# -*- coding: utf-8 -*-
"""ETL 调度:支持在线抓取、离线清洗入库、全流程三种模式。"""
"""ETL 调度:支持在线抓取、离线清洗入库、全流程三种模式。
说明:
为了便于排障与审计,调度器默认会在每次运行时将日志写入文件:
`io.log_root/<run_uuid>.log`。
- 该文件路径会同步写入 `etl_admin.etl_run.log_path` 字段(由 RunTracker 记录)。
- 文件日志通过给 root logger 动态挂载 FileHandler 实现,保证即便子模块使用
`logging.getLogger(__name__)` 也能写入同一份日志文件。
"""
from __future__ import annotations
import logging
import uuid
from datetime import datetime
from pathlib import Path
@@ -50,6 +60,40 @@ class ETLScheduler:
self.run_tracker = RunTracker(self.db_conn)
self.task_registry = default_registry
def _attach_run_file_logger(self, run_uuid: str) -> logging.Handler | None:
"""
为本次 run_uuid 动态挂载文件日志处理器。
返回值:
- 成功:返回 FileHandler调用方负责 removeHandler/close
- 失败:返回 None不中断主流程
"""
log_root = Path(self.config["io"]["log_root"])
try:
log_root.mkdir(parents=True, exist_ok=True)
except Exception as exc: # noqa: BLE001
self.logger.warning("创建日志目录失败:%s%s", log_root, exc)
return None
log_path = log_root / f"{run_uuid}.log"
try:
handler: logging.Handler = logging.FileHandler(log_path, encoding="utf-8")
except Exception as exc: # noqa: BLE001
self.logger.warning("创建文件日志失败:%s%s", log_path, exc)
return None
fmt = logging.Formatter(
fmt="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
datefmt="%Y-%m-%d %H:%M:%S",
)
handler.setFormatter(fmt)
handler.setLevel(logging.INFO)
# 挂到 root logger保证各模块 logger 都能写入同一文件。
root_logger = logging.getLogger()
root_logger.addHandler(handler)
return handler
# ------------------------------------------------------------------ public
def run_tasks(self, task_codes: list | None = None):
"""按配置或传入列表执行任务。"""
@@ -59,16 +103,28 @@ class ETLScheduler:
if not task_codes:
task_codes = self.config.get("run.tasks", [])
self.logger.info("开始运行任务: %s, run_uuid=%s", task_codes, run_uuid)
file_handler = self._attach_run_file_logger(run_uuid)
try:
self.logger.info("开始运行任务: %s, run_uuid=%s", task_codes, run_uuid)
for task_code in task_codes:
try:
self._run_single_task(task_code, run_uuid, store_id)
except Exception as exc: # noqa: BLE001
self.logger.error("任务 %s 失败: %s", task_code, exc, exc_info=True)
continue
for task_code in task_codes:
try:
self._run_single_task(task_code, run_uuid, store_id)
except Exception as exc: # noqa: BLE001
self.logger.error("任务 %s 失败: %s", task_code, exc, exc_info=True)
continue
self.logger.info("所有任务执行完成")
self.logger.info("所有任务执行完成")
finally:
if file_handler is not None:
try:
logging.getLogger().removeHandler(file_handler)
except Exception:
pass
try:
file_handler.close()
except Exception:
pass
# ------------------------------------------------------------------ internals
def _run_single_task(self, task_code: str, run_uuid: str, store_id: int):
@@ -98,6 +154,37 @@ class ETLScheduler:
fetch_stats = None
try:
# ODS_* tasks (except ODS_JSON_ARCHIVE) don't implement extract/transform/load stages in this repo
# version, so we execute them as a single step with the appropriate API client.
if self._is_ods_task(task_code):
if self.pipeline_flow in {"FULL", "FETCH_ONLY"}:
result, _ = self._execute_ods_record_and_load(task_code, cursor_data, fetch_dir, run_id)
else:
source_dir = self._resolve_ingest_source(fetch_dir, None)
result = self._execute_ingest(task_code, cursor_data, source_dir)
self.run_tracker.update_run(
run_id=run_id,
counts=result.get("counts") or {},
status=self._map_run_status(result.get("status")),
ended_at=datetime.now(self.tz),
window=result.get("window"),
request_params=result.get("request_params"),
overlap_seconds=self.config.get("run.overlap_seconds"),
)
if (result.get("status") or "").upper() == "SUCCESS":
window = result.get("window")
if isinstance(window, dict):
self.cursor_mgr.advance(
task_id=task_id,
store_id=store_id,
window_start=window.get("start"),
window_end=window.get("end"),
run_id=run_id,
)
return
if self._flow_includes_fetch():
fetch_stats = self._execute_fetch(task_code, cursor_data, fetch_dir, run_id)
if self.pipeline_flow == "FETCH_ONLY":
@@ -119,6 +206,9 @@ class ETLScheduler:
counts=result["counts"],
status=self._map_run_status(result["status"]),
ended_at=datetime.now(self.tz),
window=result.get("window"),
request_params=result.get("request_params"),
overlap_seconds=self.config.get("run.overlap_seconds"),
)
if (result.get("status") or "").upper() == "SUCCESS":
@@ -158,7 +248,10 @@ class ETLScheduler:
extracted = task.extract(context)
# 抓取结束,不执行 transform/load
stats = recording_client.last_dump or {}
fetched_count = stats.get("records") or len(extracted.get("records", [])) if isinstance(extracted, dict) else 0
extracted_count = 0
if isinstance(extracted, dict):
extracted_count = int(extracted.get("fetched") or 0) or len(extracted.get("records", []))
fetched_count = stats.get("records") or extracted_count or 0
self.logger.info(
"%s: 抓取完成,文件=%s,记录数=%s",
task_code,
@@ -167,6 +260,34 @@ class ETLScheduler:
)
return {"file": stats.get("file"), "records": fetched_count, "pages": stats.get("pages")}
@staticmethod
def _is_ods_task(task_code: str) -> bool:
tc = str(task_code or "").upper()
return tc.startswith("ODS_") and tc != "ODS_JSON_ARCHIVE"
def _execute_ods_record_and_load(
self,
task_code: str,
cursor_data: dict | None,
fetch_dir: Path,
run_id: int,
) -> tuple[dict, dict]:
"""
Execute an ODS task with RecordingAPIClient so it fetches online and writes JSON dumps.
(ODS tasks in this repo perform DB upsert inside execute(); there is no staged extract/load.)
"""
recording_client = RecordingAPIClient(
base_client=self.api_client,
output_dir=fetch_dir,
task_code=task_code,
run_id=run_id,
write_pretty=self.write_pretty_json,
)
task = self.task_registry.create_task(task_code, self.config, self.db_ops, recording_client, self.logger)
self.logger.info("%s: ODS fetch+load start, dir=%s", task_code, fetch_dir)
result = task.execute(cursor_data)
return result, (recording_client.last_dump or {})
def _execute_ingest(self, task_code: str, cursor_data: dict | None, source_dir: Path):
"""本地清洗入库:使用 LocalJsonClient 回放 JSON走原有任务 ETL。"""
local_client = LocalJsonClient(source_dir)

Some files were not shown because too many files have changed in this diff Show More