fix: 员工规避损失明细排除无关联员工的月度任务记录

This commit is contained in:
selfrelease
2026-07-31 10:44:05 +08:00
parent abbba82f25
commit 6c008387ad
+3
View File
@@ -1560,6 +1560,7 @@ export async function getAnnualValueReport(orgId: string, year: number) {
orgId, status: 'RESOLVED', orgId, status: 'RESOLVED',
resolvedBy: { not: null }, resolvedBy: { not: null },
resolvedAt: { gte: yearStart, lte: yearEnd }, resolvedAt: { gte: yearStart, lte: yearEnd },
employeeId: { not: null },
}, },
}), }),
prisma.riskItem.aggregate({ prisma.riskItem.aggregate({
@@ -1567,6 +1568,7 @@ export async function getAnnualValueReport(orgId: string, year: number) {
orgId, status: 'RESOLVED', estimatedLoss: { gt: 0 }, orgId, status: 'RESOLVED', estimatedLoss: { gt: 0 },
resolvedBy: { not: null }, resolvedBy: { not: null },
resolvedAt: { gte: yearStart, lte: yearEnd }, resolvedAt: { gte: yearStart, lte: yearEnd },
employeeId: { not: null },
}, },
_sum: { estimatedLoss: true }, _sum: { estimatedLoss: true },
}), }),
@@ -1624,6 +1626,7 @@ export async function getAnnualValueReport(orgId: string, year: number) {
orgId, status: 'RESOLVED', orgId, status: 'RESOLVED',
resolvedBy: { not: null }, resolvedBy: { not: null },
resolvedAt: { gte: yearStart, lte: yearEnd }, resolvedAt: { gte: yearStart, lte: yearEnd },
employeeId: { not: null },
}, },
include: { include: {
employee: { employee: {