feat: add report material workflows and gateway safeguards
This commit is contained in:
+140
-4
@@ -417,6 +417,9 @@ model SmsSignature {
|
||||
auditStatus String @default("draft")
|
||||
reportStatus String @default("waiting_material")
|
||||
rejectReason String?
|
||||
materialVersion Int @default(1)
|
||||
pendingReport Boolean @default(true)
|
||||
reportChangedAt DateTime @default(now())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@ -429,6 +432,7 @@ model SmsSignature {
|
||||
drainageItems SmsDrainageInfo[]
|
||||
reportTasks ChannelSignatureReportTask[]
|
||||
messageRecords SmsMessageRecord[]
|
||||
reportBatchItems ReportMaterialBatchItem[]
|
||||
|
||||
@@index([tenantId, auditStatus])
|
||||
@@index([tenantId, reportStatus])
|
||||
@@ -445,6 +449,9 @@ model SmsDrainageInfo {
|
||||
reportValues Json?
|
||||
auditStatus String @default("pending")
|
||||
rejectReason String?
|
||||
materialVersion Int @default(1)
|
||||
pendingReport Boolean @default(true)
|
||||
reportChangedAt DateTime @default(now())
|
||||
submittedAt DateTime @default(now())
|
||||
reviewedAt DateTime?
|
||||
createdAt DateTime @default(now())
|
||||
@@ -455,6 +462,7 @@ model SmsDrainageInfo {
|
||||
application SmsApplication? @relation(fields: [applicationId], references: [id])
|
||||
reportTasks ChannelSignatureReportTask[]
|
||||
messageRecords SmsMessageRecord[]
|
||||
reportBatchItems ReportMaterialBatchItem[]
|
||||
|
||||
@@index([tenantId, auditStatus, updatedAt])
|
||||
@@index([signatureId, auditStatus])
|
||||
@@ -651,7 +659,6 @@ model SmsChannelGroupItem {
|
||||
priority Int @default(100)
|
||||
weight Int @default(1)
|
||||
isBackup Boolean @default(false)
|
||||
rateLimitPerSecond Int?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
group SmsChannelGroup @relation(fields: [groupId], references: [id], onDelete: Cascade)
|
||||
@@ -707,10 +714,16 @@ model ChannelReportField {
|
||||
reportType String @default("both")
|
||||
code String
|
||||
name String
|
||||
exportName String?
|
||||
fieldType String
|
||||
required Boolean @default(false)
|
||||
description String?
|
||||
sortOrder Int @default(100)
|
||||
columnWidth Int @default(18)
|
||||
imageWidth Int @default(120)
|
||||
imageHeight Int @default(80)
|
||||
defaultValue String?
|
||||
transform String?
|
||||
status String @default("active")
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
@@ -718,7 +731,7 @@ model ChannelReportField {
|
||||
channel SmsChannel @relation(fields: [channelId], references: [id], onDelete: Cascade)
|
||||
drainageField DrainageField? @relation(fields: [drainageFieldId], references: [id])
|
||||
|
||||
@@unique([channelId, code])
|
||||
@@unique([channelId, code, reportType])
|
||||
@@index([drainageFieldId, reportType])
|
||||
}
|
||||
|
||||
@@ -791,6 +804,7 @@ model ChannelSignatureReportTask {
|
||||
records ChannelSignatureReportRecord[]
|
||||
exportFiles ReportExportFile[]
|
||||
receiptImports ReportReceiptImport[]
|
||||
exportItems ReportExportFileItem[]
|
||||
|
||||
@@index([tenantId, status])
|
||||
@@index([signatureId, channelId])
|
||||
@@ -819,14 +833,136 @@ model ChannelSignatureReportRecord {
|
||||
|
||||
model ReportExportFile {
|
||||
id String @id @default(cuid())
|
||||
taskId String
|
||||
taskId String?
|
||||
batchId String?
|
||||
channelId String?
|
||||
fileObjectId String?
|
||||
fileName String
|
||||
rowCount Int @default(0)
|
||||
status String @default("generated")
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
task ChannelSignatureReportTask @relation(fields: [taskId], references: [id], onDelete: Cascade)
|
||||
task ChannelSignatureReportTask? @relation(fields: [taskId], references: [id], onDelete: Cascade)
|
||||
batch ReportMaterialBatch? @relation(fields: [batchId], references: [id], onDelete: Cascade)
|
||||
items ReportExportFileItem[]
|
||||
|
||||
@@index([batchId, channelId])
|
||||
}
|
||||
|
||||
model ReportMaterialBatch {
|
||||
id String @id @default(cuid())
|
||||
batchNo String @unique
|
||||
status String @default("generating")
|
||||
createdById String?
|
||||
selectedCount Int @default(0)
|
||||
channelCount Int @default(0)
|
||||
fileCount Int @default(0)
|
||||
errorMessage String?
|
||||
createdAt DateTime @default(now())
|
||||
completedAt DateTime?
|
||||
|
||||
items ReportMaterialBatchItem[]
|
||||
exportFiles ReportExportFile[]
|
||||
|
||||
@@index([status, createdAt])
|
||||
}
|
||||
|
||||
model ReportMaterialBatchItem {
|
||||
id String @id @default(cuid())
|
||||
batchId String
|
||||
signatureId String
|
||||
drainageItemId String?
|
||||
reportType String
|
||||
materialVersion Int
|
||||
snapshot Json
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
batch ReportMaterialBatch @relation(fields: [batchId], references: [id], onDelete: Cascade)
|
||||
signature SmsSignature @relation(fields: [signatureId], references: [id])
|
||||
drainageInfo SmsDrainageInfo? @relation(fields: [drainageItemId], references: [id])
|
||||
exportItems ReportExportFileItem[]
|
||||
|
||||
@@index([batchId, reportType])
|
||||
@@index([signatureId, drainageItemId])
|
||||
}
|
||||
|
||||
model ReportExportFileItem {
|
||||
id String @id @default(cuid())
|
||||
exportFileId String
|
||||
batchItemId String
|
||||
taskId String
|
||||
rowNumber Int
|
||||
|
||||
exportFile ReportExportFile @relation(fields: [exportFileId], references: [id], onDelete: Cascade)
|
||||
batchItem ReportMaterialBatchItem @relation(fields: [batchItemId], references: [id], onDelete: Cascade)
|
||||
task ChannelSignatureReportTask @relation(fields: [taskId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([exportFileId, batchItemId])
|
||||
@@index([taskId])
|
||||
}
|
||||
|
||||
model ReportMaterialImportProfile {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
reportType String
|
||||
tenantId String?
|
||||
applicationId String?
|
||||
sheetName String?
|
||||
headerRowCount Int @default(1)
|
||||
dataStartRow Int @default(2)
|
||||
status String @default("active")
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
columns ReportMaterialImportProfileColumn[]
|
||||
|
||||
@@index([reportType, status])
|
||||
@@index([tenantId, applicationId])
|
||||
}
|
||||
|
||||
model ReportMaterialImportProfileColumn {
|
||||
id String @id @default(cuid())
|
||||
profileId String
|
||||
sourceHeader String
|
||||
sourceHeaderPath String?
|
||||
sourceColumnIndex Int
|
||||
targetFieldCode String
|
||||
targetKind String @default("dynamic")
|
||||
fieldType String @default("string")
|
||||
required Boolean @default(false)
|
||||
transform String?
|
||||
sortOrder Int @default(100)
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
profile ReportMaterialImportProfile @relation(fields: [profileId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([profileId, sourceColumnIndex])
|
||||
@@index([profileId, sortOrder])
|
||||
}
|
||||
|
||||
model ReportMaterialImportBatch {
|
||||
id String @id @default(cuid())
|
||||
tenantId String
|
||||
applicationId String?
|
||||
profileId String?
|
||||
fileObjectId String
|
||||
fileName String
|
||||
reportType String
|
||||
status String @default("analyzed")
|
||||
sheetName String
|
||||
headerRowCount Int @default(1)
|
||||
dataStartRow Int @default(2)
|
||||
mapping Json
|
||||
preview Json?
|
||||
result Json?
|
||||
rowCount Int @default(0)
|
||||
successCount Int @default(0)
|
||||
failedCount Int @default(0)
|
||||
createdAt DateTime @default(now())
|
||||
completedAt DateTime?
|
||||
|
||||
@@index([tenantId, createdAt])
|
||||
@@index([status, createdAt])
|
||||
}
|
||||
|
||||
model ReportReceiptImport {
|
||||
|
||||
Reference in New Issue
Block a user