Commit 50e5bf4d by 周立明

门店名称使用精确匹配

1 parent c1fd1ace
......@@ -887,12 +887,10 @@ def compute_metrics(src, period_start, period_end, month_start=None, month_end_e
logger.warning(f"[指标] 拉取失败,产值/成交/触客置 0: {e}")
def match_any(name, stores):
"""指标系统商户名 ↔ SAAS 门店名 匹配(精确优先,再双向包含)"""
"""指标系统商户名 ↔ SAAS 门店名 匹配(精确匹配,不使用包含)"""
if not name:
return False
if name in stores:
return True
return any(s and (s in name or name in s) for s in stores)
return name in stores
def ind_sum(ind_map, stores, code):
t = Decimal('0')
......@@ -969,16 +967,14 @@ def compute_metrics(src, period_start, period_end, month_start=None, month_end_e
m['全国直营店均人数'] = safe_div(m['全国直营营销人数'], m['全国直营门店总数'])
m['全国人均产值(w)'] = safe_div(m['全国经营总产值'], m['全国直营营销人数'])
# 豪华/非豪华:按「入驻门店」映射门店集合(精确优先,再包含匹配)
# 豪华/非豪华:按「入驻门店」映射门店集合(精确匹配,不使用包含)
lux_stores = {r['store'] for r in allrows if r['category'] == '豪华'}
nonlux_stores = {r['store'] for r in allrows if r['category'] != '豪华'}
def in_stores(hs, stores):
if not hs:
return False
if hs in stores:
return True
return any(s and (s in hs or hs in s) for s in stores)
return hs in stores
lux_emp = {r['emp_no'] for r in not_left if in_stores(r['store'], lux_stores)}
nonlux_emp = {r['emp_no'] for r in not_left if in_stores(r['store'], nonlux_stores)}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!