docs: 更新 AGENTS/README 平台架构说明与月度总结,运行日志视图支持已取消状态
This commit is contained in:
@@ -568,8 +568,10 @@ def _import_all_api(categories, on_progress=None):
|
||||
|
||||
results = []
|
||||
units = []
|
||||
for c in categories:
|
||||
for menu in (MENU_SUB, MENU_ADD):
|
||||
# ★ 顺序不可换:先全部类别【减员】,再全部类别【增员】
|
||||
# (替换/改方案人员必须先撤旧方案再上新方案,否则会因方案冲突报错)
|
||||
for menu in (MENU_SUB, MENU_ADD):
|
||||
for c in categories:
|
||||
label = "减员" if menu == MENU_SUB else "增员"
|
||||
file_path = _import_file_path(c, menu)
|
||||
if not os.path.isfile(file_path):
|
||||
@@ -645,6 +647,10 @@ def _map_api_result(category, menu_label, expected_total, res):
|
||||
success = int(res.get("success") or 0)
|
||||
fail = (int(res.get("check_fail") or 0) + int(res.get("save_fail") or 0)
|
||||
+ int(res.get("other") or 0))
|
||||
# 系统会把校验通过的数据自动入库:isSuccess=1 但接口未回填条数时按文件条数推定,
|
||||
# 避免汇总里出现"全部成功却显示成功 0 条"(与 UI 版 assume 口径一致)
|
||||
if res.get("is_success") and success <= 0:
|
||||
success = expected_total
|
||||
exceptions = res.get("exceptions") or []
|
||||
for exc in exceptions:
|
||||
logger.error(" - [%s/%s] 方案[%s]:%s", exc["staff_code"], exc["staff_name"],
|
||||
@@ -698,8 +704,10 @@ def _import_all_ui(categories, on_progress=None):
|
||||
# ---- 预检:按导入文件实际条数过滤出真正需要导入的单元(类别×菜单) ----
|
||||
results = []
|
||||
units = []
|
||||
for c in categories:
|
||||
for menu in (MENU_SUB, MENU_ADD):
|
||||
# ★ 顺序不可换:先全部类别【减员】,再全部类别【增员】
|
||||
# (替换/改方案人员必须先撤旧方案再上新方案,否则会因方案冲突报错)
|
||||
for menu in (MENU_SUB, MENU_ADD):
|
||||
for c in categories:
|
||||
label = "减员" if menu == MENU_SUB else "增员"
|
||||
file_path = _import_file_path(c, menu)
|
||||
if not os.path.isfile(file_path):
|
||||
@@ -763,6 +771,8 @@ def summarize_results(results):
|
||||
|
||||
口径与影刀版一致:需导入条数取自导入文件(expected_total,与接口是否捕获无关);
|
||||
成功/失败取接口返回的业务结果(全部成功时 HR 不返回接口,按文件条数推定成功);
|
||||
业务规则:提交后系统自动把校验通过的数据入库、失败的数据返回明细,因此
|
||||
「成功 N 条」即已入库条数,「异常 M 条」即被退回条数,两者相加应等于需导入条数;
|
||||
流程失败(登录/元素/文件缺失)的单元不纳入条数统计,仅报失败;
|
||||
跳过单元(skipped,无待导入条目)正常纳入统计(需导入 0 条),不报失败/待确认。
|
||||
"""
|
||||
@@ -775,9 +785,12 @@ def summarize_results(results):
|
||||
success = sum(r.get("success_count") or 0 for r in rs if not r.get("error"))
|
||||
fail = sum(len(r.get("exceptions") or []) for r in rs if not r.get("error"))
|
||||
flow_failed = [r["category"] for r in rs if r.get("error")]
|
||||
# 有成功条数说明这批数据已按业务规则入库(系统自动入库成功部分、失败部分返回明细),
|
||||
# 即便 isSuccess 不为 1 也无需人工确认,直接按「成功 N 条 + 异常明细」汇报
|
||||
unconfirmed = [r["category"] for r in rs
|
||||
if not r.get("error") and not r.get("exceptions")
|
||||
and not r.get("assumed_all_success") and not r.get("skipped")
|
||||
and not (r.get("success_count") or 0)
|
||||
and (not r.get("captured") or r.get("state") != TMP_DATA_STATE_OK)]
|
||||
line = f"{label}:需导入 {total} 条,成功 {success} 条,异常 {fail} 条"
|
||||
extras = []
|
||||
|
||||
Reference in New Issue
Block a user