fix 内部人员申请门岗错误提醒优化

This commit is contained in:
2025-03-18 10:01:45 +08:00
parent 70bc7081fb
commit 0ad2c8e379

View File

@@ -43,6 +43,14 @@ public class AppointmentService : IAppointmentService
await _dbContext.InsertAsync(mst); await _dbContext.InsertAsync(mst);
var invalids = new[] { GainfoUserTypeEnumType.Normal, GainfoUserTypeEnumType.SecurityWhite }; var invalids = new[] { GainfoUserTypeEnumType.Normal, GainfoUserTypeEnumType.SecurityWhite };
var idNos = request.Items.Where(x => x.IsEnterDoorArea).Select(x => x.IdNo).Distinct().ToList();
var errors = await _dbContext.Queryable<GainfoEntity>().Where(x => idNos.Contains(x.Code) || idNos.Contains(x.Code))
.Where(x => invalids.Contains(x.Type))
.Select(x => x.Code).ToListAsync();
errors.ThrowIfExists($"内部人员无法发起门岗预约({errors.Join(",")})");
foreach (var item in request.Items) foreach (var item in request.Items)
{ {
if (item.IsEnterDoorArea && areas.Where(x => x.Type == AppointmentAreaEnumType.Door) if (item.IsEnterDoorArea && areas.Where(x => x.Type == AppointmentAreaEnumType.Door)