R49 合同台账增强:金额分类、筛选、到期预警、续约与导出

这个提交包含在:
2026-04-05 11:21:15 +08:00
父节点 a960c9b57f
当前提交 ff0a677bf3
共修改 10 个文件,包含 2214 行新增和 168 行删除
@@ -0,0 +1,17 @@
-- CreateEnum
CREATE TYPE "ContractRegistryType" AS ENUM ('purchase', 'sales', 'service', 'framework', 'other');
-- AlterTable
ALTER TABLE "contract_registry"
ADD COLUMN "contract_type" "ContractRegistryType" NOT NULL DEFAULT 'other',
ADD COLUMN "amount" DECIMAL(14, 2),
ADD COLUMN "currency" VARCHAR(8) NOT NULL DEFAULT 'CNY',
ADD COLUMN "signed_date" DATE,
ADD COLUMN "effective_date" DATE,
ADD COLUMN "expiry_date" DATE;
-- CreateIndex
CREATE INDEX "idx_contract_registry_status_expiry" ON "contract_registry"("status", "expiry_date");
-- CreateIndex
CREATE INDEX "idx_contract_registry_type_status" ON "contract_registry"("contract_type", "status");
+47 -1
查看文件
@@ -412,6 +412,12 @@ enum TodoStatus {
cancelled
}
enum NotificationDeliveryStatus {
pending
success
failed
}
enum TodoSource {
manual
weekly_report
@@ -492,6 +498,14 @@ enum ConfidentialityLevel {
restricted
}
enum ContractRegistryType {
purchase
sales
service
framework
other
}
enum DocumentStorageType {
oa_link
nas
@@ -549,6 +563,7 @@ model Employee {
emergency_contact_phone String?
notes String?
avatar_path String?
notification_push_enabled Boolean @default(true)
bank_account_encrypted String
bank_name String
@@ -753,13 +768,34 @@ model Notification {
read_at DateTime?
created_at DateTime @default(now())
recipient Employee @relation(fields: [recipient_employee_id], references: [id], onDelete: Cascade)
recipient Employee @relation(fields: [recipient_employee_id], references: [id], onDelete: Cascade)
deliveries NotificationDelivery[]
@@index([recipient_employee_id, created_at])
@@index([recipient_employee_id, read_at, created_at], map: "idx_notifications_unread_query")
@@map("notifications")
}
model NotificationDelivery {
id String @id @default(uuid()) @db.Uuid
notification_id String @db.Uuid
channel_id String @db.Uuid
status NotificationDeliveryStatus
attempt_no Int
result_code String? @db.VarChar(64)
error_message String?
response_body Json?
attempted_at DateTime @default(now())
notification Notification @relation(fields: [notification_id], references: [id], onDelete: Cascade)
channel NotificationChannel @relation(fields: [channel_id], references: [id], onDelete: Cascade)
@@index([notification_id, attempted_at], map: "idx_notification_deliveries_notification_attempted")
@@index([channel_id, attempted_at], map: "idx_notification_deliveries_channel_attempted")
@@index([status, attempted_at], map: "idx_notification_deliveries_status_attempted")
@@map("notification_deliveries")
}
model ExpenseType {
id String @id @default(uuid()) @db.Uuid
code String @unique
@@ -2014,8 +2050,14 @@ model ContractRegistry {
id String @id @default(uuid()) @db.Uuid
contract_no String @unique
project_id String? @db.Uuid
contract_type ContractRegistryType @default(other)
counterparty_name String
summary String
amount Decimal? @db.Decimal(14, 2)
currency String @default("CNY") @db.VarChar(8)
signed_date DateTime? @db.Date
effective_date DateTime? @db.Date
expiry_date DateTime? @db.Date
confidentiality_level ConfidentialityLevel @default(internal)
archive_location String
offline_archive_no String?
@@ -2030,6 +2072,8 @@ model ContractRegistry {
document_refs ConfidentialDocumentRef[]
@@index([project_id, status], map: "idx_contract_registry_project_status")
@@index([status, expiry_date], map: "idx_contract_registry_status_expiry")
@@index([contract_type, status], map: "idx_contract_registry_type_status")
@@index([owner_employee_id, created_at], map: "idx_contract_registry_owner_created")
@@map("contract_registry")
}
@@ -2649,6 +2693,8 @@ model NotificationChannel {
updated_at DateTime @default(now()) @updatedAt
updated_by String? @db.Uuid
deliveries NotificationDelivery[]
@@unique([channel_type, name], map: "notification_channels_type_name_ux")
@@index([enabled, channel_type], map: "idx_notification_channels_enabled_type")
@@map("notification_channels")