fix: 退休检测排除劳务协议等非劳动合同类型
detectRetirementRisks 和日历退休日期查询均增加 contracts 过滤, 只检测 FIXED/UNFIXED 正式劳动合同员工,与 updateEmployeesRetirementDays 一致
This commit is contained in:
@@ -488,7 +488,7 @@ export async function detectMonthlyTasks(orgId: string) {
|
||||
*/
|
||||
export async function detectRetirementRisks(orgId: string) {
|
||||
const employees = await prisma.employee.findMany({
|
||||
where: { orgId, status: 'ACTIVE', birthDate: { not: null } },
|
||||
where: { orgId, status: 'ACTIVE', birthDate: { not: null }, contracts: { some: { contractType: { in: ['FIXED', 'UNFIXED'] } } } },
|
||||
select: { id: true, name: true, gender: true, birthDate: true, femaleWorkerType: true },
|
||||
})
|
||||
|
||||
@@ -1204,12 +1204,13 @@ export async function getMonthlyCalendar(orgId: string, month: string) {
|
||||
})
|
||||
}
|
||||
|
||||
// 6. 退休日期
|
||||
// 6. 退休日期(仅正式劳动合同员工)
|
||||
const retiringEmployees = await prisma.employee.findMany({
|
||||
where: {
|
||||
orgId,
|
||||
status: 'ACTIVE',
|
||||
retirementDaysLeft: { gte: 0, lte: 365 },
|
||||
contracts: { some: { contractType: { in: ['FIXED', 'UNFIXED'] } } },
|
||||
},
|
||||
})
|
||||
for (const emp of retiringEmployees) {
|
||||
|
||||
Reference in New Issue
Block a user