From aa9bd95d6cee63d016bf8d84e4f50d30511b4d5d Mon Sep 17 00:00:00 2001 From: selfrelease Date: Sat, 1 Aug 2026 14:46:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=94=A8=E5=B7=A5=E4=BD=93=E6=A3=80?= =?UTF-8?q?=E8=AF=8A=E6=96=AD=E5=88=86=E6=95=B0=E4=B8=8D=E5=90=88=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 合同管理:缺少附件扣分上限30分(每份2分),避免42份无附件直接扣到0分 2. 保密竞业:employeesWithNDA 改为按员工数(distinct employee)计算而非合同数,避免一个员工多份合同被重复计数 --- backend/src/services/risk.service.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/services/risk.service.ts b/backend/src/services/risk.service.ts index 1c11c98..3c96a69 100644 --- a/backend/src/services/risk.service.ts +++ b/backend/src/services/risk.service.ts @@ -1598,7 +1598,7 @@ export async function getHealthCheck(orgId: string) { prisma.employee.count({ where: { orgId, status: 'ACTIVE', id: { notIn: [] } } }), prisma.overtimeRecord.count({ where: { orgId, weekdayHours: { gt: 36 } } }), prisma.employee.count({ where: { orgId, status: 'ACTIVE', contracts: { none: { contractType: 'FIXED' } } } }), - prisma.laborContract.count({ where: { orgId, contractType: 'FIXED', employee: { status: 'ACTIVE' } } }), + prisma.employee.count({ where: { orgId, status: 'ACTIVE', contracts: { some: { contractType: 'FIXED' } } } }), ]) // 6 维度诊断 @@ -1606,7 +1606,7 @@ export async function getHealthCheck(orgId: string) { { key: 'contract', name: '合同管理', - score: Math.max(0, 100 - unsignedContracts * 15 - expiringContracts * 5 - contractsNoAttachment * 3), + score: Math.max(0, 100 - unsignedContracts * 15 - expiringContracts * 5 - Math.min(30, contractsNoAttachment * 2)), findings: [ unsignedContracts > 0 ? `${unsignedContracts} 名员工未签书面合同,存在双倍工资风险` : '全员已签书面合同', expiringContracts > 0 ? `${expiringContracts} 份合同 30 天内到期,需及时续签` : '无即将到期合同',