diff --git a/backend/src/services/risk.service.ts b/backend/src/services/risk.service.ts index ea3b703..0c93bfc 100644 --- a/backend/src/services/risk.service.ts +++ b/backend/src/services/risk.service.ts @@ -449,11 +449,13 @@ export async function detectMonthlyTasks(orgId: string) { { day: setting.taxDay, title: `${currentMonth}月 申报个税`, desc: `每月${setting.taxDay}日前完成个税申报`, url: '/money?tab=batch' }, ] - const risks: { employeeId: null; type: RiskType; level: RiskLevel; title: string; description: string; actionUrl: string }[] = [] + const risks: { employeeId: null; type: RiskType; level: RiskLevel; title: string; description: string; actionUrl: string; deadline?: Date }[] = [] for (const task of tasks) { // 当月已过截止日或正好到截止日时生成提醒 if (today >= task.day) { + // deadline 为当月截止日 + const deadline = new Date(now.getFullYear(), now.getMonth(), task.day) risks.push({ employeeId: null, type: 'MONTHLY', @@ -461,6 +463,7 @@ export async function detectMonthlyTasks(orgId: string) { title: task.title, description: task.desc, actionUrl: task.url, + deadline, }) } } @@ -664,7 +667,7 @@ export async function runRiskDetection(orgId: string) { actionUrl: r.actionUrl, estimatedLoss: cost.estimatedLoss, lossRange: cost.lossRange, - deadline: cost.deadline, + deadline: (r as any).deadline || cost.deadline, } }) await prisma.riskItem.createMany({ data: createData })