LW工号劳务不发放生日券

This commit is contained in:
2026-09-30 11:04:38 +08:00
parent 0ed292e214
commit 2e92ba82af
2 changed files with 6 additions and 1 deletions

View File

@@ -245,6 +245,7 @@ public class BirthdayVoucherService : BaseVoucherService, IVoucherService
.Where(x => x.Birthday.HasValue)
//.Where(x => !string.IsNullOrEmpty(x.CostId))
// 正常情况:匹配当天生日
// 注意:LW 劳务派遣工号统一在下方返回前过滤,不能在此处 SQL 过滤,否则留痕事件无法写入
.WhereIF(isToday && !includeLeapDayBirthday, x => SqlFunc.DateValue(x.Birthday.Value, DateType.Month) == begin.Month && SqlFunc.DateValue(x.Birthday.Value, DateType.Day) == begin.Day)
// 特殊情况:非闰年的2月28日,同时匹配当天生日和2月29日生日
.WhereIF(isToday && includeLeapDayBirthday, x =>
@@ -272,12 +273,17 @@ public class BirthdayVoucherService : BaseVoucherService, IVoucherService
{
events.Add(new UserBusinessEventEntity { UserCode = gainfo.Code, EventType = "GenerateBirthdayVoucher", Content = "成本中心为空" });
}
else if (gainfo.Code.StartsWith("LW", StringComparison.OrdinalIgnoreCase))
{
events.Add(new UserBusinessEventEntity { UserCode = gainfo.Code, EventType = "GenerateBirthdayVoucher", Content = "LW工号劳务不发放生日券" });
}
}
return (gainfos
.Where(x => x.DepartmentNo.IsPresent())
.Where(x => !excludePositionNos.Contains(x.PositionNo))
.Where(x => x.CostId.IsPresent())
.Where(x => !x.Code.StartsWith("LW", StringComparison.OrdinalIgnoreCase))//排除劳务派遣工号(LW 开头)
.ToList(), events);
}

View File

@@ -33,7 +33,6 @@ public class BirthdayCostUploadJob : BaseJob
var endDayOfMonth = e.AddDays(-1);
var userCodeAll = await DbContext.Queryable<UserBalanceEntity>()
.Where(x => !x.UserCode.StartsWith("LW"))
.Select(x => x.UserCode)
.Distinct()
.ToListAsync();