Files
alert-contract-expiring-hr/scripts/main.py
taojianmin e2b45d690e v1.0.1: 合同到期智能预警与续聘辅助 - 初版骨架
基于匠厂 skill-template 主仓 v1.0.108 派生的业务技能。

核心业务:
- 每日凌晨定时扫描全校教职工合同电子台账
- 距到期日 90 / 60 / 30 天分级预警(黄 / 橙 / 红)
- 自动生成个人版《续聘准备任务书》与单位版《本月到期人员清单》
- 30 天红色预警自动抄送分管校领导

输出形态:
- 个人版 HTML 任务书 + 单位版 PDF 清单 + 三级预警通知

预期提效:因合同逾期未续签导致的劳动纠纷降为 0;人事处年终集中突击签合同的工作量减少 60%。

业务行生命周期:可续聘 → 预警中(黄 / 橙 / 红)→ 已续签 / 已驳回 / 已过期

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-14 12:19:11 +08:00

92 lines
2.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
"""合同到期智能预警与续聘辅助 - CLI 入口(占位骨架)"""
import sys
from pathlib import Path
# 占位:开发者后续接入 jiangchang_skill_core
# from jiangchang_skill_core import ...
BASE_DIR = Path(__file__).resolve().parent.parent
def health():
"""运行检查(占位)。"""
print(f"alert-contract-expiring-hr health check (placeholder)")
print(f"base_dir: {BASE_DIR}")
return 0
def version():
"""查看版本(占位)。"""
print("alert-contract-expiring-hr v1.0.1")
return 0
def config_path():
"""查看配置位置(占位)。"""
print(f"{BASE_DIR / '.env'}")
return 0
def init_db():
"""初始化数据库(占位)。"""
print("init-db: 后续由开发者按 references/SCHEMA.md 实现")
return 0
def scan_expiring_contracts(thresholds: str = "90,60,30"):
"""扫描即将到期合同(async)。"""
print(f"scan-expiring-contracts: thresholds={thresholds} (待开发者实现)")
return 0
def generate_renewal_task(contract_id: str):
"""生成续聘任务书。"""
print(f"generate-renewal-task: contract_id={contract_id} (待开发者实现)")
return 0
def dispatch_task_notice(unit_id: str = "", month: str = ""):
"""下发续聘任务通知单。"""
print(f"dispatch-task-notice: unit_id={unit_id} month={month} (待开发者实现)")
return 0
def mark_contract_renewed(contract_id: str, material_id: str):
"""标记合同已续签。"""
print(f"mark-contract-renewed: contract_id={contract_id} material_id={material_id} (待开发者实现)")
return 0
def render_html(task_id: str):
"""在浏览器中打开续聘任务书。"""
print(f"render-html: task_id={task_id} (待开发者实现)")
return 0
COMMANDS = {
"health": health,
"version": version,
"config-path": config_path,
"init-db": init_db,
"scan-expiring-contracts": scan_expiring_contracts,
"generate-renewal-task": generate_renewal_task,
"dispatch-task-notice": dispatch_task_notice,
"mark-contract-renewed": mark_contract_renewed,
"render-html": render_html,
}
def main(argv=None):
argv = argv or sys.argv[1:]
if not argv or argv[0] not in COMMANDS:
print("Usage: python scripts/main.py <command>")
print("Commands:", ", ".join(COMMANDS.keys()))
return 1
return COMMANDS[argv[0]](*argv[1:])
if __name__ == "__main__":
sys.exit(main())