fix: blank_employees 模式不再自动带出基本工资
本月空白模式应所有金额默认 0,去掉从 emp.monthlySalary 自动填充 基本工资的逻辑,保持与"空白"语义一致。 Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
@@ -405,11 +405,7 @@ router.post('/batches', async (req: AuthRequest, res: Response, next: NextFuncti
|
||||
allowance = prevPayslip?.allowance || 0
|
||||
deduction = prevPayslip?.deduction || 0
|
||||
}
|
||||
// blank_employees 和 blank_all: 所有金额默认 0
|
||||
// blank_employees 模式下尝试从员工记录获取基本工资
|
||||
if (mode === 'blank_employees' && emp.monthlySalary) {
|
||||
try { baseSalary = Number(decrypt(emp.monthlySalary)) || 0 } catch { baseSalary = Number(emp.monthlySalary) || 0 }
|
||||
}
|
||||
// blank_employees 和 blank_all: 所有金额默认 0(不自动带出基本工资)
|
||||
|
||||
// 统一试用期判定(所有模式适用,SEVERANCE 除外)
|
||||
// 试用期且 probationSalary > 0 → 覆盖 baseSalary 为试用期工资
|
||||
|
||||
@@ -233,6 +233,26 @@ router.post('/accounts/:accountId/standards', async (req: AuthRequest, res: Resp
|
||||
} catch (err) { next(err) }
|
||||
})
|
||||
|
||||
/**
|
||||
* 快速更新当前年度标准的最低工资(无需新建版本)
|
||||
*/
|
||||
router.put('/accounts/:accountId/min-wage', async (req: AuthRequest, res: Response, next: NextFunction) => {
|
||||
try {
|
||||
const orgId = req.user!.orgId
|
||||
const { accountId } = req.params
|
||||
const { minWage } = req.body as { minWage: number }
|
||||
if (minWage === undefined || minWage < 0) {
|
||||
return res.status(400).json({ success: false, error: { code: 'BAD_REQUEST', message: 'minWage 必须为非负数' } })
|
||||
}
|
||||
const account = await prisma.socialAccount.findFirst({ where: { id: accountId, orgId } })
|
||||
if (!account) return res.status(404).json({ success: false, error: { code: 'NOT_FOUND', message: '账户不存在' } })
|
||||
const standard = await prisma.socialYearStandard.findFirst({ where: { accountId, isCurrent: true } })
|
||||
if (!standard) return res.status(404).json({ success: false, error: { code: 'NOT_FOUND', message: '当前年度标准不存在' } })
|
||||
const updated = await prisma.socialYearStandard.update({ where: { id: standard.id }, data: { minWage } })
|
||||
res.json({ success: true, data: updated })
|
||||
} catch (err) { next(err) }
|
||||
})
|
||||
|
||||
// 账户关联根部门(level=0)批量设置
|
||||
router.put('/accounts/:id/departments', async (req: AuthRequest, res: Response, next: NextFunction) => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user