From 2b8a5d6e30d8689168c8a0056713c51ea1ceeef6 Mon Sep 17 00:00:00 2001 From: freedakgmail Date: Mon, 17 Aug 2026 21:16:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9C=88=E5=BA=A6=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=88=AA=E6=AD=A2=E6=97=A5=E4=BD=BF=E7=94=A8=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=9A=84=E5=AE=9E=E9=99=85=E6=97=A5=E6=9C=9F=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E5=86=8D=E7=94=A8=20today+N=E5=A4=A9=20=E7=A1=AC=E7=BC=96?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit detectMonthlyTasks 生成风险时设置 deadline 为当月配置的截止日 runRiskDetection 创建记录时优先使用风险自带的 deadline --- backend/src/services/risk.service.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 })