From 442063fb144bd2cfce3631a37b9978f052688d34 Mon Sep 17 00:00:00 2001 From: freedakgmail Date: Mon, 17 Aug 2026 20:25:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=90=8E=E7=AB=AF=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E9=9D=9E=E5=8A=B3=E5=8A=A8=E5=90=88=E5=90=8C=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E4=B8=8D=E7=BC=B4=E7=A4=BE=E4=BF=9D=E5=85=AC=E7=A7=AF=E9=87=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - payroll.service.ts: isNoSocialContract 补充 PARTTIME/OUTSOURCING/UNSIGNED - payroll.routes.ts tax-preview: 增加 contract 类型判断,非劳动合同 socialBase/housingBase 强制 0 - roster.routes.ts: 之前已修复 --- backend/src/routes/payroll.routes.ts | 11 +++++++---- backend/src/services/payroll.service.ts | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/backend/src/routes/payroll.routes.ts b/backend/src/routes/payroll.routes.ts index 1a24138..e38ed35 100644 --- a/backend/src/routes/payroll.routes.ts +++ b/backend/src/routes/payroll.routes.ts @@ -584,7 +584,7 @@ router.post('/tax-preview', async (req: AuthRequest, res: Response, next: NextFu // 获取员工和配置 const [employee, socialConfig, housingConfig] = await Promise.all([ - employeeId ? prisma.employee.findFirst({ where: { id: employeeId, orgId } }) : null, + employeeId ? prisma.employee.findFirst({ where: { id: employeeId, orgId }, include: { contracts: { orderBy: { createdAt: 'desc' }, take: 1 } } }) : null, prisma.socialInsuranceConfig.findFirst({ where: { orgId, effectiveFrom: { lte: month }, OR: [{ effectiveTo: null }, { effectiveTo: { gte: month } }] }, orderBy: { effectiveFrom: 'desc' }, @@ -595,9 +595,12 @@ router.post('/tax-preview', async (req: AuthRequest, res: Response, next: NextFu }), ]) - const emp = employee || { socialInsBase: baseSalary, housingFundBase: baseSalary } - const socialBase = emp.socialInsBase != null ? emp.socialInsBase : baseSalary - const housingBase = emp.housingFundBase != null ? emp.housingFundBase : baseSalary + const emp = employee || { socialInsBase: baseSalary, housingFundBase: baseSalary } as any + // 非劳动合同类型不缴纳社保公积金 + const contractType = (employee as any)?.contracts?.[0]?.contractType + const isNoSocialContract = contractType && ['LABOR', 'INTERNSHIP', 'PARTTIME', 'OUTSOURCING', 'UNSIGNED'].includes(contractType) + const socialBase = isNoSocialContract ? 0 : (emp.socialInsBase != null ? emp.socialInsBase : baseSalary) + const housingBase = isNoSocialContract ? 0 : (emp.housingFundBase != null ? emp.housingFundBase : baseSalary) // 计算社保公积金 let socialEmp = 0, housingEmp = 0 diff --git a/backend/src/services/payroll.service.ts b/backend/src/services/payroll.service.ts index fb3a91b..76c49f7 100644 --- a/backend/src/services/payroll.service.ts +++ b/backend/src/services/payroll.service.ts @@ -214,7 +214,7 @@ export async function calcBatchEntry( // 劳务协议/实习协议人员:不缴纳社保公积金,基数强制 0 const latestContract = employee.contracts[0] - const isNoSocialContract = latestContract && ['LABOR', 'INTERNSHIP'].includes(latestContract.contractType) + const isNoSocialContract = latestContract && ['LABOR', 'INTERNSHIP', 'PARTTIME', 'OUTSOURCING', 'UNSIGNED'].includes(latestContract.contractType) // 通过员工账户查年度标准(新逻辑),回退到旧配置(兼容) const { socialAccount, housingAccount } = await getEmployeeAccounts(orgId, employeeId)