fix: 所有批次模式统一试用期工资判定

之前只有copy_last模式有试用期判定,copy_batch和blank_employees模式
未判定试用期,试用期员工baseSalary错误填为转正工资。

修复: 在所有模式赋值后统一加试用期覆盖逻辑(SEVERANCE/TERMINATION除外),
试用期且probationSalary>0时强制覆盖baseSalary为试用期工资。

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
selfrelease
2026-08-16 13:20:50 +08:00
parent 37649419c4
commit ce1670d171
+10
View File
@@ -377,6 +377,16 @@ router.post('/batches', async (req: AuthRequest, res: Response, next: NextFuncti
try { baseSalary = Number(decrypt(emp.monthlySalary)) || 0 } catch { baseSalary = Number(emp.monthlySalary) || 0 }
}
// 统一试用期判定(所有模式适用,SEVERANCE 除外)
// 试用期且 probationSalary > 0 → 覆盖 baseSalary 为试用期工资
if (type !== 'SEVERANCE' && type !== 'TERMINATION') {
const batchMonthEnd = new Date(`${month}-28T23:59:59`)
const latestContract = emp.contracts?.[0]
if (isInProbation(latestContract, batchMonthEnd) && latestContract?.probationSalary > 0) {
baseSalary = latestContract.probationSalary
}
}
// SEVERANCE 批次:从离职记录读取补偿金作为应发金额,不走工资/社保/个税计算
let severanceAmount = 0
let severanceBreakdown: any = null