Commit 74312e3b by zhouhaibao

feat(data-process): 添加商户名称标准化映射和财务数据分析功能

- 新增别名映射系统,支持流量方和园区店名称标准化
- 实现 D+ 前缀去除和标准名称转换功能
- 扩展 GMV 数据结构,增加服务费、分润、服务商等财务字段
- 集成装修摊销、门店耗材等成本计算逻辑
- 添加 F公司毛利和毛利率计算公式
- 实现在数据处理流程中应用名称标准化映射
- 增加上月毛利率历史数据对比功能
- 更新 Excel 输出格式以包含新的财务指标
- 优化毛利重新计算逻辑以确保数据准确性
1 parent e33de39b
...@@ -93,6 +93,58 @@ KNOWN_PASSWORDS = { ...@@ -93,6 +93,58 @@ KNOWN_PASSWORDS = {
"人力成本表-密码2026": "2026", "人力成本表-密码2026": "2026",
} }
# ---------------- 标准名 / 别名映射(merchant_4s 流量方、merchant_yq 园区店) ----------------
_ALIAS_MAPS = {} # kind('4s'|'yq') -> {alias_name: standard_name}
def strip_if_dplus(name):
"""去 'D+' 前缀的归一化"""
if name and str(name).startswith('D+'):
return str(name)[2:]
return str(name or '')
def load_alias_maps():
"""从 merchant_4s(流量方字典表)与 merchant_yq(园区店字典表)加载 别名→标准名 映射。
结果缓存到模块级 _ALIAS_MAPS,整个进程只加载一次。
"""
global _ALIAS_MAPS
if _ALIAS_MAPS:
return _ALIAS_MAPS
from models import db
maps = {}
for kind, table in (('4s', 'merchant_4s'), ('yq', 'merchant_yq')):
m = {}
try:
with db.engine.connect() as conn:
result = conn.execute(text(f'SELECT standard_name, alias_name FROM `{table}`'))
for r in result.fetchall():
sn = (r[0] or '').strip()
an = (r[1] or '').strip()
if an:
m[an] = sn
except Exception as e:
logger.warning(f"[别名映射] 加载 {table} 失败: {e}")
maps[kind] = m
_ALIAS_MAPS = maps
logger.info(f"[别名映射] 加载完成: 4s({len(maps.get('4s', {}))}个), yq({len(maps.get('yq', {}))}个)")
return _ALIAS_MAPS
def to_standard(raw, kind):
"""将流量方名称(kind='4s')或园区店名称(kind='yq')归一为字典表中的标准名。"""
if raw is None:
return raw
raw = str(raw).strip()
if not raw:
return raw
m = _ALIAS_MAPS.get(kind, {})
if raw in m:
return m[raw]
s = strip_if_dplus(raw)
if s and s != raw and s in m:
return m[s]
return raw
def decrypt_excel_if_needed(file_path): def decrypt_excel_if_needed(file_path):
""" """
...@@ -349,7 +401,8 @@ class DataProcessor: ...@@ -349,7 +401,8 @@ class DataProcessor:
def _fetch_gmv_from_db(self, task_id, stat_month): def _fetch_gmv_from_db(self, task_id, stat_month):
""" """
从 biz_budget_achieve 表查询已有的 GMV 和产值数据。 从 biz_budget_achieve 表查询已有的 GMV 和产值数据。
返回:settlement_map 字典 {(流量方名称, 业务类型, 品牌): {"GMV": Decimal, "产值": Decimal}} 返回:settlement_map 字典 {(流量方名称, 业务类型, 品牌): {"GMV": Decimal, "产值": Decimal,
"服务费": Decimal, "嘀加分润": Decimal, "服务商": str, "装修摊销": Decimal, "门店耗材": Decimal}}
""" """
logger.info(f"[GMV数据] 从数据库获取 task_id={task_id}, stat_month={stat_month} 的 GMV 数据") logger.info(f"[GMV数据] 从数据库获取 task_id={task_id}, stat_month={stat_month} 的 GMV 数据")
settlement_map = {} settlement_map = {}
...@@ -369,12 +422,26 @@ class DataProcessor: ...@@ -369,12 +422,26 @@ class DataProcessor:
brand = (r.brand or "").strip() brand = (r.brand or "").strip()
gmv_val = Decimal(str(r.gmv or 0)) gmv_val = Decimal(str(r.gmv or 0))
revenue_val = Decimal(str(r.revenue or 0)) revenue_val = Decimal(str(r.revenue or 0))
service_fee = Decimal(str(r.service_fee or 0))
dijia_profit = Decimal(str(r.dijia_profit_sharing or 0))
service_provider = (r.service_provider or "").strip()
renovation = Decimal(str(r.renovation_amortization or 0))
consumables = Decimal(str(r.store_consumables or 0))
key = (flow_name, biz_type, brand) key = (flow_name, biz_type, brand)
if key not in settlement_map: if key not in settlement_map:
settlement_map[key] = {"GMV": Decimal("0"), "产值": Decimal("0")} settlement_map[key] = {
"GMV": Decimal("0"), "产值": Decimal("0"),
"服务费": Decimal("0"), "嘀加分润": Decimal("0"),
"服务商": "", "装修摊销": Decimal("0"), "门店耗材": Decimal("0")
}
settlement_map[key]["GMV"] += gmv_val settlement_map[key]["GMV"] += gmv_val
settlement_map[key]["产值"] += revenue_val settlement_map[key]["产值"] += revenue_val
settlement_map[key]["服务费"] += service_fee
settlement_map[key]["嘀加分润"] += dijia_profit
settlement_map[key]["服务商"] = service_provider # 服务商不累积,直接覆盖
settlement_map[key]["装修摊销"] += renovation
settlement_map[key]["门店耗材"] += consumables
logger.info(f"[GMV数据] 获取到 {len(settlement_map)} 条 GMV 记录") logger.info(f"[GMV数据] 获取到 {len(settlement_map)} 条 GMV 记录")
except Exception as e: except Exception as e:
...@@ -423,6 +490,7 @@ class DataProcessor: ...@@ -423,6 +490,7 @@ class DataProcessor:
prev_month_data[key] = { prev_month_data[key] = {
"market_fee_ratio": Decimal(str(r.market_fee_ratio_current or 0)), "market_fee_ratio": Decimal(str(r.market_fee_ratio_current or 0)),
"personnel_salary_ratio": Decimal(str(r.personnel_salary_ratio_current or 0)), "personnel_salary_ratio": Decimal(str(r.personnel_salary_ratio_current or 0)),
"gross_profit_ratio": Decimal(str(r.gross_profit_ratio_current or 0)),
"gmv": Decimal(str(r.gmv or 0)), "gmv": Decimal(str(r.gmv or 0)),
} }
...@@ -488,6 +556,9 @@ class DataProcessor: ...@@ -488,6 +556,9 @@ class DataProcessor:
task_start_time = time.time() task_start_time = time.time()
logger.info(f"[处理任务] 任务 {task_id} 开始处理, 开始时间: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}") logger.info(f"[处理任务] 任务 {task_id} 开始处理, 开始时间: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
# 加载别名映射表(流量方、园区店标准名映射)
load_alias_maps()
# 获取任务 # 获取任务
task = DataProcessTask.query.filter_by(id=task_id, is_deleted=0).first() task = DataProcessTask.query.filter_by(id=task_id, is_deleted=0).first()
if not task: if not task:
...@@ -568,6 +639,11 @@ class DataProcessor: ...@@ -568,6 +639,11 @@ class DataProcessor:
"品牌": brand, "品牌": brand,
"GMV": data["GMV"], "GMV": data["GMV"],
"产值": data["产值"], "产值": data["产值"],
"服务费": data.get("服务费", Decimal("0")),
"嘀加分润": data.get("嘀加分润", Decimal("0")),
"服务商": data.get("服务商", ""),
"装修摊销": data.get("装修摊销", Decimal("0")),
"门店耗材": data.get("门店耗材", Decimal("0")),
}) })
logger.info(f"[处理任务] 从数据库获取 GMV 数据 {len(settlement_data)} 条记录") logger.info(f"[处理任务] 从数据库获取 GMV 数据 {len(settlement_data)} 条记录")
else: else:
...@@ -1031,8 +1107,12 @@ class DataProcessor: ...@@ -1031,8 +1107,12 @@ class DataProcessor:
biz_type = BIZ_TYPE_2_1 biz_type = BIZ_TYPE_2_1
logger.debug(f"[市场费] 2.3→2.1 归属: flow={flow_name}, category={category}") logger.debug(f"[市场费] 2.3→2.1 归属: flow={flow_name}, category={category}")
# 使用标准名映射
std_flow_name = to_standard(flow_name, '4s')
result_row = { result_row = {
"流量方名称": flow_name, "流量方名称": std_flow_name,
"原始名称": flow_name,
"业务类型": biz_type, "业务类型": biz_type,
"品牌": brand or "未知品牌", "品牌": brand or "未知品牌",
"市场费": fee, "市场费": fee,
...@@ -1125,12 +1205,16 @@ class DataProcessor: ...@@ -1125,12 +1205,16 @@ class DataProcessor:
if any(k in flow_source for k in ["合计", "汇总", "总计", "月外"]): if any(k in flow_source for k in ["合计", "汇总", "总计", "月外"]):
continue continue
# 使用标准名映射
std_source = to_standard(flow_source, '4s')
fee = safe_decimal(row[col_total]) fee = safe_decimal(row[col_total])
if fee == 0: if fee == 0:
continue continue
raw_records.append({ raw_records.append({
"流量方名称": flow_source, "流量方名称": std_source,
"原始名称": flow_source,
"业务类型": BIZ_TYPE_1_1, "业务类型": BIZ_TYPE_1_1,
"外援施工费": fee, "外援施工费": fee,
}) })
...@@ -1264,12 +1348,17 @@ class DataProcessor: ...@@ -1264,12 +1348,17 @@ class DataProcessor:
store_name = str(store_name).strip() store_name = str(store_name).strip()
# 使用标准名映射
std_store_name = to_standard(store_name, '4s')
# 获取园区店 # 获取园区店
park_store = "" park_store = ""
if col_park_store: if col_park_store:
park_store_val = row[col_park_store] park_store_val = row[col_park_store]
if pd.notna(park_store_val) and str(park_store_val).strip() not in ["", "nan"]: if pd.notna(park_store_val) and str(park_store_val).strip() not in ["", "nan"]:
park_store = str(park_store_val).strip() park_store = str(park_store_val).strip()
# 园区店也应用标准名映射
park_store = to_standard(park_store, 'yq')
# 获取业务类型 # 获取业务类型
biz_type = None biz_type = None
...@@ -1319,7 +1408,8 @@ class DataProcessor: ...@@ -1319,7 +1408,8 @@ class DataProcessor:
is_park_store = "园区" in store_name or "园区店" in store_name is_park_store = "园区" in store_name or "园区店" in store_name
raw_records.append({ raw_records.append({
"流量方名称": store_name, "流量方名称": std_store_name,
"原始名称": store_name,
"园区店": park_store, "园区店": park_store,
"业务类型": biz_type or "未知", "业务类型": biz_type or "未知",
"技师工资": technician_salary, "技师工资": technician_salary,
...@@ -1476,6 +1566,9 @@ class DataProcessor: ...@@ -1476,6 +1566,9 @@ class DataProcessor:
target = str(target).strip() target = str(target).strip()
# 使用标准名映射
std_target = to_standard(target, '4s')
# 仅统计 1.1 业务 # 仅统计 1.1 业务
if col_biz: if col_biz:
biz_val = str(row[col_biz]).strip() if pd.notna(row[col_biz]) else "" biz_val = str(row[col_biz]).strip() if pd.notna(row[col_biz]) else ""
...@@ -1497,10 +1590,11 @@ class DataProcessor: ...@@ -1497,10 +1590,11 @@ class DataProcessor:
gmv = safe_decimal(row[col_gmv]) gmv = safe_decimal(row[col_gmv])
# 判断是否为园区店 # 判断是否为园区店
is_park_store = "园区" in target or "园区店" in target is_park_store = "园区" in std_target or "园区店" in std_target
raw_records.append({ raw_records.append({
"流量方名称": target, "流量方名称": std_target,
"原始名称": target,
"业务类型": BIZ_TYPE_1_1, "业务类型": BIZ_TYPE_1_1,
"房租及水电费": total_fee, "房租及水电费": total_fee,
"gmv": gmv, "gmv": gmv,
...@@ -1671,15 +1765,30 @@ class DataProcessor: ...@@ -1671,15 +1765,30 @@ class DataProcessor:
if settle_key in settlement_map: if settle_key in settlement_map:
gmv = settlement_map[settle_key]["GMV"] gmv = settlement_map[settle_key]["GMV"]
revenue = settlement_map[settle_key]["产值"] revenue = settlement_map[settle_key]["产值"]
service_fee = settlement_map[settle_key].get("服务费", Decimal("0"))
dijia_profit = settlement_map[settle_key].get("嘀加分润", Decimal("0"))
service_provider = settlement_map[settle_key].get("服务商", "")
renovation = settlement_map[settle_key].get("装修摊销", Decimal("0"))
consumables = settlement_map[settle_key].get("门店耗材", Decimal("0"))
else: else:
# 尝试无品牌匹配 # 尝试无品牌匹配
settle_key_no_brand = (flow_name, biz_type, "") settle_key_no_brand = (flow_name, biz_type, "")
if settle_key_no_brand in settlement_map: if settle_key_no_brand in settlement_map:
gmv = settlement_map[settle_key_no_brand]["GMV"] gmv = settlement_map[settle_key_no_brand]["GMV"]
revenue = settlement_map[settle_key_no_brand]["产值"] revenue = settlement_map[settle_key_no_brand]["产值"]
service_fee = settlement_map[settle_key_no_brand].get("服务费", Decimal("0"))
dijia_profit = settlement_map[settle_key_no_brand].get("嘀加分润", Decimal("0"))
service_provider = settlement_map[settle_key_no_brand].get("服务商", "")
renovation = settlement_map[settle_key_no_brand].get("装修摊销", Decimal("0"))
consumables = settlement_map[settle_key_no_brand].get("门店耗材", Decimal("0"))
else: else:
gmv = Decimal("0") gmv = Decimal("0")
revenue = Decimal("0") revenue = Decimal("0")
service_fee = Decimal("0")
dijia_profit = Decimal("0")
service_provider = ""
renovation = Decimal("0")
consumables = Decimal("0")
row = { row = {
"流量方名称": flow_name, "流量方名称": flow_name,
...@@ -1687,6 +1796,11 @@ class DataProcessor: ...@@ -1687,6 +1796,11 @@ class DataProcessor:
"品牌": brand, "品牌": brand,
"GMV": gmv, "GMV": gmv,
"产值": revenue, "产值": revenue,
"服务商": service_provider,
"服务费": service_fee,
"嘀加分润": dijia_profit,
"装修摊销": renovation,
"门店耗材": consumables,
"市场费": Decimal("0"), "市场费": Decimal("0"),
"外援施工": Decimal("0"), "外援施工": Decimal("0"),
"技师工资": Decimal("0"), "技师工资": Decimal("0"),
...@@ -1756,16 +1870,38 @@ class DataProcessor: ...@@ -1756,16 +1870,38 @@ class DataProcessor:
elif prev_key_no_brand in prev_month_data: elif prev_key_no_brand in prev_month_data:
row["人员工资上月占比"] = prev_month_data[prev_key_no_brand]["personnel_salary_ratio"] row["人员工资上月占比"] = prev_month_data[prev_key_no_brand]["personnel_salary_ratio"]
# 计算毛利 = GMV - 市场费 - 人员工资 - 房租及水电费 # ---------- 计算毛利相关字段 ----------
# 注意:这里的成本计算简化处理 # F公司毛利 - 仅服务商=嘀加自营时计算
gross_profit = gmv - row["市场费"] - row["人员工资"] - row["房租及水电费"] is_dijia_self = "嘀加自营" in str(service_provider or "")
f_company_gross_profit = Decimal("0")
if is_dijia_self:
f_company_gross_profit = service_fee - row["人员工资"]
f_company_gross_profit = round_2(f_company_gross_profit)
row["F公司毛利"] = f_company_gross_profit
# 毛利计算
# 服务商=嘀加自营时:毛利 = 嘀加分润 - 市场费 - 房租水电 - 装修摊销 - 门店耗材 + F公司毛利
# 服务商≠嘀加自营时:毛利 = 嘀加分润 - 市场费 - 房租水电 - 装修摊销 - 门店耗材
if is_dijia_self:
gross_profit = dijia_profit - row["市场费"] - row["房租及水电费"] - renovation - consumables + f_company_gross_profit
else:
gross_profit = dijia_profit - row["市场费"] - row["房租及水电费"] - renovation - consumables
row["毛利"] = round_2(gross_profit) row["毛利"] = round_2(gross_profit)
# 毛利率 = 毛利/GMV*100%
# 本月毛利率 = 毛利/GMV*100%
row["毛利率本月"] = pct(gross_profit, gmv) row["毛利率本月"] = pct(gross_profit, gmv)
row["毛利率上月"] = pct(gross_profit, gmv)
# 上月毛利率 - 从历史数据查询
row["毛利率上月"] = Decimal("0")
if prev_month_data:
if prev_key in prev_month_data:
row["毛利率上月"] = prev_month_data[prev_key].get("gross_profit_ratio", Decimal("0"))
elif prev_key_no_brand in prev_month_data:
row["毛利率上月"] = prev_month_data[prev_key_no_brand].get("gross_profit_ratio", Decimal("0"))
# 四舍五入所有金额 # 四舍五入所有金额
for key in ["市场费", "外援施工", "技师工资", "营销团队工资", "人员工资", "房租及水电费", "毛利"]: for key in ["市场费", "外援施工", "技师工资", "营销团队工资", "人员工资",
"房租及水电费", "F公司毛利", "毛利"]:
row[key] = round_2(row[key]) row[key] = round_2(row[key])
summary.append(row) summary.append(row)
...@@ -1822,7 +1958,7 @@ class DataProcessor: ...@@ -1822,7 +1958,7 @@ class DataProcessor:
ratio = c["GMV"] / total_cand_gmv if total_cand_gmv > 0 else Decimal("0") ratio = c["GMV"] / total_cand_gmv if total_cand_gmv > 0 else Decimal("0")
c["房租及水电费"] += round_2(util_fee * ratio) c["房租及水电费"] += round_2(util_fee * ratio)
# 重新计算占比和毛利 # 重新计算占比和毛利(使用与主循环一致的公式)
for s in summary: for s in summary:
gmv = s["GMV"] gmv = s["GMV"]
revenue = s["产值"] revenue = s["产值"]
...@@ -1830,10 +1966,25 @@ class DataProcessor: ...@@ -1830,10 +1966,25 @@ class DataProcessor:
s["技师工资占比"] = pct(s["技师工资"], revenue) s["技师工资占比"] = pct(s["技师工资"], revenue)
s["营销团队工资占比"] = pct(s["营销团队工资"], revenue) s["营销团队工资占比"] = pct(s["营销团队工资"], revenue)
s["人员工资本月占比"] = pct(s["人员工资"], revenue) s["人员工资本月占比"] = pct(s["人员工资"], revenue)
# 重新计算毛利
gross_profit = gmv - s["市场费"] - s["人员工资"] - s["房租及水电费"] # 重新计算 F公司毛利 和 毛利(使用正确公式)
s["毛利"] = round_2(gross_profit) is_dijia_self = "嘀加自营" in str(s.get("服务商", "") or "")
s["毛利率本月"] = pct(gross_profit, gmv) f_company_gp = Decimal("0")
if is_dijia_self:
svc_fee = s.get("服务费", Decimal("0"))
f_company_gp = round_2(svc_fee - s["人员工资"])
s["F公司毛利"] = f_company_gp
dijia_profit_sharing = s.get("嘀加分润", Decimal("0"))
renovation_amort = s.get("装修摊销", Decimal("0"))
store_consum = s.get("门店耗材", Decimal("0"))
if is_dijia_self:
gp = dijia_profit_sharing - s["市场费"] - s["房租及水电费"] - renovation_amort - store_consum + f_company_gp
else:
gp = dijia_profit_sharing - s["市场费"] - s["房租及水电费"] - renovation_amort - store_consum
s["毛利"] = round_2(gp)
s["毛利率本月"] = pct(gp, gmv)
# ---------- 格式化输出 ---------- # ---------- 格式化输出 ----------
logger.info(f"[成本汇总] 生成完成,共 {len(summary)} 行数据") logger.info(f"[成本汇总] 生成完成,共 {len(summary)} 行数据")
...@@ -1858,6 +2009,8 @@ class DataProcessor: ...@@ -1858,6 +2009,8 @@ class DataProcessor:
'marketing_team_salary', 'marketing_team_salary_ratio', 'marketing_team_salary', 'marketing_team_salary_ratio',
'personnel_salary_ratio_current', 'personnel_salary_ratio_previous', 'personnel_salary_ratio_current', 'personnel_salary_ratio_previous',
'rent_utilities', 'rent_utilities',
'f_company_gross_profit', 'gross_profit',
'gross_profit_ratio_current', 'gross_profit_ratio_previous',
] ]
def safe_float(val): def safe_float(val):
...@@ -1904,6 +2057,7 @@ class DataProcessor: ...@@ -1904,6 +2057,7 @@ class DataProcessor:
'personnel_salary_ratio_current': safe_float(row.get("人员工资本月占比", Decimal("0"))), 'personnel_salary_ratio_current': safe_float(row.get("人员工资本月占比", Decimal("0"))),
'personnel_salary_ratio_previous': safe_float(row.get("人员工资上月占比", Decimal("0"))), 'personnel_salary_ratio_previous': safe_float(row.get("人员工资上月占比", Decimal("0"))),
'rent_utilities': safe_float(row.get("房租及水电费", Decimal("0"))), 'rent_utilities': safe_float(row.get("房租及水电费", Decimal("0"))),
'f_company_gross_profit': safe_float(row.get("F公司毛利", Decimal("0"))),
'gross_profit': safe_float(row.get("毛利", Decimal("0"))), 'gross_profit': safe_float(row.get("毛利", Decimal("0"))),
'gross_profit_ratio_current': safe_float(row.get("毛利率本月", Decimal("0"))), 'gross_profit_ratio_current': safe_float(row.get("毛利率本月", Decimal("0"))),
'gross_profit_ratio_previous': safe_float(row.get("毛利率上月", Decimal("0"))), 'gross_profit_ratio_previous': safe_float(row.get("毛利率上月", Decimal("0"))),
...@@ -1995,7 +2149,7 @@ class DataProcessor: ...@@ -1995,7 +2149,7 @@ class DataProcessor:
"市场费", "市场费本月占比", "市场费上月占比", "市场费", "市场费本月占比", "市场费上月占比",
"外援施工", "技师工资", "技师工资占比", "营销团队工资", "外援施工", "技师工资", "技师工资占比", "营销团队工资",
"营销团队工资占比", "人员工资", "人员工资本月占比", "营销团队工资占比", "人员工资", "人员工资本月占比",
"人员工资上月占比", "房租及水电费", "毛利", "毛利率本月", "毛利率上月", "人员工资上月占比", "房租及水电费", "F公司毛利", "毛利", "毛利率本月", "毛利率上月",
] ]
# 创建 Excel 工作簿 # 创建 Excel 工作簿
...@@ -2031,7 +2185,7 @@ class DataProcessor: ...@@ -2031,7 +2185,7 @@ class DataProcessor:
"毛利率本月", "毛利率上月"} "毛利率本月", "毛利率上月"}
# 数值列名 # 数值列名
numeric_cols = {"GMV", "产值", "市场费", "外援施工", "技师工资", numeric_cols = {"GMV", "产值", "市场费", "外援施工", "技师工资",
"营销团队工资", "人员工资", "房租及水电费", "毛利"} "营销团队工资", "人员工资", "房租及水电费", "F公司毛利", "毛利"}
# 写入数据行 # 写入数据行
for row_idx, row_data in enumerate(summary_data, 2): for row_idx, row_data in enumerate(summary_data, 2):
...@@ -2070,7 +2224,7 @@ class DataProcessor: ...@@ -2070,7 +2224,7 @@ class DataProcessor:
"外援施工": 12, "技师工资": 12, "技师工资占比": 12, "外援施工": 12, "技师工资": 12, "技师工资占比": 12,
"营销团队工资": 14, "营销团队工资占比": 14, "营销团队工资": 14, "营销团队工资占比": 14,
"人员工资": 12, "人员工资本月占比": 14, "人员工资上月占比": 14, "人员工资": 12, "人员工资本月占比": 14, "人员工资上月占比": 14,
"房租及水电费": 14, "毛利": 14, "毛利率本月": 12, "毛利率上月": 12, "房租及水电费": 14, "F公司毛利": 14, "毛利": 14, "毛利率本月": 12, "毛利率上月": 12,
} }
for col_idx, header_name in enumerate(headers, 1): for col_idx, header_name in enumerate(headers, 1):
width = column_widths.get(header_name, 12) width = column_widths.get(header_name, 12)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!