Files
BossAi/seed_debt_templates.py
selfrelease fbda31b290
CI / 后端测试 (push) Has been cancelled
CI / 前端构建 (push) Has been cancelled
fix: seed脚本去掉KnowledgeStore不支持的category参数
2026-09-01 10:52:48 +08:00

286 lines
16 KiB
Python

"""货款催收文书模板 - 种子数据导入。
将催收全流程6阶段的文书模板导入知识库(doc_type='debt_collection_template'),
供法务参谋在催收场景中生成对应文书。
阶段:
1. 友好催收(0-30天) → 催款函
2. 正式催收(30-60天) → 律师函
3. 支付令(60-90天) → 支付令申请书
4. 民事诉讼(90天+) → 起诉状 + 财产保全申请
5. 庭审准备 → 证据目录 + 代理词框架
6. 强制执行 → 强制执行申请书
"""
import json
import os
import sys
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from bossai import KnowledgeStore
DEBT_TEMPLATES = [
# ===== 阶段1:催款函 =====
{
"title": "催款函模板(友好催收阶段)",
"doc_type": "debt_collection_template",
"category": "催收文书",
"source": "BossAi法务参谋",
"content": json.dumps({
"name": "催款函",
"stage": 1,
"stage_name": "友好催收(0-30天)",
"applicable": "逾期30天内,双方关系尚可,希望维护合作关系",
"elements": [
{"key": "creditor", "label": "债权人(我方)名称", "type": "text", "required": True},
{"key": "debtor", "label": "债务人(对方)名称", "type": "text", "required": True},
{"key": "contract_no", "label": "合同编号", "type": "text", "required": False},
{"key": "debt_amount", "label": "欠款金额(元)", "type": "text", "required": True},
{"key": "debt_reason", "label": "欠款事由(货款/服务费等)", "type": "text", "required": True},
{"key": "due_date", "label": "应付款日期", "type": "date", "required": True},
{"key": "overdue_days", "label": "逾期天数", "type": "number", "required": True},
{"key": "request_deadline", "label": "要求还款期限", "type": "date", "required": True},
{"key": "contact_person", "label": "联系人", "type": "text", "required": True},
{"key": "contact_phone", "label": "联系电话", "type": "text", "required": True},
],
"template_text": (
"催款函\n\n"
"{debtor}:\n\n"
"我司{creditor}与贵司于合同编号{contract_no}项下,"
"贵司尚欠我司{debt_reason}款项人民币{debt_amount}元,"
"该款项应于{due_date}支付,现已逾期{overdue_days}天。\n\n"
"鉴于双方长期合作关系,我司一直予以谅解。但该笔款项已严重影响我司资金周转,"
"请贵司于{request_deadline}前将上述款项支付至我司账户。\n\n"
"如贵司暂遇资金困难,请于收到本函后3个工作日内与我司联系,协商还款方案。\n"
"逾期未支付且未协商的,我司将不得不采取进一步法律措施。\n\n"
"{creditor}\n"
"联系人:{contact_person}\n"
"联系电话:{contact_phone}\n"
"{date}"
),
}, ensure_ascii=False),
},
# ===== 阶段2:律师函 =====
{
"title": "律师函模板(正式催收阶段)",
"doc_type": "debt_collection_template",
"category": "催收文书",
"source": "BossAi法务参谋",
"content": json.dumps({
"name": "律师函",
"stage": 2,
"stage_name": "正式催收(30-60天)",
"applicable": "逾期30-60天,友好催收无效,需要正式施压",
"elements": [
{"key": "law_firm", "label": "律师事务所名称", "type": "text", "required": True},
{"key": "lawyer_name", "label": "律师姓名", "type": "text", "required": True},
{"key": "creditor", "label": "委托人(债权人)名称", "type": "text", "required": True},
{"key": "debtor", "label": "债务人名称", "type": "text", "required": True},
{"key": "debt_amount", "label": "欠款金额(元)", "type": "text", "required": True},
{"key": "debt_reason", "label": "欠款事由", "type": "text", "required": True},
{"key": "contract_no", "label": "合同编号", "type": "text", "required": False},
{"key": "due_date", "label": "应付款日期", "type": "date", "required": True},
{"key": "overdue_days", "label": "逾期天数", "type": "number", "required": True},
{"key": "prior_efforts", "label": "已催收情况", "type": "textarea", "required": True},
{"key": "deadline", "label": "最后还款期限", "type": "date", "required": True},
{"key": "legal_consequences", "label": "法律后果提示", "type": "textarea", "required": False},
],
"template_text": (
"律师函\n\n"
"{law_firm}函〔2026〕第XX号\n\n"
"{debtor}:\n\n"
"本律师受{creditor}委托,就贵司拖欠{debt_reason}款项一事,致函如下:\n\n"
"一、基本事实\n"
"贵司与委托人于合同编号{contract_no}项下发生业务往来,"
"贵司应于{due_date}向委托人支付{debt_reason}款项人民币{debt_amount}元。"
"截至本函发出之日,已逾期{overdue_days}天,经委托人多次催收({prior_efforts}),"
"贵司至今未付。\n\n"
"二、法律意见\n"
"根据《中华人民共和国民法典》相关规定,贵司的行为已构成违约,"
"委托人有权要求贵司立即支付欠款及逾期付款违约金。\n\n"
"三、律师要求\n"
"请贵司于{deadline}前将上述款项人民币{debt_amount}元"
"支付至委托人指定账户。\n\n"
"四、法律后果\n"
"如贵司在上述期限内仍未履行付款义务,本律师将受托采取以下法律措施:\n"
"1. 向人民法院申请支付令;\n"
"2. 向人民法院提起民事诉讼,并申请财产保全,冻结贵司银行账户;\n"
"3. 追究贵司逾期付款的违约金及实现债权的费用(含律师费)。\n\n"
"{law_firm}\n"
"经办律师:{lawyer_name}\n"
"{date}"
),
}, ensure_ascii=False),
},
# ===== 阶段3:支付令申请书 =====
{
"title": "支付令申请书模板(司法催收阶段)",
"doc_type": "debt_collection_template",
"category": "催收文书",
"source": "BossAi法务参谋",
"content": json.dumps({
"name": "支付令申请书",
"stage": 3,
"stage_name": "支付令(60-90天)",
"applicable": "逾期60-90天,债权债务关系明确,无其他债务纠纷,请求法院发出支付令",
"elements": [
{"key": "applicant", "label": "申请人名称", "type": "text", "required": True},
{"key": "applicant_legal", "label": "法定代表人", "type": "text", "required": True},
{"key": "applicant_address", "label": "申请人地址", "type": "text", "required": True},
{"key": "applicant_phone", "label": "申请人电话", "type": "text", "required": True},
{"key": "respondent", "label": "被申请人名称", "type": "text", "required": True},
{"key": "respondent_legal", "label": "被申请人法定代表人", "type": "text", "required": True},
{"key": "respondent_address", "label": "被申请人地址", "type": "text", "required": True},
{"key": "respondent_phone", "label": "被申请人电话", "type": "text", "required": False},
{"key": "debt_amount", "label": "欠款金额(元)", "type": "text", "required": True},
{"key": "debt_reason", "label": "欠款事由", "type": "textarea", "required": True},
{"key": "evidence_list", "label": "证据清单", "type": "textarea", "required": True},
{"key": "court", "label": "申请法院", "type": "text", "required": True},
],
"template_text": (
"支付令申请书\n\n"
"申请人:{applicant}\n"
"住所:{applicant_address}\n"
"法定代表人:{applicant_legal}\n"
"联系电话:{applicant_phone}\n\n"
"被申请人:{respondent}\n"
"住所:{respondent_address}\n"
"法定代表人:{respondent_legal}\n"
"联系电话:{respondent_phone}\n\n"
"请求事项:\n"
"请求人民法院向被申请人发出支付令,督促被申请人向申请人支付"
"{debt_reason}款项人民币{debt_amount}元。\n\n"
"事实和理由:\n"
"{debt_reason}\n\n"
"申请人与被申请人之间的债权债务关系明确,并有以下证据予以证明:\n"
"{evidence_list}\n\n"
"被申请人至今未履行付款义务,且对该债务无争议。"
"根据《中华人民共和国民事诉讼法》第二百二十一条规定,"
"特向{court}申请支付令。\n\n"
"此致\n"
"{court}\n\n"
"申请人:{applicant}\n"
"{date}"
),
}, ensure_ascii=False),
},
# ===== 阶段4:财产保全申请书 =====
{
"title": "财产保全申请书模板(诉讼阶段)",
"doc_type": "debt_collection_template",
"category": "催收文书",
"source": "BossAi法务参谋",
"content": json.dumps({
"name": "财产保全申请书",
"stage": 4,
"stage_name": "民事诉讼(90天+)",
"applicable": "起诉前或诉讼中,防止对方转移财产,申请冻结对方账户/查封财产",
"elements": [
{"key": "applicant", "label": "申请人名称", "type": "text", "required": True},
{"key": "respondent", "label": "被申请人名称", "type": "text", "required": True},
{"key": "claim_amount", "label": "请求保全金额(元)", "type": "text", "required": True},
{"key": "case_no", "label": "案号(诉中保全填)", "type": "text", "required": False},
{"key": "property_info", "label": "请求保全的财产线索", "type": "textarea", "required": True},
{"key": "urgency_reason", "label": "紧急性说明(对方可能转移财产的证据)", "type": "textarea", "required": True},
{"key": "guarantee", "label": "担保方式(现金/保函)", "type": "text", "required": True},
{"key": "court", "label": "申请法院", "type": "text", "required": True},
],
"template_text": (
"财产保全申请书\n\n"
"申请人:{applicant}\n"
"被申请人:{respondent}\n\n"
"请求事项:\n"
"请求人民法院查封、冻结被申请人价值人民币{claim_amount}元的财产,"
"具体财产线索如下:\n{property_info}\n\n"
"事实和理由:\n"
"申请人与被申请人因{case_no}一案,现已诉至贵院(或即将起诉)。"
"因被申请人存在转移财产的可能,{urgency_reason}"
"如不立即采取保全措施,将使申请人的合法权益受到难以弥补的损害。\n\n"
"担保:\n"
"申请人提供{guarantee}作为本次保全的担保。\n\n"
"此致\n"
"{court}\n\n"
"申请人:{applicant}\n"
"{date}"
),
}, ensure_ascii=False),
},
# ===== 阶段6:强制执行申请书 =====
{
"title": "强制执行申请书模板(执行阶段)",
"doc_type": "debt_collection_template",
"category": "催收文书",
"source": "BossAi法务参谋",
"content": json.dumps({
"name": "强制执行申请书",
"stage": 6,
"stage_name": "强制执行",
"applicable": "判决书/调解书/仲裁裁决书生效后,对方仍不履行,申请法院强制执行",
"elements": [
{"key": "applicant", "label": "申请人名称", "type": "text", "required": True},
{"key": "applicant_legal", "label": "法定代表人", "type": "text", "required": True},
{"key": "applicant_address", "label": "申请人地址", "type": "text", "required": True},
{"key": "respondent", "label": "被申请人名称", "type": "text", "required": True},
{"key": "respondent_legal", "label": "被申请人法定代表人", "type": "text", "required": True},
{"key": "respondent_address", "label": "被申请人地址", "type": "text", "required": True},
{"key": "respondent_phone", "label": "被申请人电话", "type": "text", "required": False},
{"key": "exec_amount", "label": "申请执行金额(元)", "type": "text", "required": True},
{"key": "legal_doc", "label": "生效法律文书(判决书/调解书/裁决书编号)", "type": "text", "required": True},
{"key": "legal_doc_date", "label": "法律文书生效日期", "type": "date", "required": True},
{"key": "obligation", "label": "被申请人应履行的义务", "type": "textarea", "required": True},
{"key": "property_clues", "label": "财产线索(已知)", "type": "textarea", "required": False},
{"key": "court", "label": "执行法院", "type": "text", "required": True},
],
"template_text": (
"强制执行申请书\n\n"
"申请人:{applicant}\n"
"住所:{applicant_address}\n"
"法定代表人:{applicant_legal}\n\n"
"被申请人:{respondent}\n"
"住所:{respondent_address}\n"
"法定代表人:{respondent_legal}\n"
"联系电话:{respondent_phone}\n\n"
"请求事项:\n"
"请求人民法院强制被申请人履行{legal_doc}确定的义务,"
"向申请人支付人民币{exec_amount}元及迟延履行期间的债务利息。\n\n"
"事实和理由:\n"
"申请人与被申请人因{legal_doc}一案,"
"该法律文书已于{legal_doc_date}生效。"
"被申请人应履行的义务为:{obligation}\n\n"
"但被申请人至今未履行上述义务。申请人已知的被申请人财产线索如下:\n"
"{property_clues}\n\n"
"根据《中华人民共和国民事诉讼法》相关规定,"
"特向{court}申请强制执行。\n\n"
"此致\n"
"{court}\n\n"
"申请人:{applicant}\n"
"{date}"
),
}, ensure_ascii=False),
},
]
def main():
"""导入催收文书模板到知识库。"""
k = KnowledgeStore()
count = 0
for tmpl in DEBT_TEMPLATES:
try:
k.add(
title=tmpl["title"],
content=tmpl["content"],
doc_type=tmpl["doc_type"],
source=tmpl.get("source", "BossAi"),
)
count += 1
print(f" 已导入: {tmpl['title']}")
except Exception as e:
print(f" 失败: {tmpl['title']} - {e}")
print(f"\n已导入 {count} 类催收文书模板到知识库")
if __name__ == "__main__":
main()