diff --git a/backend/src/services/risk.service.ts b/backend/src/services/risk.service.ts index eae8a1d..727fa34 100644 --- a/backend/src/services/risk.service.ts +++ b/backend/src/services/risk.service.ts @@ -1408,7 +1408,8 @@ export async function getComplianceScore(orgId: string) { lastMonthRisks, ] = await Promise.all([ prisma.employee.count({ where: { orgId, status: 'ACTIVE' } }), - prisma.laborContract.count({ where: { orgId, contractType: 'UNSIGNED', employee: { status: 'ACTIVE' } } }), + // 未签合同:完全无合同记录的在职员工 + prisma.employee.count({ where: { orgId, status: 'ACTIVE', contracts: { none: {} } } }), prisma.laborContract.count({ where: { orgId, @@ -1583,7 +1584,8 @@ export async function getHealthCheck(orgId: string) { totalPayslips, ] = await Promise.all([ prisma.employee.count({ where: { orgId, status: 'ACTIVE' } }), - prisma.laborContract.count({ where: { orgId, contractType: 'UNSIGNED', employee: { status: 'ACTIVE' } } }), + // 未签合同:完全无合同记录的在职员工 + prisma.employee.count({ where: { orgId, status: 'ACTIVE', contracts: { none: {} } } }), prisma.laborContract.count({ where: { orgId,