docs: 更新 AGENTS/README 平台架构说明与月度总结,运行日志视图支持已取消状态

This commit is contained in:
2026-10-31 17:55:25 +08:00
parent e1b4097573
commit b976b80d9d
201 changed files with 11049 additions and 7398 deletions
@@ -28,7 +28,7 @@ from .xq35_step2_sign_new_contract import ( # noqa: E402
from .xq35_step1_trial_period_change import initiate_resign_esign # noqa: E402
from .step2_transfer_initiate import _hr_session, load_pending_list # noqa: E402
from .step3_transfer_todo import ( # noqa: E402
WORKER_NAME, WORKFORM_FORM_ID, _log, get_business_data,
WORKER_NAME, WORKFORM_FORM_ID, _abnormal_path, _log, get_business_data,
list_running_workflows, write_abnormal)
ACTIVITY_ESIGN = "离职电子签办理"
@@ -78,32 +78,33 @@ def find_esign_candidates(session, pending):
def process_one(session, flow, code, name, dry_run):
"""处理单人;返回 (result, detail),detail 为失败明细 dict(群通知展示用),成功/跳过为 None。"""
title = str(flow.get("title") or "")
status = query_sign_status(session, flow.get("businessKey"))
if str(status.get("is_initiate_sign") or "") not in ("", "0"):
_log(f"[跳过] {code} {name} | 电子签此前已发起(is_initiate_sign="
f"{status.get('is_initiate_sign')}),不重复发起")
return "already"
return "already", None
if dry_run:
_log(f"[试算·不发起] {code} {name} | {title}")
return "dry"
return "dry", None
ok, msg = initiate_resign_esign(
session, {"base_code": code},
{"business_key": flow.get("businessKey"),
"process_id": flow.get("processId")})
if ok and "此前已完成" in msg:
_log(f"[跳过] {code} {name} | {msg}")
return "already"
return "already", None
if ok:
_log(f"[发起] {code} {name} | {msg}")
return "initiated"
return "initiated", None
if "已发起或已完成" in msg:
# msca 侧重复发起保护(签署记录可能滞后):按已完成处理,不算异常
_log(f"[跳过] {code} {name} | {msg}(按此前已发起处理)")
return "already"
return "already", None
_log(f"[失败] {code} {name} | {msg}")
write_abnormal(code, name, title, "电子签发起失败", msg, dry_run)
return "error"
return "error", {"code": code, "name": name, "kind": "电子签发起失败", "note": msg}
def main(dry_run=None):
@@ -111,15 +112,26 @@ def main(dry_run=None):
pending = load_pending_list()
if not pending:
_log("[待办] 待办工号列表为空(本批次无人待办),无事可做")
return {"initiated": 0, "already": 0, "error": 0, "dry": 0}
return {"initiated": 0, "already": 0, "error": 0, "dry": 0,
"issues": [], "abnormal_path": "", "dry_run": bool(dry_run)}
_log("[待办] 本批待办 {} 人:{}".format(
len(pending), "、".join(f"{c}{n}" for c, n in sorted(pending.items()))))
session = _hr_session()
stats = {"initiated": 0, "already": 0, "error": 0, "dry": 0}
issues = [] # 失败明细(群通知逐条展示,详情落异常表)
for flow, code, name in find_esign_candidates(session, pending):
stats[process_one(session, flow, code, name, dry_run)] += 1
result, detail = process_one(session, flow, code, name, dry_run)
stats[result] += 1
if detail:
issues.append(dict(detail, result=result))
for it in issues:
_log(f"[异常明细] {it.get('code')} {it.get('name')} | "
f"{it.get('kind')} | {it.get('note')}")
_log(f"[汇总] 发起={stats['initiated']} 此前已完成={stats['already']} "
f"失败={stats['error']} 试算={stats['dry']}"
f"{'(试算模式,未发起)' if dry_run else ''}"
f"(待办列表由 step5 回写 AI 表后移除)")
stats["issues"] = issues
stats["abnormal_path"] = _abnormal_path()
stats["dry_run"] = bool(dry_run)
return stats