fix: 月度任务截止日使用配置的实际日期,不再用 today+N天 硬编码
detectMonthlyTasks 生成风险时设置 deadline 为当月配置的截止日 runRiskDetection 创建记录时优先使用风险自带的 deadline
This commit is contained in:
@@ -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 })
|
||||
|
||||
Reference in New Issue
Block a user