Files
freedakgmail c670b9e454 外包风险评估系统:领域引擎+前端+服务端持久化与生产部署
- 确定性领域引擎(分类/评分/分级/红线/费用/裁决)+LLM(通义千问)语言理解
- 6步评估向导、服务端草稿持久化(跨设备/编辑草稿保护)
- 工作流(草稿→风控→管理层)、RBAC、报告导出、校准、客户/费率/红线/最低工资管理
- 专业图标体系替换全部emoji、看板美化
- 生产化:API_BASE可配置(同源反代)、auth密钥惰性读取修复RBAC
- 444单测+204前端测试+51 e2e
2026-06-13 01:06:39 +08:00

27 lines
1.4 KiB
JavaScript

/**
* E2E 基础数据播种:插入少量客户档案(含各信用等级),供 e2e-full.mjs 使用。
* 幂等(ON CONFLICT DO NOTHING)。CI 与本地均可运行。
*/
import { Client } from 'pg';
const URL = process.env.DATABASE_URL ?? 'postgresql://localhost:5432/riskagent';
const customers = [
{ id: 'seed-cust-aaa', name: '某国有大行', creditRating: 'AAA', avgOverdueDays: 3, totalContractAmount: 8000000, assessmentCount: 0, notes: null },
{ id: 'seed-cust-a', name: '某制造企业', creditRating: 'A', avgOverdueDays: 15, totalContractAmount: 2000000, assessmentCount: 0, notes: null },
{ id: 'seed-cust-bbb', name: '某省电信公司', creditRating: 'BBB', avgOverdueDays: 45, totalContractAmount: 3000000, assessmentCount: 0, notes: null },
{ id: 'seed-cust-b', name: '某互联网初创企业', creditRating: 'B', avgOverdueDays: 70, totalContractAmount: 500000, assessmentCount: 0, notes: null },
];
const c = new Client({ connectionString: URL });
await c.connect();
for (const x of customers) {
await c.query(
`INSERT INTO customers(id, name, credit_rating, avg_overdue_days, total_contract_amount, assessment_count, notes, updated_at)
VALUES($1,$2,$3,$4,$5,$6,$7,now()) ON CONFLICT(id) DO NOTHING`,
[x.id, x.name, x.creditRating, x.avgOverdueDays, x.totalContractAmount, x.assessmentCount, x.notes],
);
}
await c.end();
console.log('已播种', customers.length, '个客户档案');