feat: 完成优化-4全部任务 + 多城市社保 + pgvector修复

- AIAssistant: 会话历史保存/加载/删除,风险预测支持范围筛选,审查结果保存到员工档案
- Dashboard: 待办批量操作,风险分布可下钻,刷新按钮Tab级联,薪税tab导出Excel
- SocialInsurance: 多城市社保/公积金配置支持,城市选择器
- Roster: 新增参保城市字段
- risk.service: 修复风险项去重逻辑(用employeeId:type:actionUrl替代含动态天数的title)
- payroll.routes: 修复OvertimeRecord/Payslip字段名错误
- pgvector: 从源码编译安装x86_64版本兼容postgresql@15
- 优化-4文档: 全部8项标记为已完成
This commit is contained in:
freedakgmail
2026-07-24 07:04:08 +08:00
parent 559a567b9b
commit f1c72f3eb0
20 changed files with 2031 additions and 260 deletions
+39 -2
View File
@@ -131,6 +131,8 @@ model Organization {
salaryChangeRecords SalaryChangeRecord[]
onboardingLinks OnboardingLink[]
confirmLinks ContractConfirmLink[]
aiConversations AIConversation[]
aiReviewRecords AIReviewRecord[]
socialInsuranceConfig SocialInsuranceConfig[]
housingFundConfigs HousingFundConfig[]
socialInsRecords EmployeeSocialInsRecord[]
@@ -191,6 +193,7 @@ model Employee {
housingFundStartMonth String? // 当前公积金开始年月(便捷字段)
housingFundEndMonth String? // 当前公积金截止年月(便捷字段)
specialDeduction Float @default(0) // 专项附加扣除(子女教育、赡养老人等,员工portal端填报)
city String? // 员工社保参保城市
createdBy String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@ -210,6 +213,7 @@ model Employee {
socialInsRecords EmployeeSocialInsRecord[]
housingFundRecords EmployeeHousingFundRecord[]
departmentRecords EmployeeDepartmentRecord[]
aiReviewRecords AIReviewRecord[]
@@unique([orgId, idCardHash])
}
@@ -342,7 +346,7 @@ model SocialInsuranceConfig {
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([orgId, effectiveFrom])
@@unique([orgId, city, effectiveFrom])
@@index([orgId, isCurrent])
}
@@ -363,7 +367,7 @@ model HousingFundConfig {
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([orgId, effectiveFrom])
@@unique([orgId, city, effectiveFrom])
@@index([orgId, isCurrent])
}
@@ -666,6 +670,7 @@ model EmployeeSocialInsRecord {
org Organization @relation(fields: [orgId], references: [id], onDelete: Cascade)
employeeId String
employee Employee @relation(fields: [employeeId], references: [id], onDelete: Cascade)
city String @default("北京") // 参保城市
startMonth String // 开始缴费年月 YYYY-MM
endMonth String? // 截止缴费年月 YYYY-MMnull=至今有效)
base Float // 缴费基数
@@ -677,6 +682,7 @@ model EmployeeSocialInsRecord {
@@index([orgId, employeeId])
@@index([employeeId, startMonth, endMonth])
@@index([orgId, city])
}
model EmployeeHousingFundRecord {
@@ -685,6 +691,7 @@ model EmployeeHousingFundRecord {
org Organization @relation(fields: [orgId], references: [id], onDelete: Cascade)
employeeId String
employee Employee @relation(fields: [employeeId], references: [id], onDelete: Cascade)
city String @default("北京") // 参保城市
startMonth String // 开始缴费年月 YYYY-MM
endMonth String? // 截止缴费年月 YYYY-MMnull=至今有效)
base Float // 缴费基数
@@ -752,3 +759,33 @@ model ContractConfirmLink {
@@index([orgId, status])
}
// ========== AI 会话 & 审查记录 ==========
model AIConversation {
id String @id @default(cuid())
orgId String
org Organization @relation(fields: [orgId], references: [id], onDelete: Cascade)
userId String
title String @default("新对话")
messages Json // [{ role, content }]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([orgId, userId])
}
model AIReviewRecord {
id String @id @default(cuid())
orgId String
org Organization @relation(fields: [orgId], references: [id], onDelete: Cascade)
employeeId String?
employee Employee? @relation(fields: [employeeId], references: [id], onDelete: SetNull)
type String // REVIEW=合同审查, CASE=案例匹配
input String // 用户输入的合同文本或争议情形
result String // AI 返回的审查/分析结果
createdBy String
createdAt DateTime @default(now())
@@index([orgId, employeeId])
}