feat(plugin): 新增 XQ0006 周考勤异常处理、XQ0083 调动流程生效确认;其余插件累积改动
XQ0001 排班异常识别 / XQ0002 雇主险增减操作 / XQ0012 ERP 付款申请 / XQ0013 社保费用申报 / XQ0042 抖音平台核对 / XQ0084 银行卡更新:逻辑与界面 bundle 更新(含各自版本号变更)
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from typing import List, Optional, Tuple
|
||||
from typing import Dict, List, Optional, Tuple
|
||||
|
||||
import pandas as pd
|
||||
|
||||
@@ -118,6 +118,20 @@ def lookup_dept4_by_code(frame: pd.DataFrame, code: str) -> str:
|
||||
return to_text(hit.iloc[0][config.COL_DEPT4])
|
||||
|
||||
|
||||
def dept1_map(frame: pd.DataFrame) -> Dict[str, str]:
|
||||
"""工号 → 一级部门(花名册无「一级部门」列时返回空 dict)。"""
|
||||
if config.COL_DEPT1 not in frame.columns:
|
||||
return {}
|
||||
return {to_text(code): to_text(dept1) for code, dept1
|
||||
in zip(frame[config.COL_CODE], frame[config.COL_DEPT1])}
|
||||
|
||||
|
||||
def dept1_excluded(dept1: str) -> bool:
|
||||
"""一级部门命中剔除关键字(如「后勤」)→ True。"""
|
||||
text = clean(dept1)
|
||||
return any(keyword in text for keyword in config.EXCLUDE_DEPT1_KEYWORDS)
|
||||
|
||||
|
||||
def match_fixed_route(row: dict):
|
||||
"""命中固定路由返回 ``((工号, 姓名), 范围描述)``,未命中返回 ``None``。"""
|
||||
seq = to_text(row.get("现职位序列"))
|
||||
|
||||
@@ -69,9 +69,11 @@ def parse_date(value) -> Optional[date]:
|
||||
|
||||
def recent_window(end: Optional[date] = None, days: int = config.DAYS_DEFAULT
|
||||
) -> Tuple[date, date]:
|
||||
"""近 N 天闭区间(含当天)。"""
|
||||
"""核查窗口:近 N 天(含当天),再排除最近 M 天(当天/昨天),实际 N-M 天。"""
|
||||
end = end or date.today()
|
||||
return end - timedelta(days=max(1, days) - 1), end
|
||||
days = max(1, days)
|
||||
skip = min(config.WINDOW_EXCLUDE_RECENT_DAYS, days - 1)
|
||||
return end - timedelta(days=days - 1), end - timedelta(days=skip)
|
||||
|
||||
|
||||
# ==================== 台账 ====================
|
||||
@@ -251,7 +253,9 @@ def collect_rows(ledger_path: str, check_row, fetcher: ShiftFetcher,
|
||||
"""读台账 → 逐行判定 → 异常行列表。"""
|
||||
frame = load_ledger(ledger_path, log)
|
||||
begin, end_date = recent_window(end, days)
|
||||
log(f"[INFO] 筛选范围:{begin} ~ {end_date}(近 {days} 天)")
|
||||
log(f"[INFO] 筛选范围:{begin} ~ {end_date}(近 {days} 天,排除最近 "
|
||||
f"{config.WINDOW_EXCLUDE_RECENT_DAYS} 天,实际核查 "
|
||||
f"{(end_date - begin).days + 1} 天)")
|
||||
rows = []
|
||||
for _, raw in frame.iterrows():
|
||||
row = check_row(fetcher, dept_fetcher, raw, begin, end_date)
|
||||
|
||||
Reference in New Issue
Block a user