fix: 用工体检诊断分数不合理

1. 合同管理:缺少附件扣分上限30分(每份2分),避免42份无附件直接扣到0分
2. 保密竞业:employeesWithNDA 改为按员工数(distinct employee)计算而非合同数,避免一个员工多份合同被重复计数
This commit is contained in:
selfrelease
2026-08-01 14:46:34 +08:00
parent 31a25a7320
commit aa9bd95d6c
+2 -2
View File
@@ -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 天内到期,需及时续签` : '无即将到期合同',