Files
37duAutomation/plugins/XQ0001-0100/XQ0036 门店员工起调薪处理/logic/tax.py
T

33 lines
1.1 KiB
Python

# -*- coding: utf-8 -*-
"""纳税单位兜底:优先沿用已显示/花名册值,缺省时按部门全路径中的会馆匹配。"""
from __future__ import annotations
from .. import config
def resolve(row: dict, started: dict = None, staff_base: dict = None,
enabled: bool = True) -> dict:
"""返回 {id, name, source}。"""
started = started or {}
staff_base = staff_base or {}
unit_id = config.text(started.get("taxUnitId"))
if unit_id:
return {"id": unit_id,
"name": config.text(started.get("taxUnitName")) or config.TAX_UNITS.get(unit_id, ""),
"source": "已显示"}
unit_id = config.text(staff_base.get("hsb_field_tax_unit_id"))
if unit_id:
return {"id": unit_id,
"name": config.TAX_UNITS.get(unit_id, ""),
"source": "花名册"}
if enabled:
unit_id, unit_name = config.tax_unit_by_org_path(row.get("ORG_FULL_PATH"))
if unit_id:
return {"id": unit_id, "name": unit_name, "source": "部门全路径"}
return {"id": "", "name": "", "source": "未匹配"}