feat: 新增交通银行数据导出插件及测试通道机制
This commit is contained in:
@@ -63,17 +63,27 @@ def check_directory():
|
||||
add("资料根目录", base_ok, base if base_ok else f"目录不存在:{base}")
|
||||
|
||||
# ---- 1. 名单制作 / 系统办理:源名单 ----
|
||||
src_file = None
|
||||
src_file, src_error = None, ""
|
||||
candidates = []
|
||||
if base_ok:
|
||||
candidates = [p for p in os.listdir(base)
|
||||
if p.lower().endswith(".xlsx") and not p.startswith("~$")
|
||||
and config.SOURCE_KEYWORD in p]
|
||||
add(f"源名单(*{config.SOURCE_KEYWORD}*.xlsx)", bool(candidates),
|
||||
"、".join(sorted(candidates)[:3]) or "未找到,请放入当月《社保变更及增减名单》")
|
||||
if candidates:
|
||||
src_file = os.path.join(base, max(
|
||||
candidates, key=lambda n: os.path.getmtime(os.path.join(base, n))))
|
||||
# 逐文件带上有效性/大小,便于一眼看出哪个文件坏了(0 KB / .xls 改名 / 被占用)
|
||||
detail_items = []
|
||||
for n in sorted(candidates, key=lambda x: os.path.getmtime(os.path.join(base, x)),
|
||||
reverse=True)[:5]:
|
||||
ok_f, info = config._xlsx_valid(os.path.join(base, n))
|
||||
detail_items.append(f"{n}({info})" if ok_f else f"{n}(无效:{info})")
|
||||
add(f"源名单(*{config.SOURCE_KEYWORD}*.xlsx)", True, ";".join(detail_items))
|
||||
try:
|
||||
src_file = config._latest_file(base, config.SOURCE_GLOB)
|
||||
except (ValueError, FileNotFoundError) as e:
|
||||
src_error = str(e)
|
||||
else:
|
||||
add(f"源名单(*{config.SOURCE_KEYWORD}*.xlsx)", False,
|
||||
"未找到,请放入当月《社保变更及增减名单》")
|
||||
|
||||
# ---- 2. 告知书数据源:当月文件 ----
|
||||
if base_ok:
|
||||
@@ -85,7 +95,11 @@ def check_directory():
|
||||
# ---- 3. 源名单关键 sheet ----
|
||||
if src_file:
|
||||
ok, missing = _check_sheets(src_file, ["参保名单", "停保名单"])
|
||||
add("源名单关键 sheet(参保名单/停保名单)", ok, "缺失:" + "、".join(missing) if missing else "齐备")
|
||||
add("源名单关键 sheet(参保名单/停保名单)", ok,
|
||||
"缺失:" + "、".join(missing) if missing else
|
||||
f"齐备({os.path.basename(src_file)})")
|
||||
elif src_error:
|
||||
add("源名单关键 sheet(参保名单/停保名单)", False, f"无法读取:{src_error}")
|
||||
else:
|
||||
add("源名单关键 sheet(参保名单/停保名单)", False, "源名单缺失,跳过校验")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user