Commit 4e070bd1 by 江名洋

feat(analysis): 支持日期范围筛选并丰富门店基础信息

1 parent 3ed058b0
...@@ -131,7 +131,7 @@ async def run_ods_sync(background_tasks: BackgroundTasks, source_table: str = No ...@@ -131,7 +131,7 @@ async def run_ods_sync(background_tasks: BackgroundTasks, source_table: str = No
@router.post("/etl/run-dw") @router.post("/etl/run-dw")
async def run_dw_sync( async def run_dw_sync(
background_tasks: BackgroundTasks, background_tasks: BackgroundTasks,
layer: str = Form(...), layer: str = Form(None),
start_date: str = Form(None), start_date: str = Form(None),
end_date: str = Form(None), end_date: str = Form(None),
full_sync: str = Form(None) full_sync: str = Form(None)
...@@ -140,8 +140,11 @@ async def run_dw_sync( ...@@ -140,8 +140,11 @@ async def run_dw_sync(
- 默认增量同步(最近一天) - 默认增量同步(最近一天)
- full_sync=true 时全量覆盖 - full_sync=true 时全量覆盖
- 指定 start_date/end_date 时按日期范围处理 - 指定 start_date/end_date 时按日期范围处理
- 参数支持 Form 或 Query 方式传递
""" """
try: try:
if not layer:
raise HTTPException(status_code=400, detail="缺少必要参数: layer")
task_id = f"manual_{layer.lower()}_sync" task_id = f"manual_{layer.lower()}_sync"
background_tasks.add_task(ETLService.run_dw_sync, layer, start_date, end_date, task_id, full_sync) background_tasks.add_task(ETLService.run_dw_sync, layer, start_date, end_date, task_id, full_sync)
return { return {
...@@ -153,6 +156,29 @@ async def run_dw_sync( ...@@ -153,6 +156,29 @@ async def run_dw_sync(
raise HTTPException(status_code=500, detail=str(e)) raise HTTPException(status_code=500, detail=str(e))
@router.get("/etl/run-dw")
async def run_dw_sync_get(
background_tasks: BackgroundTasks,
layer: str = Query(...),
start_date: str = Query(None),
end_date: str = Query(None),
full_sync: str = Query(None)
):
"""GET 方式触发 DWS/DWM/DWA 加工 (支持 Query 参数)
- 用法: GET /api/etl/run-dw?layer=DWS&full_sync=true
"""
try:
task_id = f"manual_{layer.lower()}_sync"
background_tasks.add_task(ETLService.run_dw_sync, layer, start_date, end_date, task_id, full_sync)
return {
"status": "success",
"message": f"{layer} 加工任务已在后台启动,请查看执行历史获取进度。"
}
except Exception as e:
logger.error(f"Failed to start background {layer} sync: {e}")
raise HTTPException(status_code=500, detail=str(e))
# ==================== 数据分析接口 ==================== # ==================== 数据分析接口 ====================
@router.get("/analysis/template/{template_type}") @router.get("/analysis/template/{template_type}")
...@@ -228,7 +254,11 @@ async def analysis_upload( ...@@ -228,7 +254,11 @@ async def analysis_upload(
@router.post("/analysis/generate") @router.post("/analysis/generate")
async def analysis_generate(background_tasks: BackgroundTasks): async def analysis_generate(
background_tasks: BackgroundTasks,
start_date: str = Form(None),
end_date: str = Form(None)
):
"""根据已上传的数据生成生态系数分析报表""" """根据已上传的数据生成生态系数分析报表"""
global _analysis_store_file global _analysis_store_file
...@@ -249,7 +279,11 @@ async def analysis_generate(background_tasks: BackgroundTasks): ...@@ -249,7 +279,11 @@ async def analysis_generate(background_tasks: BackgroundTasks):
try: try:
store_df = AnalysisService.read_store_list(_analysis_store_file) store_df = AnalysisService.read_store_list(_analysis_store_file)
factory_sheets = AnalysisService.read_factory_data(factory_path) factory_sheets = AnalysisService.read_factory_data(factory_path)
output_path = AnalysisService.build_report(store_df, factory_sheets) output_path = AnalysisService.build_report(
store_df, factory_sheets,
start_date=start_date or None,
end_date=end_date or None
)
return { return {
"status": "success", "status": "success",
......
...@@ -11,7 +11,7 @@ import pandas as pd ...@@ -11,7 +11,7 @@ import pandas as pd
import numpy as np import numpy as np
import pymysql import pymysql
from datetime import date, timedelta from datetime import date, timedelta
from openpyxl import Workbook from openpyxl import load_workbook
from openpyxl.styles import Font, PatternFill, Alignment, Border, Side from openpyxl.styles import Font, PatternFill, Alignment, Border, Side
from openpyxl.utils import get_column_letter from openpyxl.utils import get_column_letter
...@@ -227,15 +227,15 @@ class AnalysisService: ...@@ -227,15 +227,15 @@ class AnalysisService:
yesterday = (date.today() - timedelta(days=1)).strftime('%Y-%m-%d') yesterday = (date.today() - timedelta(days=1)).strftime('%Y-%m-%d')
return yesterday, yesterday return yesterday, yesterday
# 鸿蒙智行 first_brand_id(参考 generate_weekly_comparison.py:34)
FIRST_BRAND_ID = 2365
@staticmethod @staticmethod
def _query_store_performance(store_names: list, start_date: str, end_date: str) -> dict: def _query_store_performance(store_names: list, start_date: str, end_date: str) -> dict:
""" """
从数据库查询门店在指定日期范围内的产值表数据 从数据库查询门店在指定日期范围内的产值表数据
返回: {store_name: {
"delivery": int, "touch": int, "touch_rate": float,
"yb_orders": int, "axb_orders": int, "battery_orders": int, "tire_orders": int
}}
参考 generate_weekly_comparison.py query_weekly_detail() 的 SQL 逻辑。
数据来源: dws_merchant_daily_wide (DWS商户日宽表) 数据来源: dws_merchant_daily_wide (DWS商户日宽表)
- delivery_count: 门店交付数 - delivery_count: 门店交付数
- sum_equity_to_shop: 售前触客总数 - sum_equity_to_shop: 售前触客总数
...@@ -243,6 +243,13 @@ class AnalysisService: ...@@ -243,6 +243,13 @@ class AnalysisService:
- sum_ax_package: 安心包成交总数 - sum_ax_package: 安心包成交总数
- sum_battery_extended: 电池延保成交总数 - sum_battery_extended: 电池延保成交总数
- sum_tire_warranty: 轮胎险成交总数 - sum_tire_warranty: 轮胎险成交总数
返回: {store_name: {
"delivery": int, "touch": int, "touch_rate": float,
"yb_orders": int, "axb_orders": int, "battery_orders": int, "tire_orders": int,
"province_name": str, "area_supervision": str,
"flight_supervision": str, "online_supervision": str,
}}
""" """
from app.core.config import settings from app.core.config import settings
...@@ -264,21 +271,54 @@ class AnalysisService: ...@@ -264,21 +271,54 @@ class AnalysisService:
placeholders = ", ".join(["%s"] * len(store_names)) placeholders = ", ".join(["%s"] * len(store_names))
sql = f""" sql = f"""
SELECT SELECT
merchant_name, m.merchant_name,
SUM(delivery_count) as total_delivery, m.merchant_id,
SUM(sum_equity_to_shop) as total_touch, m.total_delivery,
SUM(sum_extended_warranty) as total_yb_orders, m.total_touch,
SUM(sum_ax_package) as total_axb_orders, m.total_yb_orders,
SUM(sum_battery_extended) as total_battery_orders, m.total_axb_orders,
SUM(sum_tire_warranty) as total_tire_orders m.total_battery_orders,
FROM dws_merchant_daily_wide m.total_tire_orders,
WHERE merchant_name IN ({placeholders}) m.province_name,
AND report_date BETWEEN %s AND %s m.area_supervision,
GROUP BY merchant_name m.flight_supervision,
m.online_supervision,
sc.operation_mode
FROM (
SELECT
merchant_id,
merchant_name,
province_name,
area_supervision,
flight_supervision,
online_supervision,
SUM(IFNULL(delivery_count, 0)) AS total_delivery,
SUM(IFNULL(sum_equity_to_shop, 0)) AS total_touch,
SUM(IFNULL(sum_extended_warranty, 0)) AS total_yb_orders,
SUM(IFNULL(sum_ax_package, 0)) AS total_axb_orders,
SUM(IFNULL(sum_battery_extended, 0)) AS total_battery_orders,
SUM(IFNULL(sum_tire_warranty, 0)) AS total_tire_orders
FROM dws_merchant_daily_wide
WHERE report_date >= %s AND report_date <= %s
AND first_brand_id = %s And scene_type = '0'
GROUP BY merchant_id, merchant_name, province_name,
area_supervision, flight_supervision, online_supervision
) m
LEFT JOIN ods_store_config sc
ON m.merchant_id = sc.merchant_id AND sc.deleted_flag = 'N'
WHERE m.merchant_name IN ({placeholders})
""" """
params = [start_date, end_date, AnalysisService.FIRST_BRAND_ID] + list(store_names)
# 打印实际执行的SQL(用于调试)
_debug_sql = sql
for i, p in enumerate(params):
_debug_sql = _debug_sql.replace("%s", repr(p), 1)
logger.info(f"_query_store_performance SQL:\n{_debug_sql}")
with conn.cursor() as cur: with conn.cursor() as cur:
cur.execute(sql, (*store_names, start_date, end_date)) cur.execute(sql, params)
rows = cur.fetchall() rows = cur.fetchall()
result = {} result = {}
...@@ -294,11 +334,19 @@ class AnalysisService: ...@@ -294,11 +334,19 @@ class AnalysisService:
"axb_orders": int(row['total_axb_orders'] or 0), "axb_orders": int(row['total_axb_orders'] or 0),
"battery_orders": int(row['total_battery_orders'] or 0), "battery_orders": int(row['total_battery_orders'] or 0),
"tire_orders": int(row['total_tire_orders'] or 0), "tire_orders": int(row['total_tire_orders'] or 0),
# 门店基础信息:从 dws_merchant_daily_wide 直接取(参考文件做法)
"province_name": row.get('province_name') or "",
"area_supervision": row.get('area_supervision') or "",
"flight_supervision": row.get('flight_supervision') or "",
"online_supervision": row.get('online_supervision') or "",
# 运营模式从 ods_store_config 补充
"operation_mode": row.get('operation_mode') or "非直营",
} }
logger.info( logger.info(
f"Queried performance for {len(store_names)} stores " f"Queried performance for {len(store_names)} stores "
f"({start_date} ~ {end_date}), got {len(result)} results" f"({start_date} ~ {end_date}, first_brand_id={AnalysisService.FIRST_BRAND_ID}), "
f"got {len(result)} results"
) )
return result return result
...@@ -310,6 +358,136 @@ class AnalysisService: ...@@ -310,6 +358,136 @@ class AnalysisService:
conn.close() conn.close()
@staticmethod @staticmethod
def _query_store_info(store_names: list) -> dict:
"""
从 ods_store_info 门店基础信息汇总表查询
返回: {store_name: {
"province_name": str, # 区域(省)
"direct_sale": str, # 直营/非直营
"area_supervision": str, # 区域运营负责人
"flight_supervision": str, # 飞行督导负责人
"online_supervision": str, # 线上运营负责人
}}
"""
from app.core.config import settings
if not store_names:
return {}
conn = None
try:
conn = pymysql.connect(
host=settings.DB_HOST,
port=settings.DB_PORT,
user=settings.DB_USER,
password=settings.DB_PASSWORD,
database=settings.DB_NAME,
charset='utf8mb4',
cursorclass=pymysql.cursors.DictCursor
)
placeholders = ", ".join(["%s"] * len(store_names))
sql = f"""
SELECT
merchant_name,
province_name,
operation_mode,
area_manager,
flight_supervisor,
online_ops
FROM ods_store_info
WHERE merchant_name IN ({placeholders})
AND deleted_flag = 'N'
"""
with conn.cursor() as cur:
cur.execute(sql, (*store_names,))
rows = cur.fetchall()
result = {}
for row in rows:
name = row.get('merchant_name')
if not name:
continue
result[name] = {
"province_name": row.get('province_name') or "",
"direct_sale": row.get('operation_mode') or "非直营",
"area_supervision": row.get('area_manager') or "",
"flight_supervision": row.get('flight_supervisor') or "",
"online_supervision": row.get('online_ops') or "",
}
logger.info(
f"Queried store info for {len(store_names)} stores, got {len(result)} results"
)
return result
except Exception as e:
logger.error(f"Failed to query store info from DB: {e}", exc_info=True)
return {}
finally:
if conn:
conn.close()
@staticmethod
def _refresh_store_info():
"""从现有 ODS 表(ods_store_config + ods_service_merchant)刷新 ods_store_info"""
from app.core.config import settings
conn = None
try:
conn = pymysql.connect(
host=settings.DB_HOST,
port=settings.DB_PORT,
user=settings.DB_USER,
password=settings.DB_PASSWORD,
database=settings.DB_NAME,
charset='utf8mb4',
cursorclass=pymysql.cursors.DictCursor
)
sql = """
INSERT INTO ods_store_info
(merchant_id, merchant_name, province_name,
operation_mode, area_manager, flight_supervisor, online_ops)
SELECT
sc.merchant_id,
sc.merchant_name,
IFNULL(sm.province_name, sc.province) as province_name,
IFNULL(sc.operation_mode, '非直营') as operation_mode,
sc.area_manager,
sc.flight_supervisor,
sc.online_ops
FROM ods_store_config sc
LEFT JOIN ods_service_merchant sm
ON sc.merchant_id = sm.merchant_id
WHERE sc.merchant_name IS NOT NULL
ON DUPLICATE KEY UPDATE
merchant_name = VALUES(merchant_name),
province_name = VALUES(province_name),
operation_mode = VALUES(operation_mode),
area_manager = VALUES(area_manager),
flight_supervisor = VALUES(flight_supervisor),
online_ops = VALUES(online_ops)
"""
with conn.cursor() as cur:
cur.execute(sql)
rowcount = cur.rowcount
conn.commit()
logger.info(f"Refreshed ods_store_info: {rowcount} rows affected")
return True
except Exception as e:
logger.error(f"Failed to refresh ods_store_info: {e}", exc_info=True)
return False
finally:
if conn:
conn.close()
@staticmethod
def build_report(store_df: pd.DataFrame, factory_sheets: dict, def build_report(store_df: pd.DataFrame, factory_sheets: dict,
start_date: str = None, end_date: str = None) -> str: start_date: str = None, end_date: str = None) -> str:
""" """
...@@ -341,10 +519,12 @@ class AnalysisService: ...@@ -341,10 +519,12 @@ class AnalysisService:
start_date, end_date = last_month_26, yesterday start_date, end_date = last_month_26, yesterday
date_range_label = f"{start_date} ~ {end_date}" date_range_label = f"{start_date} ~ {end_date}"
# 查询数据库产值数据 # 查询数据库产值数据(包含门店基础信息:区域、运营负责人等)
# 参考 generate_weekly_comparison.py query_weekly_detail() 的 SQL 逻辑
store_names = [str(n) for n in store_df["门店名"].tolist() if pd.notna(n)] store_names = [str(n) for n in store_df["门店名"].tolist() if pd.notna(n)]
db_perf = AnalysisService._query_store_performance(store_names, start_date, end_date) db_perf = AnalysisService._query_store_performance(store_names, start_date, end_date)
logger.info(f"DB performance data fetched for {len(db_perf)} stores ({start_date} ~ {end_date})") logger.info(f"DB performance + store info fetched for {len(db_perf)} stores "
f"({start_date} ~ {end_date}, first_brand_id={AnalysisService.FIRST_BRAND_ID})")
# 复制模板到输出目录 # 复制模板到输出目录
output_dir = "temp_uploads" output_dir = "temp_uploads"
...@@ -360,17 +540,16 @@ class AnalysisService: ...@@ -360,17 +540,16 @@ class AnalysisService:
wb = load_workbook(output_path) wb = load_workbook(output_path)
ws = wb["问界生态系数(5.26-6.14)"] ws = wb["问界生态系数(5.26-6.14)"]
# 保留样式模板(从第4行获取每个单元格的样式) # 读取第4行公式(在清除数据之前),用于后续写入公式而非静态值
template_styles = {} formula_map = {} # {col_index: formula_text}
for col in range(1, 54): for col in range(1, 54):
cell = ws.cell(row=4, column=col) cell = ws.cell(row=4, column=col)
template_styles[col] = { val = cell.value
"font": cell.font, if val is not None:
"fill": cell.fill, if isinstance(val, str) and val.startswith('='):
"border": cell.border, formula_map[col] = val
"alignment": cell.alignment, elif hasattr(val, 'text'):
"number_format": cell.number_format, formula_map[col] = val.text
}
# 清除旧数据(第4行到 max_row) # 清除旧数据(第4行到 max_row)
for r in range(4, ws.max_row + 1): for r in range(4, ws.max_row + 1):
...@@ -378,8 +557,8 @@ class AnalysisService: ...@@ -378,8 +557,8 @@ class AnalysisService:
ws.cell(row=r, column=c).value = None ws.cell(row=r, column=c).value = None
# 写入新数据 # 写入新数据
AnalysisService._write_data_rows(ws, store_df, factory_sheets, db_perf, AnalysisService._write_data_rows(ws, store_df, factory_sheets, db_perf,
template_styles, start_date, end_date) start_date, end_date, formula_map)
wb.save(output_path) wb.save(output_path)
logger.info(f"Report generated: {output_path}") logger.info(f"Report generated: {output_path}")
...@@ -422,121 +601,153 @@ class AnalysisService: ...@@ -422,121 +601,153 @@ class AnalysisService:
cell.border = THIN_BORDER cell.border = THIN_BORDER
@staticmethod @staticmethod
def _write_data_rows(ws, store_df, factory_sheets, db_perf: dict = None): def _write_data_rows(ws, store_df, factory_sheets, db_perf: dict = None,
"""写入数据行 start_date: str = None, end_date: str = None,
formula_map: dict = None):
"""写入数据行到模板,从第4行开始
Args: Args:
db_perf: 从数据库查询的门店产值数据 {store_name: {"delivery": int, "touch": int, "touch_rate": float}} db_perf: 从数据库查询的门店产值数据
start_date/end_date: 查询日期范围
formula_map: 模板第4行的公式映射 {col: formula_text},有公式的列直接写入公式
""" """
if db_perf is None: if db_perf is None:
db_perf = {} db_perf = {}
if formula_map is None:
formula_map = {}
# 使用第一个sheet的主机厂数据(主sheet,如"(5.26-6.21)")
if not factory_sheets: if not factory_sheets:
logger.warning("No factory data available") logger.warning("No factory data available")
return return
# 取数据行最多的那个sheet作为主数据
main_sheet_name = max(factory_sheets.keys(), key=lambda k: len(factory_sheets[k])) main_sheet_name = max(factory_sheets.keys(), key=lambda k: len(factory_sheets[k]))
factory_df = factory_sheets[main_sheet_name].copy() factory_df = factory_sheets[main_sheet_name].copy()
# 提取sheet名中的日期范围作为兜底月份 # 兜底月份显示
date_range = main_sheet_name.strip("()()") if start_date and end_date:
date_range = f"{start_date} ~ {end_date}"
else:
date_range = main_sheet_name.strip("()()")
# 按门店名合并
merged = pd.merge( merged = pd.merge(
store_df, factory_df, store_df, factory_df,
on="门店名", how="left", suffixes=("", "_factory") on="门店名", how="left", suffixes=("", "_factory")
) )
# 找出哪个是真正的"区域(省)"列
province_col = None province_col = None
for c in merged.columns: for c in merged.columns:
if c == "区域(省)" or c == "区域(省)_factory": if c == "区域(省)" or c == "区域(省)_factory":
province_col = c province_col = c
row_num = 4 # 数据从第4行开始 def _style_cell(r, c, value):
for idx, row in merged.iterrows(): """设置单元格值和样式(使用固定样式,不从模板copy不可哈希的StyleProxy对象)"""
store_name = row.get("门店名", "") cell = ws.cell(row=r, column=c, value=value)
cell.font = Font(name="微软雅黑", size=10)
cell.border = THIN_BORDER
cell.alignment = Alignment(horizontal="center", vertical="center", wrap_text=True)
# 根据列和值类型设置数字格式
if isinstance(value, (int, float)):
if c in (18, 23, 24, 25, 26, 34, 35, 36): # 触客率/渗透率/转化率
cell.number_format = '0.00%'
elif c in (27, 28, 29, 30): # 生态系数
cell.number_format = '0.0'
elif c in (50,): # 门店等级文字
pass
else:
cell.number_format = '0'
return cell
row_num = 4
for idx, store_row in merged.iterrows():
store_name = store_row.get("门店名", "")
if pd.isna(store_name) or str(store_name).strip() == "": if pd.isna(store_name) or str(store_name).strip() == "":
continue continue
# 基础信息 (A-J)
ws.cell(row=row_num, column=1, value=store_name)
ws.cell(row=row_num, column=2, value=row.get("兜底指标", ""))
ws.cell(row=row_num, column=3, value=row.get("兜底类型", ""))
ws.cell(row=row_num, column=4, value=row.get("特殊情况1", ""))
ws.cell(row=row_num, column=5, value=row.get("特殊情况2", ""))
ws.cell(row=row_num, column=6, value=row.get(province_col if province_col else "区域(省)", ""))
# G-J 手工填写
ws.cell(row=row_num, column=7, value="") # 直营与否
ws.cell(row=row_num, column=8, value="") # 区域运营
ws.cell(row=row_num, column=9, value="") # 飞行督导
ws.cell(row=row_num, column=10, value="") # 线上运营
# 主机厂数据 (K-O)
delivery = _safe_float(row.get("交付数", 0))
yb_purchase = _safe_float(row.get("整车延保采购数", 0))
axb_purchase = _safe_float(row.get("安心包采购数", 0))
battery_purchase = _safe_float(row.get("电池延保采购数", 0))
tire_purchase = _safe_float(row.get("轮胎险采购数", 0))
ws.cell(row=row_num, column=11, value=delivery) # K 交付数
ws.cell(row=row_num, column=12, value=yb_purchase) # L
ws.cell(row=row_num, column=13, value=axb_purchase) # M
ws.cell(row=row_num, column=14, value=battery_purchase) # N
ws.cell(row=row_num, column=15, value=tire_purchase) # O
# 产值表数据 (P-Z) - 从数据库查询真实交付数和触客数
store_name_str = str(store_name) store_name_str = str(store_name)
store_perf = db_perf.get(store_name_str, {}) store_perf = db_perf.get(store_name_str, {})
# 交付数2 = 数据库查询的实际交付数,没有则回退为0 # ========== 基础门店信息 (A-J) ==========
_style_cell(row_num, 1, store_name_str)
_style_cell(row_num, 2, store_row.get("兜底指标", ""))
_style_cell(row_num, 3, store_row.get("兜底类型", ""))
_style_cell(row_num, 4, store_row.get("特殊情况1", ""))
_style_cell(row_num, 5, store_row.get("特殊情况2", ""))
# 区域(省):优先从数据库取,其次从主机厂Excel取
province_db = store_perf.get("province_name", "")
province_factory = store_row.get(province_col if province_col else "区域(省)", "")
_style_cell(row_num, 6, province_db if province_db else province_factory)
# 直营与否:从数据库查询(直营/非直营),operation_mode 来自 ods_store_config
_style_cell(row_num, 7, store_perf.get("operation_mode", ""))
# 区域运营 / 飞行督导 / 线上运营:从数据库提取
_style_cell(row_num, 8, store_perf.get("area_supervision", ""))
_style_cell(row_num, 9, store_perf.get("flight_supervision", ""))
_style_cell(row_num, 10, store_perf.get("online_supervision", ""))
# ========== 主机厂数据 (K-O) - 来自上传的Excel ==========
delivery = _safe_float(store_row.get("交付数", 0))
yb_purchase = _safe_float(store_row.get("整车延保采购数", 0))
axb_purchase = _safe_float(store_row.get("安心包采购数", 0))
battery_purchase = _safe_float(store_row.get("电池延保采购数", 0))
tire_purchase = _safe_float(store_row.get("轮胎险采购数", 0))
_style_cell(row_num, 11, delivery)
_style_cell(row_num, 12, yb_purchase)
_style_cell(row_num, 13, axb_purchase)
_style_cell(row_num, 14, battery_purchase)
_style_cell(row_num, 15, tire_purchase)
# ========== 产值表数据 (P-Z) - 全部从数据库查询 ==========
# P: 交付数2 (DB)
delivery2 = _safe_float(store_perf.get("delivery", 0)) delivery2 = _safe_float(store_perf.get("delivery", 0))
# 触客数 = 数据库查询的实际触客数 # Q: 触客数 (DB)
customer_count = _safe_float(store_perf.get("touch", 0)) customer_count = _safe_float(store_perf.get("touch", 0))
# 触客率 = 触客数 / 交付数2(从DB查询),没有则回退 # R: 触客率 (DB)
touch_rate = _safe_float(store_perf.get("touch_rate", 0.0)) touch_rate = _safe_float(store_perf.get("touch_rate", 0.0))
# 如果DB没拿到触客率,自己算
if touch_rate == 0.0 and customer_count > 0 and delivery2 > 0: if touch_rate == 0.0 and customer_count > 0 and delivery2 > 0:
touch_rate = round(customer_count / delivery2, 4) touch_rate = round(customer_count / delivery2, 4)
# 订单数据(暂用主机厂采购数代替产值表订单数) # S-V: 订单数据 (DB)
yb_orders = yb_purchase yb_orders = _safe_float(store_perf.get("yb_orders", 0))
axb_orders = axb_purchase axb_orders = _safe_float(store_perf.get("axb_orders", 0))
battery_orders = battery_purchase battery_orders = _safe_float(store_perf.get("battery_orders", 0))
tire_orders = tire_purchase tire_orders = _safe_float(store_perf.get("tire_orders", 0))
ws.cell(row=row_num, column=16, value=delivery2) # P 交付数2 _style_cell(row_num, 16, delivery2) # P
ws.cell(row=row_num, column=17, value=customer_count) # Q 触客数 _style_cell(row_num, 17, customer_count) # Q
ws.cell(row=row_num, column=18, value=touch_rate) # R 触客率 _style_cell(row_num, 18, touch_rate) # R
ws.cell(row=row_num, column=19, value=yb_orders) # S _style_cell(row_num, 19, yb_orders) # S
ws.cell(row=row_num, column=20, value=axb_orders) # T _style_cell(row_num, 20, axb_orders) # T
ws.cell(row=row_num, column=21, value=battery_orders) # U _style_cell(row_num, 21, battery_orders) # U
ws.cell(row=row_num, column=22, value=tire_orders) # V _style_cell(row_num, 22, tire_orders) # V
# 渗透率 (W-Z) # W-Z: 渗透率 = 成交数 / 触客数(参考 generate_weekly_comparison)
touch_safe = _safe_float(customer_count, 0)
yb_penetration = _safe_float(yb_orders) / touch_safe if touch_safe > 0 else 0
axb_penetration = _safe_float(axb_orders) / touch_safe if touch_safe > 0 else 0
battery_penetration = _safe_float(battery_orders) / touch_safe if touch_safe > 0 else 0
tire_penetration = _safe_float(tire_orders) / touch_safe if touch_safe > 0 else 0
_style_cell(row_num, 23, round(yb_penetration, 4))
_style_cell(row_num, 24, round(axb_penetration, 4))
_style_cell(row_num, 25, round(battery_penetration, 4))
_style_cell(row_num, 26, round(tire_penetration, 4))
# 转化率 = 成交数 / 交付数2(用于生态系数、兜底触发)
d_safe = _safe_float(delivery2, 0) d_safe = _safe_float(delivery2, 0)
yb_rate = _safe_float(yb_orders) / d_safe if d_safe > 0 else 0 yb_rate = _safe_float(yb_orders) / d_safe if d_safe > 0 else 0
axb_rate = _safe_float(axb_orders) / d_safe if d_safe > 0 else 0 axb_rate = _safe_float(axb_orders) / d_safe if d_safe > 0 else 0
battery_rate = _safe_float(battery_orders) / d_safe if d_safe > 0 else 0 battery_rate = _safe_float(battery_orders) / d_safe if d_safe > 0 else 0
tire_rate = _safe_float(tire_orders) / d_safe if d_safe > 0 else 0 tire_rate = _safe_float(tire_orders) / d_safe if d_safe > 0 else 0
ws.cell(row=row_num, column=23, value=round(yb_rate, 4)) # W # ========== 生态系数 (AA-AD) ==========
ws.cell(row=row_num, column=24, value=round(axb_rate, 4)) # X targets = extract_target_rates(store_row)
ws.cell(row=row_num, column=25, value=round(battery_rate, 4)) # Y
ws.cell(row=row_num, column=26, value=round(tire_rate, 4)) # Z
# 生态系数 (AA-AD)
targets = extract_target_rates(row)
req_yb = targets["整车延保"] req_yb = targets["整车延保"]
req_axb = targets["安心包"] req_axb = targets["安心包"]
req_battery = targets["电池延保"] req_battery = targets["电池延保"]
def calc_coeff(rate, required, baodi_type="交付"): def calc_coeff(rate, required):
if required <= 0: if required <= 0:
return 1.0 return 1.0
if rate >= required: if rate >= required:
# 达到标杆
if rate >= required + 0.15: if rate >= required + 0.15:
return 1.4 return 1.4
if rate >= required + 0.10: if rate >= required + 0.10:
...@@ -554,31 +765,31 @@ class AnalysisService: ...@@ -554,31 +765,31 @@ class AnalysisService:
battery_coeff = calc_coeff(battery_rate, req_battery) if req_battery > 0 else 1.0 battery_coeff = calc_coeff(battery_rate, req_battery) if req_battery > 0 else 1.0
total_score = round(yb_coeff + axb_coeff + battery_coeff, 1) total_score = round(yb_coeff + axb_coeff + battery_coeff, 1)
ws.cell(row=row_num, column=27, value=yb_coeff) # AA _style_cell(row_num, 27, yb_coeff)
ws.cell(row=row_num, column=28, value=axb_coeff) # AB _style_cell(row_num, 28, axb_coeff)
ws.cell(row=row_num, column=29, value=battery_coeff) # AC _style_cell(row_num, 29, battery_coeff)
ws.cell(row=row_num, column=30, value=total_score) # AD _style_cell(row_num, 30, total_score)
# 主机厂采购差异 (AE-AG) # ========== 主机厂采购差异 (AE-AG) ==========
diff_yb = yb_purchase - yb_orders diff_yb = yb_purchase - yb_orders
diff_axb = axb_purchase - axb_orders diff_axb = axb_purchase - axb_orders
diff_battery = battery_purchase - battery_orders diff_battery = battery_purchase - battery_orders
ws.cell(row=row_num, column=31, value=round(diff_yb, 1)) # AE _style_cell(row_num, 31, round(diff_yb, 1))
ws.cell(row=row_num, column=32, value=round(diff_axb, 1)) # AF _style_cell(row_num, 32, round(diff_axb, 1))
ws.cell(row=row_num, column=33, value=round(diff_battery, 1)) # AG _style_cell(row_num, 33, round(diff_battery, 1))
# 当前转化率 (AH-AJ) = 渗透率 # ========== 当前转化率 (AH-AJ) ==========
ws.cell(row=row_num, column=34, value=round(yb_rate, 4)) # AH _style_cell(row_num, 34, round(yb_rate, 4))
ws.cell(row=row_num, column=35, value=round(axb_rate, 4)) # AI _style_cell(row_num, 35, round(axb_rate, 4))
ws.cell(row=row_num, column=36, value=round(battery_rate, 4)) # AJ _style_cell(row_num, 36, round(battery_rate, 4))
# 需达标转化率 (AK-AM) # ========== 需达标转化率 (AK-AM) ==========
ws.cell(row=row_num, column=37, value=req_yb) # AK _style_cell(row_num, 37, req_yb)
ws.cell(row=row_num, column=38, value=req_axb) # AL _style_cell(row_num, 38, req_axb)
ws.cell(row=row_num, column=39, value=req_battery) # AM _style_cell(row_num, 39, req_battery)
# 是否触发兜底 (AN) # ========== 是否触发兜底 (AN) ==========
triggered = False triggered = False
if req_yb > 0 and yb_rate < req_yb: if req_yb > 0 and yb_rate < req_yb:
triggered = True triggered = True
...@@ -586,9 +797,9 @@ class AnalysisService: ...@@ -586,9 +797,9 @@ class AnalysisService:
triggered = True triggered = True
if req_battery > 0 and battery_rate < req_battery: if req_battery > 0 and battery_rate < req_battery:
triggered = True triggered = True
ws.cell(row=row_num, column=40, value="是" if triggered else "否") # AN _style_cell(row_num, 40, "是" if triggered else "否")
# 需达标订单数差额 (AO-AQ) # ========== 需达标订单数差额 (AO-AQ) ==========
d2_safe = max(0, _safe_float(delivery2)) d2_safe = max(0, _safe_float(delivery2))
required_yb_orders = max(0, math.ceil(d2_safe * _safe_float(req_yb, 0))) required_yb_orders = max(0, math.ceil(d2_safe * _safe_float(req_yb, 0)))
required_axb_orders = max(0, math.ceil(d2_safe * _safe_float(req_axb, 0))) required_axb_orders = max(0, math.ceil(d2_safe * _safe_float(req_axb, 0)))
...@@ -598,76 +809,68 @@ class AnalysisService: ...@@ -598,76 +809,68 @@ class AnalysisService:
gap_axb = max(0, required_axb_orders - int(axb_orders)) gap_axb = max(0, required_axb_orders - int(axb_orders))
gap_battery = max(0, required_battery_orders - int(battery_orders)) gap_battery = max(0, required_battery_orders - int(battery_orders))
ws.cell(row=row_num, column=41, value=gap_yb) # AO _style_cell(row_num, 41, gap_yb)
ws.cell(row=row_num, column=42, value=gap_axb) # AP _style_cell(row_num, 42, gap_axb)
ws.cell(row=row_num, column=43, value=gap_battery) # AQ _style_cell(row_num, 43, gap_battery)
# 赔付金额 (AR-AT) # ========== 赔付金额 (AR-AT) ==========
penalty_yb = gap_yb * COMPENSATION_PRICE["整车延保"] * COST_RATIO["整车延保"] penalty_yb = gap_yb * COMPENSATION_PRICE["整车延保"] * COST_RATIO["整车延保"]
penalty_axb = gap_axb * COMPENSATION_PRICE["安心包"] * COST_RATIO["安心包"] penalty_axb = gap_axb * COMPENSATION_PRICE["安心包"] * COST_RATIO["安心包"]
penalty_battery = gap_battery * COMPENSATION_PRICE["电池延保"] * COST_RATIO["电池延保"] penalty_battery = gap_battery * COMPENSATION_PRICE["电池延保"] * COST_RATIO["电池延保"]
ws.cell(row=row_num, column=44, value=round(penalty_yb, 1)) # AR _style_cell(row_num, 44, round(penalty_yb, 1))
ws.cell(row=row_num, column=45, value=round(penalty_axb, 1)) # AS _style_cell(row_num, 45, round(penalty_axb, 1))
ws.cell(row=row_num, column=46, value=round(penalty_battery, 1)) # AT _style_cell(row_num, 46, round(penalty_battery, 1))
# 是否需要赔付 (AU) # ========== 是否需要赔付 (AU) ==========
need_pay = (gap_yb > 0 or gap_axb > 0 or gap_battery > 0) and triggered need_pay = (gap_yb > 0 or gap_axb > 0 or gap_battery > 0) and triggered
ws.cell(row=row_num, column=47, value="是" if need_pay else "否") # AU _style_cell(row_num, 47, "是" if need_pay else "否")
# 赔付总金额 (AV) # ========== 赔付总金额 (AV) ==========
total_penalty = penalty_yb + penalty_axb + penalty_battery if need_pay else 0 total_penalty = penalty_yb + penalty_axb + penalty_battery if need_pay else 0
ws.cell(row=row_num, column=48, value=round(total_penalty, 1)) # AV _style_cell(row_num, 48, round(total_penalty, 1))
# 兜底月份 (AW) # ========== 兜底月份 (AW) ==========
ws.cell(row=row_num, column=49, value=date_range) # AW _style_cell(row_num, 49, date_range)
# 门店等级 (AX) # ========== 门店等级 (AX) ==========
if total_score >= 3.0: if total_score >= 3.0:
level = "绿色门店" level = "绿色门店"
level_fill = GREEN_FILL
elif total_score >= 2.0: elif total_score >= 2.0:
level = "黄色门店" level = "黄色门店"
level_fill = YELLOW_FILL
else: else:
level = "红色门店" level = "红色门店"
cell_level = ws.cell(row=row_num, column=50, value=level) # AX level_fill = RED_FILL
if level == "红色门店": cell_level = _style_cell(row_num, 50, level)
cell_level.fill = RED_FILL cell_level.fill = level_fill
elif level == "黄色门店":
cell_level.fill = YELLOW_FILL # ========== 人工核对列 (AY-BA) ==========
else: for c in (51, 52, 53):
cell_level.fill = GREEN_FILL _style_cell(row_num, c, "")
# 人工审核 (AY) # ========== 写入公式列(模板第4行有公式的列,使用公式替代静态值)==========
ws.cell(row=row_num, column=51, value="") # AY for col_idx, formula_text in formula_map.items():
# 调整公式:将行号4替换为当前行号
# 备注 (AZ) adjusted = re.sub(
ws.cell(row=row_num, column=52, value="") # AZ r'([A-Z]{1,3})4\b',
lambda m: f'{m.group(1)}{row_num}',
# 去除服务商 (BA) formula_text
ws.cell(row=row_num, column=53, value="") # BA )
cell = ws.cell(row=row_num, column=col_idx)
# 样式 cell.value = adjusted
for col in range(1, 54): cell.font = Font(name="微软雅黑", size=10)
cell = ws.cell(row=row_num, column=col)
cell.font = DATA_FONT
cell.border = THIN_BORDER cell.border = THIN_BORDER
if col >= 11 and col <= 48: cell.alignment = Alignment(horizontal="center", vertical="center", wrap_text=True)
if isinstance(cell.value, (int, float)): # 设置数字格式
cell.number_format = '0.00' if col in (23, 24, 25, 26, 27, 28, 29, 30, 34, 35, 36, 37, 38, 39) else '0.0' if col_idx in (23, 24, 25, 26, 34, 35, 36):
cell.alignment = Alignment(horizontal="center") cell.number_format = '0.00%'
elif col_idx in (27, 28, 29, 30):
cell.number_format = '0.0'
elif col_idx in (48,):
cell.number_format = '#,##0'
row_num += 1 row_num += 1
# 写入公式行(汇总)
if row_num > 4:
last_row = row_num - 1
ws.cell(row=row_num, column=1, value="合计汇总")
ws.cell(row=row_num, column=1).font = Font(name="微软雅黑", bold=True, size=10)
for col in range(11, 49):
col_letter = get_column_letter(col)
if col >= 11 and col <= 16:
ws.cell(row=row_num, column=col, value=f"=SUM({col_letter}4:{col_letter}{last_row})")
elif col == 27 or col == 28 or col == 29:
ws.cell(row=row_num, column=col, value=f"=AVERAGE({col_letter}4:{col_letter}{last_row})")
elif col == 48:
ws.cell(row=row_num, column=col, value=f"=SUM({col_letter}4:{col_letter}{last_row})")
...@@ -37,6 +37,9 @@ class ETLService: ...@@ -37,6 +37,9 @@ class ETLService:
('dj_car_life_goods_order', 'ods_goods_order', 'order_code', True), ('dj_car_life_goods_order', 'ods_goods_order', 'order_code', True),
('dj_car_life_goods_sub_order', 'ods_goods_sub_order', 'id', True), ('dj_car_life_goods_sub_order', 'ods_goods_sub_order', 'id', True),
('dj_car_life_goods_order_customer', 'ods_goods_order_customer', 'id', True), ('dj_car_life_goods_order_customer', 'ods_goods_order_customer', 'id', True),
# --- 商户关联与配置表 ---
('dj_car_life_scene_merchant_ref', 'ods_scene_merchant_ref', 'id', True),
('dj_car_life_yqmerchant_config', 'ods_yqmerchant_config', 'id', True),
# --- 目标配置表 --- # --- 目标配置表 ---
('dj_car_life_merchant_deliver_target_config', 'ods_merchant_deliver_target_config','id', True), ('dj_car_life_merchant_deliver_target_config', 'ods_merchant_deliver_target_config','id', True),
('dj_car_life_merchant_output_target_config', 'ods_merchant_output_target_config', 'id', True), ('dj_car_life_merchant_output_target_config', 'ods_merchant_output_target_config', 'id', True),
...@@ -254,6 +257,9 @@ class ETLService: ...@@ -254,6 +257,9 @@ class ETLService:
}) })
db.commit() db.commit()
# 4. 从 ods_service_merchant 填充 ods_store_config(如果该表为空或缺失门店)
cls._populate_ods_store_config()
logger.info(f"[+] ODS Sync task_id={task_id} completed. Total rows: {total_rows}") logger.info(f"[+] ODS Sync task_id={task_id} completed. Total rows: {total_rows}")
return results return results
...@@ -269,6 +275,120 @@ class ETLService: ...@@ -269,6 +275,120 @@ class ETLService:
finally: finally:
db.close() db.close()
@staticmethod
def _populate_ods_store_config():
"""
从 ods_service_merchant 填充 ods_store_config 中缺失的门店基础信息,
并基于 ods_scene_merchant_ref + ods_yqmerchant_config 计算 operation_mode。
ods_store_config 是手工维护表,但门店列表应自动从 ods_service_merchant 同步。
INSERT IGNORE 只插入新门店;UPDATE 会刷新 operation_mode 和负责人信息。
"""
conn = None
try:
conn = ETLService.get_target_conn()
with conn.cursor() as cur:
# 1. 插入新门店(从 ods_service_merchant)
sql_insert = """
INSERT IGNORE INTO ods_store_config (
merchant_id, merchant_code, merchant_name, merchant_short_name,
province, city, deleted_flag
)
SELECT
sm.merchant_id,
sm.store_code,
sm.merchant_name,
sm.merchant_name,
sm.province_name,
sm.city_name,
'N'
FROM ods_service_merchant sm
WHERE sm.deleted_flag = 'N'
AND sm.merchant_id IS NOT NULL
"""
cur.execute(sql_insert)
rows_inserted = cur.rowcount
# 2. 更新 operation_mode(直营/非直营)
# 参考 SQL:通过 scene_merchant_ref + yqmerchant_config 判断
# 若存在 sub_merchant 是 partner_merchant_id=44206988 的园区店,则为直营
sql_operation_mode = """
UPDATE ods_store_config sc
SET sc.operation_mode = CASE
WHEN EXISTS (
SELECT 1
FROM ods_scene_merchant_ref smr2
INNER JOIN ods_yqmerchant_config yc
ON smr2.sub_merchant_id = yc.merchant_id
AND yc.deleted_flag = 'N'
AND yc.partner_merchant_id = 44206988
WHERE smr2.deleted_flag = 'N'
AND smr2.main_merchant_type IN (1, 2, 3, 4, 5)
AND smr2.sub_merchant_type IN (6, 8)
AND smr2.main_merchant_id = sc.merchant_id
) THEN '直营'
ELSE '非直营'
END
WHERE sc.deleted_flag = 'N'
"""
cur.execute(sql_operation_mode)
rows_mode = cur.rowcount
# 3. 更新负责人信息(从 ods_shop_merchant_director_config,使用 GROUP_CONCAT)
sql_area = """
UPDATE ods_store_config sc
LEFT JOIN (
SELECT merchant_id,
GROUP_CONCAT(DISTINCT director_name SEPARATOR '/') AS names
FROM ods_shop_merchant_director_config
WHERE deleted_flag = 'N' AND director_type IN (8, 9)
GROUP BY merchant_id
) d ON sc.merchant_id = d.merchant_id
SET sc.area_manager = d.names
WHERE sc.deleted_flag = 'N'
"""
cur.execute(sql_area)
sql_flight = """
UPDATE ods_store_config sc
LEFT JOIN (
SELECT merchant_id,
GROUP_CONCAT(DISTINCT director_name SEPARATOR '/') AS names
FROM ods_shop_merchant_director_config
WHERE deleted_flag = 'N' AND director_type IN (6, 13)
GROUP BY merchant_id
) d ON sc.merchant_id = d.merchant_id
SET sc.flight_supervisor = d.names
WHERE sc.deleted_flag = 'N'
"""
cur.execute(sql_flight)
sql_online = """
UPDATE ods_store_config sc
LEFT JOIN (
SELECT merchant_id,
GROUP_CONCAT(DISTINCT director_name SEPARATOR '/') AS names
FROM ods_shop_merchant_director_config
WHERE deleted_flag = 'N' AND director_type IN (5, 7)
GROUP BY merchant_id
) d ON sc.merchant_id = d.merchant_id
SET sc.online_ops = d.names
WHERE sc.deleted_flag = 'N'
"""
cur.execute(sql_online)
conn.commit()
logger.info(
f"[+] ods_store_config: inserted {rows_inserted}, "
f"updated operation_mode={rows_mode}"
)
except Exception as e:
logger.error(f"[X] Failed to populate ods_store_config: {e}", exc_info=True)
finally:
if conn:
conn.close()
@classmethod @classmethod
async def run_dw_sync(cls, layer: str, start_date: str = None, end_date: str = None, task_id: str = None, full_sync: str = None): async def run_dw_sync(cls, layer: str, start_date: str = None, end_date: str = None, task_id: str = None, full_sync: str = None):
""" """
...@@ -455,14 +575,172 @@ class ETLService: ...@@ -455,14 +575,172 @@ class ETLService:
@staticmethod @staticmethod
def _get_sql_merchant_daily_wide(start, end): def _get_sql_merchant_daily_wide(start, end):
filter_str = f"AND report_date BETWEEN '{start}' AND '{end}'" if start and end else "" filter_str = f"AND mdrh.report_date BETWEEN '{start}' AND '{end}'" if start and end else ""
return f""" return f"""
INSERT IGNORE INTO dws_merchant_daily_wide ( INSERT INTO dws_merchant_daily_wide (
report_date, merchant_id, merchant_name, province_name, scene_type, etl_date report_date, merchant_id, merchant_name, store_code,
) province_id, province_name, city_name, region, channel_type,
SELECT report_date, merchant_id, merchant_id, '未知', scene_type, CURDATE() area_supervision, online_supervision, flight_supervision,
FROM ods_merchant_daily_report_huawei scene_type, first_brand_id, first_brand_name, brand_id, brand_name,
WHERE deleted_flag='N' {filter_str} delivery_count, customer_loss_count,
total_staff, active_staff, on_break_staff,
sum_equity_to_shop, sum_extended_warranty_to_shop, sum_real_equity_to_shop,
sum_after_sale_to_shop, sum_not_delivery,
sum_order_count, sum_extended_warranty, sum_tire_warranty, sum_ax_package,
sum_battery_extended, sum_battery_money, sum_total_order_money,
etl_date
)
SELECT
mdrh.report_date,
mdrh.merchant_id,
IFNULL(sm.merchant_name, mdrh.merchant_id),
sm.store_code,
sm.province_id, sm.province_name, sm.city_name, sm.region, sm.channel_type,
dir_area.director_name, dir_online.director_name, dir_flight.director_name,
mdrh.scene_type,
IFNULL(mdrh.first_brand_id, IFNULL(bm.brand_id, 2365)) AS first_brand_id,
IFNULL(bm.brand_name, '鸿蒙智行') AS first_brand_name,
IFNULL(mdrh.brand_id, IFNULL(bm.child_id, 2695)) AS brand_id,
IFNULL(bm.child_name, '问界') AS brand_name,
mdrh.delivery_count, mdrh.customer_loss_count,
t.total_staff, t.active_staff, t.on_break_staff,
t.sum_equity_to_shop, t.sum_extended_warranty_to_shop, t.sum_real_equity_to_shop,
t.sum_after_sale_to_shop, t.sum_not_delivery,
t.sum_order_count, t.sum_extended_warranty, t.sum_tire_warranty, t.sum_ax_package,
t.sum_battery_extended, t.sum_battery_money, t.sum_total_order_money,
CURDATE()
FROM (
SELECT
merchant_id, report_date, scene_type,
IFNULL(first_brand_id, 2365) AS first_brand_id,
IFNULL(NULLIF(brand_id, -1), 2695) AS brand_id,
SUM(IFNULL(delivery_count, 0)) AS delivery_count,
SUM(IFNULL(customer_loss_count, 0)) AS customer_loss_count
FROM ods_merchant_daily_report_huawei
WHERE deleted_flag = 'N'
GROUP BY merchant_id, report_date, scene_type,
IFNULL(first_brand_id, 2365),
IFNULL(NULLIF(brand_id, -1), 2695)
) mdrh
LEFT JOIN ods_service_merchant sm
ON mdrh.merchant_id = sm.merchant_id AND sm.deleted_flag = 'N'
LEFT JOIN (
SELECT merchant_id,
MAX(brand_id) AS brand_id,
MAX(brand_name) AS brand_name,
MAX(child_id) AS child_id,
MAX(child_name) AS child_name
FROM ods_merchant_brand_model
WHERE deleted_flag = 'N'
GROUP BY merchant_id
) bm ON mdrh.merchant_id = bm.merchant_id
LEFT JOIN (
SELECT merchant_id,
GROUP_CONCAT(DISTINCT director_name SEPARATOR '/') AS director_name
FROM ods_shop_merchant_director_config
WHERE director_type IN (9, 8) AND deleted_flag = 'N'
GROUP BY merchant_id
) dir_area ON mdrh.merchant_id = dir_area.merchant_id
LEFT JOIN (
SELECT merchant_id,
GROUP_CONCAT(DISTINCT director_name SEPARATOR '/') AS director_name
FROM ods_shop_merchant_director_config
WHERE director_type IN (7, 5) AND deleted_flag = 'N'
GROUP BY merchant_id
) dir_online ON mdrh.merchant_id = dir_online.merchant_id
LEFT JOIN (
SELECT merchant_id,
GROUP_CONCAT(DISTINCT director_name SEPARATOR '/') AS director_name
FROM ods_shop_merchant_director_config
WHERE director_type IN (13, 6) AND deleted_flag = 'N'
GROUP BY merchant_id
) dir_flight ON mdrh.merchant_id = dir_flight.merchant_id
LEFT JOIN (
SELECT
sdrh.merchant_id, sdrh.report_date, sdrh.scene_type,
IFNULL(sdrh.first_brand_id, 2365) AS first_brand_id,
IFNULL(NULLIF(sdrh.brand_id, -1), 2695) AS brand_id,
COUNT(DISTINCT sdrh.staff_uuid) AS total_staff,
COUNT(DISTINCT sdrh.staff_uuid) AS active_staff,
0 AS on_break_staff,
SUM(IFNULL(sdrh.equity_to_shop_count, 0)) AS sum_equity_to_shop,
SUM(IFNULL(sdrh.extended_warranty_to_shop_count, 0)) AS sum_extended_warranty_to_shop,
SUM(IFNULL(sdrh.real_equity_to_shop_count, 0)) AS sum_real_equity_to_shop,
SUM(IFNULL(sdrh.after_sale_equity_to_shop_count, 0)
+ IFNULL(sdrh.after_sale_extended_warranty_to_shop_count, 0)
+ IFNULL(sdrh.after_sale_real_equity_to_shop_count, 0)) AS sum_after_sale_to_shop,
SUM(IFNULL(sdrh.not_delivery_count, 0)) AS sum_not_delivery,
SUM(IFNULL(sdrh.total_order_count, 0)) AS sum_order_count,
SUM(IFNULL(sdrh.extended_warranty_count, 0)) AS sum_extended_warranty,
SUM(IFNULL(sdrh.tire_warranty_count, 0)) AS sum_tire_warranty,
IFNULL(ax_sub.ax_cnt, 0) AS sum_ax_package,
SUM(IFNULL(sdrh.battery_extended_warranty_count, 0)) AS sum_battery_extended,
SUM(IFNULL(sdrh.battery_extended_warranty_money, 0)) AS sum_battery_money,
0 AS sum_total_order_money
FROM ods_staff_daily_report_huawei sdrh
LEFT JOIN (
SELECT
go.merchant_id,
DATE(go.install_upgrade_time) AS install_date,
go.scene_type,
COUNT(DISTINCT gso.id) AS ax_cnt
FROM ods_goods_order go
INNER JOIN ods_goods_sub_order gso
ON go.order_code = gso.order_code
AND gso.deleted_flag = 'N'
AND gso.status = 1
AND (gso.upgrade_goods_type = 180
OR gso.upgrade_secondary_goods_type = 180
OR gso.upgrade_third_level_goods_type = 180)
WHERE go.deleted_flag = 'N'
AND go.status IN (4, 6, 12)
GROUP BY go.merchant_id, DATE(go.install_upgrade_time), go.scene_type
) ax_sub ON sdrh.merchant_id = ax_sub.merchant_id
AND sdrh.report_date = ax_sub.install_date
AND sdrh.scene_type = ax_sub.scene_type
WHERE sdrh.deleted_flag = 'N'
GROUP BY sdrh.merchant_id, sdrh.report_date, sdrh.scene_type,
IFNULL(sdrh.first_brand_id, 2365),
IFNULL(NULLIF(sdrh.brand_id, -1), 2695)
) t ON mdrh.merchant_id = t.merchant_id
AND mdrh.report_date = t.report_date
AND mdrh.scene_type = t.scene_type
AND IFNULL(mdrh.first_brand_id, 2365) = t.first_brand_id
AND IFNULL(mdrh.brand_id, 2695) = t.brand_id
{filter_str}
ON DUPLICATE KEY UPDATE
merchant_name = VALUES(merchant_name),
store_code = VALUES(store_code),
province_id = VALUES(province_id),
province_name = VALUES(province_name),
city_name = VALUES(city_name),
region = VALUES(region),
channel_type = VALUES(channel_type),
area_supervision = VALUES(area_supervision),
online_supervision = VALUES(online_supervision),
flight_supervision = VALUES(flight_supervision),
first_brand_id = VALUES(first_brand_id),
first_brand_name = VALUES(first_brand_name),
brand_id = VALUES(brand_id),
brand_name = VALUES(brand_name),
delivery_count = VALUES(delivery_count),
customer_loss_count = VALUES(customer_loss_count),
total_staff = VALUES(total_staff),
active_staff = VALUES(active_staff),
on_break_staff = VALUES(on_break_staff),
sum_equity_to_shop = VALUES(sum_equity_to_shop),
sum_extended_warranty_to_shop = VALUES(sum_extended_warranty_to_shop),
sum_real_equity_to_shop = VALUES(sum_real_equity_to_shop),
sum_after_sale_to_shop = VALUES(sum_after_sale_to_shop),
sum_not_delivery = VALUES(sum_not_delivery),
sum_order_count = VALUES(sum_order_count),
sum_extended_warranty = VALUES(sum_extended_warranty),
sum_tire_warranty = VALUES(sum_tire_warranty),
sum_ax_package = VALUES(sum_ax_package),
sum_battery_extended = VALUES(sum_battery_extended),
sum_battery_money = VALUES(sum_battery_money),
sum_total_order_money = VALUES(sum_total_order_money),
etl_date = VALUES(etl_date)
""" """
@staticmethod @staticmethod
......
...@@ -371,6 +371,21 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -371,6 +371,21 @@ document.addEventListener('DOMContentLoaded', () => {
hideAllSections(); hideAllSections();
document.getElementById('data-analysis-section').style.display = 'block'; document.getElementById('data-analysis-section').style.display = 'block';
document.getElementById('content-title').textContent = '数据分析'; document.getElementById('content-title').textContent = '数据分析';
// 初始化默认日期: 上月26号 至 今天
const now = new Date();
const todayStr = now.toISOString().split('T')[0];
// 计算上月26号
const firstOfThisMonth = new Date(now.getFullYear(), now.getMonth(), 1);
const lastDayOfLastMonth = new Date(firstOfThisMonth - 86400000);
const lastMonth26 = new Date(lastDayOfLastMonth.getFullYear(), lastDayOfLastMonth.getMonth(), 26);
const startStr = lastMonth26.toISOString().split('T')[0];
const startInput = document.getElementById('analysis-start-date');
const endInput = document.getElementById('analysis-end-date');
if (startInput && !startInput.value) startInput.value = startStr;
if (endInput && !endInput.value) endInput.value = todayStr;
} }
// 门店列表上传 // 门店列表上传
...@@ -432,10 +447,18 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -432,10 +447,18 @@ document.addEventListener('DOMContentLoaded', () => {
throw new Error(uploadData.detail || '文件上传失败'); throw new Error(uploadData.detail || '文件上传失败');
} }
// 生成报表 // 生成报表 - 携带时间范围参数
btnGenerateReport.textContent = '⏳ 正在分析计算...'; btnGenerateReport.textContent = '⏳ 正在分析计算...';
const genForm = new FormData();
const startDate = document.getElementById('analysis-start-date').value;
const endDate = document.getElementById('analysis-end-date').value;
if (startDate) genForm.append('start_date', startDate);
if (endDate) genForm.append('end_date', endDate);
const genRes = await fetch('/api/analysis/generate', { const genRes = await fetch('/api/analysis/generate', {
method: 'POST' method: 'POST',
body: genForm
}); });
const genData = await genRes.json(); const genData = await genRes.json();
......
...@@ -195,13 +195,29 @@ ...@@ -195,13 +195,29 @@
</div> </div>
</div> </div>
<!-- 步骤3: 生成报表 --> <!-- 步骤3: 选择时间范围 -->
<div style="background: #f8f9fa; padding: 20px; border-radius: 8px; border: 1px solid #e8e8e8; margin-bottom: 20px;">
<h3 style="margin:0 0 12px; font-size:16px; color:#333;">步骤3: 选择时间范围</h3>
<div style="display: flex; gap: 20px; align-items: center; flex-wrap: wrap;">
<div>
<label style="font-weight: bold; margin-right: 8px;">开始日期:</label>
<input type="date" id="analysis-start-date" style="padding: 6px; border: 1px solid #d9d9d9; border-radius: 4px;">
</div>
<div>
<label style="font-weight: bold; margin-right: 8px;">结束日期:</label>
<input type="date" id="analysis-end-date" style="padding: 6px; border: 1px solid #d9d9d9; border-radius: 4px;">
</div>
</div>
<p style="margin-top: 8px; font-size: 12px; color: #888;">* 默认:上月26号 至 今天。填写日期后用于数据库产值数据查询和输出报表命名。</p>
</div>
<!-- 步骤4: 生成报表 -->
<div style="text-align: center; margin: 20px 0;"> <div style="text-align: center; margin: 20px 0;">
<button id="btn-generate-report" style="padding: 12px 48px; background: #1890ff; color: white; border: none; border-radius: 6px; font-size: 16px; cursor: pointer; transition: all 0.3s;"> <button id="btn-generate-report" style="padding: 12px 48px; background: #1890ff; color: white; border: none; border-radius: 6px; font-size: 16px; cursor: pointer; transition: all 0.3s;">
🚀 开始生成分析报表 🚀 开始生成分析报表
</button> </button>
<p style="font-size:12px; color:#999; margin-top:8px;">根据门店数据与主机厂数据,自动计算生态系数并生成Excel报表</p> <p style="font-size:12px; color:#999; margin-top:8px;">根据门店数据与主机厂数据,自动计算生态系数并生成Excel报表</p>
<p style="font-size:11px; color:#faad14;">📌 表头参考: <a href="/api/analysis/template/output" style="color:#1890ff;">输出样例</a></p> <p style="font-size:11px; color:#faad14;">📌 使用模板: 输出-问界生态系数生态-模板.xlsx</p>
</div> </div>
<!-- 生成结果提示 --> <!-- 生成结果提示 -->
......
16:58:35 ERROR Analysis generate failed: name 'touch' is not defined [endpoints.py:272]
Traceback (most recent call last):
File "D:\work1\data-analyze-webui\app\api\endpoints.py", line 256, in analysis_generate
output_path = AnalysisService.build_report(
store_df, factory_sheets,
start_date=start_date or None,
end_date=end_date or None
)
File "D:\work1\data-analyze-webui\app\services\analysis_service.py", line 493, in build_report
AnalysisService._write_data_rows(ws, store_df, factory_sheets, db_perf,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
start_date, end_date)
^^^^^^^^^^^^^^^^^^^^^
File "D:\work1\data-analyze-webui\app\services\analysis_service.py", line 652, in _write_data_rows
touch_safe = _safe_float(touch, 0)
^^^^^
NameError: name 'touch' is not defined
...@@ -86,3 +86,74 @@ Traceback (most recent call last): ...@@ -86,3 +86,74 @@ Traceback (most recent call last):
raise TypeError(f'Object of type {o.__class__.__name__} ' raise TypeError(f'Object of type {o.__class__.__name__} '
f'is not JSON serializable') f'is not JSON serializable')
TypeError: Object of type datetime is not JSON serializable TypeError: Object of type datetime is not JSON serializable
16:58:33 ERROR Failed to query store info from DB: (1146, "Table 'data_analyze.dj_car_life_scene_merchant_ref' doesn't exist") [analysis_service.py:421]
Traceback (most recent call last):
File "D:\work1\data-analyze-webui\app\services\analysis_service.py", line 399, in _query_store_info
cur.execute(sql, (*store_names,))
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python313\Lib\site-packages\pymysql\cursors.py", line 157, in execute
result = self._query(query)
File "D:\Python313\Lib\site-packages\pymysql\cursors.py", line 328, in _query
conn.query(q)
~~~~~~~~~~^^^
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 575, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 826, in _read_query_result
result.read()
~~~~~~~~~~~^^
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 1203, in read
first_packet = self.connection._read_packet()
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 782, in _read_packet
packet.raise_for_error()
~~~~~~~~~~~~~~~~~~~~~~^^
File "D:\Python313\Lib\site-packages\pymysql\protocol.py", line 219, in raise_for_error
err.raise_mysql_exception(self._data)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
File "D:\Python313\Lib\site-packages\pymysql\err.py", line 150, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.ProgrammingError: (1146, "Table 'data_analyze.dj_car_life_scene_merchant_ref' doesn't exist")
16:58:35 ERROR Analysis generate failed: name 'touch' is not defined [endpoints.py:272]
Traceback (most recent call last):
File "D:\work1\data-analyze-webui\app\api\endpoints.py", line 256, in analysis_generate
output_path = AnalysisService.build_report(
store_df, factory_sheets,
start_date=start_date or None,
end_date=end_date or None
)
File "D:\work1\data-analyze-webui\app\services\analysis_service.py", line 493, in build_report
AnalysisService._write_data_rows(ws, store_df, factory_sheets, db_perf,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
start_date, end_date)
^^^^^^^^^^^^^^^^^^^^^
File "D:\work1\data-analyze-webui\app\services\analysis_service.py", line 652, in _write_data_rows
touch_safe = _safe_float(touch, 0)
^^^^^
NameError: name 'touch' is not defined
18:16:26 ERROR Failed to query store performance from DB: (1054, "Unknown column 'sence_type' in 'where clause'") [analysis_service.py:354]
Traceback (most recent call last):
File "D:\work1\data-analyze-webui\app\services\analysis_service.py", line 321, in _query_store_performance
cur.execute(sql, params)
~~~~~~~~~~~^^^^^^^^^^^^^
File "D:\Python313\Lib\site-packages\pymysql\cursors.py", line 157, in execute
result = self._query(query)
File "D:\Python313\Lib\site-packages\pymysql\cursors.py", line 328, in _query
conn.query(q)
~~~~~~~~~~^^^
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 575, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 826, in _read_query_result
result.read()
~~~~~~~~~~~^^
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 1203, in read
first_packet = self.connection._read_packet()
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 782, in _read_packet
packet.raise_for_error()
~~~~~~~~~~~~~~~~~~~~~~^^
File "D:\Python313\Lib\site-packages\pymysql\protocol.py", line 219, in raise_for_error
err.raise_mysql_exception(self._data)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
File "D:\Python313\Lib\site-packages\pymysql\err.py", line 150, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.OperationalError: (1054, "Unknown column 'sence_type' in 'where clause'")
This diff could not be displayed because it is too large.
...@@ -1036,3 +1036,368 @@ Traceback (most recent call last): ...@@ -1036,3 +1036,368 @@ Traceback (most recent call last):
f'is not JSON serializable') f'is not JSON serializable')
TypeError: Object of type datetime is not JSON serializable TypeError: Object of type datetime is not JSON serializable
16:19:31 INFO Report generated: temp_uploads\问界生态系数分析报表.xlsx [analysis_service.py:248] 16:19:31 INFO Report generated: temp_uploads\问界生态系数分析报表.xlsx [analysis_service.py:248]
16:49:54 INFO Queried performance for 136 stores (2026-05-25 ~ 2026-06-14), got 0 results [analysis_service.py:299]
16:49:54 INFO DB performance data fetched for 0 stores (2026-05-25 ~ 2026-06-14) [analysis_service.py:347]
16:49:57 INFO Report generated: temp_uploads\问界生态系数分析_2026-05-25-2026-06-14.xlsx [analysis_service.py:373]
16:58:33 INFO Queried performance for 136 stores (2026-05-25 ~ 2026-06-14), got 0 results [analysis_service.py:299]
16:58:33 INFO DB performance data fetched for 0 stores (2026-05-25 ~ 2026-06-14) [analysis_service.py:462]
16:58:33 ERROR Failed to query store info from DB: (1146, "Table 'data_analyze.dj_car_life_scene_merchant_ref' doesn't exist") [analysis_service.py:421]
Traceback (most recent call last):
File "D:\work1\data-analyze-webui\app\services\analysis_service.py", line 399, in _query_store_info
cur.execute(sql, (*store_names,))
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python313\Lib\site-packages\pymysql\cursors.py", line 157, in execute
result = self._query(query)
File "D:\Python313\Lib\site-packages\pymysql\cursors.py", line 328, in _query
conn.query(q)
~~~~~~~~~~^^^
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 575, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 826, in _read_query_result
result.read()
~~~~~~~~~~~^^
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 1203, in read
first_packet = self.connection._read_packet()
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 782, in _read_packet
packet.raise_for_error()
~~~~~~~~~~~~~~~~~~~~~~^^
File "D:\Python313\Lib\site-packages\pymysql\protocol.py", line 219, in raise_for_error
err.raise_mysql_exception(self._data)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
File "D:\Python313\Lib\site-packages\pymysql\err.py", line 150, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.ProgrammingError: (1146, "Table 'data_analyze.dj_car_life_scene_merchant_ref' doesn't exist")
16:58:33 INFO Store info merged: 0 stores from DB [analysis_service.py:471]
17:01:49 INFO Queried performance for 136 stores (2026-05-25 ~ 2026-06-14), got 0 results [analysis_service.py:299]
17:01:49 INFO DB performance data fetched for 0 stores (2026-05-25 ~ 2026-06-14) [analysis_service.py:424]
17:01:49 INFO Queried store info for 136 stores, got 0 results [analysis_service.py:377]
17:01:49 INFO Store info merged: 0 stores from DB [analysis_service.py:433]
17:01:53 INFO Report generated: temp_uploads\问界生态系数分析_2026-05-25-2026-06-14.xlsx [analysis_service.py:459]
17:10:03 INFO _query_store_performance SQL:
SELECT
m.merchant_name,
m.merchant_id,
m.total_delivery,
m.total_touch,
m.total_yb_orders,
m.total_axb_orders,
m.total_battery_orders,
m.total_tire_orders,
m.province_name,
m.area_supervision,
m.flight_supervision,
m.online_supervision,
sc.operation_mode
FROM (
SELECT
merchant_id,
merchant_name,
province_name,
area_supervision,
flight_supervision,
online_supervision,
SUM(IFNULL(delivery_count, 0)) AS total_delivery,
SUM(IFNULL(sum_equity_to_shop, 0)) AS total_touch,
SUM(IFNULL(sum_extended_warranty, 0)) AS total_yb_orders,
SUM(IFNULL(sum_ax_package, 0)) AS total_axb_orders,
SUM(IFNULL(sum_battery_extended, 0)) AS total_battery_orders,
SUM(IFNULL(sum_tire_warranty, 0)) AS total_tire_orders
FROM dws_merchant_daily_wide
WHERE report_date >= '2026-05-25' AND report_date <= '2026-06-14'
AND first_brand_id = 2365
GROUP BY merchant_id, merchant_name, province_name,
area_supervision, flight_supervision, online_supervision
) m
LEFT JOIN ods_store_config sc
ON m.merchant_id = sc.merchant_id AND sc.deleted_flag = 'N'
WHERE m.merchant_name IN ('遵义广新智腾汽车销售有限公司', '镇江鸿昇汽车销售服务有限公司', '长沙力天瑞祥汽车销售服务有限公司', '长春德联星骏汽车销售服务有限公司', '益阳瑞祥汽车销售服务有限公司', '宜宾广信汽车销售有限公司', '信阳裕华起航汽车销售服务有限公司', '西昌明云华界汽车销售服务有限责任公司', '武汉市华阳通胜汽车销售有限公司', '武汉大雍欣炎汽车销售服务有限责任公司', '渭南丰华智行汽车销售服务有限公司', '威海鑫通华康汽车销售服务有限公司', '通辽市众昇销售服务有限公司', '通化华运汽车销售服务有限公司', '天水华和汽车销售服务有限公司', '天津吉合汽车销售服务有限公司', '十堰大雍欣弘汽车销售有限公司', '沈阳德联华骏汽车销售服务有限公司', '商丘市银丰汽车销售有限公司', '陕西福达汽车服务有限公司', '陕西泛想德邦汽车服务有限公司', '厦门信达通瑞汽车销售服务有限公司', '厦门和泰汽车销售服务有限公司', '衢州鸿圣汽车销售服务有限公司', '内蒙古世通瑞祺汽车销售服务有限公司', '内蒙古华捷众汽车销售服务有限公司', '南阳裕华福源汽车销售服务有限公司', '南京鸿荣汽车销售服务有限公司', '洛阳新荣嘉汽车销售服务有限公司', '六安汉界汽车销售服务有限公司', '临沂问鼎汽车销售服务有限公司', '兰州丰泰世纪汽车销售服务有限公司', '开封博为汽车销售服务有限公司', '酒泉金岛振通新能源汽车销售有限公司', '江苏吉合新能源汽车科技有限公司', '黄石仨创汽车销售有限责任公司', '衡阳瑞祥汽车销售服务有限公司', '哈尔滨华界汽车销售有限公司', '广西恒为汽车销售服务有限公司', '赣州市赛为汽车销售服务有限公司', '阜阳赛力斯汽车销售服务有限公司', '福建信达启润汽车销售服务有限公司', '佛山市吉赛汽车销售服务有限公司', '德州金车博士汽车服务有限公司', '赤峰宜新汽车服务有限公司', '亳州佰利汇新能源汽车销售服务有限公司', '北京百得利智行汽车服务有限公司', '安庆永通汽车销售服务有限公司', '元翔(福建)汽车销售服务有限公司', '新乡市天源汽车商贸有限公司', '青海嘉辉晟汽车销售服务有限公司', '青岛富源豪新能源汽车销售有限公司', '滁州佰利智行汽车销售服务有限公司', '郑州聚广源汽车服务有限公司', '肇庆鸿粤宏鑫汽车销售服务有限公司', '漳州市华骏汽车销售服务有限公司', '湖北三环盛通科技有限公司', '广州鸿粤宏鑫汽车销售服务有限公司', '广东鸿嘉汽车销售服务有限公司', '甘肃金岛振通新能源汽车销售有限公司', '许昌赛博汽车销售服务有限公司', '长沙市骏鸿汽车销售服务有限公司', '银川华为2.', '广东华界汽车销售服务有限公司', '宿州安之星汽车销售服务有限公司', '宁夏瑞华界汽车销售服务有限公司', '湖北中基兴汉汽车销售服务有限公司', '按自然月', '珠海市南菱华鑫汽车销售服务有限公司', '湛江市南菱华赛汽车销售服务有限公司', '西安友邻友安汽车销售服务有限公司', '深圳市骏智汽车销售服务有限公司', '汕头市骏业汽车销售服务有限公司', '山西聚驰汽车销售服务有限公司', '曲靖宝达汽车销售有限公司', '清远市南菱华智汽车销售服务有限公司', '揭阳市骏业汽车销售服务有限公司', '江门市大昌行盛奥汽车销售服务有限公司', '惠州市标驰汽车有限公司', '广州市南菱华弘汽车销售服务有限公司', '广州南菱华粤汽车有限公司', '广州南菱华创汽车有限公司', '佛山市越昌晟汽车贸易有限公司', '东莞市骏业汽车销售服务有限公司', '太原天问汽车销售服务有限公司', '周口市中鑫之宝汽车销售服务有限公司', '郑州中鑫华金汽车销售服务有限公司', '长治市聚鑫驰汽车销售服务有限公司', '宜昌康亿汽车销售服务有限公司', '唐山市福瑞美界汽车销售服务有限公司', '陕西福跃赛为汽车销售服务有限公司', '山西聚锦驰汽车销售服务有限公司', '秦皇岛华启汽车销售服务有限公司', '普洱宝达汽车销售服务有限公司', '河北永通鹏瑞汽车销售服务有限公司', '杭州旺泽宝华汽车销售服务有限公司', '杭州昇宇汽车销售服务有限公司', '海南丰盛利华汽车销售服务有限公司', '恩施华界汽车销售服务有限公司', '楚雄大昌行联迪汽车销售服务有限公司', '北京正通宝泽汽车销售服务有限公司', '北京星悦福瑞汽车销售服务有限公司', '北京市华阳盛世汽车销售有限公司', '北京博瑞祥宇汽车销售服务有限公司', '太仓宝诚汽车销售服务有限公司', '江苏冠川汽车销售服务有限公司', '毕节星瑞象汽车销售服务有限责任公司', '中益德诚(河北)新能源汽车有限公司', '浙江旺泽锦华汽车销售服务有限公司', '长春市华达汽车销售有限公司', '长春华智升汽车销售服务有限公司', '营口华智升汽车销售服务有限公司', '易联讯达(北京)汽车销售有限公司', '延安鑫华悦汽车销售服务有限公司', '沈阳汇升汽车销售有限公司', '沈阳华升汽车销售服务有限公司', '陕西福祥汽车销售服务有限公司', '吉林市华阳汽车销售有限公司', '惠州鸿粤宏鑫汽车销售服务有限公司', '汉中华驭智行汽车销售服务有限公司', '大连华智升汽车销售服务有限公司', '北京中益德诚新能源汽车销售有限公司', '北京中益德诚汽车销售有限公司', '太原瑞尚成汽车销售服务有限公司', '鞍山华升汽车销售服务有限公司', '大庆成悦汽车销售服务有限公司', '延吉市华阳汽车销售服务有限公司', '龙海智行(上海)汽车科技有限公司', '淮南盛至汽车销售服务有限公司', '泉州市华奥致源汽车有限公司', '莆田华奥智源汽车销售有限公司', '南平华奥智源汽车销售有限公司', '梅州华奥智源汽车销售有限公司', '福建华奥智源汽车销售有限公司', '海口华之杰汽车销售有限公司', '华奥集团')
[analysis_service.py:318]
17:10:03 INFO Queried performance for 136 stores (2026-05-25 ~ 2026-06-14, first_brand_id=2365), got 0 results [analysis_service.py:346]
17:10:03 INFO DB performance + store info fetched for 0 stores (2026-05-25 ~ 2026-06-14, first_brand_id=2365) [analysis_service.py:526]
17:10:07 INFO Report generated: temp_uploads\问界生态系数分析_2026-05-25-2026-06-14.xlsx [analysis_service.py:553]
17:43:58 INFO _query_store_performance SQL:
SELECT
m.merchant_name,
m.merchant_id,
m.total_delivery,
m.total_touch,
m.total_yb_orders,
m.total_axb_orders,
m.total_battery_orders,
m.total_tire_orders,
m.province_name,
m.area_supervision,
m.flight_supervision,
m.online_supervision,
sc.operation_mode
FROM (
SELECT
merchant_id,
merchant_name,
province_name,
area_supervision,
flight_supervision,
online_supervision,
SUM(IFNULL(delivery_count, 0)) AS total_delivery,
SUM(IFNULL(sum_equity_to_shop, 0)) AS total_touch,
SUM(IFNULL(sum_extended_warranty, 0)) AS total_yb_orders,
SUM(IFNULL(sum_ax_package, 0)) AS total_axb_orders,
SUM(IFNULL(sum_battery_extended, 0)) AS total_battery_orders,
SUM(IFNULL(sum_tire_warranty, 0)) AS total_tire_orders
FROM dws_merchant_daily_wide
WHERE report_date >= '2026-05-25' AND report_date <= '2026-06-14'
AND first_brand_id = 2365
GROUP BY merchant_id, merchant_name, province_name,
area_supervision, flight_supervision, online_supervision
) m
LEFT JOIN ods_store_config sc
ON m.merchant_id = sc.merchant_id AND sc.deleted_flag = 'N'
WHERE m.merchant_name IN ('遵义广新智腾汽车销售有限公司', '镇江鸿昇汽车销售服务有限公司', '长沙力天瑞祥汽车销售服务有限公司', '长春德联星骏汽车销售服务有限公司', '益阳瑞祥汽车销售服务有限公司', '宜宾广信汽车销售有限公司', '信阳裕华起航汽车销售服务有限公司', '西昌明云华界汽车销售服务有限责任公司', '武汉市华阳通胜汽车销售有限公司', '武汉大雍欣炎汽车销售服务有限责任公司', '渭南丰华智行汽车销售服务有限公司', '威海鑫通华康汽车销售服务有限公司', '通辽市众昇销售服务有限公司', '通化华运汽车销售服务有限公司', '天水华和汽车销售服务有限公司', '天津吉合汽车销售服务有限公司', '十堰大雍欣弘汽车销售有限公司', '沈阳德联华骏汽车销售服务有限公司', '商丘市银丰汽车销售有限公司', '陕西福达汽车服务有限公司', '陕西泛想德邦汽车服务有限公司', '厦门信达通瑞汽车销售服务有限公司', '厦门和泰汽车销售服务有限公司', '衢州鸿圣汽车销售服务有限公司', '内蒙古世通瑞祺汽车销售服务有限公司', '内蒙古华捷众汽车销售服务有限公司', '南阳裕华福源汽车销售服务有限公司', '南京鸿荣汽车销售服务有限公司', '洛阳新荣嘉汽车销售服务有限公司', '六安汉界汽车销售服务有限公司', '临沂问鼎汽车销售服务有限公司', '兰州丰泰世纪汽车销售服务有限公司', '开封博为汽车销售服务有限公司', '酒泉金岛振通新能源汽车销售有限公司', '江苏吉合新能源汽车科技有限公司', '黄石仨创汽车销售有限责任公司', '衡阳瑞祥汽车销售服务有限公司', '哈尔滨华界汽车销售有限公司', '广西恒为汽车销售服务有限公司', '赣州市赛为汽车销售服务有限公司', '阜阳赛力斯汽车销售服务有限公司', '福建信达启润汽车销售服务有限公司', '佛山市吉赛汽车销售服务有限公司', '德州金车博士汽车服务有限公司', '赤峰宜新汽车服务有限公司', '亳州佰利汇新能源汽车销售服务有限公司', '北京百得利智行汽车服务有限公司', '安庆永通汽车销售服务有限公司', '元翔(福建)汽车销售服务有限公司', '新乡市天源汽车商贸有限公司', '青海嘉辉晟汽车销售服务有限公司', '青岛富源豪新能源汽车销售有限公司', '滁州佰利智行汽车销售服务有限公司', '郑州聚广源汽车服务有限公司', '肇庆鸿粤宏鑫汽车销售服务有限公司', '漳州市华骏汽车销售服务有限公司', '湖北三环盛通科技有限公司', '广州鸿粤宏鑫汽车销售服务有限公司', '广东鸿嘉汽车销售服务有限公司', '甘肃金岛振通新能源汽车销售有限公司', '许昌赛博汽车销售服务有限公司', '长沙市骏鸿汽车销售服务有限公司', '银川华为2.', '广东华界汽车销售服务有限公司', '宿州安之星汽车销售服务有限公司', '宁夏瑞华界汽车销售服务有限公司', '湖北中基兴汉汽车销售服务有限公司', '按自然月', '珠海市南菱华鑫汽车销售服务有限公司', '湛江市南菱华赛汽车销售服务有限公司', '西安友邻友安汽车销售服务有限公司', '深圳市骏智汽车销售服务有限公司', '汕头市骏业汽车销售服务有限公司', '山西聚驰汽车销售服务有限公司', '曲靖宝达汽车销售有限公司', '清远市南菱华智汽车销售服务有限公司', '揭阳市骏业汽车销售服务有限公司', '江门市大昌行盛奥汽车销售服务有限公司', '惠州市标驰汽车有限公司', '广州市南菱华弘汽车销售服务有限公司', '广州南菱华粤汽车有限公司', '广州南菱华创汽车有限公司', '佛山市越昌晟汽车贸易有限公司', '东莞市骏业汽车销售服务有限公司', '太原天问汽车销售服务有限公司', '周口市中鑫之宝汽车销售服务有限公司', '郑州中鑫华金汽车销售服务有限公司', '长治市聚鑫驰汽车销售服务有限公司', '宜昌康亿汽车销售服务有限公司', '唐山市福瑞美界汽车销售服务有限公司', '陕西福跃赛为汽车销售服务有限公司', '山西聚锦驰汽车销售服务有限公司', '秦皇岛华启汽车销售服务有限公司', '普洱宝达汽车销售服务有限公司', '河北永通鹏瑞汽车销售服务有限公司', '杭州旺泽宝华汽车销售服务有限公司', '杭州昇宇汽车销售服务有限公司', '海南丰盛利华汽车销售服务有限公司', '恩施华界汽车销售服务有限公司', '楚雄大昌行联迪汽车销售服务有限公司', '北京正通宝泽汽车销售服务有限公司', '北京星悦福瑞汽车销售服务有限公司', '北京市华阳盛世汽车销售有限公司', '北京博瑞祥宇汽车销售服务有限公司', '太仓宝诚汽车销售服务有限公司', '江苏冠川汽车销售服务有限公司', '毕节星瑞象汽车销售服务有限责任公司', '中益德诚(河北)新能源汽车有限公司', '浙江旺泽锦华汽车销售服务有限公司', '长春市华达汽车销售有限公司', '长春华智升汽车销售服务有限公司', '营口华智升汽车销售服务有限公司', '易联讯达(北京)汽车销售有限公司', '延安鑫华悦汽车销售服务有限公司', '沈阳汇升汽车销售有限公司', '沈阳华升汽车销售服务有限公司', '陕西福祥汽车销售服务有限公司', '吉林市华阳汽车销售有限公司', '惠州鸿粤宏鑫汽车销售服务有限公司', '汉中华驭智行汽车销售服务有限公司', '大连华智升汽车销售服务有限公司', '北京中益德诚新能源汽车销售有限公司', '北京中益德诚汽车销售有限公司', '太原瑞尚成汽车销售服务有限公司', '鞍山华升汽车销售服务有限公司', '大庆成悦汽车销售服务有限公司', '延吉市华阳汽车销售服务有限公司', '龙海智行(上海)汽车科技有限公司', '淮南盛至汽车销售服务有限公司', '泉州市华奥致源汽车有限公司', '莆田华奥智源汽车销售有限公司', '南平华奥智源汽车销售有限公司', '梅州华奥智源汽车销售有限公司', '福建华奥智源汽车销售有限公司', '海口华之杰汽车销售有限公司', '华奥集团')
[analysis_service.py:318]
17:43:58 INFO Queried performance for 136 stores (2026-05-25 ~ 2026-06-14, first_brand_id=2365), got 134 results [analysis_service.py:346]
17:43:58 INFO DB performance + store info fetched for 134 stores (2026-05-25 ~ 2026-06-14, first_brand_id=2365) [analysis_service.py:526]
17:44:01 INFO Report generated: temp_uploads\问界生态系数分析_2026-05-25-2026-06-14.xlsx [analysis_service.py:553]
18:16:26 INFO _query_store_performance SQL:
SELECT
m.merchant_name,
m.merchant_id,
m.total_delivery,
m.total_touch,
m.total_yb_orders,
m.total_axb_orders,
m.total_battery_orders,
m.total_tire_orders,
m.province_name,
m.area_supervision,
m.flight_supervision,
m.online_supervision,
sc.operation_mode
FROM (
SELECT
merchant_id,
merchant_name,
province_name,
area_supervision,
flight_supervision,
online_supervision,
SUM(IFNULL(delivery_count, 0)) AS total_delivery,
SUM(IFNULL(sum_equity_to_shop, 0)) AS total_touch,
SUM(IFNULL(sum_extended_warranty, 0)) AS total_yb_orders,
SUM(IFNULL(sum_ax_package, 0)) AS total_axb_orders,
SUM(IFNULL(sum_battery_extended, 0)) AS total_battery_orders,
SUM(IFNULL(sum_tire_warranty, 0)) AS total_tire_orders
FROM dws_merchant_daily_wide
WHERE report_date >= '2026-05-25' AND report_date <= '2026-06-14'
AND first_brand_id = 2365 And sence_type = '0'
GROUP BY merchant_id, merchant_name, province_name,
area_supervision, flight_supervision, online_supervision
) m
LEFT JOIN ods_store_config sc
ON m.merchant_id = sc.merchant_id AND sc.deleted_flag = 'N'
WHERE m.merchant_name IN ('遵义广新智腾汽车销售有限公司', '镇江鸿昇汽车销售服务有限公司', '长沙力天瑞祥汽车销售服务有限公司', '长春德联星骏汽车销售服务有限公司', '益阳瑞祥汽车销售服务有限公司', '宜宾广信汽车销售有限公司', '信阳裕华起航汽车销售服务有限公司', '西昌明云华界汽车销售服务有限责任公司', '武汉市华阳通胜汽车销售有限公司', '武汉大雍欣炎汽车销售服务有限责任公司', '渭南丰华智行汽车销售服务有限公司', '威海鑫通华康汽车销售服务有限公司', '通辽市众昇销售服务有限公司', '通化华运汽车销售服务有限公司', '天水华和汽车销售服务有限公司', '天津吉合汽车销售服务有限公司', '十堰大雍欣弘汽车销售有限公司', '沈阳德联华骏汽车销售服务有限公司', '商丘市银丰汽车销售有限公司', '陕西福达汽车服务有限公司', '陕西泛想德邦汽车服务有限公司', '厦门信达通瑞汽车销售服务有限公司', '厦门和泰汽车销售服务有限公司', '衢州鸿圣汽车销售服务有限公司', '内蒙古世通瑞祺汽车销售服务有限公司', '内蒙古华捷众汽车销售服务有限公司', '南阳裕华福源汽车销售服务有限公司', '南京鸿荣汽车销售服务有限公司', '洛阳新荣嘉汽车销售服务有限公司', '六安汉界汽车销售服务有限公司', '临沂问鼎汽车销售服务有限公司', '兰州丰泰世纪汽车销售服务有限公司', '开封博为汽车销售服务有限公司', '酒泉金岛振通新能源汽车销售有限公司', '江苏吉合新能源汽车科技有限公司', '黄石仨创汽车销售有限责任公司', '衡阳瑞祥汽车销售服务有限公司', '哈尔滨华界汽车销售有限公司', '广西恒为汽车销售服务有限公司', '赣州市赛为汽车销售服务有限公司', '阜阳赛力斯汽车销售服务有限公司', '福建信达启润汽车销售服务有限公司', '佛山市吉赛汽车销售服务有限公司', '德州金车博士汽车服务有限公司', '赤峰宜新汽车服务有限公司', '亳州佰利汇新能源汽车销售服务有限公司', '北京百得利智行汽车服务有限公司', '安庆永通汽车销售服务有限公司', '元翔(福建)汽车销售服务有限公司', '新乡市天源汽车商贸有限公司', '青海嘉辉晟汽车销售服务有限公司', '青岛富源豪新能源汽车销售有限公司', '滁州佰利智行汽车销售服务有限公司', '郑州聚广源汽车服务有限公司', '肇庆鸿粤宏鑫汽车销售服务有限公司', '漳州市华骏汽车销售服务有限公司', '湖北三环盛通科技有限公司', '广州鸿粤宏鑫汽车销售服务有限公司', '广东鸿嘉汽车销售服务有限公司', '甘肃金岛振通新能源汽车销售有限公司', '许昌赛博汽车销售服务有限公司', '长沙市骏鸿汽车销售服务有限公司', '银川华为2.', '广东华界汽车销售服务有限公司', '宿州安之星汽车销售服务有限公司', '宁夏瑞华界汽车销售服务有限公司', '湖北中基兴汉汽车销售服务有限公司', '按自然月', '珠海市南菱华鑫汽车销售服务有限公司', '湛江市南菱华赛汽车销售服务有限公司', '西安友邻友安汽车销售服务有限公司', '深圳市骏智汽车销售服务有限公司', '汕头市骏业汽车销售服务有限公司', '山西聚驰汽车销售服务有限公司', '曲靖宝达汽车销售有限公司', '清远市南菱华智汽车销售服务有限公司', '揭阳市骏业汽车销售服务有限公司', '江门市大昌行盛奥汽车销售服务有限公司', '惠州市标驰汽车有限公司', '广州市南菱华弘汽车销售服务有限公司', '广州南菱华粤汽车有限公司', '广州南菱华创汽车有限公司', '佛山市越昌晟汽车贸易有限公司', '东莞市骏业汽车销售服务有限公司', '太原天问汽车销售服务有限公司', '周口市中鑫之宝汽车销售服务有限公司', '郑州中鑫华金汽车销售服务有限公司', '长治市聚鑫驰汽车销售服务有限公司', '宜昌康亿汽车销售服务有限公司', '唐山市福瑞美界汽车销售服务有限公司', '陕西福跃赛为汽车销售服务有限公司', '山西聚锦驰汽车销售服务有限公司', '秦皇岛华启汽车销售服务有限公司', '普洱宝达汽车销售服务有限公司', '河北永通鹏瑞汽车销售服务有限公司', '杭州旺泽宝华汽车销售服务有限公司', '杭州昇宇汽车销售服务有限公司', '海南丰盛利华汽车销售服务有限公司', '恩施华界汽车销售服务有限公司', '楚雄大昌行联迪汽车销售服务有限公司', '北京正通宝泽汽车销售服务有限公司', '北京星悦福瑞汽车销售服务有限公司', '北京市华阳盛世汽车销售有限公司', '北京博瑞祥宇汽车销售服务有限公司', '太仓宝诚汽车销售服务有限公司', '江苏冠川汽车销售服务有限公司', '毕节星瑞象汽车销售服务有限责任公司', '中益德诚(河北)新能源汽车有限公司', '浙江旺泽锦华汽车销售服务有限公司', '长春市华达汽车销售有限公司', '长春华智升汽车销售服务有限公司', '营口华智升汽车销售服务有限公司', '易联讯达(北京)汽车销售有限公司', '延安鑫华悦汽车销售服务有限公司', '沈阳汇升汽车销售有限公司', '沈阳华升汽车销售服务有限公司', '陕西福祥汽车销售服务有限公司', '吉林市华阳汽车销售有限公司', '惠州鸿粤宏鑫汽车销售服务有限公司', '汉中华驭智行汽车销售服务有限公司', '大连华智升汽车销售服务有限公司', '北京中益德诚新能源汽车销售有限公司', '北京中益德诚汽车销售有限公司', '太原瑞尚成汽车销售服务有限公司', '鞍山华升汽车销售服务有限公司', '大庆成悦汽车销售服务有限公司', '延吉市华阳汽车销售服务有限公司', '龙海智行(上海)汽车科技有限公司', '淮南盛至汽车销售服务有限公司', '泉州市华奥致源汽车有限公司', '莆田华奥智源汽车销售有限公司', '南平华奥智源汽车销售有限公司', '梅州华奥智源汽车销售有限公司', '福建华奥智源汽车销售有限公司', '海口华之杰汽车销售有限公司', '华奥集团')
[analysis_service.py:318]
18:16:26 ERROR Failed to query store performance from DB: (1054, "Unknown column 'sence_type' in 'where clause'") [analysis_service.py:354]
Traceback (most recent call last):
File "D:\work1\data-analyze-webui\app\services\analysis_service.py", line 321, in _query_store_performance
cur.execute(sql, params)
~~~~~~~~~~~^^^^^^^^^^^^^
File "D:\Python313\Lib\site-packages\pymysql\cursors.py", line 157, in execute
result = self._query(query)
File "D:\Python313\Lib\site-packages\pymysql\cursors.py", line 328, in _query
conn.query(q)
~~~~~~~~~~^^^
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 575, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 826, in _read_query_result
result.read()
~~~~~~~~~~~^^
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 1203, in read
first_packet = self.connection._read_packet()
File "D:\Python313\Lib\site-packages\pymysql\connections.py", line 782, in _read_packet
packet.raise_for_error()
~~~~~~~~~~~~~~~~~~~~~~^^
File "D:\Python313\Lib\site-packages\pymysql\protocol.py", line 219, in raise_for_error
err.raise_mysql_exception(self._data)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
File "D:\Python313\Lib\site-packages\pymysql\err.py", line 150, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.OperationalError: (1054, "Unknown column 'sence_type' in 'where clause'")
18:16:26 INFO DB performance + store info fetched for 0 stores (2026-05-25 ~ 2026-06-14, first_brand_id=2365) [analysis_service.py:526]
18:16:30 INFO Report generated: temp_uploads\问界生态系数分析_2026-05-25-2026-06-14.xlsx [analysis_service.py:553]
18:16:56 INFO _query_store_performance SQL:
SELECT
m.merchant_name,
m.merchant_id,
m.total_delivery,
m.total_touch,
m.total_yb_orders,
m.total_axb_orders,
m.total_battery_orders,
m.total_tire_orders,
m.province_name,
m.area_supervision,
m.flight_supervision,
m.online_supervision,
sc.operation_mode
FROM (
SELECT
merchant_id,
merchant_name,
province_name,
area_supervision,
flight_supervision,
online_supervision,
SUM(IFNULL(delivery_count, 0)) AS total_delivery,
SUM(IFNULL(sum_equity_to_shop, 0)) AS total_touch,
SUM(IFNULL(sum_extended_warranty, 0)) AS total_yb_orders,
SUM(IFNULL(sum_ax_package, 0)) AS total_axb_orders,
SUM(IFNULL(sum_battery_extended, 0)) AS total_battery_orders,
SUM(IFNULL(sum_tire_warranty, 0)) AS total_tire_orders
FROM dws_merchant_daily_wide
WHERE report_date >= '2026-05-25' AND report_date <= '2026-06-14'
AND first_brand_id = 2365 And scene_type = '0'
GROUP BY merchant_id, merchant_name, province_name,
area_supervision, flight_supervision, online_supervision
) m
LEFT JOIN ods_store_config sc
ON m.merchant_id = sc.merchant_id AND sc.deleted_flag = 'N'
WHERE m.merchant_name IN ('遵义广新智腾汽车销售有限公司', '镇江鸿昇汽车销售服务有限公司', '长沙力天瑞祥汽车销售服务有限公司', '长春德联星骏汽车销售服务有限公司', '益阳瑞祥汽车销售服务有限公司', '宜宾广信汽车销售有限公司', '信阳裕华起航汽车销售服务有限公司', '西昌明云华界汽车销售服务有限责任公司', '武汉市华阳通胜汽车销售有限公司', '武汉大雍欣炎汽车销售服务有限责任公司', '渭南丰华智行汽车销售服务有限公司', '威海鑫通华康汽车销售服务有限公司', '通辽市众昇销售服务有限公司', '通化华运汽车销售服务有限公司', '天水华和汽车销售服务有限公司', '天津吉合汽车销售服务有限公司', '十堰大雍欣弘汽车销售有限公司', '沈阳德联华骏汽车销售服务有限公司', '商丘市银丰汽车销售有限公司', '陕西福达汽车服务有限公司', '陕西泛想德邦汽车服务有限公司', '厦门信达通瑞汽车销售服务有限公司', '厦门和泰汽车销售服务有限公司', '衢州鸿圣汽车销售服务有限公司', '内蒙古世通瑞祺汽车销售服务有限公司', '内蒙古华捷众汽车销售服务有限公司', '南阳裕华福源汽车销售服务有限公司', '南京鸿荣汽车销售服务有限公司', '洛阳新荣嘉汽车销售服务有限公司', '六安汉界汽车销售服务有限公司', '临沂问鼎汽车销售服务有限公司', '兰州丰泰世纪汽车销售服务有限公司', '开封博为汽车销售服务有限公司', '酒泉金岛振通新能源汽车销售有限公司', '江苏吉合新能源汽车科技有限公司', '黄石仨创汽车销售有限责任公司', '衡阳瑞祥汽车销售服务有限公司', '哈尔滨华界汽车销售有限公司', '广西恒为汽车销售服务有限公司', '赣州市赛为汽车销售服务有限公司', '阜阳赛力斯汽车销售服务有限公司', '福建信达启润汽车销售服务有限公司', '佛山市吉赛汽车销售服务有限公司', '德州金车博士汽车服务有限公司', '赤峰宜新汽车服务有限公司', '亳州佰利汇新能源汽车销售服务有限公司', '北京百得利智行汽车服务有限公司', '安庆永通汽车销售服务有限公司', '元翔(福建)汽车销售服务有限公司', '新乡市天源汽车商贸有限公司', '青海嘉辉晟汽车销售服务有限公司', '青岛富源豪新能源汽车销售有限公司', '滁州佰利智行汽车销售服务有限公司', '郑州聚广源汽车服务有限公司', '肇庆鸿粤宏鑫汽车销售服务有限公司', '漳州市华骏汽车销售服务有限公司', '湖北三环盛通科技有限公司', '广州鸿粤宏鑫汽车销售服务有限公司', '广东鸿嘉汽车销售服务有限公司', '甘肃金岛振通新能源汽车销售有限公司', '许昌赛博汽车销售服务有限公司', '长沙市骏鸿汽车销售服务有限公司', '银川华为2.', '广东华界汽车销售服务有限公司', '宿州安之星汽车销售服务有限公司', '宁夏瑞华界汽车销售服务有限公司', '湖北中基兴汉汽车销售服务有限公司', '按自然月', '珠海市南菱华鑫汽车销售服务有限公司', '湛江市南菱华赛汽车销售服务有限公司', '西安友邻友安汽车销售服务有限公司', '深圳市骏智汽车销售服务有限公司', '汕头市骏业汽车销售服务有限公司', '山西聚驰汽车销售服务有限公司', '曲靖宝达汽车销售有限公司', '清远市南菱华智汽车销售服务有限公司', '揭阳市骏业汽车销售服务有限公司', '江门市大昌行盛奥汽车销售服务有限公司', '惠州市标驰汽车有限公司', '广州市南菱华弘汽车销售服务有限公司', '广州南菱华粤汽车有限公司', '广州南菱华创汽车有限公司', '佛山市越昌晟汽车贸易有限公司', '东莞市骏业汽车销售服务有限公司', '太原天问汽车销售服务有限公司', '周口市中鑫之宝汽车销售服务有限公司', '郑州中鑫华金汽车销售服务有限公司', '长治市聚鑫驰汽车销售服务有限公司', '宜昌康亿汽车销售服务有限公司', '唐山市福瑞美界汽车销售服务有限公司', '陕西福跃赛为汽车销售服务有限公司', '山西聚锦驰汽车销售服务有限公司', '秦皇岛华启汽车销售服务有限公司', '普洱宝达汽车销售服务有限公司', '河北永通鹏瑞汽车销售服务有限公司', '杭州旺泽宝华汽车销售服务有限公司', '杭州昇宇汽车销售服务有限公司', '海南丰盛利华汽车销售服务有限公司', '恩施华界汽车销售服务有限公司', '楚雄大昌行联迪汽车销售服务有限公司', '北京正通宝泽汽车销售服务有限公司', '北京星悦福瑞汽车销售服务有限公司', '北京市华阳盛世汽车销售有限公司', '北京博瑞祥宇汽车销售服务有限公司', '太仓宝诚汽车销售服务有限公司', '江苏冠川汽车销售服务有限公司', '毕节星瑞象汽车销售服务有限责任公司', '中益德诚(河北)新能源汽车有限公司', '浙江旺泽锦华汽车销售服务有限公司', '长春市华达汽车销售有限公司', '长春华智升汽车销售服务有限公司', '营口华智升汽车销售服务有限公司', '易联讯达(北京)汽车销售有限公司', '延安鑫华悦汽车销售服务有限公司', '沈阳汇升汽车销售有限公司', '沈阳华升汽车销售服务有限公司', '陕西福祥汽车销售服务有限公司', '吉林市华阳汽车销售有限公司', '惠州鸿粤宏鑫汽车销售服务有限公司', '汉中华驭智行汽车销售服务有限公司', '大连华智升汽车销售服务有限公司', '北京中益德诚新能源汽车销售有限公司', '北京中益德诚汽车销售有限公司', '太原瑞尚成汽车销售服务有限公司', '鞍山华升汽车销售服务有限公司', '大庆成悦汽车销售服务有限公司', '延吉市华阳汽车销售服务有限公司', '龙海智行(上海)汽车科技有限公司', '淮南盛至汽车销售服务有限公司', '泉州市华奥致源汽车有限公司', '莆田华奥智源汽车销售有限公司', '南平华奥智源汽车销售有限公司', '梅州华奥智源汽车销售有限公司', '福建华奥智源汽车销售有限公司', '海口华之杰汽车销售有限公司', '华奥集团')
[analysis_service.py:318]
18:16:56 INFO Queried performance for 136 stores (2026-05-25 ~ 2026-06-14, first_brand_id=2365), got 133 results [analysis_service.py:346]
18:16:56 INFO DB performance + store info fetched for 133 stores (2026-05-25 ~ 2026-06-14, first_brand_id=2365) [analysis_service.py:526]
18:17:00 INFO Report generated: temp_uploads\问界生态系数分析_2026-05-25-2026-06-14.xlsx [analysis_service.py:553]
18:43:25 INFO _query_store_performance SQL:
SELECT
m.merchant_name,
m.merchant_id,
m.total_delivery,
m.total_touch,
m.total_yb_orders,
m.total_axb_orders,
m.total_battery_orders,
m.total_tire_orders,
m.province_name,
m.area_supervision,
m.flight_supervision,
m.online_supervision,
sc.operation_mode
FROM (
SELECT
merchant_id,
merchant_name,
province_name,
area_supervision,
flight_supervision,
online_supervision,
SUM(IFNULL(delivery_count, 0)) AS total_delivery,
SUM(IFNULL(sum_equity_to_shop, 0)) AS total_touch,
SUM(IFNULL(sum_extended_warranty, 0)) AS total_yb_orders,
SUM(IFNULL(sum_ax_package, 0)) AS total_axb_orders,
SUM(IFNULL(sum_battery_extended, 0)) AS total_battery_orders,
SUM(IFNULL(sum_tire_warranty, 0)) AS total_tire_orders
FROM dws_merchant_daily_wide
WHERE report_date >= '2026-05-25' AND report_date <= '2026-06-14'
AND first_brand_id = 2365 And scene_type = '0'
GROUP BY merchant_id, merchant_name, province_name,
area_supervision, flight_supervision, online_supervision
) m
LEFT JOIN ods_store_config sc
ON m.merchant_id = sc.merchant_id AND sc.deleted_flag = 'N'
WHERE m.merchant_name IN ('遵义广新智腾汽车销售有限公司', '镇江鸿昇汽车销售服务有限公司', '长沙力天瑞祥汽车销售服务有限公司', '长春德联星骏汽车销售服务有限公司', '益阳瑞祥汽车销售服务有限公司', '宜宾广信汽车销售有限公司', '信阳裕华起航汽车销售服务有限公司', '西昌明云华界汽车销售服务有限责任公司', '武汉市华阳通胜汽车销售有限公司', '武汉大雍欣炎汽车销售服务有限责任公司', '渭南丰华智行汽车销售服务有限公司', '威海鑫通华康汽车销售服务有限公司', '通辽市众昇销售服务有限公司', '通化华运汽车销售服务有限公司', '天水华和汽车销售服务有限公司', '天津吉合汽车销售服务有限公司', '十堰大雍欣弘汽车销售有限公司', '沈阳德联华骏汽车销售服务有限公司', '商丘市银丰汽车销售有限公司', '陕西福达汽车服务有限公司', '陕西泛想德邦汽车服务有限公司', '厦门信达通瑞汽车销售服务有限公司', '厦门和泰汽车销售服务有限公司', '衢州鸿圣汽车销售服务有限公司', '内蒙古世通瑞祺汽车销售服务有限公司', '内蒙古华捷众汽车销售服务有限公司', '南阳裕华福源汽车销售服务有限公司', '南京鸿荣汽车销售服务有限公司', '洛阳新荣嘉汽车销售服务有限公司', '六安汉界汽车销售服务有限公司', '临沂问鼎汽车销售服务有限公司', '兰州丰泰世纪汽车销售服务有限公司', '开封博为汽车销售服务有限公司', '酒泉金岛振通新能源汽车销售有限公司', '江苏吉合新能源汽车科技有限公司', '黄石仨创汽车销售有限责任公司', '衡阳瑞祥汽车销售服务有限公司', '哈尔滨华界汽车销售有限公司', '广西恒为汽车销售服务有限公司', '赣州市赛为汽车销售服务有限公司', '阜阳赛力斯汽车销售服务有限公司', '福建信达启润汽车销售服务有限公司', '佛山市吉赛汽车销售服务有限公司', '德州金车博士汽车服务有限公司', '赤峰宜新汽车服务有限公司', '亳州佰利汇新能源汽车销售服务有限公司', '北京百得利智行汽车服务有限公司', '安庆永通汽车销售服务有限公司', '元翔(福建)汽车销售服务有限公司', '新乡市天源汽车商贸有限公司', '青海嘉辉晟汽车销售服务有限公司', '青岛富源豪新能源汽车销售有限公司', '滁州佰利智行汽车销售服务有限公司', '郑州聚广源汽车服务有限公司', '肇庆鸿粤宏鑫汽车销售服务有限公司', '漳州市华骏汽车销售服务有限公司', '湖北三环盛通科技有限公司', '广州鸿粤宏鑫汽车销售服务有限公司', '广东鸿嘉汽车销售服务有限公司', '甘肃金岛振通新能源汽车销售有限公司', '许昌赛博汽车销售服务有限公司', '长沙市骏鸿汽车销售服务有限公司', '银川华为2.', '广东华界汽车销售服务有限公司', '宿州安之星汽车销售服务有限公司', '宁夏瑞华界汽车销售服务有限公司', '湖北中基兴汉汽车销售服务有限公司', '按自然月', '珠海市南菱华鑫汽车销售服务有限公司', '湛江市南菱华赛汽车销售服务有限公司', '西安友邻友安汽车销售服务有限公司', '深圳市骏智汽车销售服务有限公司', '汕头市骏业汽车销售服务有限公司', '山西聚驰汽车销售服务有限公司', '曲靖宝达汽车销售有限公司', '清远市南菱华智汽车销售服务有限公司', '揭阳市骏业汽车销售服务有限公司', '江门市大昌行盛奥汽车销售服务有限公司', '惠州市标驰汽车有限公司', '广州市南菱华弘汽车销售服务有限公司', '广州南菱华粤汽车有限公司', '广州南菱华创汽车有限公司', '佛山市越昌晟汽车贸易有限公司', '东莞市骏业汽车销售服务有限公司', '太原天问汽车销售服务有限公司', '周口市中鑫之宝汽车销售服务有限公司', '郑州中鑫华金汽车销售服务有限公司', '长治市聚鑫驰汽车销售服务有限公司', '宜昌康亿汽车销售服务有限公司', '唐山市福瑞美界汽车销售服务有限公司', '陕西福跃赛为汽车销售服务有限公司', '山西聚锦驰汽车销售服务有限公司', '秦皇岛华启汽车销售服务有限公司', '普洱宝达汽车销售服务有限公司', '河北永通鹏瑞汽车销售服务有限公司', '杭州旺泽宝华汽车销售服务有限公司', '杭州昇宇汽车销售服务有限公司', '海南丰盛利华汽车销售服务有限公司', '恩施华界汽车销售服务有限公司', '楚雄大昌行联迪汽车销售服务有限公司', '北京正通宝泽汽车销售服务有限公司', '北京星悦福瑞汽车销售服务有限公司', '北京市华阳盛世汽车销售有限公司', '北京博瑞祥宇汽车销售服务有限公司', '太仓宝诚汽车销售服务有限公司', '江苏冠川汽车销售服务有限公司', '毕节星瑞象汽车销售服务有限责任公司', '中益德诚(河北)新能源汽车有限公司', '浙江旺泽锦华汽车销售服务有限公司', '长春市华达汽车销售有限公司', '长春华智升汽车销售服务有限公司', '营口华智升汽车销售服务有限公司', '易联讯达(北京)汽车销售有限公司', '延安鑫华悦汽车销售服务有限公司', '沈阳汇升汽车销售有限公司', '沈阳华升汽车销售服务有限公司', '陕西福祥汽车销售服务有限公司', '吉林市华阳汽车销售有限公司', '惠州鸿粤宏鑫汽车销售服务有限公司', '汉中华驭智行汽车销售服务有限公司', '大连华智升汽车销售服务有限公司', '北京中益德诚新能源汽车销售有限公司', '北京中益德诚汽车销售有限公司', '太原瑞尚成汽车销售服务有限公司', '鞍山华升汽车销售服务有限公司', '大庆成悦汽车销售服务有限公司', '延吉市华阳汽车销售服务有限公司', '龙海智行(上海)汽车科技有限公司', '淮南盛至汽车销售服务有限公司', '泉州市华奥致源汽车有限公司', '莆田华奥智源汽车销售有限公司', '南平华奥智源汽车销售有限公司', '梅州华奥智源汽车销售有限公司', '福建华奥智源汽车销售有限公司', '海口华之杰汽车销售有限公司', '华奥集团')
[analysis_service.py:318]
18:43:25 INFO Queried performance for 136 stores (2026-05-25 ~ 2026-06-14, first_brand_id=2365), got 133 results [analysis_service.py:346]
18:43:25 INFO DB performance + store info fetched for 133 stores (2026-05-25 ~ 2026-06-14, first_brand_id=2365) [analysis_service.py:526]
18:43:29 INFO Report generated: temp_uploads\问界生态系数分析_2026-05-25-2026-06-14.xlsx [analysis_service.py:553]
19:58:18 INFO _query_store_performance SQL:
SELECT
m.merchant_name,
m.merchant_id,
m.total_delivery,
m.total_touch,
m.total_yb_orders,
m.total_axb_orders,
m.total_battery_orders,
m.total_tire_orders,
m.province_name,
m.area_supervision,
m.flight_supervision,
m.online_supervision,
sc.operation_mode
FROM (
SELECT
merchant_id,
merchant_name,
province_name,
area_supervision,
flight_supervision,
online_supervision,
SUM(IFNULL(delivery_count, 0)) AS total_delivery,
SUM(IFNULL(sum_equity_to_shop, 0)) AS total_touch,
SUM(IFNULL(sum_extended_warranty, 0)) AS total_yb_orders,
SUM(IFNULL(sum_ax_package, 0)) AS total_axb_orders,
SUM(IFNULL(sum_battery_extended, 0)) AS total_battery_orders,
SUM(IFNULL(sum_tire_warranty, 0)) AS total_tire_orders
FROM dws_merchant_daily_wide
WHERE report_date >= '2026-05-25' AND report_date <= '2026-06-14'
AND first_brand_id = 2365 And scene_type = '0'
GROUP BY merchant_id, merchant_name, province_name,
area_supervision, flight_supervision, online_supervision
) m
LEFT JOIN ods_store_config sc
ON m.merchant_id = sc.merchant_id AND sc.deleted_flag = 'N'
WHERE m.merchant_name IN ('遵义广新智腾汽车销售有限公司', '镇江鸿昇汽车销售服务有限公司', '长沙力天瑞祥汽车销售服务有限公司', '长春德联星骏汽车销售服务有限公司', '益阳瑞祥汽车销售服务有限公司', '宜宾广信汽车销售有限公司', '信阳裕华起航汽车销售服务有限公司', '西昌明云华界汽车销售服务有限责任公司', '武汉市华阳通胜汽车销售有限公司', '武汉大雍欣炎汽车销售服务有限责任公司', '渭南丰华智行汽车销售服务有限公司', '威海鑫通华康汽车销售服务有限公司', '通辽市众昇销售服务有限公司', '通化华运汽车销售服务有限公司', '天水华和汽车销售服务有限公司', '天津吉合汽车销售服务有限公司', '十堰大雍欣弘汽车销售有限公司', '沈阳德联华骏汽车销售服务有限公司', '商丘市银丰汽车销售有限公司', '陕西福达汽车服务有限公司', '陕西泛想德邦汽车服务有限公司', '厦门信达通瑞汽车销售服务有限公司', '厦门和泰汽车销售服务有限公司', '衢州鸿圣汽车销售服务有限公司', '内蒙古世通瑞祺汽车销售服务有限公司', '内蒙古华捷众汽车销售服务有限公司', '南阳裕华福源汽车销售服务有限公司', '南京鸿荣汽车销售服务有限公司', '洛阳新荣嘉汽车销售服务有限公司', '六安汉界汽车销售服务有限公司', '临沂问鼎汽车销售服务有限公司', '兰州丰泰世纪汽车销售服务有限公司', '开封博为汽车销售服务有限公司', '酒泉金岛振通新能源汽车销售有限公司', '江苏吉合新能源汽车科技有限公司', '黄石仨创汽车销售有限责任公司', '衡阳瑞祥汽车销售服务有限公司', '哈尔滨华界汽车销售有限公司', '广西恒为汽车销售服务有限公司', '赣州市赛为汽车销售服务有限公司', '阜阳赛力斯汽车销售服务有限公司', '福建信达启润汽车销售服务有限公司', '佛山市吉赛汽车销售服务有限公司', '德州金车博士汽车服务有限公司', '赤峰宜新汽车服务有限公司', '亳州佰利汇新能源汽车销售服务有限公司', '北京百得利智行汽车服务有限公司', '安庆永通汽车销售服务有限公司', '元翔(福建)汽车销售服务有限公司', '新乡市天源汽车商贸有限公司', '青海嘉辉晟汽车销售服务有限公司', '青岛富源豪新能源汽车销售有限公司', '滁州佰利智行汽车销售服务有限公司', '郑州聚广源汽车服务有限公司', '肇庆鸿粤宏鑫汽车销售服务有限公司', '漳州市华骏汽车销售服务有限公司', '湖北三环盛通科技有限公司', '广州鸿粤宏鑫汽车销售服务有限公司', '广东鸿嘉汽车销售服务有限公司', '甘肃金岛振通新能源汽车销售有限公司', '许昌赛博汽车销售服务有限公司', '长沙市骏鸿汽车销售服务有限公司', '银川华为2.', '广东华界汽车销售服务有限公司', '宿州安之星汽车销售服务有限公司', '宁夏瑞华界汽车销售服务有限公司', '湖北中基兴汉汽车销售服务有限公司', '按自然月', '珠海市南菱华鑫汽车销售服务有限公司', '湛江市南菱华赛汽车销售服务有限公司', '西安友邻友安汽车销售服务有限公司', '深圳市骏智汽车销售服务有限公司', '汕头市骏业汽车销售服务有限公司', '山西聚驰汽车销售服务有限公司', '曲靖宝达汽车销售有限公司', '清远市南菱华智汽车销售服务有限公司', '揭阳市骏业汽车销售服务有限公司', '江门市大昌行盛奥汽车销售服务有限公司', '惠州市标驰汽车有限公司', '广州市南菱华弘汽车销售服务有限公司', '广州南菱华粤汽车有限公司', '广州南菱华创汽车有限公司', '佛山市越昌晟汽车贸易有限公司', '东莞市骏业汽车销售服务有限公司', '太原天问汽车销售服务有限公司', '周口市中鑫之宝汽车销售服务有限公司', '郑州中鑫华金汽车销售服务有限公司', '长治市聚鑫驰汽车销售服务有限公司', '宜昌康亿汽车销售服务有限公司', '唐山市福瑞美界汽车销售服务有限公司', '陕西福跃赛为汽车销售服务有限公司', '山西聚锦驰汽车销售服务有限公司', '秦皇岛华启汽车销售服务有限公司', '普洱宝达汽车销售服务有限公司', '河北永通鹏瑞汽车销售服务有限公司', '杭州旺泽宝华汽车销售服务有限公司', '杭州昇宇汽车销售服务有限公司', '海南丰盛利华汽车销售服务有限公司', '恩施华界汽车销售服务有限公司', '楚雄大昌行联迪汽车销售服务有限公司', '北京正通宝泽汽车销售服务有限公司', '北京星悦福瑞汽车销售服务有限公司', '北京市华阳盛世汽车销售有限公司', '北京博瑞祥宇汽车销售服务有限公司', '太仓宝诚汽车销售服务有限公司', '江苏冠川汽车销售服务有限公司', '毕节星瑞象汽车销售服务有限责任公司', '中益德诚(河北)新能源汽车有限公司', '浙江旺泽锦华汽车销售服务有限公司', '长春市华达汽车销售有限公司', '长春华智升汽车销售服务有限公司', '营口华智升汽车销售服务有限公司', '易联讯达(北京)汽车销售有限公司', '延安鑫华悦汽车销售服务有限公司', '沈阳汇升汽车销售有限公司', '沈阳华升汽车销售服务有限公司', '陕西福祥汽车销售服务有限公司', '吉林市华阳汽车销售有限公司', '惠州鸿粤宏鑫汽车销售服务有限公司', '汉中华驭智行汽车销售服务有限公司', '大连华智升汽车销售服务有限公司', '北京中益德诚新能源汽车销售有限公司', '北京中益德诚汽车销售有限公司', '太原瑞尚成汽车销售服务有限公司', '鞍山华升汽车销售服务有限公司', '大庆成悦汽车销售服务有限公司', '延吉市华阳汽车销售服务有限公司', '龙海智行(上海)汽车科技有限公司', '淮南盛至汽车销售服务有限公司', '泉州市华奥致源汽车有限公司', '莆田华奥智源汽车销售有限公司', '南平华奥智源汽车销售有限公司', '梅州华奥智源汽车销售有限公司', '福建华奥智源汽车销售有限公司', '海口华之杰汽车销售有限公司', '华奥集团')
[analysis_service.py:318]
19:58:18 INFO Queried performance for 136 stores (2026-05-25 ~ 2026-06-14, first_brand_id=2365), got 133 results [analysis_service.py:346]
19:58:18 INFO DB performance + store info fetched for 133 stores (2026-05-25 ~ 2026-06-14, first_brand_id=2365) [analysis_service.py:526]
19:58:21 INFO Report generated: temp_uploads\问界生态系数分析_2026-05-25-2026-06-14.xlsx [analysis_service.py:553]
20:32:29 INFO _query_store_performance SQL:
SELECT
m.merchant_name,
m.merchant_id,
m.total_delivery,
m.total_touch,
m.total_yb_orders,
m.total_axb_orders,
m.total_battery_orders,
m.total_tire_orders,
m.province_name,
m.area_supervision,
m.flight_supervision,
m.online_supervision,
sc.operation_mode
FROM (
SELECT
merchant_id,
merchant_name,
province_name,
area_supervision,
flight_supervision,
online_supervision,
SUM(IFNULL(delivery_count, 0)) AS total_delivery,
SUM(IFNULL(sum_equity_to_shop, 0)) AS total_touch,
SUM(IFNULL(sum_extended_warranty, 0)) AS total_yb_orders,
SUM(IFNULL(sum_ax_package, 0)) AS total_axb_orders,
SUM(IFNULL(sum_battery_extended, 0)) AS total_battery_orders,
SUM(IFNULL(sum_tire_warranty, 0)) AS total_tire_orders
FROM dws_merchant_daily_wide
WHERE report_date >= '2026-05-25' AND report_date <= '2026-06-14'
AND first_brand_id = 2365 And scene_type = '0'
GROUP BY merchant_id, merchant_name, province_name,
area_supervision, flight_supervision, online_supervision
) m
LEFT JOIN ods_store_config sc
ON m.merchant_id = sc.merchant_id AND sc.deleted_flag = 'N'
WHERE m.merchant_name IN ('遵义广新智腾汽车销售有限公司', '镇江鸿昇汽车销售服务有限公司', '长沙力天瑞祥汽车销售服务有限公司', '长春德联星骏汽车销售服务有限公司', '益阳瑞祥汽车销售服务有限公司', '宜宾广信汽车销售有限公司', '信阳裕华起航汽车销售服务有限公司', '西昌明云华界汽车销售服务有限责任公司', '武汉市华阳通胜汽车销售有限公司', '武汉大雍欣炎汽车销售服务有限责任公司', '渭南丰华智行汽车销售服务有限公司', '威海鑫通华康汽车销售服务有限公司', '通辽市众昇销售服务有限公司', '通化华运汽车销售服务有限公司', '天水华和汽车销售服务有限公司', '天津吉合汽车销售服务有限公司', '十堰大雍欣弘汽车销售有限公司', '沈阳德联华骏汽车销售服务有限公司', '商丘市银丰汽车销售有限公司', '陕西福达汽车服务有限公司', '陕西泛想德邦汽车服务有限公司', '厦门信达通瑞汽车销售服务有限公司', '厦门和泰汽车销售服务有限公司', '衢州鸿圣汽车销售服务有限公司', '内蒙古世通瑞祺汽车销售服务有限公司', '内蒙古华捷众汽车销售服务有限公司', '南阳裕华福源汽车销售服务有限公司', '南京鸿荣汽车销售服务有限公司', '洛阳新荣嘉汽车销售服务有限公司', '六安汉界汽车销售服务有限公司', '临沂问鼎汽车销售服务有限公司', '兰州丰泰世纪汽车销售服务有限公司', '开封博为汽车销售服务有限公司', '酒泉金岛振通新能源汽车销售有限公司', '江苏吉合新能源汽车科技有限公司', '黄石仨创汽车销售有限责任公司', '衡阳瑞祥汽车销售服务有限公司', '哈尔滨华界汽车销售有限公司', '广西恒为汽车销售服务有限公司', '赣州市赛为汽车销售服务有限公司', '阜阳赛力斯汽车销售服务有限公司', '福建信达启润汽车销售服务有限公司', '佛山市吉赛汽车销售服务有限公司', '德州金车博士汽车服务有限公司', '赤峰宜新汽车服务有限公司', '亳州佰利汇新能源汽车销售服务有限公司', '北京百得利智行汽车服务有限公司', '安庆永通汽车销售服务有限公司', '元翔(福建)汽车销售服务有限公司', '新乡市天源汽车商贸有限公司', '青海嘉辉晟汽车销售服务有限公司', '青岛富源豪新能源汽车销售有限公司', '滁州佰利智行汽车销售服务有限公司', '郑州聚广源汽车服务有限公司', '肇庆鸿粤宏鑫汽车销售服务有限公司', '漳州市华骏汽车销售服务有限公司', '湖北三环盛通科技有限公司', '广州鸿粤宏鑫汽车销售服务有限公司', '广东鸿嘉汽车销售服务有限公司', '甘肃金岛振通新能源汽车销售有限公司', '许昌赛博汽车销售服务有限公司', '长沙市骏鸿汽车销售服务有限公司', '银川华为2.', '广东华界汽车销售服务有限公司', '宿州安之星汽车销售服务有限公司', '宁夏瑞华界汽车销售服务有限公司', '湖北中基兴汉汽车销售服务有限公司', '按自然月', '珠海市南菱华鑫汽车销售服务有限公司', '湛江市南菱华赛汽车销售服务有限公司', '西安友邻友安汽车销售服务有限公司', '深圳市骏智汽车销售服务有限公司', '汕头市骏业汽车销售服务有限公司', '山西聚驰汽车销售服务有限公司', '曲靖宝达汽车销售有限公司', '清远市南菱华智汽车销售服务有限公司', '揭阳市骏业汽车销售服务有限公司', '江门市大昌行盛奥汽车销售服务有限公司', '惠州市标驰汽车有限公司', '广州市南菱华弘汽车销售服务有限公司', '广州南菱华粤汽车有限公司', '广州南菱华创汽车有限公司', '佛山市越昌晟汽车贸易有限公司', '东莞市骏业汽车销售服务有限公司', '太原天问汽车销售服务有限公司', '周口市中鑫之宝汽车销售服务有限公司', '郑州中鑫华金汽车销售服务有限公司', '长治市聚鑫驰汽车销售服务有限公司', '宜昌康亿汽车销售服务有限公司', '唐山市福瑞美界汽车销售服务有限公司', '陕西福跃赛为汽车销售服务有限公司', '山西聚锦驰汽车销售服务有限公司', '秦皇岛华启汽车销售服务有限公司', '普洱宝达汽车销售服务有限公司', '河北永通鹏瑞汽车销售服务有限公司', '杭州旺泽宝华汽车销售服务有限公司', '杭州昇宇汽车销售服务有限公司', '海南丰盛利华汽车销售服务有限公司', '恩施华界汽车销售服务有限公司', '楚雄大昌行联迪汽车销售服务有限公司', '北京正通宝泽汽车销售服务有限公司', '北京星悦福瑞汽车销售服务有限公司', '北京市华阳盛世汽车销售有限公司', '北京博瑞祥宇汽车销售服务有限公司', '太仓宝诚汽车销售服务有限公司', '江苏冠川汽车销售服务有限公司', '毕节星瑞象汽车销售服务有限责任公司', '中益德诚(河北)新能源汽车有限公司', '浙江旺泽锦华汽车销售服务有限公司', '长春市华达汽车销售有限公司', '长春华智升汽车销售服务有限公司', '营口华智升汽车销售服务有限公司', '易联讯达(北京)汽车销售有限公司', '延安鑫华悦汽车销售服务有限公司', '沈阳汇升汽车销售有限公司', '沈阳华升汽车销售服务有限公司', '陕西福祥汽车销售服务有限公司', '吉林市华阳汽车销售有限公司', '惠州鸿粤宏鑫汽车销售服务有限公司', '汉中华驭智行汽车销售服务有限公司', '大连华智升汽车销售服务有限公司', '北京中益德诚新能源汽车销售有限公司', '北京中益德诚汽车销售有限公司', '太原瑞尚成汽车销售服务有限公司', '鞍山华升汽车销售服务有限公司', '大庆成悦汽车销售服务有限公司', '延吉市华阳汽车销售服务有限公司', '龙海智行(上海)汽车科技有限公司', '淮南盛至汽车销售服务有限公司', '泉州市华奥致源汽车有限公司', '莆田华奥智源汽车销售有限公司', '南平华奥智源汽车销售有限公司', '梅州华奥智源汽车销售有限公司', '福建华奥智源汽车销售有限公司', '海口华之杰汽车销售有限公司', '华奥集团')
[analysis_service.py:318]
20:32:29 INFO Queried performance for 136 stores (2026-05-25 ~ 2026-06-14, first_brand_id=2365), got 133 results [analysis_service.py:346]
20:32:29 INFO DB performance + store info fetched for 133 stores (2026-05-25 ~ 2026-06-14, first_brand_id=2365) [analysis_service.py:526]
20:32:32 INFO Report generated: temp_uploads\问界生态系数分析_2026-05-25-2026-06-14.xlsx [analysis_service.py:564]
...@@ -211,3 +211,68 @@ ...@@ -211,3 +211,68 @@
16:15:19 INFO [Scheduler] APScheduler started successfully. [scheduler.py:53] 16:15:19 INFO [Scheduler] APScheduler started successfully. [scheduler.py:53]
16:25:19 INFO [Scheduler] System health check at 2026-06-23 16:25:19.403715 [scheduler.py:77] 16:25:19 INFO [Scheduler] System health check at 2026-06-23 16:25:19.403715 [scheduler.py:77]
16:35:19 INFO [Scheduler] System health check at 2026-06-23 16:35:19.404934 [scheduler.py:77] 16:35:19 INFO [Scheduler] System health check at 2026-06-23 16:35:19.404934 [scheduler.py:77]
16:45:19 INFO [Scheduler] System health check at 2026-06-23 16:45:19.413065 [scheduler.py:77]
16:45:22 INFO [Scheduler] Start sync_ods_task at 2026-06-23 16:45:22.004016 [scheduler.py:66]
16:45:28 INFO [Scheduler] sync_ods_task completed. Results: [{'source': 'dj_car_life_service_merchant', 'target': 'ods_service_merchant', 'rows': 1, 'status': 'success', 'range_start': '2026-06-23 15:36:47', 'range_end': '2026-06-23 15:36:47'}, {'source': 'dj_car_life_shop_merchant_director_config', 'target': 'ods_shop_merchant_director_config', 'rows': 2, 'status': 'success', 'range_start': '2026-06-23 15:36:48', 'range_end': '2026-06-23 15:36:48'}, {'source': 'dj_car_life_merchant_brand_model', 'target': 'ods_merchant_brand_model', 'rows': 6, 'status': 'success', 'range_start': '2026-06-12 12:02:22', 'range_end': '2026-06-12 12:02:22'}, {'source': 'dj_car_life_staff_info', 'target': 'ods_staff_info', 'rows': 2, 'status': 'success', 'range_start': '2026-06-23 15:59:54', 'range_end': '2026-06-23 16:35:00'}, {'source': 'dj_car_life_base_goods', 'target': 'ods_base_goods', 'rows': 7, 'status': 'success', 'range_start': '2026-06-23 16:10:45', 'range_end': '2026-06-23 16:33:19'}, {'source': 'dj_car_life_goods_info', 'target': 'ods_goods_info', 'rows': 6, 'status': 'success', 'range_start': '2026-06-23 16:10:45', 'range_end': '2026-06-23 16:33:19'}, {'source': 'dj_car_life_upgrade_goods', 'target': 'ods_upgrade_goods', 'rows': 50, 'status': 'success', 'range_start': '2026-06-23 16:10:46', 'range_end': '2026-06-23 16:33:19'}, {'source': 'dj_car_life_merchant_goods_info', 'target': 'ods_merchant_goods_info', 'rows': 70, 'status': 'success', 'range_start': '2026-06-22 15:39:25', 'range_end': '2026-06-22 15:39:25'}, {'source': 'dj_car_life_merchant_package_goods_info', 'target': 'ods_merchant_package_goods_info', 'rows': 4, 'status': 'success', 'range_start': '2026-06-23 14:51:32', 'range_end': '2026-06-23 16:24:05'}, {'source': 'dj_car_life_staff_daily_report_huawei', 'target': 'ods_staff_daily_report_huawei', 'rows': 139, 'status': 'success', 'range_start': '2026-06-23 16:07:14', 'range_end': '2026-06-23 16:39:07'}, {'source': 'dj_car_life_staff_daily_report', 'target': 'ods_staff_daily_report', 'rows': 25, 'status': 'success', 'range_start': '2026-06-23 16:07:14', 'range_end': '2026-06-23 16:39:07'}, {'source': 'dj_car_life_merchant_daily_report_huawei', 'target': 'ods_merchant_daily_report_huawei', 'rows': 72, 'status': 'success', 'range_start': '2026-06-23 16:07:14', 'range_end': '2026-06-23 16:39:07'}, {'source': 'dj_car_life_goods_order', 'target': 'ods_goods_order', 'rows': 68, 'status': 'success', 'range_start': '2026-06-23 16:15:03', 'range_end': '2026-06-23 16:45:22'}, {'source': 'dj_car_life_goods_sub_order', 'target': 'ods_goods_sub_order', 'rows': 107, 'status': 'success', 'range_start': '2026-06-23 16:14:41', 'range_end': '2026-06-23 16:45:23'}, {'source': 'dj_car_life_goods_order_customer', 'target': 'ods_goods_order_customer', 'rows': 51, 'status': 'success', 'range_start': '2026-06-23 16:14:41', 'range_end': '2026-06-23 16:45:23'}, {'source': 'dj_car_life_merchant_deliver_target_config', 'target': 'ods_merchant_deliver_target_config', 'rows': 1, 'status': 'success', 'range_start': '2026-06-15 23:49:36', 'range_end': '2026-06-15 23:49:36'}, {'source': 'dj_car_life_merchant_output_target_config', 'target': 'ods_merchant_output_target_config', 'rows': 4, 'status': 'success', 'range_start': '2026-06-23 11:50:21', 'range_end': '2026-06-23 11:50:21'}, {'source': 'employee_delivery_deal_rate', 'target': 'ods_employee_delivery_deal_rate', 'rows': 1, 'status': 'success', 'range_start': '2025-12-30 23:25:51', 'range_end': '2025-12-30 23:25:51'}] [scheduler.py:70]
16:49:21 INFO [Scheduler] APScheduler shut down (immediate). [scheduler.py:61]
16:49:25 INFO [Scheduler] Initializing APScheduler... [scheduler.py:28]
16:49:25 INFO [Scheduler] APScheduler started successfully. [scheduler.py:53]
16:58:02 INFO [Scheduler] APScheduler shut down (immediate). [scheduler.py:61]
16:58:06 INFO [Scheduler] Initializing APScheduler... [scheduler.py:28]
16:58:06 INFO [Scheduler] APScheduler started successfully. [scheduler.py:53]
17:01:42 INFO [Scheduler] APScheduler shut down (immediate). [scheduler.py:61]
17:01:45 INFO [Scheduler] Initializing APScheduler... [scheduler.py:28]
17:01:45 INFO [Scheduler] APScheduler started successfully. [scheduler.py:53]
17:09:46 INFO [Scheduler] APScheduler shut down (immediate). [scheduler.py:61]
17:09:49 INFO [Scheduler] Initializing APScheduler... [scheduler.py:28]
17:09:49 INFO [Scheduler] APScheduler started successfully. [scheduler.py:53]
17:13:07 INFO [Scheduler] APScheduler shut down (immediate). [scheduler.py:61]
17:13:10 INFO [Scheduler] Initializing APScheduler... [scheduler.py:28]
17:13:10 INFO [Scheduler] APScheduler started successfully. [scheduler.py:53]
17:23:10 INFO [Scheduler] System health check at 2026-06-23 17:23:10.839740 [scheduler.py:77]
17:33:10 INFO [Scheduler] System health check at 2026-06-23 17:33:10.828027 [scheduler.py:77]
17:43:10 INFO [Scheduler] System health check at 2026-06-23 17:43:10.837676 [scheduler.py:77]
17:43:10 INFO [Scheduler] Start sync_ods_task at 2026-06-23 17:43:10.947977 [scheduler.py:66]
17:43:18 INFO [Scheduler] sync_ods_task completed. Results: [{'source': 'dj_car_life_service_merchant', 'target': 'ods_service_merchant', 'rows': 4, 'status': 'success', 'range_start': '2026-06-23 15:36:47', 'range_end': '2026-06-23 17:30:46'}, {'source': 'dj_car_life_shop_merchant_director_config', 'target': 'ods_shop_merchant_director_config', 'rows': 58, 'status': 'success', 'range_start': '2026-06-23 15:36:48', 'range_end': '2026-06-23 17:30:47'}, {'source': 'dj_car_life_merchant_brand_model', 'target': 'ods_merchant_brand_model', 'rows': 6, 'status': 'success', 'range_start': '2026-06-12 12:02:22', 'range_end': '2026-06-12 12:02:22'}, {'source': 'dj_car_life_staff_info', 'target': 'ods_staff_info', 'rows': 2, 'status': 'success', 'range_start': '2026-06-23 16:35:00', 'range_end': '2026-06-23 17:32:29'}, {'source': 'dj_car_life_base_goods', 'target': 'ods_base_goods', 'rows': 9, 'status': 'success', 'range_start': '2026-06-23 16:33:19', 'range_end': '2026-06-23 17:14:21'}, {'source': 'dj_car_life_goods_info', 'target': 'ods_goods_info', 'rows': 1, 'status': 'success', 'range_start': '2026-06-23 16:33:19', 'range_end': '2026-06-23 16:33:19'}, {'source': 'dj_car_life_upgrade_goods', 'target': 'ods_upgrade_goods', 'rows': 16, 'status': 'success', 'range_start': '2026-06-23 16:33:19', 'range_end': '2026-06-23 17:30:59'}, {'source': 'dj_car_life_merchant_goods_info', 'target': 'ods_merchant_goods_info', 'rows': 70, 'status': 'success', 'range_start': '2026-06-22 15:39:25', 'range_end': '2026-06-22 15:39:25'}, {'source': 'dj_car_life_merchant_package_goods_info', 'target': 'ods_merchant_package_goods_info', 'rows': 4, 'status': 'success', 'range_start': '2026-06-23 16:24:05', 'range_end': '2026-06-23 17:06:31'}, {'source': 'dj_car_life_staff_daily_report_huawei', 'target': 'ods_staff_daily_report_huawei', 'rows': 314, 'status': 'success', 'range_start': '2026-06-23 16:39:07', 'range_end': '2026-06-23 17:43:11'}, {'source': 'dj_car_life_staff_daily_report', 'target': 'ods_staff_daily_report', 'rows': 133, 'status': 'success', 'range_start': '2026-06-23 16:39:07', 'range_end': '2026-06-23 17:43:11'}, {'source': 'dj_car_life_merchant_daily_report_huawei', 'target': 'ods_merchant_daily_report_huawei', 'rows': 208, 'status': 'success', 'range_start': '2026-06-23 16:39:07', 'range_end': '2026-06-23 17:43:11'}, {'source': 'dj_car_life_goods_order', 'target': 'ods_goods_order', 'rows': 128, 'status': 'success', 'range_start': '2026-06-23 16:45:22', 'range_end': '2026-06-23 17:42:59'}, {'source': 'dj_car_life_goods_sub_order', 'target': 'ods_goods_sub_order', 'rows': 174, 'status': 'success', 'range_start': '2026-06-23 16:45:23', 'range_end': '2026-06-23 17:42:24'}, {'source': 'dj_car_life_goods_order_customer', 'target': 'ods_goods_order_customer', 'rows': 94, 'status': 'success', 'range_start': '2026-06-23 16:45:23', 'range_end': '2026-06-23 17:42:24'}, {'source': 'dj_car_life_merchant_deliver_target_config', 'target': 'ods_merchant_deliver_target_config', 'rows': 1, 'status': 'success', 'range_start': '2026-06-15 23:49:36', 'range_end': '2026-06-15 23:49:36'}, {'source': 'dj_car_life_merchant_output_target_config', 'target': 'ods_merchant_output_target_config', 'rows': 4, 'status': 'success', 'range_start': '2026-06-23 11:50:21', 'range_end': '2026-06-23 11:50:21'}, {'source': 'employee_delivery_deal_rate', 'target': 'ods_employee_delivery_deal_rate', 'rows': 1, 'status': 'success', 'range_start': '2025-12-30 23:25:51', 'range_end': '2025-12-30 23:25:51'}] [scheduler.py:70]
17:43:48 INFO [Scheduler] APScheduler shut down (immediate). [scheduler.py:61]
17:43:51 INFO [Scheduler] Initializing APScheduler... [scheduler.py:28]
17:43:51 INFO [Scheduler] APScheduler started successfully. [scheduler.py:53]
17:53:51 INFO [Scheduler] System health check at 2026-06-23 17:53:51.690368 [scheduler.py:77]
18:03:51 INFO [Scheduler] System health check at 2026-06-23 18:03:51.697488 [scheduler.py:77]
18:11:46 INFO [Scheduler] APScheduler shut down (immediate). [scheduler.py:61]
18:11:49 INFO [Scheduler] Initializing APScheduler... [scheduler.py:28]
18:11:49 INFO [Scheduler] APScheduler started successfully. [scheduler.py:53]
18:16:19 INFO [Scheduler] APScheduler shut down (immediate). [scheduler.py:61]
18:16:22 INFO [Scheduler] Initializing APScheduler... [scheduler.py:28]
18:16:22 INFO [Scheduler] APScheduler started successfully. [scheduler.py:53]
18:16:49 INFO [Scheduler] APScheduler shut down (immediate). [scheduler.py:61]
18:16:52 INFO [Scheduler] Initializing APScheduler... [scheduler.py:28]
18:16:52 INFO [Scheduler] APScheduler started successfully. [scheduler.py:53]
18:26:52 INFO [Scheduler] System health check at 2026-06-23 18:26:52.988629 [scheduler.py:77]
18:36:52 INFO [Scheduler] System health check at 2026-06-23 18:36:52.989582 [scheduler.py:77]
18:43:02 INFO [Scheduler] APScheduler shut down (immediate). [scheduler.py:61]
18:43:06 INFO [Scheduler] Initializing APScheduler... [scheduler.py:28]
18:43:06 INFO [Scheduler] APScheduler started successfully. [scheduler.py:53]
18:53:06 INFO [Scheduler] System health check at 2026-06-23 18:53:06.795806 [scheduler.py:77]
19:03:06 INFO [Scheduler] System health check at 2026-06-23 19:03:06.793002 [scheduler.py:77]
19:13:06 INFO [Scheduler] System health check at 2026-06-23 19:13:06.794320 [scheduler.py:77]
19:13:09 INFO [Scheduler] Start sync_ods_task at 2026-06-23 19:13:09.730937 [scheduler.py:66]
19:13:18 INFO [Scheduler] sync_ods_task completed. Results: [{'source': 'dj_car_life_service_merchant', 'target': 'ods_service_merchant', 'rows': 3, 'status': 'success', 'range_start': '2026-06-23 18:10:11', 'range_end': '2026-06-23 18:10:11'}, {'source': 'dj_car_life_shop_merchant_director_config', 'target': 'ods_shop_merchant_director_config', 'rows': 3, 'status': 'success', 'range_start': '2026-06-23 17:30:47', 'range_end': '2026-06-23 17:30:47'}, {'source': 'dj_car_life_merchant_brand_model', 'target': 'ods_merchant_brand_model', 'rows': 6, 'status': 'success', 'range_start': '2026-06-12 12:02:22', 'range_end': '2026-06-12 12:02:22'}, {'source': 'dj_car_life_staff_info', 'target': 'ods_staff_info', 'rows': 1, 'status': 'success', 'range_start': '2026-06-23 18:52:56', 'range_end': '2026-06-23 18:52:56'}, {'source': 'dj_car_life_base_goods', 'target': 'ods_base_goods', 'rows': 4, 'status': 'success', 'range_start': '2026-06-23 18:53:27', 'range_end': '2026-06-23 19:05:08'}, {'source': 'dj_car_life_goods_info', 'target': 'ods_goods_info', 'rows': 1, 'status': 'success', 'range_start': '2026-06-23 18:13:44', 'range_end': '2026-06-23 18:13:44'}, {'source': 'dj_car_life_upgrade_goods', 'target': 'ods_upgrade_goods', 'rows': 97, 'status': 'success', 'range_start': '2026-06-23 18:53:27', 'range_end': '2026-06-23 19:05:21'}, {'source': 'dj_car_life_merchant_goods_info', 'target': 'ods_merchant_goods_info', 'rows': 70, 'status': 'success', 'range_start': '2026-06-22 15:39:25', 'range_end': '2026-06-22 15:39:25'}, {'source': 'dj_car_life_merchant_package_goods_info', 'target': 'ods_merchant_package_goods_info', 'rows': 1, 'status': 'success', 'range_start': '2026-06-23 18:17:19', 'range_end': '2026-06-23 18:17:19'}, {'source': 'dj_car_life_staff_daily_report_huawei', 'target': 'ods_staff_daily_report_huawei', 'rows': 37, 'status': 'success', 'range_start': '2026-06-23 19:01:12', 'range_end': '2026-06-23 19:12:25'}, {'source': 'dj_car_life_staff_daily_report', 'target': 'ods_staff_daily_report', 'rows': 25, 'status': 'success', 'range_start': '2026-06-23 19:01:12', 'range_end': '2026-06-23 19:12:25'}, {'source': 'dj_car_life_merchant_daily_report_huawei', 'target': 'ods_merchant_daily_report_huawei', 'rows': 30, 'status': 'success', 'range_start': '2026-06-23 19:01:12', 'range_end': '2026-06-23 19:12:25'}, {'source': 'dj_car_life_goods_order', 'target': 'ods_goods_order', 'rows': 11, 'status': 'success', 'range_start': '2026-06-23 19:01:10', 'range_end': '2026-06-23 19:11:34'}, {'source': 'dj_car_life_goods_sub_order', 'target': 'ods_goods_sub_order', 'rows': 14, 'status': 'success', 'range_start': '2026-06-23 19:00:52', 'range_end': '2026-06-23 19:11:22'}, {'source': 'dj_car_life_goods_order_customer', 'target': 'ods_goods_order_customer', 'rows': 7, 'status': 'success', 'range_start': '2026-06-23 19:00:52', 'range_end': '2026-06-23 19:11:22'}, {'source': 'dj_car_life_merchant_deliver_target_config', 'target': 'ods_merchant_deliver_target_config', 'rows': 1, 'status': 'success', 'range_start': '2026-06-15 23:49:36', 'range_end': '2026-06-15 23:49:36'}, {'source': 'dj_car_life_merchant_output_target_config', 'target': 'ods_merchant_output_target_config', 'rows': 4, 'status': 'success', 'range_start': '2026-06-23 11:50:21', 'range_end': '2026-06-23 11:50:21'}, {'source': 'employee_delivery_deal_rate', 'target': 'ods_employee_delivery_deal_rate', 'rows': 1, 'status': 'success', 'range_start': '2025-12-30 23:25:51', 'range_end': '2025-12-30 23:25:51'}] [scheduler.py:70]
19:23:06 INFO [Scheduler] System health check at 2026-06-23 19:23:06.789138 [scheduler.py:77]
19:33:06 INFO [Scheduler] System health check at 2026-06-23 19:33:06.795575 [scheduler.py:77]
19:43:06 INFO [Scheduler] System health check at 2026-06-23 19:43:06.798281 [scheduler.py:77]
19:43:09 INFO [Scheduler] Start sync_ods_task at 2026-06-23 19:43:09.973767 [scheduler.py:66]
19:43:17 INFO [Scheduler] sync_ods_task completed. Results: [{'source': 'dj_car_life_service_merchant', 'target': 'ods_service_merchant', 'rows': 3, 'status': 'success', 'range_start': '2026-06-23 18:10:11', 'range_end': '2026-06-23 18:10:11'}, {'source': 'dj_car_life_shop_merchant_director_config', 'target': 'ods_shop_merchant_director_config', 'rows': 3, 'status': 'success', 'range_start': '2026-06-23 17:30:47', 'range_end': '2026-06-23 17:30:47'}, {'source': 'dj_car_life_merchant_brand_model', 'target': 'ods_merchant_brand_model', 'rows': 6, 'status': 'success', 'range_start': '2026-06-12 12:02:22', 'range_end': '2026-06-12 12:02:22'}, {'source': 'dj_car_life_staff_info', 'target': 'ods_staff_info', 'rows': 1, 'status': 'success', 'range_start': '2026-06-23 18:52:56', 'range_end': '2026-06-23 18:52:56'}, {'source': 'dj_car_life_base_goods', 'target': 'ods_base_goods', 'rows': 4, 'status': 'success', 'range_start': '2026-06-23 19:05:08', 'range_end': '2026-06-23 19:20:11'}, {'source': 'dj_car_life_goods_info', 'target': 'ods_goods_info', 'rows': 1, 'status': 'success', 'range_start': '2026-06-23 18:13:44', 'range_end': '2026-06-23 18:13:44'}, {'source': 'dj_car_life_upgrade_goods', 'target': 'ods_upgrade_goods', 'rows': 6, 'status': 'success', 'range_start': '2026-06-23 19:05:21', 'range_end': '2026-06-23 19:20:11'}, {'source': 'dj_car_life_merchant_goods_info', 'target': 'ods_merchant_goods_info', 'rows': 70, 'status': 'success', 'range_start': '2026-06-22 15:39:25', 'range_end': '2026-06-22 15:39:25'}, {'source': 'dj_car_life_merchant_package_goods_info', 'target': 'ods_merchant_package_goods_info', 'rows': 1, 'status': 'success', 'range_start': '2026-06-23 18:17:19', 'range_end': '2026-06-23 18:17:19'}, {'source': 'dj_car_life_staff_daily_report_huawei', 'target': 'ods_staff_daily_report_huawei', 'rows': 103, 'status': 'success', 'range_start': '2026-06-23 19:12:25', 'range_end': '2026-06-23 19:42:20'}, {'source': 'dj_car_life_staff_daily_report', 'target': 'ods_staff_daily_report', 'rows': 45, 'status': 'success', 'range_start': '2026-06-23 19:12:25', 'range_end': '2026-06-23 19:42:20'}, {'source': 'dj_car_life_merchant_daily_report_huawei', 'target': 'ods_merchant_daily_report_huawei', 'rows': 71, 'status': 'success', 'range_start': '2026-06-23 19:12:25', 'range_end': '2026-06-23 19:42:20'}, {'source': 'dj_car_life_goods_order', 'target': 'ods_goods_order', 'rows': 16, 'status': 'success', 'range_start': '2026-06-23 19:11:34', 'range_end': '2026-06-23 19:40:12'}, {'source': 'dj_car_life_goods_sub_order', 'target': 'ods_goods_sub_order', 'rows': 6, 'status': 'success', 'range_start': '2026-06-23 19:11:22', 'range_end': '2026-06-23 19:38:13'}, {'source': 'dj_car_life_goods_order_customer', 'target': 'ods_goods_order_customer', 'rows': 5, 'status': 'success', 'range_start': '2026-06-23 19:11:22', 'range_end': '2026-06-23 19:38:13'}, {'source': 'dj_car_life_merchant_deliver_target_config', 'target': 'ods_merchant_deliver_target_config', 'rows': 1, 'status': 'success', 'range_start': '2026-06-15 23:49:36', 'range_end': '2026-06-15 23:49:36'}, {'source': 'dj_car_life_merchant_output_target_config', 'target': 'ods_merchant_output_target_config', 'rows': 4, 'status': 'success', 'range_start': '2026-06-23 11:50:21', 'range_end': '2026-06-23 11:50:21'}, {'source': 'employee_delivery_deal_rate', 'target': 'ods_employee_delivery_deal_rate', 'rows': 1, 'status': 'success', 'range_start': '2025-12-30 23:25:51', 'range_end': '2025-12-30 23:25:51'}] [scheduler.py:70]
19:53:06 INFO [Scheduler] System health check at 2026-06-23 19:53:06.801717 [scheduler.py:77]
19:57:56 INFO [Scheduler] APScheduler shut down (immediate). [scheduler.py:61]
19:57:59 INFO [Scheduler] Initializing APScheduler... [scheduler.py:28]
19:57:59 INFO [Scheduler] APScheduler started successfully. [scheduler.py:53]
20:07:59 INFO [Scheduler] System health check at 2026-06-23 20:07:59.360295 [scheduler.py:77]
20:17:59 INFO [Scheduler] System health check at 2026-06-23 20:17:59.363213 [scheduler.py:77]
20:27:59 INFO [Scheduler] System health check at 2026-06-23 20:27:59.357078 [scheduler.py:77]
20:27:59 INFO [Scheduler] Start sync_ods_task at 2026-06-23 20:27:59.831842 [scheduler.py:66]
20:28:13 INFO [Scheduler] sync_ods_task completed. Results: [{'source': 'dj_car_life_service_merchant', 'target': 'ods_service_merchant', 'rows': 3, 'status': 'success', 'range_start': '2026-06-23 18:10:11', 'range_end': '2026-06-23 18:10:11'}, {'source': 'dj_car_life_shop_merchant_director_config', 'target': 'ods_shop_merchant_director_config', 'rows': 3, 'status': 'success', 'range_start': '2026-06-23 17:30:47', 'range_end': '2026-06-23 17:30:47'}, {'source': 'dj_car_life_merchant_brand_model', 'target': 'ods_merchant_brand_model', 'rows': 6, 'status': 'success', 'range_start': '2026-06-12 12:02:22', 'range_end': '2026-06-12 12:02:22'}, {'source': 'dj_car_life_staff_info', 'target': 'ods_staff_info', 'rows': 1, 'status': 'success', 'range_start': '2026-06-23 18:52:56', 'range_end': '2026-06-23 18:52:56'}, {'source': 'dj_car_life_base_goods', 'target': 'ods_base_goods', 'rows': 9, 'status': 'success', 'range_start': '2026-06-23 19:20:11', 'range_end': '2026-06-23 20:21:18'}, {'source': 'dj_car_life_goods_info', 'target': 'ods_goods_info', 'rows': 1, 'status': 'success', 'range_start': '2026-06-23 18:13:44', 'range_end': '2026-06-23 18:13:44'}, {'source': 'dj_car_life_upgrade_goods', 'target': 'ods_upgrade_goods', 'rows': 89, 'status': 'success', 'range_start': '2026-06-23 19:20:11', 'range_end': '2026-06-23 20:21:18'}, {'source': 'dj_car_life_merchant_goods_info', 'target': 'ods_merchant_goods_info', 'rows': 70, 'status': 'success', 'range_start': '2026-06-22 15:39:25', 'range_end': '2026-06-22 15:39:25'}, {'source': 'dj_car_life_merchant_package_goods_info', 'target': 'ods_merchant_package_goods_info', 'rows': 1, 'status': 'success', 'range_start': '2026-06-23 18:17:19', 'range_end': '2026-06-23 18:17:19'}, {'source': 'dj_car_life_staff_daily_report_huawei', 'target': 'ods_staff_daily_report_huawei', 'rows': 344, 'status': 'success', 'range_start': '2026-06-23 19:42:20', 'range_end': '2026-06-23 20:26:33'}, {'source': 'dj_car_life_staff_daily_report', 'target': 'ods_staff_daily_report', 'rows': 59, 'status': 'success', 'range_start': '2026-06-23 19:42:20', 'range_end': '2026-06-23 20:26:33'}, {'source': 'dj_car_life_merchant_daily_report_huawei', 'target': 'ods_merchant_daily_report_huawei', 'rows': 135, 'status': 'success', 'range_start': '2026-06-23 19:42:20', 'range_end': '2026-06-23 20:26:33'}, {'source': 'dj_car_life_goods_order', 'target': 'ods_goods_order', 'rows': 46, 'status': 'success', 'range_start': '2026-06-23 19:40:12', 'range_end': '2026-06-23 20:26:02'}, {'source': 'dj_car_life_goods_sub_order', 'target': 'ods_goods_sub_order', 'rows': 59, 'status': 'success', 'range_start': '2026-06-23 19:38:13', 'range_end': '2026-06-23 20:27:06'}, {'source': 'dj_car_life_goods_order_customer', 'target': 'ods_goods_order_customer', 'rows': 18, 'status': 'success', 'range_start': '2026-06-23 19:38:13', 'range_end': '2026-06-23 20:24:28'}, {'source': 'dj_car_life_scene_merchant_ref', 'target': 'ods_scene_merchant_ref', 'rows': 28479, 'status': 'success', 'range_start': 'Beginning', 'range_end': '2026-06-23 18:56:59'}, {'source': 'dj_car_life_yqmerchant_config', 'target': 'ods_yqmerchant_config', 'rows': 1989, 'status': 'success', 'range_start': 'Beginning', 'range_end': '2026-06-23 18:10:11'}, {'source': 'dj_car_life_merchant_deliver_target_config', 'target': 'ods_merchant_deliver_target_config', 'rows': 1, 'status': 'success', 'range_start': '2026-06-15 23:49:36', 'range_end': '2026-06-15 23:49:36'}, {'source': 'dj_car_life_merchant_output_target_config', 'target': 'ods_merchant_output_target_config', 'rows': 4, 'status': 'success', 'range_start': '2026-06-23 11:50:21', 'range_end': '2026-06-23 11:50:21'}, {'source': 'employee_delivery_deal_rate', 'target': 'ods_employee_delivery_deal_rate', 'rows': 1, 'status': 'success', 'range_start': '2025-12-30 23:25:51', 'range_end': '2025-12-30 23:25:51'}] [scheduler.py:70]
20:31:08 INFO [Scheduler] APScheduler shut down (immediate). [scheduler.py:61]
20:31:12 INFO [Scheduler] Initializing APScheduler... [scheduler.py:28]
20:31:12 INFO [Scheduler] APScheduler started successfully. [scheduler.py:53]
20:41:12 INFO [Scheduler] System health check at 2026-06-23 20:41:12.414040 [scheduler.py:77]
...@@ -359,6 +359,60 @@ CREATE TABLE ods_store_config ( ...@@ -359,6 +359,60 @@ CREATE TABLE ods_store_config (
INDEX idx_traffic_grade (traffic_grade) INDEX idx_traffic_grade (traffic_grade)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='店铺配置主数据-ODS'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='店铺配置主数据-ODS';
-- ods_scene_merchant_ref — 场景关联关系表
DROP TABLE IF EXISTS ods_scene_merchant_ref;
CREATE TABLE ods_scene_merchant_ref (
id BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键',
main_merchant_id BIGINT NOT NULL COMMENT '主关联商户ID',
main_merchant_name VARCHAR(128) DEFAULT NULL COMMENT '主关联商户名称',
sub_merchant_id BIGINT NOT NULL COMMENT '被关联商户ID',
sub_merchant_name VARCHAR(128) DEFAULT NULL COMMENT '被关联商户名称',
scene TINYINT NOT NULL COMMENT '场景值',
main_merchant_type TINYINT DEFAULT NULL COMMENT '主关联商户类型',
sub_merchant_type TINYINT DEFAULT NULL COMMENT '被关联商户类型',
deleted_flag CHAR(1) DEFAULT 'N' COMMENT '删除标记',
created_date DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
updated_date DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (id),
INDEX idx_main_merchant (main_merchant_id),
INDEX idx_sub_merchant (sub_merchant_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='场景关联关系表-ODS';
-- ods_yqmerchant_config — 园区店配置项
DROP TABLE IF EXISTS ods_yqmerchant_config;
CREATE TABLE ods_yqmerchant_config (
id BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键',
merchant_id BIGINT NOT NULL COMMENT '商户号',
partner_merchant_id BIGINT DEFAULT NULL COMMENT '主服务商商户ID',
partner_merchant_name VARCHAR(128) DEFAULT NULL COMMENT '主服务商商户名称',
business_model TINYINT DEFAULT NULL COMMENT '经营模式 0-园区店 1-驻店',
deleted_flag CHAR(1) DEFAULT 'N' COMMENT '删除标记',
created_date DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
updated_date DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (id),
INDEX idx_merchant_id (merchant_id),
INDEX idx_partner_merchant_id (partner_merchant_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='园区店配置项-ODS';
-- ods_store_info — 门店基础信息汇总表(合并 ods_store_config + ods_service_merchant)
DROP TABLE IF EXISTS ods_store_info;
CREATE TABLE ods_store_info (
id BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键',
merchant_id BIGINT NOT NULL COMMENT '门店ID',
merchant_name VARCHAR(128) DEFAULT NULL COMMENT '门店名称',
province_name VARCHAR(32) DEFAULT NULL COMMENT '区域(省)',
operation_mode VARCHAR(16) DEFAULT NULL COMMENT '直营与否(直营/非直营)',
area_manager VARCHAR(64) DEFAULT NULL COMMENT '区域运营',
flight_supervisor VARCHAR(128) DEFAULT NULL COMMENT '飞行督导',
online_ops VARCHAR(128) DEFAULT NULL COMMENT '线上运营',
deleted_flag CHAR(1) DEFAULT 'N' COMMENT '删除标记',
created_date DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
updated_date DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (id),
UNIQUE KEY uk_merchant_id (merchant_id),
INDEX idx_name (merchant_name)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='门店基础信息汇总表-ODS';
-- ods_guarantee_config — 兜底保障配置 -- ods_guarantee_config — 兜底保障配置
DROP TABLE IF EXISTS ods_guarantee_config; DROP TABLE IF EXISTS ods_guarantee_config;
CREATE TABLE ods_guarantee_config ( CREATE TABLE ods_guarantee_config (
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!