Files
alert-contract-expiring-hr/scripts/service/platform_collector.py
taojianmin 4af2b4fbf3 v1.1.2: sandbox 卡卡片文本采集 + 解析为 performance 记录
sandbox 行为新发现:
1. 「续聘材料包」按钮不是下载文件,而是触发页面下方显示「续聘准备任务书」
   +「单位清单」卡片(含 checklist + 近三年考核表)
2. 进入 hr/contracts 页面后需要刷新(page.reload)才能看到表格行
3. 表格列序扩展为 10 列:工号 / 姓名 / 单位 / 岗位 / 合同类型 / 起止日期 / 剩余天数 / 预警 / 建议 / 材料包按钮
4. contract_id 改用工号(稳定,不随姓名变化)

改动:
- platform_collector.collect_all:
  * 进入 hr/contracts 后 page.reload 刷新触发 SPA mock 数据加载
  * 新列序映射:r[0]=工号 r[1]=姓名 r[2]=单位 r[3]=岗位 r[4]=合同类型
    r[5]=起止日期 r[6]=剩余天数 r[7]=预警 r[8]=建议
  * 合同 end_date 从「2024-03-01 ~ 2026-04-15」截取 ~ 后的部分
  * 点「续聘材料包」按钮 → 抓下方卡片 inner_text(含 checklist + 考核等次)
  * 把卡片文本存入 materials_content(parse_method='sandbox_card')
- _persist_contracts 增加 sandbox_card 路径分支:写 materials_content 后同步调
  repo.parse_sandbox_card_performance → 抽 year + 等次 → 写 performance_records
- repository.parse_sandbox_card_performance:双模式正则匹配
  * 行格式 "2024\t称职"
  * 叙述式 "2024年:等次「称职」"
- repository.upsert_performance_record + 等次 → 分数映射
  (优秀=90 称职=75 基本称职=60 不称职=30)

实测(sandbox 3 合同):
- RPA-T20190033-20260415 钱实验 → 解析 4 条 performance
- RPA-T20200055-20260630 孙助理 → 解析 6 条
- RPA-T20180021-20260831 王明远 → 解析 6 条
- generate-renewal-task 全部输出 observe + decision_source=rules

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-14 16:01:20 +08:00

24 KiB