fix 校验补充

This commit is contained in:
2024-10-18 18:42:23 +08:00
parent a24cade558
commit f17fb62a72

View File

@@ -3,6 +3,7 @@ using Dlhis.Entity.Basic.Enums;
using Dlhis.Entity.Visitor.Entity; using Dlhis.Entity.Visitor.Entity;
using Dlhis.Entity.Visitor.Enums; using Dlhis.Entity.Visitor.Enums;
using Dlhis.External.Appointment.Request; using Dlhis.External.Appointment.Request;
using Kurisu.AspNetCore.CustomClass;
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services; using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
using Kurisu.AspNetCore.Utils; using Kurisu.AspNetCore.Utils;
using Kurisu.AspNetCore.Utils.Extensions; using Kurisu.AspNetCore.Utils.Extensions;
@@ -44,6 +45,23 @@ public class AppointmentService : IAppointmentService
foreach (var item in request.Items) foreach (var item in request.Items)
{ {
if (item.IsEnterDoorArea && areas.Where(x => x.Type == AppointmentAreaEnumType.Door)
.Select(x => x.CustomCode)
.Contains(item.ApplyDoorArea) == false)
{
throw new UserFriendlyException($"门岗区域{item.ApplyDoorArea}无效");
}
if (item.IsEnterWorkplace &&
item.ApplyWorkplaceAreas.All(p => areas.Where(x => x.Type == AppointmentAreaEnumType.Workplace)
.Select(x => x.CustomCode)
.Contains(p)) == false)
{
var workplaceAreas = areas.Where(x => x.Type == AppointmentAreaEnumType.Workplace).Select(x => x.CustomCode);
var notExistsAreas = workplaceAreas.Where(x => !item.ApplyWorkplaceAreas.Contains(x));
throw new UserFriendlyException($"车间区域{notExistsAreas.Join(",")}无效");
}
var gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.IdNo == item.IdNo || x.Code == item.IdNo).SingleAsync(); var gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.IdNo == item.IdNo || x.Code == item.IdNo).SingleAsync();
//外部人员 //外部人员
if (gainfo == null) if (gainfo == null)